您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Implements an "ignore user" function on the gw2wvw.net forum.
当前为
// ==UserScript== // @name GW2WvW.net Ignore List // @namespace http://www.gw2wvw.net/ // @version 0.1 // @description Implements an "ignore user" function on the gw2wvw.net forum. // @author Anvil Pants // @include http://www.gw2wvw.net/topic/* // @include http://www.gw2wvw.net/comment/* // @grant GM_getValue // @grant GM_setValue // @run-at document-start // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js // ==/UserScript== function getIgnoreList() { var ignoreList = GM_getValue('gw2wvw_ignore'); if (!ignoreList) return []; return JSON.parse(ignoreList); } function addIgnoreList(asshole) { asshole = String(decodeURIComponent(asshole)); if (asshole !== 'null' && asshole !== 'undefined' && confirm('Do you want to ignore "'+asshole+'"?')) { var ignoreList = GM_getValue('gw2wvw_ignore'); if (!ignoreList) var ignoreList = []; else ignoreList = JSON.parse(ignoreList); if (ignoreList.indexOf(asshole) == -1) { ignoreList.push(asshole); GM_setValue('gw2wvw_ignore', JSON.stringify(ignoreList)); } } } function delIgnoreList(asshole) { asshole = String(decodeURIComponent(asshole)); if (asshole !== 'null' && asshole !== 'undefined' && confirm('Do you want to stop ignoring "'+asshole+'"?')) { var ignoreList = GM_getValue('gw2wvw_ignore'); if (!ignoreList) return; else ignoreList = JSON.parse(ignoreList); if (ignoreList.indexOf(asshole) !== -1) { ignoreList = $.grep(ignoreList, function(value) { return value != asshole; }); GM_setValue('gw2wvw_ignore', JSON.stringify(ignoreList)); } } } function resetIgnoreList() { GM_setValue('gw2wvw_ignore', ''); } function addIgnoreLinks() { var searchNodes = document.evaluate("//a[@class='username']", document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); var resultNodes = []; while (aResult = searchNodes.iterateNext()) { resultNodes.push(aResult); } for (var i in resultNodes) { if ($(resultNodes[i].parentNode.parentNode).hasClass('author-pane-section')) { var ignoreLink = document.createElement('div'); ignoreLink.setAttribute('class', 'author-pane-line'); ignoreLink.innerHTML = '<a href="'+document.location.href.replace(/(\/?\#.*?)+$/,'')+'/#ignore-'+encodeURIComponent(String(resultNodes[i].innerHTML))+'">Ignore User</a>'; resultNodes[i].parentNode.parentNode.appendChild(ignoreLink); } } } function fuckThoseGuys() { var ignoreList = getIgnoreList(); var resultNodes = []; var ignoredUsers = []; var ignoredUserCount = 0; var style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = '.ignore-user { padding: 1em !important; border: 2px dotted #444 !important; } #ignored-notice { position: fixed !important; bottom: 0 !important; left: 0 !important; font-size: 10pt !important; background: black !important; border-top-left-radius: 7px !important; border-top-right-radius: 7px !important; max-height: 25% !important; overflow-y: auto !important; padding: .25em 1em !important; list-style-type: none !important; } #ignored-notice:not(:hover) > li:not(#ignored-notice-heading) { display: none !important; } #ignored-notice:not(:hover), #ignored-notice:not(:hover) * { opacity: 0.5 !important; }'; document.getElementsByTagName('head')[0].appendChild(style); /* Look for quoted posts to ignore. */ var searchNodes = document.evaluate("//blockquote/div/em | //blockquote/p/em", document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); while (aResult = searchNodes.iterateNext()) { if (aResult.innerHTML == ignoreList[$.inArray(aResult.innerHTML, ignoreList)]) { resultNodes.push(aResult.parentNode.parentNode); ignoredUsers[String(aResult.innerHTML)] = String(aResult.innerHTML); ignoredUserCount++; } } /* Look for posts to ignore. */ var searchNodes = document.evaluate("//a[@class='username']", document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null); while (aResult = searchNodes.iterateNext()) { if ($.inArray(aResult.innerHTML, ignoreList) !== -1) { aResultPost = aResult.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; if ($(aResultPost).hasClass('forum-post')) { resultNodes.push(aResultPost); ignoredUsers[String(aResult.innerHTML)] = String(aResult.innerHTML); ignoredUserCount++; } } } /* Fuck those guys. */ for (var i in resultNodes) { resultNodes[i].setAttribute('class', 'ignore-user '+resultNodes[i].getAttribute('class')); resultNodes[i].innerHTML = '...'; } if (ignoredUserCount) { var ignoredNotice = document.createElement('ul'); ignoredNotice.setAttribute('id', 'ignored-notice'); var ignoredNoticeUser = document.createElement('li'); ignoredNoticeUser.innerHTML = 'Ignored users on page:'; ignoredNoticeUser.setAttribute('id', 'ignored-notice-heading'); ignoredNotice.appendChild(ignoredNoticeUser); for (var i in ignoredUsers) { var ignoredNoticeUser = document.createElement('li'); ignoredNoticeUser.innerHTML = '<a href="'+document.location.href.replace(/(\/?\#.*?)+$/,'')+'/#stopignore-'+encodeURIComponent(String(ignoredUsers[i]))+'">'+ignoredUsers[i]+'</a>'; ignoredNotice.appendChild(ignoredNoticeUser); } document.getElementsByTagName('body')[0].appendChild(ignoredNotice); } } /* Intercept user requests to ignore someone. */ document.location.href.replace(/\/\#ignore\-(.*?)$/, function(match, part){ if (part) { addIgnoreList(part); document.location.href = document.location.href.replace('/#ignore-'+part, ''); } }); /* Intercept user requests to not ignore someone. */ document.location.href.replace(/\/\#stopignore\-(.*?)$/, function(match, part){ if (part) { delIgnoreList(part); document.location.href = document.location.href.replace('/#stopignore-'+part, ''); } }); $(document).ready(function() { addIgnoreLinks(); fuckThoseGuys(); });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址