66// @author techxuexi ,荷包蛋。
77// @match https://www.xuexi.cn
88// @match https://www.xuexi.cn/*
9+ // @match https://pc.xuexi.cn/points/login.html*
910// @match https://pc.xuexi.cn/points/exam-practice.html
1011// @match https://pc.xuexi.cn/points/exam-weekly-detail.html?id=*
1112// @match https://pc.xuexi.cn/points/exam-weekly-list.html
@@ -103,12 +104,13 @@ function waitRandomBetween(minSecond = 2, MaxSecond = 5) {
103104 if ( MaxSecond <= minSecond ) {
104105 MaxSecond = minSecond + 3
105106 }
106- let waitTime = Math . random ( ) * ( MaxSecond - minSecond ) + minSecond
107+
108+ let waitTime = Math . floor ( Math . random ( ) * ( MaxSecond * 1000 - minSecond * 1000 ) + minSecond * 1000 )
107109 return new Promise ( ( resolve , reject ) => {
108110 setTimeout ( ( ) => {
109- console . log ( `随机等待${ waitTime } 秒` )
111+ console . log ( `随机等待${ waitTime / 1000 } 秒` )
110112 resolve ( )
111- } , waitTime * 1000 )
113+ } , waitTime )
112114 } )
113115}
114116
@@ -124,7 +126,13 @@ $(document).ready(function () {
124126 createStartButton ( ) ;
125127 }
126128 } , 800 ) ;
127- } else if ( typeof GM_getValue ( "readingUrl" ) != 'object' && url == GM_getValue ( "readingUrl" ) ) {
129+ } else if ( url . indexOf ( "login.html" ) !== - 1 ) {
130+ console . log ( "检测到登录页" )
131+ setTimeout ( ( ) => {
132+ window . scrollTo ( 0 , 1000 ) ;
133+ } , 500 ) ;
134+ }
135+ else if ( typeof GM_getValue ( "readingUrl" ) != 'object' && url == GM_getValue ( "readingUrl" ) ) {
128136 try {
129137 let settingTemp = JSON . parse ( GM_getValue ( 'studySetting' ) ) ;
130138 if ( ! settingTemp [ 7 ] ) {
@@ -1179,10 +1187,13 @@ async function start() {
11791187 } else {
11801188 //提醒登录
11811189 // alert("请先登录");
1182-
1190+
11831191 //修改为跳转到登陆页
11841192 let loggedButton = document . querySelectorAll ( "a[class='icon login-icon']" ) [ 0 ] ;
11851193 loggedButton . click ( )
1194+ setTimeout ( ( ) => {
1195+ closeWin ( )
1196+ } , 2000 ) ;
11861197 }
11871198 return false ;
11881199}
0 commit comments