您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This allows you to hide HF profile images and signatures.
当前为
// ==UserScript== // @name HF Profile Image and Signature Blocker // @author TyrantKingBen // @namespace http://www.hackforums.net/member.php?action=profile&uid=2525478 // @description This allows you to hide HF profile images and signatures. // @include *hackforums.net/* // @version 0.09 // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant GM_getValue // @grant GM_setValue // @grant GM_info // @grant GM_log // @grant GM_deleteValue // @require https://gf.qytechs.cn/libraries/GM_config/20131122/GM_config.js // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js // @require https://gf.qytechs.cn/scripts/622-super-gm-setvalue-and-gm-getvalue-js/code/Super_GM_setValue_and_GM_getValuejs.js?version=1786 // ==/UserScript== //Setup configuration popup var title = "HF Profile Image and Signature Blocker by TyrantKingBen - v" + GM_info.script.version; var configInit = { 'fixLinks':{ 'label':'Fix quick links?', 'type':'checkbox', 'default':false, 'section':['','Settings'] }, 'reloadImage':{ 'label':'Reload image on unblock?', 'type':'checkbox', 'default':true, 'section':['','Profile Images'] }, /*'saveProfileImage':{ 'label':'Store image?', 'type':'checkbox', 'default':false },*/ 'useCustomBlock':{ 'label':'Use a custom block image?', 'type':'checkbox', 'default':false }, 'useCustomBlockImage':{ 'label':'Custom block image:', 'type':'textbox', 'default':'' }, 'useCustomBlockImageWidth':{ 'label':'Custom block image width:', 'type':'textbox', 'default':'0' }, 'useCustomBlockImageHeight':{ 'label':'Custom block image height:', 'type':'textbox', 'default':'0' }, 'reloadSignature':{ 'label':'Reload signature on unblock?', 'type':'checkbox', 'default':true, 'section':['','Signatures'] }, 'useCustomSignature':{ 'label':'Use a custom signature?', 'type':'checkbox', 'default':false }, 'useCustomSignatureText':{ 'label':'Custom signature:', 'type':'textarea', 'default':'' } }; //Add white reset link and textarea styling. Minified. Thanks to Emylbus. http://www.hackforums.net/member.php?action=profile&uid=956054 var HFPIH_CSS = "#HFPIH_config{background:#333;color:#CCC;font-size:14px}#HFPIH_config_header{color:#FFF}#HFPIH_config .section_desc{background:#072948;color:#FFF;border:none;font-size:14px}#HFPIH_config .section_header{display:none!important}#HFPIH_config .config_var{text-align:left}#HFPIH_config .field_label{font-size:14px;font-weight:400}#HFPIH_config *{font-family:Verdana,Arial,Sans-Serif;font-weight:400}#HFPIH_config .reset{color:#fff}#HFPIH_config_field_useCustomSignatureText{resize:none;width:50%;height:100px}#HFPIH_config_useCustomSignatureText_field_label{vertical-align:top}"; //Setup configuration popup GM_config.init({ 'id':'HFPIH_config', 'title':title, 'fields':configInit, 'css':HFPIH_CSS, 'events': { 'open': function() { //Remove textarea block class document.getElementById("HFPIH_config").contentDocument.getElementById("HFPIH_config_field_useCustomSignatureText").removeAttribute("class"); }, 'save': function() { location.reload(); }, 'reset': function() { GM_deleteValue("blockedProfileIDs"); //GM_deleteValue("blockedProfileImages"); GM_deleteValue("blockedSignatureIDs"); GM_config.save(); } } }); //Setup Variables var blockedProfileIDs = GM_SuperValue.get("blockedProfileIDs", []); //var blockedProfileImages = GM_SuperValue.get("blockedProfileImages", []); var reloadImage = GM_config.get('reloadImage'); var useCustomBlock = GM_config.get('useCustomBlock'); var useCustomBlockImage = GM_config.get('useCustomBlockImage'); var useCustomBlockImageWidth = parseInt(GM_config.get('useCustomBlockImageWidth')); var useCustomBlockImageHeight = parseInt(GM_config.get('useCustomBlockImageHeight')); //var saveProfileImage = GM_config.get('saveProfileImage'); var blockedSignatureIDs = GM_SuperValue.get("blockedSignatureIDs", []); var reloadSignature = GM_config.get('reloadSignature'); var useCustomSignature = GM_config.get('useCustomSignature'); var useCustomSignatureText = GM_config.get('useCustomSignatureText'); var fixLinks = GM_config.get('fixLinks'); //Mostly found online. Minimized. GM_addStyle(".xButton{border:2px solid #fff;border-radius:9px;box-shadow:1px 1px 3px rgba(0,0,0,.5);color:#fff;cursor:pointer;font-family:verdana;font-size:12px;font-weight:700;height:14px;line-height:10px;opacity:0;position:absolute;right:2px;text-align:center;text-shadow:1px 1px 3px rgba(0,0,0,.5);-webkit-transition:all .2s ease-in;-webkit-transform:perspective(600px) translateX(14px) rotateY(90deg) rotateZ(90deg);top:2px;width:14px}#xButtonBlock{background-color:#8b0000}#xButtonBlock:hover{background-color:red}#xButtonUnblock{background-color:#006400}#xButtonUnblock:hover{background-color:green}div:hover>.xButton{opacity:1;-webkit-transform:perspective(600px)}.buttonContainer{position:absolute}"); var postTableData = document.getElementsByClassName("post_avatar"); var quickLinks = document.getElementsByClassName('links')[0]; //Create Settings var settingsAnchor = document.createElement("a"); settingsAnchor.id = "settingsLink"; settingsAnchor.innerHTML = "HFPISB Settings"; settingsAnchor.href = "javascript:void(0);"; quickLinks.innerHTML += ' | '; quickLinks.appendChild(settingsAnchor); $("#settingsLink").live("click", function() { GM_config.open(); }); //Fix quick links incase using another script if (fixLinks) { quickLinks.style.width = "50%"; quickLinks.style.marginTop = "-18px"; } //Since signature images sometimes take too long to load window.onload = function() { //Initialize blocking for (var i = 0; i < postTableData.length; i++) { var anchorTag = postTableData[i].getElementsByTagName("a")[0]; if (anchorTag) { //Incase profile has no image var profileID = anchorTag.href.split("uid=")[1]; var profileImage = postTableData[i].getElementsByTagName("img")[0]; //Create block container var buttonContainer = document.createElement("div"); buttonContainer.className = "buttonContainer"; buttonContainer.style.width = profileImage.width + "px"; buttonContainer.style.height = profileImage.height + "px"; //Create block button var xButton = document.createElement("div"); xButton.className = "xButton"; //If it's blocked setup the unblocking if (blockedProfileIDs.indexOf(profileID) != -1) { xButton.id = "xButtonUnblock"; xButton.innerHTML = "✓"; if (useCustomBlock) { var scale_width = parseInt(profileImage.width) / useCustomBlockImageWidth; var scale_height = parseInt(profileImage.height) / useCustomBlockImageHeight; var scale = Math.min(scale_width, scale_height); profileImage.width = useCustomBlockImageWidth * scale; profileImage.height = useCustomBlockImageHeight * scale; profileImage.src = useCustomBlockImage; } else profileImage.src = ""; } else { //Otherwise setup the blocking xButton.id = "xButtonBlock"; xButton.innerHTML = "x"; } //Event listeners (function (xButton, anchorTag) { xButton.addEventListener("mouseover", function() { changeLink(0, anchorTag); }); })(xButton, anchorTag); (function (xButton, profileID, anchorTag) { xButton.addEventListener("mouseout", function() { changeLink(profileID, anchorTag); }); })(xButton, profileID, anchorTag); (function (xButton, profileID, profileImage) { xButton.addEventListener("click", function() { var status; var xButtonID = xButton.id; if (xButtonID == "xButtonBlock") status = "blocking"; else status = "unblocking"; blockManager(xButton, profileID, status, profileImage); }); })(xButton, profileID, profileImage); //Append nodes buttonContainer.appendChild(xButton); anchorTag.insertBefore(buttonContainer, anchorTag.firstChild); } } var postContent = document.getElementsByClassName("trow2 post_content "); for (var i = 0; i < postContent.length; i++) { var signature = postContent[i].children[2]; if (postContent[i].lastChild.previousSibling.previousSibling.previousSibling.className != "post_body") { //Incase profile has no signature var profileID = signature.parentNode.parentNode.parentNode.getElementsByClassName("post_author")[0].getElementsByTagName("a")[0].href.split("uid=")[1]; //Create block container var buttonContainer = document.createElement("div"); buttonContainer.className = "buttonContainer"; buttonContainer.style.width = signature.offsetWidth + "px"; buttonContainer.style.height = signature.offsetHeight + "px"; //Create block button var xButton = document.createElement("div"); xButton.className = "xButton"; //If it's blocked setup the unblocking if (blockedSignatureIDs.indexOf(profileID) != -1) { xButton.id = "xButtonUnblock"; xButton.innerHTML = "✓"; if (useCustomSignature) { //Use custom signature signature.innerHTML = useCustomSignatureText; } else signature.innerHTML = " <br> <br> <br> <br>"; //No custom signature } else { //Otherwise setup the blocking xButton.id = "xButtonBlock"; xButton.innerHTML = "x"; } //Event listener (function (xButton, profileID, profileImage) { xButton.addEventListener("click", function() { var status; var xButtonID = xButton.id; if (xButtonID == "xButtonBlock") status = "blocking"; else status = "unblocking"; blockManager2(profileID, status); }); })(xButton, profileID); //Append nodes buttonContainer.appendChild(xButton); signature.parentNode.insertBefore(buttonContainer, signature); postContent[i].children[2].style.height = signature.offsetHeight + "px"; //Fix hover area } } } function blockManager(xButton, profileID, status, profileImage2) { var profileImages = []; var blockedIDIndex; var postTableData = document.getElementsByClassName("post_avatar"); for (var i = 0; i < postTableData.length; i++) { var anchorTag = postTableData[i].getElementsByTagName("a")[0]; if (anchorTag) { //Incase profile has no image var profileID2 = anchorTag.href.split("uid=")[1]; var profileImage = postTableData[i].getElementsByTagName("img")[0]; if (profileID == profileID2 || profileImage == profileImage2) { //If this is a blocked profile blockedIDIndex = blockedProfileIDs.indexOf(profileID); if (status == "blocking") { //If we are blocking if (blockedIDIndex == -1) { blockedProfileIDs.push(profileID); GM_SuperValue.set("blockedProfileIDs", blockedProfileIDs); /*if (saveProfileImage) { blockedProfileImages.push(profileImage.src); GM_SuperValue.set("blockedProfileImages", blockedProfileImages); }*/ } if (useCustomBlock) { //Use custom block image //Scales custom block image to maintain page layout var scale_width = parseInt(xButton.parentNode.style.width) / useCustomBlockImageWidth; var scale_height = parseInt(xButton.parentNode.style.height) / useCustomBlockImageHeight; var scale = Math.min(scale_width, scale_height); profileImage.width = useCustomBlockImageWidth * scale; profileImage.height = useCustomBlockImageHeight * scale; profileImage.src = useCustomBlockImage; } else profileImage.src = ""; //No custom block image profileImage.parentNode.firstChild.firstChild.id = "xButtonUnblock"; profileImage.parentNode.firstChild.firstChild.innerHTML = "✓"; } else if (status == "unblocking") { //If we are unblocking //Scales spinner image to maintain page layout var scale_width = parseInt(xButton.parentNode.style.width) / 50; var scale_height = parseInt(xButton.parentNode.style.height) / 50; var scale = Math.min(scale_width, scale_height); profileImage.width = 50 * scale; profileImage.height = 50 * scale; if (blockedIDIndex != -1) { blockedProfileIDs.splice(blockedIDIndex, 1); GM_SuperValue.set("blockedProfileIDs", blockedProfileIDs); } profileImages.push(profileImage); if (reloadImage) profileImage.src = "http://i.imgur.com/uJvKSoX.gif"; //My custom spinner //if (!saveProfileImage) profileImage.src = "http://i.imgur.com/uJvKSoX.gif"; //else profileImage.src = blockedProfileImages[blockedIDIndex]; profileImage.parentNode.firstChild.firstChild.id = "xButtonBlock"; profileImage.parentNode.firstChild.firstChild.innerHTML = "x"; } } } /*if (i == postTableData.length && saveProfileImage && status == "unblocking") { blockedProfileImages.splice(blockedIDIndex, 1); GM_SuperValue.set("blockedProfileImages", blockedProfileImages); }*/ } //Updates an unblocked profile if (reloadImage && status == "unblocking") { GM_xmlhttpRequest({ method: "GET", url: "http://www.hackforums.net/member.php?action=profile&uid=" + profileID, onload: function(response) { var regexp = /class="tborder">[\n\w\W]+?valign="middle"><img src="([\w\W]+?)"/; var m = regexp.exec(response.responseText); for (var i = 0; i < profileImages.length; i++) { //Fixes back to original dimensions profileImages[i].width = parseInt(xButton.parentNode.style.width); profileImages[i].height = parseInt(xButton.parentNode.style.height); profileImages[i].src = m[1]; } } }); } } function changeLink(profileID, anchorTag) { if (profileID == 0) anchorTag.removeAttribute("href"); else anchorTag.href = "member.php?action=profile&uid=" + profileID; } function blockManager2(profileID, status) { var profileSignatures = []; var blockedIDIndex; var postContent = document.getElementsByClassName("trow2 post_content "); for (var i = 0; i < postContent.length; i++) { var signature = postContent[i].children[3]; if (postContent[i].lastChild.previousSibling.previousSibling.previousSibling.className != "post_body") { //Incase profile has no signature var profileID2 = signature.parentNode.parentNode.parentNode.getElementsByClassName("post_author")[0].getElementsByTagName("a")[0].href.split("uid=")[1]; var profileSignature = signature; if (profileID == profileID2) { //If this is a blocked profile blockedIDIndex = blockedSignatureIDs.indexOf(profileID); if (status == "blocking") { //If we are blocking if (blockedIDIndex == -1) { blockedSignatureIDs.push(profileID); GM_SuperValue.set("blockedSignatureIDs", blockedSignatureIDs); } if (useCustomSignature) { //Use custom signature profileSignature.innerHTML = useCustomSignatureText; } else profileSignature.innerHTML = " <br> <br> <br> <br>"; //No custom signature postContent[i].children[2].firstChild.id = "xButtonUnblock"; postContent[i].children[2].firstChild.innerHTML = "✓"; postContent[i].children[2].style.height = profileSignature.offsetHeight + "px"; //Fix hover area } else if (status == "unblocking") { //If we are unblocking if (blockedIDIndex != -1) { blockedSignatureIDs.splice(blockedIDIndex, 1); GM_SuperValue.set("blockedSignatureIDs", blockedSignatureIDs); } profileSignatures.push(profileSignature); if (reloadSignature) profileSignature.innerHTML = "<div style=\"text-align: center;\"><img src=\"http://i.imgur.com/uJvKSoX.gif\"></div>"; //My custom spinner postContent[i].children[2].firstChild.id = "xButtonBlock"; postContent[i].children[2].firstChild.innerHTML = "x"; } } } } //Updates an unblocked profile if (reloadSignature && status == "unblocking") { GM_xmlhttpRequest({ method: "GET", url: "http://www.hackforums.net/member.php?action=profile&uid=" + profileID, onload: function(response) { var regexp = /<!-- start: member_profile_signature -->[\n\w\W]+?class="trow1">([\n\w\W]+?)<\/td>/; var m = regexp.exec(response.responseText); for (var i = 0; i < profileSignatures.length; i++) { profileSignatures[i].innerHTML = m[1]; postContent[i].children[2].style.height = profileSignatures[i].offsetHeight + "px"; //Fix hover area } } }); } }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址