NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name 南航人工排队工具 // @namespace https://openuserjs.org/users/rainbowcorn // @version 0.0.1 // @description 南航人工排队工具 // @author rainbowcorn // @match https://xrns.ngame.io/ // @grant none // @licence MIT // @copyright 2019, rainbowcorn (https://openuserjs.org/users/rainbowcorn) // @require http://code.jquery.com/jquery-3.4.1.min.js // ==/UserScript== (function() { 'use strict'; const serviceId = '1a5a9f307d7c422791080e495512054b'; const header = document.querySelector('.header'); const int = 15000; function step1 () { if (!localStorage.getItem('count')) { localStorage.setItem('count', 0); } custService.send('转人工'); let id = setInterval(() => { if (document.querySelector('[href="javaScript:custService.getCustService()"]')) { clearInterval(id); step2(); } }, 1000); } function step2 () { custService.getCustService(); let id = setInterval(() => { if (document.querySelector('[href="javaScript:custService.getSocket(\'' + serviceId + '\')"]')) { clearInterval(id); step3(); } }, 1000); } function step3 () { custService.getSocket(serviceId); let id, inQueue = false, rets; id = setInterval(() => { rets = document.querySelectorAll('.sys_return'); if (rets.length) { rets.forEach((ret) => { if (ret.innerText.indexOf('已在排队中') > -1) { inQueue = true; } }); if (inQueue) { header.innerHTML = '排上队了'; } else { step4(); } clearInterval(id); } }, 1000); } function step4 () { let count = parseInt(localStorage.getItem('count')); count ++; header.innerHTML = '进行了 ' + count + ' 次,' + (int / 1000) + '秒后进行下一次尝试'; let id = setTimeout(() => { localStorage.setItem('count', count); clearTimeout(id); step1(); }, int); } function getQueueNumber () { let result = '', rets = document.querySelectorAll('.sys_return'); if (rets.length) { rets.forEach(ret => { if (ret.innerText.indexOf('已在排队中') > -1) { ret.innerText.split('').forEach(char => { if (!isNaN(parseInt(char))) { result += char; } }); } }); } return result ? parseInt(result) : false; } step1(); })();