// ==UserScript==
// @name 傲星英华学堂网课助手
// @namespace https://yinghuaonline.aoaostar.com
// @version 2.4.1
// @description 英华学堂在线网课全自动挂机脚本,支持验证码识别
// @author Pluto
// @icon https://www.aoaostar.com/favicon.ico
// @license GPL-3.0 License
// @supportURL https://www.aoaostar.com
// @homepageURL https://github.com/aoaostar
// @connect *
// @match */*
// @webRequest {"selector": "*static/user/js/video.js*", "action": "cancel"}
// @grant GM_addElement
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @grant GM_xmlhttpRequest
// @grant GM_notification
// @grant GM_listValues
// @grant GM_info
// @grant GM_log
// @grant GM_addStyle
// @require https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js
// @require https://greasyfork.org/scripts/447800/code/ckplayer.js
// @require https://greasyfork.org/scripts/447799/code/aoaostar-yinghua-main.js
// @run-at document-idle
// @downloadURL none
// ==/UserScript==
(function () {
$(function () {
if (!contain_platform()) {
return
}
// 去除烦人的第一次登录信息框
const layer_close = setInterval(() => {
if ($('.layui-layer-content').text().includes("您可能是第一次登录系统")) {
layer.closeAll()
clearInterval(layer_close)
}
}, 500)
if (window.location.pathname.match('/user/node')) {
//初始化面板
init_panel()
aoaostar_main()
}
if (window.location.pathname.match('/user/login') && GM_getValue('menu_force_login', true)) {
GM_addStyle('#code_row{display:none;}')
$('#login-title').text('学生登录(已开启封号强登)')
$('#loginForm > .list > .item:last-child').html(`
`)
$("#loginForm").off()
$('#force_login').click(force_login)
// 监听回车
$("#password").keydown((e) => {
if (e.keyCode === 13) {
e.preventDefault();
$('#force_login').click()
}
})
}
})
const MenuCommands = [
{
title: (GM_getValue('menu_force_login', true) ? '✅' : '❌') + " 强制登录(封号强登)",
func: function () {
GM_setValue('menu_force_login', !GM_getValue('menu_force_login', true))
notification('切换成功')
location.reload()
}
},
{
title: (low_consumption_mode_enabled() ? '✅' : '❌') + " 省流模式",
func: function () {
GM_setValue('menu_low_consumption_mode', !low_consumption_mode_enabled())
notification('切换成功')
location.reload()
}
},
{
title: `${!contain_platform() ? '🍀 添加' : '🍁 删除'}平台`,
func: function () {
const b = contain_platform();
let platforms_data = new Set(GM_getValue('platforms_data', []))
!b ? platforms_data.add(document.domain) : platforms_data.delete(document.domain)
GM_setValue('platforms_data', [...platforms_data])
notification(`${b ? '删除' : '添加'}平台成功`)
location.reload()
}
},
{
title: "💬 反馈 & 建议 [Github]",
func: function () {
window.open("https://github.com/aoaostar/cdn/issues")
}
},
]
register_menu_command()
function register_menu_command() {
for (const command of MenuCommands) {
GM_registerMenuCommand(command.title, command.func)
}
}
function force_login() {
const username = $('#username').val() || '';
const password = $('#password').val() || '';
const schoolId = $('#schoolId').val() || '';
if ($('#remember').is(':checked') && window.localStorage) {
localStorage.setItem("schoolId", schoolId);
localStorage.setItem("userName", username);
localStorage.setItem("passWord", password);
localStorage.setItem("remember", '1');
}
let data = {
platform: 'Android',
username: username,
password: password,
pushId: '140fe1da9e67b9c14a7',
schoolId: schoolId,
imgSign: '533560501d19cc30271a850810b09e3e',
imgCode: 'cryd',
}
let formData = new FormData();
for (const dataKey in data) {
formData.append(dataKey, data[dataKey])
}
GM_xmlhttpRequest({
method: 'POST',
url: '/api/login.json',
data: formData,
onload: function (response) {
if (response.readyState === 4 && response.status === 200) {
const content = JSON.parse(response.responseText);
if (content.status) {
let domainArr = document.domain.split('.')
let domain = document.domain
if (domainArr.length > 2) {
domain = domainArr.slice(1).join('.')
}
document.cookie = `token=${encodeURIComponent(content.result.data.token)}; domain=${domain}; path=/`
notification("强制登录成功")
window.location.href = '/user'
} else {
notification("登录失败!" + content.msg)
}
}
}
})
}
function init_panel() {
GM_addElement('link', {
href: "//cdn.aoaostar.com/yinghuaonline/style.css?v=" + GM_info.script.version,
rel: 'stylesheet'
});
const el = `👈
`
$(document.body).append(el)
}
})()