您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Поиск и установка на работу с любой страницы игры
当前为
// // ==UserScript== // @name hwm_work_find // @author Pahan https://gf.qytechs.cn/uk/users/18377-pahan // @namespace hwm_pahan // @description Поиск и установка на работу с любой страницы игры // @homepage https://gf.qytechs.cn/uk/scripts/13911-hwm-work-find // @icon http://dcdn.heroeswm.ru/avatars/30/nc-5/30547.gif // @version 1.51 // @encoding utf-8 // @include http://www.heroeswm.ru/* // @include http://qrator.heroeswm.ru/* // @include http://178.248.235.15/* // @include http://www.lordswm.com/* // @exclude */rightcol.php* // @exclude */ch_box.php* // @exclude */chat* // @exclude */ticker.html* // @exclude */frames* // @exclude */brd.php* // @grant GM_deleteValue // @grant GM_getValue // @grant GM_listValues // @grant GM_setValue // @grant GM_addStyle // @grant GM_log // @grant GM_openInTab // ==/UserScript== var version = '1.51'; var str_url = 'https://gf.qytechs.cn/uk/scripts/13911-hwm-work-find'; var str_script_name = 'Поиск и установка ГР'; var str_url_aut = '/sms-create.php?mailto=Pahan&subject=Скрипт: '+str_script_name+' v'+version+'. Найдена ошибка:'; if (typeof GM_deleteValue != 'function') { this.GM_getValue=function (key,def) {return localStorage[key] || def;}; this.GM_setValue=function (key,value) {return localStorage[key]=value;}; this.GM_deleteValue=function (key) {return delete localStorage[key];}; this.GM_addStyle=function (key) { var style = document.createElement('style'); style.textContent = key; document.querySelector("head").appendChild(style); } } if (typeof GM_listValues != 'function') { this.GM_listValues=function () { var values = []; for (var i=0; i<localStorage.length; i++) { values.push(localStorage.key(i)); } return values; } } function addEvent(elem, evType, fn) { // elem["on" + evType] = fn; if (elem.addEventListener) { elem.addEventListener(evType, fn, false); } else if (elem.attachEvent) { elem.attachEvent("on" + evType, fn); } else { elem["on" + evType] = fn; } } function $(id) { return document.querySelector(id); } function URLAttrValueGet(attr_name, aurl) { attr_name = attr_name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]" + attr_name + "=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( aurl ); if( results == null ) return ""; else return results[1]; } function Ajax(AMethod, AURL, AParams, ACallBackFunc) { var LRequest = new XMLHttpRequest(); LRequest.open(AMethod, AURL, true); LRequest.overrideMimeType('text/html; charset=windows-1251'); LRequest.send(AParams); LRequest.onreadystatechange = function() { if (LRequest.readyState == 4) { ACallBackFunc(LRequest.responseText); } }; } function Trim(AText) { return AText.replace(/^\s+|\s+$|^( )+|( )+$/g, ''); } // --------------------------------- WorkResultFound = false; function close_find_work_info() { bg = $('#bgOverlayFindWork') ; bgc = $('#bgCenterFindWork') ; if( bg ) { bg.style.display = bgc.style.display = 'none' ; } } function ShowFindWorkHTML(AFindWorkHTML, AIsResult) { WorkResultFound = AIsResult; bg = $('#bgOverlayFindWork') ; bgc = $('#bgCenterFindWork') ; if( !bg ) { bg = document.createElement('div') ; bg.id = 'bgOverlayFindWork' ; document.body.appendChild( bg ); bg.style.position = 'absolute' ; bg.style.left = '0'; bg.style.width = '100%'; bg.style.height = '100%'; bg.style.background = "#000000"; bg.style.opacity = "0.5"; bg.addEventListener( "click", close_find_work_info , false ); bgc = document.createElement('div') ; bgc.id = 'bgCenterFindWork' ; document.body.appendChild( bgc ); bgc.style.position = 'absolute' ; bgc.style.width = '600px'; bgc.style.background = "#F6F3EA"; bgc.style.left = ( ( document.body.offsetWidth - 600 ) / 2 ) + 'px' ; bgc.style.zIndex = "1105"; } bgc.innerHTML = '<div style="border:1px solid #abc;padding:5px;margin:2px;">' + ' <div style="float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;" id="bt_closeFindWork" title="Закрыть">x</div>' + ' <center>' + ' <table>' + ' <tr>' + ' <td><b>'+str_script_name+' <font style="color:#0070FF;">'+version+'</font></b><hr/></td>' + ' </tr>' + ' <tr>' + ' <td>' + AFindWorkHTML + '</td>' + ' </tr>' + ' <tr><td><hr/></td></tr>' + ' <tr>' + ' <td style="font-weight:bold;font-size:10px;" >' + ' <a style="font-weight:bold;font-size:10px;" href="'+str_url+'">Проверить обновление скрипта.</a>' + ' <a style="font-weight:bold;font-size:10px;" href="'+str_url_aut+'">Сообщить автору о найденной ошибке.</a>' + ' </td>' + ' </tr>' + ' <tr>' + ' <td style="font-weight:bold;font-size:10px;" >' + ' Автор: <a style="font-weight:bold;font-size:10px;" href="http://www.heroeswm.ru/pl_info.php?id=30547">Pahan.</a>' + ' </td>' + ' </tr>' + ' </table>' + '', ' </center>' + '</div>'; $("#bt_closeFindWork").addEventListener( "click", close_find_work_info , false ); bg.style.top = (-document.body.scrollTop)+'px'; bgc.style.top = ( document.body.scrollTop + 100 ) + 'px'; bg.style.display = bgc.style.display = 'block' ; } function GetObjectInfo(AObjHTML) { var LFirst = AObjHTML.indexOf('Тип:'); var LEnd = AObjHTML.indexOf('Окончание смены'); var LLast = AObjHTML.indexOf('</td>', LEnd); var LInfo = AObjHTML.substr(LFirst, LLast - LFirst); var re = /Свободных мест: <b>\d+<\/b>/gim; LInfo += (res = re.exec(AObjHTML)) ? res[0] : ''; return LInfo; } function ObjectProcess(AObjHTML) { AObjHTML = AObjHTML.replace(/[\n\r]/g, ' ').replace(/\s{2,}/g, ' '); var re = /Вы уже устроены\./gim; var re2 = /Прошло меньше часа с последнего устройства на работу\. Ждите\./gim; var res; if (((res = re.exec(AObjHTML)) != null) || (res = re2.exec(AObjHTML)) != null) ShowFindWorkHTML(res[0], true); else { re = /Свободных мест\: <b>0<\/b>/gim; if ((res = re.exec(AObjHTML)) != null) {} else { // re = /<form[^>]*name="working"[^>]*>.*<\/form>/gim; re = /<form[^>]*name=working[^>]*>.*<\/form>/gim; if ((res = re.exec(AObjHTML)) != null) { ShowFindWorkHTML(GetObjectInfo(AObjHTML) + res[0], true); } } } } function FindWorkObject(APlaceIndex, AObjIndex, APlaceHTML) { // href="object-info.php?id=163">»»»</a> var re = /<[^>]*href='([^']*)'[^>]*>»»»<\/a>/gim; var res; var LLink; var LFindCount = 0; while ((res = re.exec(APlaceHTML)) != null) { LLink = res[1]; if (LFindCount == AObjIndex) { Ajax('GET', LLink, null, function(AObjHTML) { ObjectProcess(AObjHTML); if (!WorkResultFound) FindWorkObject(APlaceIndex, AObjIndex + 1, APlaceHTML); } ); } LFindCount++; } // $("#find_work").innerHTML = $("#find_work").innerHTML + '<br>' + // 'AObjIndex: ' + AObjIndex + ', LFindCount: ' + LFindCount; if (!WorkResultFound && (AObjIndex >= LFindCount)) FindWorkProcess(APlaceIndex + 1); } function FindWorkProcess(APlaceIndex) { var works = ['sh', 'fc', 'mn']; var names = ['Производства', 'Обработка', 'Добыча']; if (APlaceIndex >= works.length) { ShowFindWorkHTML('Поиск работы завершен.<br>' + 'Все места заняты или недостаточно золота на объектах.<br>' + 'Смените локацию, или попробуйте позже.', true); return; } ShowFindWorkHTML('Сканирование ' + names[APlaceIndex] + '...', false); Ajax('GET', '/map.php?st=' + works[APlaceIndex], null, function(AHTML) { FindWorkObject(APlaceIndex, 0, AHTML); } ); } function AddWorkFindHref() { var LLinks = document.querySelectorAll('a[href^="map.php"]'); var LLink; if (LLinks) { for(i = 0; i < LLinks.length; i++) { LLink = LLinks[i]; if (LLink.innerHTML == '<b>Карта</b>') { LNewHref = document.createElement('a'); LNewHref.href = '#'; LNewHref.style = "text-decoration: none;color: #f5c137;" LNewHref.innerHTML = '<b>ГР</b>'; LNewHref.title = 'Найти место работы'; LNewHref.id = 'find_work'; LLink.parentNode.appendChild(LNewHref); addEvent($("#find_work"), "click", function() { WorkResultFound = false; FindWorkProcess(0); } ); } } } } function ProcessMain() { AddWorkFindHref(); } ProcessMain();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址