Greasy Fork is available in English.
Автосдача задания ГН
当前为
// ==UserScript==
// @name HWM_AutoReportMGTasks
// @namespace Небылица
// @version 1.1
// @description Автосдача задания ГН
// @author Небылица
// @include /^https{0,1}:\/\/((www|qrator)\.heroeswm\.ru|178\.248\.235\.15)\/(map|mercenary_guild)\.php/
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function() {
'use strict';
// скрипт требует для своей работы скрипт SetsMaster от Demin, который должен находиться выше по порядку исполнения
if (document.getElementById("pers_gn").innerHTML.split(":").length === 3){
if ((document.querySelector("a[href=\"map.php?cx=51&cy=50\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=50&cy=48\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=52&cy=48\"]") !== null) || (document.querySelector("a[href=\"map.php?cx=52&cy=53\"]") !== null)){
var xhr = new XMLHttpRequest();
var response;
xhr.open('GET', "mercenary_guild.php", true);
xhr.send();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
response = xhr.responseText;
if (response.indexOf("<b>Статус</b>") !== -1){
GM_setValue("reward", response.match(/<Br><br>(.+?)<table\sborder=0\scellspacing=0\scellpadding=0>/)[1]);
window.open("mercenary_guild.php", "_self");
}
}
};
}
}
if (location.pathname.indexOf("mercenary_guild.php") !== -1 && GM_getValue("reward") !== "-1"){
var td = document.querySelector("td[rowspan=\"2\"]");
td.innerHTML = td.innerHTML.split("<table border")[0] + GM_getValue("reward") + "<table border"+ td.innerHTML.split("<table border")[1];
GM_setValue("reward", "-1");
}
})();