@@ -94,6 +94,35 @@ function closeWin() {
9494
9595}
9696
97+ /** 模拟鼠标移动 改方法来自https://blog.csdn.net/Wuzihui___/article/details/79952068
98+ * @param id
99+ * @param clientX 相对窗口横坐标
100+ * @param clientY 相对窗口纵坐标
101+ * @param distance 滑动距离
102+ */
103+ function dragandDrop ( btn_hk , clientX , clientY , distance ) {
104+ var elem = btn_hk ,
105+ k = 0 ,
106+ interval ;
107+ iME ( elem , "mousedown" , 0 , 0 , clientX , clientY ) ;
108+ interval = setInterval ( function ( ) {
109+ k ++ ;
110+ iter ( k ) ;
111+ if ( k === distance ) {
112+ clearInterval ( interval ) ;
113+ iME ( elem , "mouseup" , clientX + k , clientY , 220 + k , 400 ) ;
114+ }
115+ } , 10 ) ;
116+ function iter ( y ) {
117+ iME ( elem , "mousemove" , clientX + y , clientY , clientX + y , clientY ) ;
118+ }
119+ function iME ( obj , event , screenXArg , screenYArg , clientXArg , clientYArg ) {
120+ var mousemove = document . createEvent ( "MouseEvent" ) ;
121+ mousemove . initMouseEvent ( event , true , true , unsafeWindow , 0 , screenXArg , screenYArg , clientXArg , clientYArg , 0 , 0 , 0 , 0 , 0 , null ) ;
122+ obj . dispatchEvent ( mousemove ) ;
123+ }
124+ }
125+
97126/**
98127 * 随机等待最小到最大之间几秒, 需要await
99128 * @param {number } minSecond 最短时长
@@ -701,6 +730,9 @@ async function doingExam() {
701730 await waitRandomBetween ( 2 , 5 ) ;
702731 await doingPause ( ) ;
703732 nextButton = await getNextButton ( ) ;
733+ if ( document . getElementsByClassName ( 'nc_iconfont btn_slide' ) [ 0 ] != null ) {
734+ dragandDrop ( document . getElementsByClassName ( 'nc_iconfont btn_slide' ) [ 0 ] , 0 , 0 , 300 ) ;
735+ }
704736 if ( nextButton . textContent == "再练一次" || nextButton . textContent == "再来一组" || nextButton . textContent == "查看解析" ) {
705737 break ;
706738 }
@@ -1112,13 +1144,14 @@ async function start() {
11121144 console . log ( "开始学习" )
11131145
11141146 // 显示目前得分
1147+ /*
11151148 let eggSettingItems = document.getElementsByClassName("egg_setting_item");
11161149 console.log(eggSettingItems[0].children[0].innerHTML);
11171150 eggSettingItems[0].children[0].innerHTML += ' ' + taskProgress[0].currentScore + '/' + taskProgress[0].dayMaxScore;
11181151 eggSettingItems[1].children[0].innerHTML += ' ' + ( taskProgress[1].currentScore + taskProgress[2].currentScore ) + '/' + ( taskProgress[1].dayMaxScore + taskProgress[2].dayMaxScore );
11191152 eggSettingItems[2].children[0].innerHTML += ' ' + taskProgress[5].currentScore + '/' + taskProgress[5].dayMaxScore;
11201153 eggSettingItems[3].children[0].innerHTML += ' ' + taskProgress[4].currentScore + '/' + taskProgress[4].dayMaxScore;
1121-
1154+ */
11221155 //检查新闻
11231156 if ( settings . News && taskProgress [ 0 ] . currentScore != taskProgress [ 0 ] . dayMaxScore ) {
11241157 tasks [ 0 ] = false ; //只要还有要做的,就当做没完成
0 commit comments