学习通刷章节(已失效)

可刷章节

  1. // ==UserScript==
  2. // @name 学习通刷章节(已失效)
  3. // @namespace 226.05
  4. // @version 0.0.2
  5. // @description 可刷章节
  6. // @author 二十四桥
  7. // @match *://*.edu.cn/*
  8. // @match *://*.chaoxing.com/*
  9. // @match *://*.chaoxing.com/exam/test/reVersionTestStartNew*
  10. // @match *://*.edu.cn/exam/test/reVersionTestStartNew*
  11. // @match *://*.jd.hk/*
  12. // @match *://*.nbdlib.cn/exam/test/reVersionTestStartNew*
  13. // @match *://*.jd.com/*
  14. // @match *://*.hnsyu.net/exam/test/reVersionTestStartNew*
  15. // @match *://*.taobao.com/*
  16. // @match *://*.taobao.hk/*
  17. // @match *://*.tmall.com/*
  18. // @match *://*.tmall.hk/*
  19. // @match *://chaoshi.detail.tmall.com/*
  20. // @match *://*.liangxinyao.com/*
  21. // @match *://*.yiyaojd.com/*
  22. // @exclude *://login.taobao.com/*
  23. // @exclude *://pages.tmall.com/*
  24. // @exclude *://uland.taobao.com/*
  25. // @connect cx.icodef.com
  26. // @run-at document-end
  27. // @grant unsafeWindow
  28. // @grant GM_xmlhttpRequest
  29. // @grant GM_setClipboard
  30. // @grant GM_setValue
  31. // @grant GM_getValue
  32. // @license MIT
  33. // @connect idey.cn
  34. // @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
  35. // @require https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js
  36. // @require https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js
  37. // @original-script https://gf.qytechs.cn/zh-CN/scripts/426129
  38. // @original-author coahr
  39. // @original-license MIT
  40.  
  41. // ==/UserScript==
  42. (function() {
  43. var _self = unsafeWindow;
  44. var $ = $ || window.$;
  45. //$ = _self.jQuery,
  46.  
  47. UE = _self.UE,
  48. host = window.location.host;
  49. var index_num = 0;
  50. var item = [];
  51. var urls = [];
  52. var selectorList = [];
  53. var obj = {};
  54. obj.onclicks = function(link) {
  55. if (document.getElementById('redirect_form')) {
  56. var form = document.getElementById('redirect_form');
  57. form.action = 'https://jd.idey.cn/red.html?url=' + encodeURIComponent(link);
  58. } else {
  59. var form = document.createElement('form');
  60. form.action = 'https://jd.idey.cn/red.html?url=' + encodeURIComponent(link);
  61. form.target = '_blank';
  62.  
  63. form.method = 'POST';
  64. form.setAttribute("id", 'redirect_form');
  65. document.body.appendChild(form);
  66.  
  67. }
  68. form.submit();
  69. form.action = "";
  70. form.parentNode.removeChild(form);
  71. };
  72. obj.GetQueryString = function(name) {
  73. var reg = eval("/" + name + "/g");
  74. var r = window.location.search.substr(1);
  75. var flag = reg.test(r);
  76. if (flag) {
  77. return true;
  78. } else {
  79. return false;
  80. }
  81. };
  82.  
  83. obj.get_url = function() {
  84. item[index_num] = [];
  85. urls[index_num] = [];
  86. $("#J_goodsList li").each(function(index) {
  87. if ($(this).attr('data-type') != 'yes') {
  88. var skuid = $(this).attr('data-sku');
  89. var itemurl = '//item.jd.com/' + skuid + '.html';
  90. if (skuid != undefined) {
  91. if (urls[index_num].length < 4) {
  92. item[index_num].push($(this));
  93. urls[index_num].push(itemurl);
  94. $(this).attr('data-type', 'yes');
  95. }
  96.  
  97.  
  98. }
  99. }
  100.  
  101. })
  102.  
  103. $("#plist li").each(function(index) {
  104. if ($(this).attr('data-type') != 'yes') {
  105. var skuid = $(this).find('.j-sku-item').attr('data-sku');
  106. var itemurl = '//item.jd.com/' + skuid + '.html';
  107. if (skuid != undefined) {
  108. if (urls[index_num].length < 4) {
  109. item[index_num].push($(this));
  110. urls[index_num].push(itemurl);
  111. $(this).attr('data-type', 'yes');
  112. }
  113.  
  114.  
  115. }
  116. }
  117.  
  118. })
  119.  
  120. $(".m-aside .aside-bar li").each(function(index) {
  121. if ($(this).attr('data-type') != 'yes') {
  122. var itemurl = $(this).find("a").attr('href');
  123. if (itemurl != '') {
  124. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  125. var sku_c = $(this).attr('sku_c');
  126. if (sku_c == undefined) {
  127. var arr = [];
  128. var str = $(this).attr('onclick');
  129. arr = str.split(",");
  130. sku_c = trim(arr[6].replace(/\"/g, ""));
  131. itemurl = '//item.jd.com/' + sku_c + '.html';
  132. }
  133.  
  134. }
  135. if (urls[index_num].length < 4) {
  136. item[index_num].push($(this));
  137. urls[index_num].push(itemurl);
  138. $(this).attr('data-type', 'yes');
  139. }
  140.  
  141.  
  142.  
  143. }
  144. }
  145.  
  146. })
  147. $(".goods-chosen-list li").each(function(index) {
  148. if ($(this).attr('data-type') != 'yes') {
  149. var itemurl = $(this).find("a").attr('href');
  150. if (itemurl != '') {
  151. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  152. var arr = [];
  153. var str = $(this).attr('onclick');
  154. arr = str.split(",");
  155. var sku_c = trim(arr[6].replace(/\"/g, ""));
  156. itemurl = '//item.jd.com/' + sku_c + '.html';
  157.  
  158. }
  159. if (urls[index_num].length < 4) {
  160. item[index_num].push($(this));
  161. urls[index_num].push(itemurl);
  162. $(this).attr('data-type', 'yes');
  163. }
  164.  
  165. }
  166.  
  167.  
  168.  
  169.  
  170. }
  171.  
  172. })
  173.  
  174. $(".may-like-list li").each(function(index) {
  175. if ($(this).attr('data-type') != 'yes') {
  176. var itemurl = $(this).find("a").attr('href');
  177. if (itemurl != '') {
  178. if (itemurl.indexOf("//ccc-x.jd.com") != -1) {
  179. var arr = [];
  180. var str = $(this).attr('onclick');
  181. arr = str.split(",");
  182. var sku_c = trim(arr[6].replace(/\"/g, ""));
  183. itemurl = '//item.jd.com/' + sku_c + '.html';
  184. }
  185. if (urls[index_num].length < 4) {
  186. item[index_num].push($(this));
  187. urls[index_num].push(itemurl);
  188. $(this).attr('data-type', 'yes');
  189. }
  190.  
  191.  
  192. }
  193. }
  194.  
  195. })
  196.  
  197.  
  198.  
  199. if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) {
  200.  
  201.  
  202. var u = urls[index_num].join(',');
  203. $.getJSON('https://shop.idey.cn/jd.php', {
  204. act:'itemlink',
  205. itemurl: u,
  206. num: index_num
  207. }, function(res) {
  208. if (res.type == 'success') {
  209. for (var i = 0; i < res.data.length; i++) {
  210. item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl);
  211. item[res.num][i].find("a").attr('target', '');
  212. item[res.num][i].find("a").unbind("click");
  213. item[res.num][i].find("a").bind("click", function(e) {
  214. if ($(this).attr('data-ref')) {
  215. e.preventDefault();
  216. obj.onclicks($(this).attr('data-ref'));
  217.  
  218. }
  219. })
  220.  
  221. }
  222.  
  223. }
  224. })
  225.  
  226.  
  227. }
  228. index_num += 1;
  229.  
  230. };
  231. obj.get_miaosha = function() {
  232. item[index_num] = [];
  233. urls[index_num] = [];
  234. $(".seckill_mod_goodslist li").each(function(index) {
  235.  
  236. if ($(this).attr('data-type') != 'yes') {
  237.  
  238. var itemurl = $(this).find("a").attr('href');
  239. var skuid = $(this).attr('data-sku');
  240. var that = $(this);
  241. if (itemurl != '') {
  242. if (urls[index_num].length < 4) {
  243.  
  244. item[index_num].push($(this));
  245. urls[index_num].push(itemurl);
  246. $(this).attr('data-type', 'yes');
  247. }
  248.  
  249.  
  250. }
  251. }
  252.  
  253. })
  254.  
  255.  
  256.  
  257. if (urls.length > 0 && urls[index_num].length > 0 && item[index_num].length > 0) {
  258.  
  259.  
  260. var u = urls[index_num].join(',');
  261. $.getJSON('https://shop.idey.cn/jd.php', {
  262. act:'itemlink',
  263. itemurl: u,
  264. num: index_num
  265. }, function(res) {
  266. if (res.type == 'success') {
  267. for (var i = 0; i < res.data.length; i++) {
  268. item[res.num][i].find("a").attr('data-ref', res.data[i].longUrl);
  269. item[res.num][i].find("a").attr('href', "javascript:void(0);");
  270. item[res.num][i].find("a").attr('target', '');
  271. // item[res.num][i].find("a").unbind("click");
  272.  
  273. item[res.num][i].find("a").click(function(e) {
  274. e.preventDefault();
  275. obj.onclicks($(this).attr('data-ref'));
  276. })
  277.  
  278. }
  279.  
  280. }
  281. })
  282.  
  283.  
  284. }
  285. index_num += 1;
  286. };
  287. const style = `
  288. .gwd_taobao .gwd-minibar-bg, .gwd_tmall .gwd-minibar-bg {
  289. display: block;
  290. }
  291.  
  292. .idey-minibar_bg{
  293. position: relative;
  294. min-height: 40px;
  295. display: inline-block;
  296. }
  297. #idey_minibar{
  298. width: 560px;
  299. background-color: #fff;
  300. position: relative;
  301. border: 1px solid #e8e8e8;
  302. display: block;
  303. line-height: 36px;
  304. font-family: 'Microsoft YaHei',Arial,SimSun!important;
  305. height: 36px;
  306. float: left;
  307. }
  308. #idey_minibar .idey_website {
  309. width: 48px;
  310. float: left;
  311. height: 36px;
  312. }
  313. #idey_minibar .minibar-tab {
  314. float: left;
  315. height: 36px;
  316. border-left: 1px solid #edf1f2!important;
  317. padding: 0;
  318. margin: 0;
  319. text-align: center;
  320. }
  321.  
  322. #idey_minibar .idey_website em {
  323. background-position: -10px -28px;
  324. height: 36px;
  325. width: 25px;
  326. float: left;
  327. margin-left: 12px;
  328. }
  329.  
  330. .setting-bg {
  331. background: url(https://cdn.gwdang.com/images/extensions/xbt/new_wishlist_pg5_2.png) no-repeat;
  332. }
  333.  
  334. #idey_minibar .minibar-tab {
  335. float: left;
  336. height: 36px;
  337. border-left: 1px solid #edf1f2!important;
  338. padding: 0;
  339. margin: 0;
  340. width: 134px;
  341. }
  342. #idey_price_history span {
  343. float: left;
  344. width: 100%;
  345. text-align: center;
  346. line-height: 36px;
  347. color: #666;
  348. font-size: 14px;
  349. }
  350.  
  351. #mini_price_history .trend-error-info-mini {
  352. position: absolute;
  353. top: 37px;
  354. left: 0px;
  355. width: 100%;
  356. background: #fff;
  357. z-index: 99999999;
  358. height: 268px;
  359. box-shadow: 0px 5px 15px 0 rgb(23 25 27 / 15%);
  360. border-radius: 0 0 4px 4px;
  361. width:559px;
  362. border: 1px solid #ddd;
  363. border-top: none;
  364. display:none;
  365.  
  366. }
  367. .minibar-btn-box {
  368. display: inline-block;
  369. margin: 0 auto;
  370. float: none;
  371. }
  372. #mini_price_history .error-p {
  373. width: 95px;
  374. margin: 110px auto;
  375. height: 20px;
  376. line-height: 20px;
  377. text-align: center;
  378. color: #000!important;
  379. border: 1px solid #333;
  380. border-radius: 5px;
  381. display: block;
  382. text-decoration: none!important;
  383. }
  384. #mini_price_history:hover .trend-error-info-mini {
  385. display: block;
  386. }
  387.  
  388. .collect_mailout_icon {
  389. background-position: -247px -134px;
  390. width: 18px;
  391. }
  392.  
  393. #idey_mini_compare_detail li *, .mini-compare-icon, .minibar-btn-box * {
  394. float: left;
  395. }
  396. .panel-wrap{
  397. width: 100%;
  398. height: 100%;
  399. }
  400. .collect_mailout_icon, .mini-compare-icon {
  401. height: 18px;
  402. margin-right: 8px;
  403. margin-top: 9px;
  404. }
  405. .all-products ul li {
  406. float: left;
  407. width: 138px;
  408. height: 262px;
  409. overflow: hidden;
  410. text-align: center;
  411. }
  412. .all-products ul li .small-img {
  413. text-align: center;
  414. display: table-cell;
  415. vertical-align: middle;
  416. line-height: 90px;
  417. width: 100%;
  418. height: 100px;
  419. position: relative;
  420. float: left;
  421. margin-top: 23px;
  422. }
  423. .all-products ul li a img {
  424. vertical-align: middle;
  425. display: inline-block;
  426. width: auto;
  427. height: auto;
  428. max-height: 100px;
  429. max-width: 100px;
  430. float: none;
  431. }
  432. .all-products ul li a.b2c-other-info {
  433. text-align: center;
  434. float: left;
  435. height: 16px;
  436. line-height: 16px;
  437. margin-top: 13px;
  438. }
  439.  
  440. .b2c-other-info .gwd-price {
  441. height: 17px;
  442. line-height: 17px;
  443. font-size: 16px;
  444. color: #E4393C;
  445. font-weight: 700;
  446. width: 100%;
  447. display: block;
  448. }
  449. .b2c-other-info .b2c-tle {
  450. height: 38px;
  451. line-height: 19px;
  452. margin-top: 8px;
  453. font-size: 12px;
  454. width: 138px;
  455. margin-left: 29px;
  456. }
  457. .bjgext-mini-trend span {
  458. float: left;
  459. /*width: 100%;*/
  460. text-align: center;
  461. line-height: 36px;
  462. color: #666;
  463. font-size: 14px;
  464. }
  465. .bjgext-mini-trend .trend-error-info-mini {
  466. position: absolute;
  467. top: 37px;
  468. left: 0px;
  469. width: 100%;
  470. background: #fff;
  471. z-index: 99999999;
  472. height: 268px;
  473. display: none;
  474. box-shadow: 0px 5px 15px 0 rgba(23,25,27,0.15);
  475. border-radius: 0 0 4px 4px;
  476. width: 460px;
  477. border: 1px solid #ddd;
  478. border-top: none;
  479. }
  480. .bjgext-mini-trend .error-p {
  481. width: 100%;
  482. float: left;
  483. text-align: center;
  484. margin-top: 45px;
  485. font-size: 14px;
  486. color: #666;
  487. }
  488. .bjgext-mini-trend .error-sp {
  489. width: 95px;
  490. margin: 110px auto;
  491. height: 20px;
  492. line-height: 20px;
  493. text-align: center;
  494. color: #000!important;
  495. border: 1px solid #333;
  496. border-radius: 5px;
  497. display: block;
  498. text-decoration: none!important;
  499. }
  500. .bjgext-mini-trend:hover .trend-error-info-mini {
  501. display: block;
  502. }
  503.  
  504.  
  505. #coupon_box.coupon-box1 {
  506. width: 560px;
  507. height: 125px;
  508. background-color: #fff;
  509. border: 1px solid #e8e8e8;
  510. border-top: none;
  511. position: relative;
  512. margin: 0px;
  513. padding: 0px;
  514. float: left;
  515. display: block;
  516. }
  517. #coupon_box:after {
  518. display: block;
  519. content: "";
  520. clear: both;
  521. }
  522. .idey_tmall #idey_minibar {
  523. float: none;
  524. }
  525.  
  526.  
  527. .minicoupon_detail {
  528. position: absolute;
  529. top: 35px;
  530. right: -1px;
  531. height: 150px;
  532. width: 132px;
  533. display: none;
  534. z-index: 99999999999;
  535. background: #FFF7F8;
  536. border: 1px solid #F95774;
  537. }
  538. #coupon_box:hover .minicoupon_detail {
  539. display: block;
  540. }
  541. .minicoupon_detail img {
  542. width: 114px;
  543. height: 114px;
  544. float: left;
  545. margin-left: 9px;
  546. margin-top: 9px;
  547. }
  548. .minicoupon_detail span {
  549. font-size: 14px;
  550. color: #F95572;
  551. letter-spacing: 0;
  552. font-weight: bold;
  553. float: left;
  554. height: 12px;
  555. line-height: 14px;
  556. width: 100%;
  557. margin-top: 6px;
  558. text-align: center;
  559. }
  560. .coupon-box1 * {
  561. font-family: 'Microsoft YaHei',Arial,SimSun;
  562. }
  563. .coupon-icon {
  564. float: left;
  565. width: 20px;
  566. height: 20px;
  567. background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_icon.png') 0px 0px no-repeat;
  568. margin: 50px 8px 9px 12px;
  569. }
  570. #coupon_box .coupon-tle {
  571. color: #FF3B5C;
  572. font-size: 24px;
  573. margin-right: 11px;
  574. float: left;
  575. height: 114px;
  576. overflow: hidden;
  577. text-overflow: ellipsis;
  578. white-space: nowrap;
  579. width: 375px;
  580. line-height: 114px;
  581. text-decoration: none!important;
  582. }
  583. #coupon_box .coupon-row{
  584. color: #FF3B5C;
  585. font-size: 12px;
  586. margin-right: 11px;
  587. float: left;
  588. height: 60px;
  589. overflow: hidden;
  590. text-overflow: ellipsis;
  591. white-space: nowrap;
  592. width: 100%;
  593. line-height: 60px;
  594. text-decoration: none!important;
  595. text-align: center;
  596. }
  597. #coupon_box .coupon-tle * {
  598. color: #f15672;
  599. }
  600. #coupon_box .coupon-tle span {
  601. margin-right: 5px;
  602. font-weight: bold;
  603. font-size: 14px;
  604. }
  605. .coupon_gif {
  606. background: url('https://cdn.gwdang.com/images/extensions/newbar/turn.gif') 0px 0px no-repeat;
  607. float: right;
  608. height: 20px;
  609. width: 56px;
  610. margin-top: 49px;
  611. }
  612. .click2get {
  613. background: url('https://cdn.gwdang.com/images/extensions/newbar/coupon_01.png') 0px 0px no-repeat;
  614. float: left;
  615. height: 30px;
  616. width: 96px;
  617. margin-top: 43px;
  618. }
  619. .click2get span {
  620. height: 24px;
  621. float: left;
  622. margin-left: 1px;
  623. }
  624. .c2g-sp1 {
  625. width: 50px;
  626. color: #FF3B5C;
  627. text-align: center;
  628. font-size: 14px;
  629. line-height: 24px!important;
  630. }
  631. .c2g-sp2 {
  632. width: 44px;
  633. line-height: 24px!important;
  634. color: #fff!important;
  635. text-align: center;
  636. }
  637. div#idey_wishlist_div.idey_wishlist_div {
  638. border-bottom-right-radius: 0px;
  639. border-bottom-left-radius: 0px;
  640. }
  641. #qrcode{
  642. float: left;
  643. width: 125px;
  644. margin-top:3px;
  645. }
  646.  
  647.  
  648. .elm_box{
  649. height: 37px;
  650. border: 1px solid #ddd;
  651. width: 460px;
  652. line-height: 37px;
  653. margin-bottom: 3px;
  654. background-color: #ff0036;
  655. font-size: 15px;
  656. }
  657. .elm_box span{
  658. width: 342px;
  659. text-align: center;
  660. display: block;
  661. float: left;
  662. color: red;
  663. color: white;
  664. }`
  665.  
  666.  
  667. function trim(str) {
  668. return str.replace(/(^\s*)|(\s*$)/g, "");
  669. }
  670.  
  671. function removeEvent(that, href) {
  672. that.find("a").attr('target', '');
  673. that.find("a").unbind("click");
  674. that.find("a").bind("click", function(e) {
  675. e.preventDefault();
  676. if (href != undefined) {
  677. obj.onclicks(href);
  678. } else {
  679. obj.onclicks($(this).attr('href'));
  680. }
  681.  
  682. })
  683. }
  684. obj.initStyle = function() {
  685. var styles = document.createElement('style')
  686. styles.type = 'text/css'
  687. styles.innerHTML = style;
  688. document.getElementsByTagName('head').item(0).appendChild(styles)
  689. }
  690.  
  691. obj.initSearchHtml = function(selectorList) {
  692. setInterval(function() {
  693. selectorList.forEach(function(selector) {
  694. obj.initSearchItemSelector(selector);
  695. });
  696. }, 3000);
  697. };
  698.  
  699. obj.initSearchEvent = function() {
  700. $(document).on("click", ".tb-cool-box-area", function() {
  701. var $this = $(this);
  702. if ($this.hasClass("tb-cool-box-wait")) {
  703. obj.basicQueryItem(this);
  704. } else if ($this.hasClass("tb-cool-box-info-translucent")) {
  705. $this.removeClass("tb-cool-box-info-translucent");
  706. } else {
  707. $this.addClass("tb-cool-box-info-translucent");
  708. }
  709. });
  710. };
  711.  
  712. obj.basicQuery = function() {
  713. setInterval(function() {
  714. $(".tb-cool-box-wait").each(function() {
  715. obj.basicQueryItem(this);
  716. });
  717. }, 3000);
  718. };
  719.  
  720. obj.initSearchItemSelector = function(selector) {
  721. $(selector).each(function() {
  722. obj.initSearchItem(this);
  723. });
  724. };
  725.  
  726. obj.initSearchItem = function(selector) {
  727. var $this = $(selector);
  728. if ($this.hasClass("tb-cool-box-already")) {
  729. return;
  730. } else {
  731. $this.addClass("tb-cool-box-already")
  732. }
  733.  
  734. var nid = $this.attr("data-id");
  735. if (!obj.isVailidItemId(nid)) {
  736. nid = $this.attr("data-itemid");
  737. }
  738.  
  739. if (!obj.isVailidItemId(nid)) {
  740. if ($this.attr("href")) {
  741. nid = location.protocol + $this.attr("href");
  742. } else {
  743. var $a = $this.find("a");
  744. if (!$a.length) {
  745. return;
  746. }
  747.  
  748. nid = $a.attr("data-nid");
  749. if (!obj.isVailidItemId(nid)) {
  750. if ($a.hasClass("j_ReceiveCoupon") && $a.length > 1) {
  751. nid = location.protocol + $($a[1]).attr("href");
  752. } else {
  753. nid = location.protocol + $a.attr("href");
  754. }
  755. }
  756. }
  757. }
  758.  
  759. if (obj.isValidNid(nid)) {
  760. obj.basicQueryItem($this, nid);
  761. }
  762. };
  763.  
  764.  
  765.  
  766. obj.basicQueryItem = function(selector, nid) {
  767. var $this = $(selector);
  768. $.get('https://tb.idey.cn/taobao.php?act=itemlink&itemid=' + nid, function(data) {
  769. if (data.type == 'success') {
  770. obj.changeUrl($this, data.data);
  771. } else {
  772.  
  773. }
  774. }, 'json')
  775. };
  776.  
  777. obj.changeUrl = function(selector, data) {
  778. var $this = $(selector);
  779. var a = $this.find("a");
  780. $this.find("a").attr('href', data.itemUrl);
  781. $this.find("a").attr('data-href', data.itemUrl);
  782. $this.find("a").click(function(e){
  783. e.preventDefault();
  784. obj.onclicks($(this).attr('data-href'));
  785. })
  786. }
  787.  
  788.  
  789. obj.isDetailPageTaoBao = function(url) {
  790. if (url.indexOf("//item.taobao.com/item.htm") > 0 || url.indexOf("//detail.tmall.com/item.htm") > 0 ||
  791. url.indexOf("//chaoshi.detail.tmall.com/item.htm") > 0 || url.indexOf(
  792. "//detail.tmall.hk/hk/item.htm") > 0) {
  793. return true;
  794. } else {
  795. return false;
  796. }
  797. };
  798.  
  799. obj.isVailidItemId = function(itemId) {
  800. if (!itemId) {
  801. return false;
  802. }
  803.  
  804. var itemIdInt = parseInt(itemId);
  805. if (itemIdInt == itemId && itemId > 10000) {
  806. return true;
  807. } else {
  808. return false;
  809. }
  810. };
  811.  
  812. obj.isValidNid = function(nid) {
  813. if (!nid) {
  814. return false;
  815. } else if (nid.indexOf('http') >= 0) {
  816. if (obj.isDetailPageTaoBao(nid) || nid.indexOf("//detail.ju.taobao.com/home.htm") > 0) {
  817. return true;
  818. } else {
  819. return false;
  820. }
  821. } else {
  822. return true;
  823. }
  824. };
  825.  
  826. obj.get_page_url_id = function(pagetype, url, type) {
  827. var return_data = '';
  828. if (pagetype == 'taobao_item') {
  829. var params = location.search.split("?")[1].split("&");
  830. for (var index in params) {
  831. if (params[index].split("=")[0] == "id") {
  832. var productId = params[index].split("=")[1];
  833. }
  834. }
  835. return_data = productId;
  836. }
  837. return return_data;
  838. }
  839. obj.get_type_url = function(url) {
  840. if (
  841. url.indexOf("//item.taobao.com/item.htm") > 0 ||
  842. url.indexOf("//detail.tmall.com/item.htm") > 0 ||
  843. url.indexOf("//chaoshi.detail.tmall.com/item.htm") > 0 ||
  844. url.indexOf("//detail.tmall.hk/hk/item.htm") > 0 ||
  845. url.indexOf("//world.tmall.com") > 0 ||
  846. url.indexOf("//detail.liangxinyao.com/item.htm") > 0 ||
  847. url.indexOf("//detail.tmall.hk/item.htm") > 0
  848. ) {
  849. return 'taobao_item';
  850. } else if (
  851. url.indexOf("//maiyao.liangxinyao.com/shop/view_shop.htm") > 0 ||
  852. url.indexOf("//list.tmall.com/search_product.htm") > 0 ||
  853. url.indexOf("//s.taobao.com/search") > 0 ||
  854. url.indexOf("//list.tmall.hk/search_product.htm") > 0
  855. ) {
  856. return 'taobao_list';
  857. } else if (
  858. url.indexOf("//search.jd.com/Search") > 0 ||
  859. url.indexOf("//search.jd.com/search") > 0 ||
  860. url.indexOf("//search.jd.hk/search") > 0 ||
  861. url.indexOf("//search.jd.hk/Search") > 0 ||
  862. url.indexOf("//www.jd.com/xinkuan") > 0 ||
  863. url.indexOf("//list.jd.com/list.html") > 0 ||
  864. url.indexOf("//search.jd.hk/Search") > 0 ||
  865. url.indexOf("//coll.jd.com") > 0
  866. ) {
  867. return 'jd_list';
  868. } else if (
  869. url.indexOf("//item.jd.hk") > 0 ||
  870. url.indexOf("//pcitem.jd.hk") > 0 ||
  871. url.indexOf("//i-item.jd.com") > 0 ||
  872. url.indexOf("//item.jd.com") > 0 ||
  873. url.indexOf("//npcitem.jd.hk") > 0 ||
  874. url.indexOf("//item.yiyaojd.com") > 0
  875. ) {
  876. return 'jd_item';
  877. } else if (
  878. url.indexOf("//miaosha.jd.com") > 0
  879. ) {
  880. return 'jd_miaosha';
  881. } else if (
  882. url.indexOf("//www.jd.com") > 0 ||
  883. url.indexOf("//jd.com") > 0
  884. ) {
  885. return 'jd_index';
  886. }
  887.  
  888. }
  889. var pageurl = location.href;
  890. var pagetype = obj.get_type_url(pageurl);
  891.  
  892. if (pagetype == 'taobao_item') {
  893. obj.initStyle(style);
  894. var productId = obj.get_page_url_id(pagetype, pageurl, pageurl);
  895. var couponurl = "https://www.idey.cn/api/index/recove_url?itemurl=" + encodeURIComponent(location.href) +
  896. '&itemid=' +
  897. productId;
  898. $.getJSON(couponurl, function(res) {
  899. var data = res.data;
  900.  
  901. var couponArea = '<div class="idey-minibar_bg">';
  902. couponArea += '<div id="idey_minibar" class="alisite_page">';
  903. couponArea +=
  904. '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://taobao.idey.cn">';
  905. couponArea += '<em class="setting-bg website_icon"></em></a>';
  906. couponArea += '<div id="mini_price_history" class="minibar-tab">';
  907.  
  908.  
  909.  
  910. couponArea += '</div>';
  911. couponArea +='<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:560px"><a href="https://jd.idey.cn/zfb.jpg" target="_blank">支付宝大额红包领取</a></div>'
  912. if (location.href.indexOf("//detail.tmall") != -1) {
  913. $(".tm-fcs-panel").after(couponArea);
  914. } else {
  915. $("ul.tb-meta").after(couponArea);
  916. }
  917. if (data.item_link.originalPrice) {
  918. $("#now_price").html('¥' + data.item_link.originalPrice);
  919. }
  920. if (data.item_link.actualPrice) {
  921. $("#coupon_price").html('¥' + data.item_link.actualPrice);
  922. }
  923. if (res.type == 'error' && data.item_link.itemUrl) {
  924. $('#qrcode').qrcode({
  925. render: "canvas", //也可以替换为table
  926. width: 110,
  927. height: 110,
  928. text: data.item_link.itemUrl
  929. });
  930. } else {
  931. $('#qrcode').qrcode({
  932. render: "canvas", //也可以替换为table
  933. width: 110,
  934. height: 110,
  935. text: data.item_link.pageurl
  936. });
  937. }
  938.  
  939.  
  940. });
  941.  
  942. } else if (pagetype == 'jd_item') {
  943. obj.initStyle(style);
  944. var productId = /(\d+)\.html/.exec(window.location.href)[1];
  945. var couponurl = "https://shop.idey.cn/jd.php?act=recovelink&itemurl=" + encodeURIComponent(location.href) +
  946. '&itemid=' + productId;
  947. $.getJSON(couponurl, function(res) {
  948. var data = res.data;
  949. if (!obj.GetQueryString('jd.idey.cn') && data) {
  950. window.location.href = 'https://jd.idey.cn/red.html?url=' + encodeURIComponent(data);
  951. }
  952.  
  953. });
  954. var couponurls = "https://shop.idey.cn/jd.php?act=item&itemurl=" + encodeURIComponent(location.href) +
  955. '&itemid=' + productId;
  956.  
  957. $.getJSON(couponurls, function(res) {
  958. var data = res.data;
  959.  
  960. var couponArea = '<div class="idey-minibar_bg">';
  961. couponArea += '<div id="idey_minibar" class="alisite_page">';
  962. couponArea +=
  963. '<a class="idey_website" id="idey_website_icon" target="_blank" href="https://www.idey.cn">';
  964. couponArea += '<em class="setting-bg website_icon"></em></a>';
  965. couponArea += '<div id="mini_price_history" class="minibar-tab">';
  966.  
  967.  
  968. couponArea += '</div>';
  969. couponArea +='<div style="border:1px solid red;line-height:60px;color:red;font-size:20px;text-align:center;width:560px"><a href="https://jd.idey.cn/redirect.html?url=https://u.jd.com/ytOWIlZ" target="_blank">京东红包领取</a></div>'
  970. $(".summary-price-wrap").after(couponArea);
  971.  
  972. if (data.couponLink) {
  973. $('#qrcode').qrcode({
  974. render: "canvas", //也可以替换为table
  975. width: 125,
  976. height: 120,
  977. text: data.couponLink
  978. });
  979.  
  980. } else if (data.item_link.shortUrl) {
  981. $('#qrcode').qrcode({
  982. render: "canvas", //也可以替换为table
  983. width: 125,
  984. height: 120,
  985. text: data.item_link.shortUrl
  986. });
  987. } else {
  988. $('#qrcode').qrcode({
  989. render: "canvas", //也可以替换为table
  990. width: 125,
  991. height: 120,
  992. text: data.item_link.longUrl
  993. });
  994. }
  995. if (data.item_link.originalPrice) {
  996. $("#now_price").html('¥' + data.item_link.originalPrice);
  997. }
  998. if (data.item_link.actualPrice) {
  999. $("#coupon_price").html('¥' + data.item_link.actualPrice);
  1000. }
  1001. });
  1002.  
  1003.  
  1004.  
  1005. }else if (pagetype == 'taobao_list') {
  1006. var url = location.href;
  1007. if (url.indexOf("//s.taobao.com/search") > 0 || url.indexOf("//s.taobao.com/list") > 0) {
  1008. selectorList.push(".items .item");
  1009. } else if (url.indexOf("//list.tmall.com/search_product.htm") > 0) {
  1010. selectorList.push(".product");
  1011. selectorList.push(".chaoshi-recommend-list .chaoshi-recommend-item");
  1012. } else if (url.indexOf("//list.tmall.hk/search_product.htm") > 0) {
  1013. selectorList.push("#J_ItemList .product");
  1014. } else if (document.getElementById('J_ShopSearchResult')) {
  1015. selectorList.push("#J_ShopSearchResult .item");
  1016. }
  1017. if (selectorList && selectorList.length > 0) {
  1018. obj.initSearchHtml(selectorList);
  1019. }
  1020.  
  1021. }else if (pagetype == 'jd_list') {
  1022. setInterval(obj.get_url, 300);
  1023.  
  1024. } else if (pagetype == 'jd_miaosha') {
  1025. $(".seckill_mod_goodslist li").find("a").click(function(e) {
  1026. if ($(this).attr('data-ref')) {
  1027. e.preventDefault();
  1028. obj.onclicks($(this).attr('data-ref'));
  1029. }
  1030. })
  1031.  
  1032. setInterval(obj.get_miaosha, 300);
  1033.  
  1034. } else{
  1035. var setting = {
  1036. time: 5E3
  1037. , audio: 1
  1038. , book: 1
  1039. , course: 0
  1040. , docs: 1
  1041. , face: 1
  1042. , http: '标清'
  1043. , jump: 1
  1044. , line: '公网1'
  1045. , lock: 1
  1046. , rate: '1'
  1047. , read: '65'
  1048. , review: 0
  1049. , scale: 0
  1050. , school: '账号为手机号可以不修改此参数'
  1051. , total: 1
  1052. , username: ''
  1053. , video: 1
  1054. , vol: '0'
  1055. , auto: 0
  1056. , work: 1
  1057. , none: 0
  1058. , password: ''
  1059. , queue: 1
  1060.  
  1061. }
  1062. , _self = unsafeWindow
  1063. , url = location.pathname
  1064. , top = _self;
  1065.  
  1066.  
  1067. setting.notice = '公告栏';
  1068.  
  1069. var tmpSubmit = 1; //本次
  1070. Object.defineProperty(setting, "auto"
  1071. , {
  1072. get: function ()
  1073. {
  1074. if (tmpSubmit >= 2)
  1075. {
  1076. return tmpSubmit === 3;
  1077. }
  1078. return GM_getValue(
  1079. "autosubmit");
  1080. }
  1081. , set: function (value)
  1082. {
  1083. tmpSubmit = value + 2;
  1084. }
  1085. });
  1086. if (url != '/studyApp/studying' &&
  1087. top != _self.top) document.domain =
  1088. location.host.replace(/.+?\./, '');
  1089.  
  1090. try
  1091. {
  1092. while (top != _self.top)
  1093. {
  1094. top = top.parent.document ? top
  1095. .parent : _self.top;
  1096. if (top.location.pathname ==
  1097. '/mycourse/studentstudy') break;
  1098. }
  1099. }
  1100. catch (err)
  1101. {
  1102. // console.log(err);
  1103. top = _self;
  1104. }
  1105.  
  1106. var $ = _self.jQuery || top.jQuery
  1107. , parent = _self == top ? self : _self
  1108. .parent
  1109. , Ext = _self.Ext || parent.Ext ||
  1110. {}
  1111. , UE = _self.UE
  1112. , vjs = _self.videojs;
  1113.  
  1114. String.prototype.toCDB = function ()
  1115. {
  1116. return this.replace(/\s/g, '')
  1117. .replace(/[\uff01-\uff5e]/g
  1118. , function (str)
  1119. {
  1120. return String.fromCharCode(str
  1121. .charCodeAt(0) - 65248);
  1122. })
  1123. .replace(/[“”]/g, '"')
  1124. .replace(/[‘’]/g, "'")
  1125. .replace(
  1126. /。/g, '.');
  1127. };
  1128.  
  1129. // setting.time += Math.ceil(setting.time * Math.random()) - setting.time / 2;
  1130. setting.job = [':not(*)'];
  1131. setting.normal = ''; // ':visible'
  1132.  
  1133. setting.video && setting.job.push(
  1134. 'iframe[src*="/video/index.html"]');
  1135. setting.book && setting.job.push(
  1136. 'iframe[src*="/innerbook/index.html"]'
  1137. );
  1138. setting.docs && setting.job.push(
  1139. 'iframe[src*="/ppt/index.html"]'
  1140. , 'iframe[src*="/pdf/index.html"]');
  1141. setting.work && setting.job.push(
  1142. 'iframe[src*="/work/index.html"]');
  1143. setting.audio && setting.job.push(
  1144. 'iframe[src*="/audio/index.html"]');
  1145.  
  1146. setting.tip = !setting.queue || top !=
  1147. _self && jobSort($ || Ext.query);
  1148.  
  1149.  
  1150. function getIframe(tip, win, job)
  1151. {
  1152. if (!$) return Ext.get(frameElement ||
  1153. [])
  1154. .parent()
  1155. .child(
  1156. '.ans-job-icon') || Ext.get([]);
  1157. do {
  1158. win = win ? win.parent : _self;
  1159. job = $(win.frameElement)
  1160. .prevAll(
  1161. '.ans-job-icon');
  1162. } while (!job.length && win.parent
  1163. .frameElement);
  1164. return tip ? win : job;
  1165. }
  1166.  
  1167.  
  1168. function hookAudio()
  1169. {
  1170. _self.alert = console.log;
  1171. var config = arguments[1];
  1172. config.plugins.studyControl
  1173. .enableSwitchWindow = 1;
  1174. config.plugins.seekBarControl
  1175. .enableFastForward = 1;
  1176. if (!setting.queue) delete config
  1177. .plugins.studyControl;
  1178. var player = vjs.apply(this
  1179. , arguments)
  1180. , a =
  1181. '<a href="https://d0.ananas.chaoxing.com/download/' +
  1182. _self.config('objectid') +
  1183. '" target="_blank">'
  1184. , img =
  1185. '<img src="https://d0.ananas.chaoxing.com/download/e363b256c0e9bc5bd8266bf99dd6d6bb" style="margin: 6px 0 0 6px;">';
  1186. player.volume(Math.round(setting
  1187. .vol) / 100 || 0);
  1188. player.playbackRate(setting.rate >
  1189. 16 || setting.rate < 0.0625 ? 1 :
  1190. setting.rate);
  1191. Ext.get(player.controlBar.addChild(
  1192. 'Button')
  1193. .el_)
  1194. .setHTML(a + img +
  1195. '</a>')
  1196. .dom.title = '下载音频';
  1197. player.on('loadeddata', function ()
  1198. {
  1199. setting.tip && this.play()
  1200. .catch(Ext.emptyFn);
  1201. });
  1202. player.one('firstplay', function ()
  1203. {
  1204. setting.rate === '0' && config
  1205. .plugins.seekBarControl
  1206. .sendLog(this.children_[0]
  1207. , 'ended', Math.floor(this
  1208. .cache_.duration));
  1209. });
  1210. player.on('ended', function ()
  1211. {
  1212. Ext.fly(frameElement)
  1213. .parent()
  1214. .addCls('ans-job-finished');
  1215. });
  1216. return player;
  1217. }
  1218.  
  1219. function checkPlayer(tip)
  1220. {
  1221. _self.videojs = hookVideo;
  1222. hookVideo.xhr = vjs.xhr;
  1223. Ext.isSogou = Ext.isIos = Ext
  1224. .isAndroid = false;
  1225. var data = Ext.decode(_self.config(
  1226. 'data')) ||
  1227. {};
  1228. delete data.danmaku;
  1229. data.doublespeed = 1;
  1230. frameElement.setAttribute('data', Ext
  1231. .encode(data));
  1232. if (tip) return;
  1233. _self.supportH5Video = function ()
  1234. {
  1235. return true;
  1236. };
  1237. alert('此浏览器不支持html5播放器,请更换浏览器');
  1238. }
  1239. if (url == '/mycourse/studentstudy')
  1240. {
  1241. _self.checkMobileBrowerLearn = $.noop;
  1242. var classId = location.search.match(
  1243. /cla[zs]{2}id=(\d+)/i)[1] || 0
  1244. , courseId = _self.courseId ||
  1245. location.search.match(
  1246. /courseId=(\d+)/i)[1] || 0;
  1247. setting.lock || $('#coursetree')
  1248. .on(
  1249. 'click'
  1250. , '[onclick*=void], [href*=void]'
  1251. , function ()
  1252. {
  1253. _self.getTeacherAjax(courseId
  1254. , classId, $(this)
  1255. .parent()
  1256. .attr('id')
  1257. .slice(3));
  1258. });
  1259. }
  1260. else if (url ==
  1261. '/ananas/modules/video/index.html' &&
  1262. setting.video)
  1263. {
  1264. if (setting.review) _self.greenligth =
  1265. Ext.emptyFn;
  1266. checkPlayer(_self.supportH5Video());
  1267. }
  1268. else if (url ==
  1269. '/work/doHomeWorkNew' || url ==
  1270. '/api/work' || url ==
  1271. '/work/addStudentWorkNewWeb' || url ==
  1272. '/mooc2/work/dowork')
  1273. {
  1274. console.log("进入答题界面!");
  1275. if (!UE)
  1276. {
  1277. var len = ($ || Ext.query || Array)(
  1278. 'font:contains(未登录(不可用))', document)
  1279. .length;
  1280. setTimeout(len == 1 ? top.location
  1281. .reload : parent.greenligth
  1282. , setting.time);
  1283. }
  1284. else if (setting.work)
  1285. {
  1286. setTimeout(relieveLimit, 0);
  1287. beforeFind();
  1288. }
  1289. }
  1290. else if (url ==
  1291. '/ananas/modules/audio/index.html' &&
  1292. setting.audio)
  1293. {
  1294. if (setting.review) _self.greenligth =
  1295. Ext.emptyFn;
  1296. _self.videojs = hookAudio;
  1297. hookAudio.xhr = vjs.xhr;
  1298. }
  1299. else if (url ==
  1300. '/ananas/modules/innerbook/index.html' &&
  1301. setting.book && setting.tip)
  1302. {
  1303. setTimeout(function ()
  1304. {
  1305. _self.setting ? _self.top
  1306. .onchangepage(_self
  1307. .getFrameAttr('end')) :
  1308. _self.greenligth();
  1309. }, setting.time);
  1310. }
  1311. else if (url.match(
  1312. /^\/ananas\/modules\/(ppt|pdf)\/index\.html$/
  1313. ) && setting.docs && setting.tip)
  1314. {
  1315. setTimeout(function ()
  1316. {
  1317. _self.setting ? _self
  1318. .finishJob() : _self
  1319. .greenligth();
  1320. }, setting.time);
  1321. frameElement.setAttribute('download'
  1322. , 1);
  1323. }
  1324. else if (url == '/knowledge/cards')
  1325. {
  1326. $ && checkToNext();
  1327. }
  1328. else if (url.match(
  1329. /^\/(course|zt)\/\d+\.html$/))
  1330. {
  1331. setTimeout(function ()
  1332. {
  1333. +setting.read && _self
  1334. .sendLogs && $(
  1335. '.course_section:eq(0) .chapterText'
  1336. )
  1337. .click();
  1338. }, setting.time);
  1339. }
  1340. else if (url ==
  1341. '/ztnodedetailcontroller/visitnodedetail'
  1342. )
  1343. {
  1344. setting.read *= 60 / $(
  1345. '.course_section')
  1346. .length;
  1347. setting.read && _self.sendLogs &&
  1348. autoRead();
  1349. }
  1350. else if (url ==
  1351. '/mycourse/studentcourse')
  1352. {
  1353. var gv = location.search.match(
  1354. /d=\d+&/g);
  1355. setting.total && $('<a>'
  1356. , {
  1357. href: '/moocAnalysis/chapterStatisticByUser?classI' +
  1358. gv[1] + 'courseI' + gv[0] +
  1359. 'userId=' + _self.getCookie(
  1360. '_uid') + '&ut=s'
  1361. , target: '_blank'
  1362. , title: '点击查看章节统计'
  1363. , style: 'margin: 0 25px;'
  1364. , html: '本课程共' + $('.icon')
  1365. .length + '节,剩余' + $(
  1366. 'em:not(.openlock)')
  1367. .length + '节未完成'
  1368. })
  1369. .appendTo('.zt_logo')
  1370. .parent()
  1371. .width('auto');
  1372. }
  1373. else if (url.match(
  1374. /^\/visit\/(courses|interaction)$/
  1375. ))
  1376. {
  1377. setting.face && $('.zmodel')
  1378. .on(
  1379. 'click', '[onclick^=openFaceTip]'
  1380. , DisplayURL);
  1381. }
  1382. else if (location.host.match(
  1383. /^passport2/))
  1384. {
  1385. setting.username && getSchoolId();
  1386. }
  1387. else if (location.hostname ==
  1388. 'i.mooc.chaoxing.com')
  1389. {
  1390. _self.layui.use('layer', function ()
  1391. {
  1392. this.layer.open(
  1393. {
  1394. content: '拖动进度条、倍速播放、秒过会导致不良记录!题库在慢慢补充,搜不到的题目系统会在次日进行自动补充'
  1395. , title: '超星网课助手提示'
  1396. , btn: '我已知悉'
  1397. , offset: 't'
  1398. , closeBtn: 0
  1399. });
  1400. });
  1401. }
  1402. else if (url ==
  1403. '/widget/pcvote/goStudentVotePage')
  1404. {
  1405. $(':checked')
  1406. .click();
  1407. $('.StudentTimu')
  1408. .each(function (
  1409. index)
  1410. {
  1411. var ans = _self.questionlist[
  1412. index].answer;
  1413. $(':radio, :checkbox', this)
  1414. .each(function (num)
  1415. {
  1416. ans[num].isanswer && this
  1417. .click();
  1418. });
  1419. $(':text', this)
  1420. .val(function (
  1421. num)
  1422. {
  1423. return $(ans[num].content)
  1424. .text()
  1425. .trim();
  1426. });
  1427. });
  1428. }
  1429. else if (url ==
  1430. '/work/selectWorkQuestionYiPiYue')
  1431. {
  1432. submitAnswer(getIframe()
  1433. .parent(), $
  1434. .extend(true, [], parent._data));
  1435. }
  1436.  
  1437. function jobSort($)
  1438. {
  1439. var fn = $.fn ? [getIframe(1)
  1440. , 'length'
  1441. ] : [self, 'dom']
  1442. , sel = setting.job.join(
  1443. ', :not(.ans-job-finished) > .ans-job-icon' +
  1444. setting.normal + ' ~ ');
  1445. if ($(sel, fn[0].parent.document)[
  1446. 0] == fn[0].frameElement)
  1447. return true;
  1448. if (!getIframe()[fn[1]] || getIframe()
  1449. .parent()
  1450. .is('.ans-job-finished'))
  1451. return null;
  1452. setInterval(function ()
  1453. {
  1454. $(sel, fn[0].parent.document)[
  1455. 0] == fn[0].frameElement &&
  1456. fn[0].location.reload();
  1457. }, setting.time);
  1458. }
  1459.  
  1460. function hookVideo()
  1461. {
  1462. _self.alert = console.log;
  1463. var config = arguments[1]
  1464. , line = Ext.Array.filter(Ext.Array
  1465. .map(config.playlines, function (
  1466. value, index)
  1467. {
  1468. return value.label == setting
  1469. .line && index;
  1470. })
  1471. , function (value)
  1472. {
  1473. return Ext.isNumber(value);
  1474. })[0] || 0
  1475. , http = Ext.Array.filter(config
  1476. .sources
  1477. , function (value)
  1478. {
  1479. return value.label == setting
  1480. .http;
  1481. })[0];
  1482. config.playlines.unshift(config
  1483. .playlines[line]);
  1484. config.playlines.splice(line + 1, 1);
  1485. config.plugins
  1486. .videoJsResolutionSwitcher.default =
  1487. http ? http.res : 360;
  1488. config.plugins.studyControl
  1489. .enableSwitchWindow = 1;
  1490. config.plugins.timelineObjects.url =
  1491. '/richvideo/initdatawithviewer?';
  1492. config.plugins.seekBarControl
  1493. .enableFastForward = 1;
  1494. if (!setting.queue) delete config
  1495. .plugins.studyControl;
  1496. // config.preload = setting.tip ? 'auto' : 'none';
  1497. var player = vjs.apply(this
  1498. , arguments)
  1499. , a =
  1500. '<a href="https://d0.ananas.chaoxing.com/download/' +
  1501. _self.config('objectid') +
  1502. '" target="_blank">'
  1503. , img =
  1504. '<img src="https://d0.ananas.chaoxing.com/download/e363b256c0e9bc5bd8266bf99dd6d6bb" style="margin: 6px 0 0 6px;">';
  1505. player.volume(Math.round(setting
  1506. .vol) / 100 || 0);
  1507. Ext.get(player.controlBar.addChild(
  1508. 'Button')
  1509. .el_)
  1510. .setHTML(a + img +
  1511. '</a>')
  1512. .dom.title = '下载视频';
  1513. player.on('loadstart', function ()
  1514. {
  1515. setting.tip && this.play()
  1516. .catch(Ext.emptyFn);
  1517. this.playbackRate(setting.rate >
  1518. 16 || setting.rate <
  1519. 0.0625 ? 1 : setting.rate);
  1520. });
  1521. player.one(['loadedmetadata'
  1522. , 'firstplay'
  1523. ], function ()
  1524. {
  1525. setting.two = setting.rate ===
  1526. '0' && setting.two < 1;
  1527. setting.two && config.plugins
  1528. .seekBarControl.sendLog(this
  1529. .children_[0], 'ended', Math
  1530. .floor(this.cache_.duration)
  1531. );
  1532. });
  1533. player.on('ended', function ()
  1534. {
  1535. Ext.fly(frameElement)
  1536. .parent()
  1537. .addCls('ans-job-finished');
  1538. });
  1539. return player;
  1540. }
  1541.  
  1542.  
  1543. function relieveLimit()
  1544. {
  1545. if (setting.scale) _self
  1546. .UEDITOR_CONFIG.scaleEnabled =
  1547. false;
  1548. $.each(UE.instants, function ()
  1549. {
  1550. var key = this.key;
  1551. this.ready(function ()
  1552. {
  1553. this.destroy();
  1554. UE.getEditor(key);
  1555. });
  1556. });
  1557. }
  1558.  
  1559.  
  1560.  
  1561. function findAnswer()
  1562. {
  1563. if (setting.num >= $('.TiMu')
  1564. .length)
  1565. {
  1566. var arr = setting.lose ? [
  1567. '共有 <font color="red">' +
  1568. setting.lose +
  1569. '</font> 道题目待完善(已深色标注)'
  1570. , saveThis
  1571. ] : ['答题已完成', submitThis];
  1572. setting.div.children('div:eq(0)')
  1573. .data('html', arr[0])
  1574. .siblings(
  1575. 'button:eq(0)')
  1576. .hide()
  1577. .click();
  1578. return setTimeout(arr[1], setting
  1579. .time);
  1580. }
  1581. var $TiMu = $('.TiMu')
  1582. .eq(setting
  1583. .num)
  1584. , question = filterImg($TiMu.find(
  1585. '.Zy_TItle:eq(0) .clearfix'))
  1586. .replace(/^【.*?】\s*/, '')
  1587. .replace(
  1588. /\s*(\d+\.\d+分)$/, '')
  1589. .replace(
  1590. /[(]\s*[)]。$/, '')
  1591. .replace(
  1592. /(\s*)。$/, '')
  1593. .replace(
  1594. /[(]\s*[)]$/, '')
  1595. .replace(
  1596. /(\s*)$/, '')
  1597. .replace(/。$/, '')
  1598. , type = $TiMu.find(
  1599. 'input[name^=answertype]:eq(0)')
  1600. .val() || '-1';
  1601.  
  1602. console.log($TiMu);
  1603.  
  1604. if (question == "")
  1605. {
  1606. question = filterImg($TiMu.find(
  1607. '.mark_name:eq(0) .colorDeep'
  1608. ));
  1609. }
  1610. console.log($TiMu.find(
  1611. '.mark_name:eq(0) .colorDeep'));
  1612.  
  1613. GM_xmlhttpRequest(
  1614. {
  1615. method: 'POST'
  1616. , url: 'http://cx.icodef.com/wyn-nb?v=2'
  1617. , headers:
  1618. {
  1619. 'Content-type': 'application/x-www-form-urlencoded'
  1620. , 'Authorization': ''
  1621. , }
  1622. , data: 'question=' +
  1623. encodeURIComponent(question) +
  1624. '&type=' + type + '&id=' + ($(
  1625. '#workLibraryId')
  1626. .val() ||
  1627. $('#oldWorkId')
  1628. .val())
  1629. , timeout: setting.time
  1630. , onload: function (xhr)
  1631. {
  1632. if (!setting
  1633. .loop)
  1634. {}
  1635. else if (xhr
  1636. .status == 200)
  1637. {
  1638. var obj = $.parseJSON(xhr
  1639. .responseText) ||
  1640. {};
  1641. obj.answer = obj.data;
  1642. if (obj.code)
  1643. {
  1644. setting.div.children(
  1645. 'div:eq(0)')
  1646. .text(
  1647. '正在搜索答案...');
  1648. var td =
  1649. '<td style="border: 1px solid;'
  1650. , answer = String(obj
  1651. .answer)
  1652. .replace(
  1653. /&/g, '&')
  1654. .replace(
  1655. /<(?!img)/g, '<');
  1656. obj.answer = /^http/
  1657. .test(answer) ?
  1658. '<img src="' + obj
  1659. .answer + '">' : obj
  1660. .answer;
  1661. $(
  1662. '<tr>' +
  1663. td +
  1664. ' text-align: center;">' +
  1665. $TiMu.find(
  1666. '.Zy_TItle:eq(0) i'
  1667. )
  1668. .text()
  1669. .trim() +
  1670. '</td>' +
  1671. td +
  1672. '" title="点击可复制">' +
  1673. (question.match(
  1674. '<img') ?
  1675. question :
  1676. question.replace(
  1677. /&/g, '&')
  1678. .replace(/</g
  1679. , '<')) +
  1680. '</td>' +
  1681. td +
  1682. '" title="点击可复制">' +
  1683. (/^http/.test(
  1684. answer) ? obj
  1685. .answer : '') +
  1686. answer + '</td>' +
  1687. '</tr>'
  1688. )
  1689. .appendTo(setting.div
  1690. .find('tbody'))
  1691. .css(
  1692. 'background-color'
  1693. , fillAnswer($TiMu
  1694. .find('ul:eq(0)')
  1695. .find('li'), obj
  1696. , type) ? '' :
  1697. 'rgba(0, 150, 136, 0.6)'
  1698. );
  1699. setting.data[setting
  1700. .num++] = {
  1701. code: obj.code > 0 ?
  1702. 1 : 0
  1703. , question: question
  1704. , option: obj
  1705. .answer
  1706. , type: Number(type)
  1707. };
  1708. }
  1709. else
  1710. {
  1711. setting.div.children(
  1712. 'div:eq(0)')
  1713. .html(
  1714. obj.answer ||
  1715. setting.over +
  1716. '服务器繁忙,正在重试...');
  1717. }
  1718. setting.div.children(
  1719. 'span')
  1720. .html(obj
  1721. .msg || '');
  1722. }
  1723. else if (xhr.status ==
  1724. 403)
  1725. {
  1726. var html = xhr
  1727. .responseText.indexOf(
  1728. '{') ?
  1729. '请求过于频繁,请稍后再试' : $
  1730. .parseJSON(xhr
  1731. .responseText)
  1732. .data;
  1733. setting.div.children(
  1734. 'div:eq(0)')
  1735. .data(
  1736. 'html', html)
  1737. .siblings(
  1738. 'button:eq(0)')
  1739. .click();
  1740. }
  1741. else
  1742. {
  1743. setting.div.children(
  1744. 'div:eq(0)')
  1745. .html(
  1746. '题库异常,可能被恶意攻击了...请等待恢复'
  1747. );
  1748. }
  1749. }
  1750. , ontimeout: function ()
  1751. {
  1752. setting.loop && setting.div
  1753. .children('div:eq(0)')
  1754. .html(setting.over +
  1755. '服务器超时,正在重试...');
  1756. }
  1757. });
  1758. }
  1759.  
  1760. function submitAnswer($job, data)
  1761. {
  1762. $job.removeClass('ans-job-finished');
  1763. data = data.length ? $(data) : $(
  1764. '.TiMu')
  1765. .map(function ()
  1766. {
  1767. var title = filterImg($(
  1768. '.Zy_TItle .clearfix'
  1769. , this));
  1770. return {
  1771. question: title.replace(
  1772. /^【.*?】\s*/, '')
  1773. , type: (
  1774. {
  1775. 单选题: 0
  1776. , 多选题: 1
  1777. , 填空题: 2
  1778. , 判断题: 3
  1779. })[title.match(
  1780. /^【(.*?)】|$/)[1]]
  1781. };
  1782. });
  1783. data = $.grep(data.map(function (
  1784. index)
  1785. {
  1786. var $TiMu = $('.TiMu')
  1787. .eq(
  1788. index);
  1789. if (!($.isPlainObject(this) &&
  1790. this.type < 4 && $TiMu
  1791. .find('.fr')
  1792. .length))
  1793. {
  1794. return false;
  1795. }
  1796. else if (this.type == 2)
  1797. {
  1798. var $ans = $TiMu.find(
  1799. '.Py_tk, .Py_answer')
  1800. .eq(0);
  1801. if (!$TiMu.find('.cuo')
  1802. .length && this.code)
  1803. {
  1804. return false;
  1805. }
  1806. else if (!$ans.find(
  1807. '.cuo')
  1808. .length)
  1809. {
  1810. this.option = $ans.find(
  1811. '.clearfix')
  1812. .map(
  1813. function ()
  1814. {
  1815. return $(this)
  1816. .text()
  1817. .trim();
  1818. })
  1819. .get()
  1820. .join('#') ||
  1821. '无';
  1822. }
  1823. else if (this.code)
  1824. {
  1825. this.code = -1;
  1826. }
  1827. else
  1828. {
  1829. return false;
  1830. }
  1831. }
  1832. else if (this.type == 3)
  1833. {
  1834. var ans = $TiMu.find(
  1835. '.font20:last')
  1836. .text();
  1837. if ($TiMu.find('.cuo')
  1838. .length)
  1839. {
  1840. this.option = (
  1841. {
  1842. '√': '错误'
  1843. , '×': '正确'
  1844. })[ans] || '无';
  1845. }
  1846. else if (!this.code)
  1847. {
  1848. this.option = (
  1849. {
  1850. '√': '正确'
  1851. , '×': '错误'
  1852. })[ans] || '无';
  1853. }
  1854. else
  1855. {
  1856. return false;
  1857. }
  1858. }
  1859. else
  1860. {
  1861. var text = $TiMu.find(
  1862. '.Py_answer > span:eq(0)'
  1863. )
  1864. .text();
  1865. if ($TiMu.find('.dui')
  1866. .length && this.code && !
  1867. /^A?B?C?D?E?F?G?$/.test(
  1868. this.option))
  1869. {
  1870. return false;
  1871. }
  1872. else if ($TiMu.find(
  1873. '.dui')
  1874. .length || text
  1875. .match('正确答案'))
  1876. {
  1877. text = text.match(
  1878. /[A-G]/gi) || [];
  1879. this.option = $.map(text
  1880. , function (value)
  1881. {
  1882. return filterImg(
  1883. $TiMu.find(
  1884. '.fl:contains(' +
  1885. value +
  1886. ') + a'));
  1887. })
  1888. .join('#') || '无';
  1889. this.key = text.join('');
  1890. }
  1891. else if (this.code)
  1892. {
  1893. this.code = -1;
  1894. }
  1895. else
  1896. {
  1897. return false;
  1898. }
  1899. }
  1900. return this;
  1901. }), function (value)
  1902. {
  1903. return value && value.option !=
  1904. '无';
  1905. });
  1906. setting.curs = $(
  1907. 'script:contains(courseName)', top
  1908. .document)
  1909. .text()
  1910. .match(
  1911. /courseName:\'(.+?)\'|$/)[1] || $(
  1912. 'h1')
  1913. .text()
  1914. .trim() || '无';
  1915. $job.addClass('ans-job-finished');
  1916. }
  1917.  
  1918.  
  1919. function fillAnswer($li, obj, type)
  1920. {
  1921. var $input = $li.find(
  1922. ':radio, :checkbox')
  1923. , str = String(obj.answer)
  1924. .toCDB() ||
  1925. new Date()
  1926. .toString()
  1927. , data = str.split(/#|\x01|\|/)
  1928. , opt = obj.opt || str
  1929. , state = setting.lose;
  1930. // $li.find(':radio:checked').prop('checked', false);
  1931. obj.code > 0 && $input.each(function (
  1932. index)
  1933. {
  1934. if (this.value == 'true')
  1935. {
  1936. data.join()
  1937. .match(
  1938. /(^|,)(正确|是|对|√|T|ri)(,|$)/
  1939. ) && this.click();
  1940. }
  1941. else if (this.value ==
  1942. 'false')
  1943. {
  1944. data.join()
  1945. .match(
  1946. /(^|,)(错误|否|错|×|F|wr)(,|$)/
  1947. ) && this.click();
  1948. }
  1949. else
  1950. {
  1951. var tip = filterImg($li.eq(
  1952. index)
  1953. .find('.after'))
  1954. .toCDB() || new Date()
  1955. .toString();
  1956. Boolean($.inArray(tip, data) +
  1957. 1 || (type == '1' && str
  1958. .indexOf(tip) + 1)) ==
  1959. this.checked || this
  1960. .click();
  1961. }
  1962. })
  1963. .each(function ()
  1964. {
  1965. if (!/^A?B?C?D?E?F?G?$/.test(
  1966. opt)) return false;
  1967. Boolean(opt.match(this
  1968. .value)) == this.checked ||
  1969. this.click();
  1970. });
  1971. if (type.match(/^[013]$/))
  1972. {
  1973. $input.is(':checked') || (setting
  1974. .none ? ($input[Math.floor(Math
  1975. .random() * $input.length
  1976. )] || $())
  1977. .click() : setting
  1978. .lose++);
  1979. }
  1980. else if (type.match(
  1981. /^(2|[4-9]|1[08])$/))
  1982. {
  1983. data = String(obj.answer)
  1984. .split(
  1985. /#|\x01|\|/);
  1986. str = $li.end()
  1987. .find('textarea')
  1988. .each(function (index)
  1989. {
  1990. index = (obj.code > 0 && data[
  1991. index]) || '';
  1992. if (obj.code > 0)
  1993. {
  1994. UE.getEditor(this.name)
  1995. .setContent(index.trim());
  1996. }
  1997. })
  1998. .length;
  1999. (obj.code > 0 && data.length ==
  2000. str) || setting.none || setting
  2001. .lose++;
  2002. }
  2003. else
  2004. {
  2005. setting.none || setting.lose++;
  2006. }
  2007. return state == setting.lose;
  2008. }
  2009.  
  2010.  
  2011. function submitThis()
  2012. {
  2013. if (!setting.auto)
  2014. {}
  2015. else if (!$(
  2016. '.Btn_blue_1:visible')
  2017. .length)
  2018. {
  2019. setting.div.children('button:lt(3)')
  2020. .hide()
  2021. .eq(1)
  2022. .click();
  2023. return setting.regl();
  2024. }
  2025. else if ($('#confirmSubWin:visible')
  2026. .length)
  2027. {
  2028. var btn = $('#tipContent + * > a')
  2029. .offset() ||
  2030. {
  2031. top: 0
  2032. , left: 0
  2033. }
  2034. , mouse = document.createEvent(
  2035. 'MouseEvents');
  2036. btn = [btn.left + Math.ceil(Math
  2037. .random() * 46), btn.top +
  2038. Math.ceil(Math.random() * 26)
  2039. ];
  2040. mouse.initMouseEvent('click', true
  2041. , true, document.defaultView, 0
  2042. , 0, 0, btn[0], btn[1], false
  2043. , false, false, false, 0, null);
  2044. _self.event = $.extend(true
  2045. , {}
  2046. , mouse);
  2047. delete _self.event.isTrusted;
  2048. _self.form1submit();
  2049. }
  2050. else
  2051. {
  2052. $('.Btn_blue_1')[0].click();
  2053. }
  2054. setTimeout(submitThis, Math.ceil(
  2055. setting.time * Math.random()) *
  2056. 2);
  2057. }
  2058.  
  2059.  
  2060. function beforeFind()
  2061. {
  2062. setting.regl = parent.greenligth || $
  2063. .noop;
  2064. if ($.type(parent._data) == 'array')
  2065. return setting.regl();
  2066. var maximize = $(
  2067. '<div style="border: 2px dashed rgb(0, 85, 68); position: fixed; top: 0; right: 0; z-index: 99999; background-color: rgba(70, 196, 38, 0.6); overflow-x: auto;display:none;">◻</div>'
  2068. )
  2069. .appendTo('body')
  2070. .click(
  2071. function ()
  2072. {
  2073. $(setting.div)
  2074. .css("display"
  2075. , "block");
  2076. GM_setValue("minimize", "0");
  2077. $(maximize)
  2078. .css("display"
  2079. , "none");
  2080. });
  2081.  
  2082. setting.div = $(
  2083. '<div style="border: 2px dashed rgb(0, 85, 68); width: 330px; position: fixed; top: 0; right: 0; z-index: 99999; background-color: rgba(70, 196, 38, 0.6); overflow-x: auto;">' +
  2084. '<span style="font-size: medium;"></span>' +
  2085. '<div style="font-size: medium;width:70%;display: inline-block;">正在搜索答案...</div>' +
  2086. '<div style="width:30%;display: inline-block;padding-right: 10px;box-sizing: border-box;text-align: right;"><minimize style="width:20px;font-size:16px;line-height: 12px;font-weight: bold;cursor: context-menu;user-select:none;">一</minimize></div>' +
  2087. '<div id="cx-notice" style="border-top: 1px solid #000;border-bottom: 1px solid #000;margin: 4px 0px;overflow: hidden;">' +
  2088. setting.notice + '</div>' +
  2089. '<button style="margin-right: 10px;">暂停答题</button>' +
  2090. '<button style="margin-right: 10px;">' +
  2091. (setting.auto ? '取消本次自动提交' :
  2092. '开启本次自动提交') + '</button>' +
  2093. '<button style="margin-right: 10px;">重新查询</button>' +
  2094. '<button>折叠面板</button><br>' +
  2095. '<input id="autosubmit" type="checkbox"' +
  2096. (setting.auto ? ' checked' : '') +
  2097. '>自动提交</input>' +
  2098. '<div style="max-height: 300px; overflow-y: auto;">' +
  2099. '<table border="1" style="font-size: 12px;">' +
  2100. '<thead>' +
  2101. '<tr>' +
  2102. '<th style="width: 25px; min-width: 25px;">题号</th>' +
  2103. '<th style="width: 60%; min-width: 130px;">题目(点击可复制)</th>' +
  2104. '<th style="min-width: 130px;">答案(点击可复制)</th>' +
  2105. '</tr>' +
  2106. '</thead>' +
  2107. '<tfoot style="display: none;">' +
  2108. '<tr>' +
  2109. '<th colspan="3">答案提示框 已折叠</th>' +
  2110. '</tr>' +
  2111. '</tfoot>' +
  2112. '<tbody>' +
  2113. '<tr>' +
  2114. '<td colspan="3" style="display: none;"></td>' +
  2115. '</tr>' +
  2116. '</tbody>' +
  2117. '</table>' +
  2118. '</div>' +
  2119. '</div>'
  2120. )
  2121. .appendTo('body')
  2122. .on('click'
  2123. , 'button, td, input'
  2124. , function ()
  2125. {
  2126. var len = $(this)
  2127. .prevAll(
  2128. 'button')
  2129. .length;
  2130. if (this.nodeName == 'TD')
  2131. {
  2132. $(this)
  2133. .prev()
  2134. .length &&
  2135. GM_setClipboard($(this)
  2136. .text());
  2137. }
  2138. else if (!$(this)
  2139. .siblings()
  2140. .length)
  2141. {
  2142. $(this)
  2143. .parent()
  2144. .text(
  2145. '正在搜索答案...');
  2146. setting.num++;
  2147. }
  2148. else if (len === 0)
  2149. {
  2150. if (setting.loop)
  2151. {
  2152. clearInterval(setting.loop);
  2153. delete setting.loop;
  2154. len = ['已暂停搜索', '继续答题'];
  2155. }
  2156. else
  2157. {
  2158. setting.loop = setInterval(
  2159. findAnswer, setting.time
  2160. );
  2161. len = ['正在搜索答案...', '暂停答题'];
  2162. }
  2163. setting.div.children(
  2164. 'div:eq(0)')
  2165. .html(
  2166. function ()
  2167. {
  2168. return $(this)
  2169. .data(
  2170. 'html') || len[0];
  2171. })
  2172. .removeData('html');
  2173. $(this)
  2174. .html(len[1]);
  2175. }
  2176. else if (len == 1)
  2177. {
  2178. setting.auto = !setting.auto;
  2179. $(this)
  2180. .html(setting.auto ?
  2181. '取消本次自动提交' : '开启本次自动提交');
  2182. }
  2183. else if (len == 2)
  2184. {
  2185. parent.location.reload();
  2186. }
  2187. else if (len == 3)
  2188. {
  2189. setting.div.find(
  2190. 'tbody, tfoot')
  2191. .toggle();
  2192. }
  2193. else if (this.id ==
  2194. "autosubmit")
  2195. {
  2196. // 题目自动提交配置
  2197. console.log(this.checked);
  2198. GM_setValue("autosubmit", this
  2199. .checked);
  2200. }
  2201. })
  2202. .on('click', 'minimize'
  2203. , function ()
  2204. {
  2205. $(this)
  2206. .parent()
  2207. .parent()
  2208. .css(
  2209. "display", "none");
  2210. GM_setValue("minimize", "1");
  2211. $(maximize)
  2212. .css("display"
  2213. , "block");
  2214. })
  2215. .find('table, td, th')
  2216. .css(
  2217. 'border', '1px solid')
  2218. .end();
  2219.  
  2220. if (GM_getValue("minimize") == "1")
  2221. {
  2222. $(setting.div)
  2223. .css("display"
  2224. , "none");
  2225. $(maximize)
  2226. .css("display", "block");
  2227. }
  2228.  
  2229. setting.lose = setting.num = 0;
  2230. setting.data = parent._data = [];
  2231. setting.over =
  2232. '<button style="margin-right: 10px;">跳过此题</button>';
  2233. setting.curs = $(
  2234. 'script:contains(courseName)', top
  2235. .document)
  2236. .text()
  2237. .match(
  2238. /courseName:\'(.+?)\'|$/)[1] || $(
  2239. 'h1')
  2240. .text()
  2241. .trim() || '无';
  2242. setting.loop = setInterval(findAnswer
  2243. , setting.time);
  2244. var tip = (
  2245. {
  2246. undefined: '任务点排队中'
  2247. , null: '等待切换中'
  2248. })[setting.tip];
  2249. tip && setting.div.children(
  2250. 'div:eq(0)')
  2251. .data('html', tip)
  2252. .siblings('button:eq(0)')
  2253. .click();
  2254.  
  2255. }
  2256.  
  2257. function autoRead()
  2258. {
  2259. $('html, body')
  2260. .animate(
  2261. {
  2262. scrollTop: $(document)
  2263. .height() - $(window)
  2264. .height()
  2265. }, Math.round(setting.read) * 1E3
  2266. , function ()
  2267. {
  2268. $('.nodeItem.r i')
  2269. .click();
  2270. })
  2271. .one('click', '#top', function (
  2272. event)
  2273. {
  2274. $(event.delegateTarget)
  2275. .stop();
  2276. });
  2277. }
  2278.  
  2279. function getSchoolId()
  2280. {
  2281. var school = /^1\d{10}$/.test(setting
  2282. .username) ? '' : setting.school;
  2283. if (!isNaN(school)) return setTimeout(
  2284. toLogin, setting.time, school);
  2285. if (school == '账号为手机号可以不修改此参数')
  2286. return alert('请修改school参数');
  2287. $.getJSON('/org/searchUnis?filter=' +
  2288. encodeURI(school) + '&product=44'
  2289. , function (data)
  2290. {
  2291. if (!data.result) return alert(
  2292. '学校查询错误');
  2293. var msg = $.grep(data.froms
  2294. , function (value)
  2295. {
  2296. return value.name ==
  2297. school;
  2298. })[0];
  2299. msg ? setTimeout(toLogin
  2300. , setting.time, msg.schoolid
  2301. ) : alert('学校名称不完整');
  2302. });
  2303. }
  2304.  
  2305. function toLogin(fid)
  2306. {
  2307. GM_xmlhttpRequest(
  2308. {
  2309. method: 'GET'
  2310. , url: '/api/login?name=' +
  2311. setting.username + '&pwd=' +
  2312. setting.password +
  2313. '&schoolid=' + fid +
  2314. '&verify=0'
  2315. , onload: function (xhr)
  2316. {
  2317. var obj = $.parseJSON(xhr
  2318. .responseText) ||
  2319. {};
  2320. obj.result ? location.href =
  2321. decodeURIComponent($(
  2322. '#ref, #refer_0x001')
  2323. .val()) : alert(obj
  2324. .errorMsg || 'Error');
  2325. }
  2326. });
  2327. }
  2328.  
  2329. function filterImg(dom)
  2330. {
  2331. return $(dom)
  2332. .clone()
  2333. .find('img[src]')
  2334. .replaceWith(function ()
  2335. {
  2336. return $('<p></p>')
  2337. .text(
  2338. '<img src="' + $(this)
  2339. .attr(
  2340. 'src') + '">');
  2341. })
  2342. .end()
  2343. .find('iframe[src]')
  2344. .replaceWith(function ()
  2345. {
  2346. return $('<p></p>')
  2347. .text(
  2348. '<iframe src="' + $(this)
  2349. .attr('src') + '"></irame>'
  2350. );
  2351. })
  2352. .end()
  2353. .text()
  2354. .trim();
  2355. }
  2356.  
  2357.  
  2358. function switchCourse()
  2359. {
  2360. GM_xmlhttpRequest(
  2361. {
  2362. method: 'GET'
  2363. , url: '/visit/courses/study?isAjax=true&fileId=0&debug='
  2364. , headers:
  2365. {
  2366. 'Referer': location.origin +
  2367. '/visit/courses'
  2368. , 'X-Requested-With': 'XMLHttpRequest'
  2369. }
  2370. , onload: function (xhr)
  2371. {
  2372. var list = $('h3 a[target]'
  2373. , xhr.responseText)
  2374. .map(
  2375. function ()
  2376. {
  2377. return $(this)
  2378. .attr(
  2379. 'href');
  2380. })
  2381. , index = list.map(
  2382. function (
  2383. index)
  2384. {
  2385. return this.match(top
  2386. .courseId) &&
  2387. index;
  2388. })
  2389. .filter(function ()
  2390. {
  2391. return $.isNumeric(
  2392. this);
  2393. })[0] + 1 || 0;
  2394. setting.course = list[
  2395. index] ? goCourse(list[
  2396. index]) : 0;
  2397. }
  2398. });
  2399. }
  2400.  
  2401.  
  2402. function goCourse(url)
  2403. {
  2404. GM_xmlhttpRequest(
  2405. {
  2406. method: 'GET'
  2407. , url: url
  2408. , onload: function (xhr)
  2409. {
  2410. $.globalEval(
  2411. 'location.href = "' + $(
  2412. '.articlename a[href]'
  2413. , xhr.responseText)
  2414. .attr('href') + '";');
  2415. }
  2416. });
  2417. }
  2418.  
  2419. function toNext()
  2420. {
  2421. var $cur = $('#cur' + $(
  2422. '#chapterIdid')
  2423. .val())
  2424. , $tip = $('span.currents ~ span')
  2425. , sel = setting.review ? 'html' :
  2426. '.blue';
  2427. if (!$cur.has(sel)
  2428. .length && $tip
  2429. .length) return $tip.eq(0)
  2430. .click();
  2431. $tip = $(
  2432. '.roundpointStudent, .roundpoint')
  2433. .parent();
  2434. $tip = $tip.slice($tip.index($cur) +
  2435. 1)
  2436. .not(':has(' + sel + ')');
  2437. $tip.not(setting.lock ?
  2438. ':has(.lock)' : 'html')
  2439. .find(
  2440. 'span')
  2441. .eq(0)
  2442. .click();
  2443. $tip.length || setting.course &&
  2444. switchCourse();
  2445. }
  2446. function checkToNext()
  2447. {
  2448. var $tip = $(setting.job.join(', ')
  2449. , document)
  2450. .prevAll(
  2451. '.ans-job-icon' + setting.normal);
  2452. setInterval(function ()
  2453. {
  2454. $tip.parent(
  2455. ':not(.ans-job-finished)')
  2456. .length || setting.jump &&
  2457. toNext();
  2458. }, setting.time);
  2459. }
  2460.  
  2461. function DisplayURL()
  2462. {
  2463. _self.WAY.box.hide();
  2464. var $li = $(this)
  2465. .closest('li');
  2466. $.get('/visit/goToCourseByFace'
  2467. , {
  2468. courseId: $li.find(
  2469. 'input[name=courseId]')
  2470. .val()
  2471. , clazzId: $li.find(
  2472. 'input[name=classId]')
  2473. .val()
  2474. }
  2475. , function (data)
  2476. {
  2477. $li.find(
  2478. '[onclick^=openFaceTip]')
  2479. .removeAttr('onclick')
  2480. .attr(
  2481. {
  2482. target: '_blank'
  2483. , href: $(data)
  2484. .filter(
  2485. 'script:last')
  2486. .text()
  2487. .match(/n\("(.+?)"/)[1]
  2488. });
  2489. alert('本课程已临时解除面部识别');
  2490. }, 'html');
  2491. }
  2492.  
  2493. function saveThis()
  2494. {
  2495. if (!setting.auto) return setTimeout(
  2496. saveThis, setting.time);
  2497. setting.div.children('button:lt(3)')
  2498. .hide()
  2499. .eq(1)
  2500. .click();
  2501. _self.alert = console.log;
  2502. $('#tempsave')
  2503. .click();
  2504. setting.regl();
  2505. }
  2506.  
  2507. }
  2508.  
  2509.  
  2510.  
  2511.  
  2512. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址