HWM_MarkRealtyOnMap

Подсвечивает предприятия, акциями которых вы владеете

当前为 2022-07-07 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         HWM_MarkRealtyOnMap
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Подсвечивает предприятия, акциями которых вы владеете
// @author       Zeleax
// @include /https?:\/\/(www.heroeswm.ru|178.248.235.15|www.lordswm.com|my.lordswm.com)\/(pl_info_realty.php|map.php).*/
// @match        https://my.lordswm.com/pl_info_realty.php?id=938382
// @icon         https://www.google.com/s2/favicons?sz=64&domain=lordswm.com
// @grant        none
// @license      MIT
// ==/UserScript==
// GM functions
if (typeof GM_getValue != '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];};}

(function() {
    var HWM_objArr = GM_getValue('HWM_objArr');

    var objArr=JSON.parse(HWM_objArr);
    if(!objArr) objArr = [];

    if(/pl_info_realty.php/.test(location.href))
    {
        objArr = [];
        var olist=getL('//a[contains(@href,"object-info.php?id=") and contains(text(),"#")]');

        if(olist.snapshotLength>0)
        {
            for (var i=0 ; i<olist.snapshotLength; i++) objArr.push(/id=(\d+)/.exec(olist.snapshotItem(i).href)[1]);
            var s_objArr=JSON.stringify(objArr);

            if(HWM_objArr!=s_objArr)
            {
                GM_setValue('HWM_objArr',s_objArr);
            }
        }
    }
    else if(/map.php/.test(location.href)){
        var list=getL('//tr[starts-with(@class, "map_obj_table")]');
        var _row;

        for (i=0 ; i<list.snapshotLength; i++)
        {
            _row = list.snapshotItem(i);
            var reg = /object-info.php\?id=(\d+)/.exec(_row.firstChild.firstChild.href);

            if((reg[1]) && objArr.includes(reg[1])) _row.firstChild.style.backgroundColor = "yellow";
        }
    }
})();

// доступ по xpath
function getE(xpath,el,docObj){return (docObj?docObj:document).evaluate(xpath,(el?el:(docObj?docObj.body:document.body)),null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;}
function getL(xpath,el,docObj){return (docObj?docObj:document).evaluate(xpath,(el?el:(docObj?docObj.body:document.body)),null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);}