BlueCat Address Manager Restore Button

Additional Restore Button in Transaction Details in BlueCat Address Manager

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        BlueCat Address Manager Restore Button
// @description Additional Restore Button in Transaction Details in BlueCat Address Manager
// @namespace   *
// @include     */app*page=UndeleteListPage*
// @version     7
// @grant       none
// @author      Marius Galm
// @copyright   2018, Marius Galm
// @license		MIT
// @icon        https://www.bluecatnetworks.com/wp-content/uploads/2018/03/cropped-bluecat-favicon-32x32.png
// ==/UserScript==

if (document.readyState === "interactive" ) {
    var page = document.childNodes[2].nodeValue;
    switch(page) {
        case " Page: HistoryDetails ":
            addButton();
            break;
        default:
            // nothing for now
    }
}

function addButton() {
    var pane = document.getElementsByClassName("detailsPane");
    if ((pane !== undefined)||(pane != null)) {
        var tds = pane[0].getElementsByClassName("detailsPane-fieldName");
        if ((tds !== undefined)||(tds != null)) {
            var tdList = Array.prototype.slice.call(tds);
            tdList.forEach(function(element) {
                if (element.innerText.trim() == "Transaction Number:") {
                    var num = parseInt(element.id.split("_")[1])+1;
                    var idVar = document.getElementById("Any_"+num).innerHTML.trim();
                    document.getElementById("Any_"+num).innerHTML = idVar+'<p><a id="undeleteLink" name="undelete_hist_History:'+idVar+':0" href="/app?component=undeleteLink&amp;page=UndeleteListPage&amp;service=direct&amp;session=T&amp;sp=SformMode%3Dedit&amp;sp=StableClass%3Dcom.bluecatnetworks.proteus.data.History&amp;sp=StablePageName%3DUndeleteListPage&amp;sp=StableId%3DuserUndeleteList&amp;sp=Spage%3DUndeleteListPage&amp;sp=SextraOptionalValue%3DundeleteType%7Cnull%3BpageBeforeList%7Cnull&amp;sp=Suserspecific%3Dtrue&amp;sp=ShistoryId%3DHistory%3A'+idVar+'%3A0"><img src="/images/icons/small/undelete.gif" border="0"></a></p>';
                }
            });
        }
    }
}