hwm_battle_add_omne

Отправка ссылок на ивентовые бои к omne

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            hwm_battle_add_omne
// @author          Kleshnerukij
// @description     Отправка ссылок на ивентовые бои к omne
// @version         1.1
// @include         https://www.heroeswm.ru/pl_warlog.php*
// @include         https://qrator.heroeswm.ru/pl_warlog.php*
// @include         http://178.248.235.15/pl_warlog.php*
// @include         https://www.lordswm.com/pl_warlog.php*
// @namespace       https://greasyfork.org/ru/scripts/405015-hwm-battle-add-omne
// @encoding 	    utf-8

// ==/UserScript==

// (c) Клещнерукий - http://www.heroeswm.ru/pl_info.php?id=7076906

(function () {
var page_content = document.getElementsByTagName('body')[0].innerHTML;
var search_string = /<a href="warlog\.php\?warid=\d+.*?">\d+-\d+-\d+ \d+:\d+<\/a>/igm;
var search_data = /href=\"warlog\.php\?warid=(\d+)\&amp;show_for_all=([a-zA-Z0-9]+)\"/i;
var check_correct = /^\d+-\d+-\d+ \d+:\d+$/i;

var res = page_content.match(search_string);
var arr_corr = [];
var step = 0;

// Собираем номера строк в которых есть бои с секретной ссылкой
res.forEach(myFunction);
function myFunction(item, index) {
    if (item.match(search_data) != null) {
        let temp_arr = item.match(search_data);
        arr_corr[step] = [temp_arr[1], temp_arr[2]];
    }
    step++;
}

// Добавляем ссылки для пересылки в сервис omne
let elements = document.querySelectorAll('center>table>tbody>tr>td>a');
step = 0;
for (let elem of elements) {
    let el = elem.innerHTML;
    if (el.search(check_correct) != -1) {
        console.log(step);
        if (typeof(arr_corr[step]) != "undefined" && arr_corr[step] !== null) {
            elem.innerHTML = el+' <a style="color: #000000" href="http://daily.heroeswm.ru/leader_rogues.php?url=warid='+arr_corr[step][0]+'+show_for_all='+arr_corr[step][1]+'"> >> </a>';
        } else {
            elem.innerHTML = el+' <span style="color: #aaaaaa"> >> </span>';
        }
    step++;
    }
}


function insertAfter(parent, node, referenceNode) {
    parent.insertBefore(node, referenceNode.nextSibling);
}
})();