您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds new settings to the very bottom of your Dashboard page that allow you to set tab titles for urls.
当前为
// ==UserScript== // @name Custom Mturk Tab Titles // @version 0.1 // @description Adds new settings to the very bottom of your Dashboard page that allow you to set tab titles for urls. // @author Cristo // @include https://www.mturk.com* // @copyright 2012+, You // @namespace https://gf.qytechs.cn/users/1973 // ==/UserScript== //In the footer of the Dashboard page you'll find two new links Add Title and Saved Title. //Click "Add Title" //Two boxes will appear and allow you to enter a new tab title for a URL. //Clcik "Saved Title" //Shows all save titles. //Hover your mouse over a title to reveal the URL. URLs are highlighted automatically to make copying simple. //Click to delete. //Check back for wildcard URLs. var titles; var urls; if (GM_getValue("titlelist") == undefined) { titles = []; urls = []; } else { titles = GM_getValue("titlelist"); urls = GM_getValue("urllist"); } if (urls.indexOf(document.URL.toString()) > -1) { console.log("Found URL"); var title = document.getElementsByTagName("title")[0]; var pos = urls.indexOf(document.URL.toString()); var tit = titles[pos]; title.innerHTML = tit; } if(document.URL.toString() == "https://www.mturk.com/mturk/dashboard"){ var foot = document.getElementsByClassName("footer")[0]; var foottable = document.createElement("table"); foottable.style.textAlign = "center"; foottable.style.marginLeft = "auto"; foottable.style.marginRight = "auto"; foot.parentNode.insertBefore(foottable, foot.nextSibling); var td1 = document.createElement("td"); var td2 = document.createElement("td"); var td3 = document.createElement("td"); foottable.appendChild(td1); foottable.appendChild(td2); foottable.appendChild(td3); var trig1 = document.createElement("span"); trig1.style.color = "#1170A0"; trig1.style.textDecoration = "underline"; trig1.style.cursor = "pointer"; trig1.innerHTML = "Add Titles"; td1.appendChild(trig1); td2.innerHTML = " "+"|"+" "; var trig2 = document.createElement("span"); trig2.style.color = "#1170A0"; trig2.style.textDecoration = "underline"; trig2.style.cursor = "pointer"; trig2.innerHTML = "Saved Titles"; td3.appendChild(trig2); var divy = document.createElement("div"); divy.style.textAlign = "center"; foottable.parentNode.insertBefore(divy, foottable.nextSibling); trig1.addEventListener( "click", function(){ divy.innerHTML = ""; var table0 = document.createElement("table"); table0.style.marginLeft = "auto"; table0.style.marginRight = "auto"; table0.style.textAlign = "center"; divy.appendChild(table0); var topRow = document.createElement("tr"); var middleRow = document.createElement("tr"); table0.appendChild(topRow); topRow.parentNode.insertBefore(middleRow, topRow.nextSibling); var nameRow = document.createElement("td"); topRow.appendChild(nameRow); var ptag1 = document.createElement("p"); nameRow.appendChild(ptag1); ptag1.innerHTML = "Tab Name"; var urlRow = document.createElement("td"); nameRow.parentNode.insertBefore(urlRow, nameRow.nextSibling); var ptag2 = document.createElement("p"); urlRow.appendChild(ptag2); ptag2.innerHTML = "URL"; var inputRow1 = document.createElement("td"); middleRow.appendChild(inputRow1); var input1 = document.createElement("input"); inputRow1.appendChild(input1); input1.type = "text"; var inputRow2 = document.createElement("td"); inputRow1.parentNode.insertBefore(inputRow2, inputRow1.nextSibling); var input2 = document.createElement("input"); inputRow2.appendChild(input2); input2.type = "text"; var addBut = document.createElement("span"); addBut.style.color = "#1170A0"; addBut.style.textDecoration = "underline"; addBut.style.cursor = "pointer"; addBut.innerHTML = "Add"; table0.parentNode.insertBefore(addBut, table0.nextSibling); addBut.addEventListener( "click", function() { //Wildcard URLs still need to be added. var userName; var userUrl; if (input1.value.length < 1) { userName = "Blank"; } else { userName = input1.value; } if (input2.value.length < 1) { userUrl = "Blank"; } else { userUrl = input2.value } titles.push(userName); urls.push(userUrl); GM_setValue("titlelist", titles); GM_setValue("urllist", urls); input1.value = ""; input2.value = ""; console.log(titles); console.log(urls); console.log(GM_getValue("titlelist")); console.log(GM_getValue("urllist")); }, false); }, false); trig2.addEventListener( "click", function(){ divy.innerHTML = ""; var table = document.createElement("table"); table.style.marginLeft = "auto"; table.style.marginRight = "auto"; table.style.textAlign = "center"; divy.appendChild(table); for (var g = 0; g < GM_getValue("urllist").length; g++){ var row = document.createElement("tr"); table.appendChild(row); var cell1 = document.createElement("td"); row.appendChild(cell1); var emptyP = document.createElement("p"); emptyP.style.color = "#7fb4cf"; emptyP.style.textDecoration = "underline"; emptyP.style.cursor = "pointer"; cell1.appendChild(emptyP); emptyP.setAttribute("class","urltable"); emptyP.innerHTML = GM_getValue("titlelist")[g]; } function overit(l) { var inex1 = l.target.innerHTML; var switchp1 = GM_getValue("titlelist").indexOf(inex1); l.target.innerHTML = GM_getValue('urllist')[switchp1]; selection = window.getSelection(); range = document.createRange(); range.selectNodeContents(this); selection.removeAllRanges(); selection.addRange(range); } function outofit(l) { var newDex; var inex2 = l.target.innerHTML; if (inex2.indexOf("&") > -1){ newDex = inex2.replace(/&/g,"&"); } else { newDex = inex2; } var switchp2 = GM_getValue("urllist").indexOf(newDex); l.target.innerHTML = GM_getValue("titlelist")[switchp2]; } function gonenow(l) { var inexd = l.target.innerHTML; var dele = GM_getValue("urllist").indexOf(inexd); titles.splice(dele,1); urls.splice(dele,1); GM_setValue("titlelist", titles); GM_setValue("urllist", urls); } var pps = document.getElementsByClassName("urltable"); for (var p = 0; p < pps.length; p++) { pps[p].addEventListener("mouseover", overit, false); pps[p].addEventListener("mouseout", outofit, false); pps[p].addEventListener("click", gonenow, false); } }, false); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址