您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
[HWM] Time Portal Data Collector
// ==UserScript== // @name [HWM] TimePortalDataCollector // @namespace hwm.name // @version 0.1 // @description [HWM] Time Portal Data Collector // @author Mr_MYSTIC // @include http://www.heroeswm.ru/* // @include http://qrator.heroeswm.ru/* // @include http://178.248.235.15/* // @grant GM_xmlhttpRequest // @connect hwm.name // @connect hwm.test // @homepage https://hwm.name/portal // ==/UserScript== (function() { 'use strict'; function getPlId() { var plLink = getXPath("//a[contains(@href, 'pl_hunter_stat.php')]").snapshotItem(0); if (plLink === null) { return false; } return plLink.href.substring(plLink.href.indexOf('=') + 1); } function getXPath(xpath, element) { return document.evaluate(xpath, (!element ? document : element), null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); } if (window.location.pathname.indexOf('tj_single_set.php') !== -1) { var options = document.querySelectorAll('select[name="mid"] option'); var data = []; for (var i = 0; i < options.length; i++) { var entry = {}; var value = options[i].value.split('.')[0]; entry.id = value; var regExp = new RegExp(/.+ ([\d]{1,}) шт. за ([\d]{1,}) кр./); var result = regExp.exec(options[i].innerHTML); entry.amount = result[1]; entry.price = result[2]; entry.pl_id = getPlId(); data.push(entry); } GM_xmlhttpRequest({ method: "POST", url: 'https://hwm.name/portal_prices/raw_data/' + btoa(JSON.stringify(data)), responseType: 'json', onload: function(response) { console.log(response.response); }, timeout: 10000, onerror: function(response) { console.log(response); } }); } if (window.location.pathname.indexOf('object-info.php') !== -1) { var test = document.body.innerHTML.indexOf('Найдены') !== -1 || document.body.innerHTML.indexOf('Эти существа уже побеждены') !== -1; if (test) { var data = {}; var link = getXPath("//a[contains(@href, 'army_info.php')]").snapshotItem(0); data.pl_id = getPlId(); data.object_id = window.location.search.replace('?id=', ''); data.monster_id = link.search.replace('?name=', ''); GM_xmlhttpRequest({ method: "POST", url: 'https://hwm.name/portal_prices/pokemons/' + btoa(JSON.stringify(data)), responseType: 'json', onload: function(response) { console.log(response.response); }, timeout: 10000, onerror: function(response) { console.log(response); } }); } } })();