您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
In Steam Translation Server, add many features to make translate easier.
当前为
// ==UserScript== // @name STS Helper // @namespace iFantz7E.StsHelper // @version 1.50 // @description In Steam Translation Server, add many features to make translate easier. // @match http://translation.steampowered.com/* // @match https://translation.steampowered.com/* // @icon http://translation.steampowered.com/public/favicon.ico // @grant GM_addStyle // @copyright 2014, 7-elephant // ==/UserScript== // http://userscripts.org/scripts/show/325610 // https://gf.qytechs.cn/scripts/2250-sts-helper/ GM_addStyle( " #logout { position: fixed; z-index: 1001; right: 12px; top: 10px; line-height: 24px; text-align: right; } " + "input[type='button'], input[type='submit'] { cursor: pointer; } " + "input[type='button']:disabled { cursor: default; color: #777; } " + "#suggestionmain > div:nth-child(4) > form:nth-child(2) > div:nth-child(1) " + " { text-align: left; } " + ".lbAction > div > input[value^='SUBMIT'] " + " { width: 97%; height: 30px; } " + "form.lbAction:nth-child(1) > div:nth-child(2) > input:nth-child(1) " + " { width: 90%; margin-top: 5px; } " + "div.suggestion form.lbAction textarea" + " { width: 700px !important; min-height: 50px; } " + ".progress td { vertical-align: top; } " + "div#suggestions_nav { z-index: 3; position: absolute; width: 525px; left: 463px; top: 4px; text-align: right; line-height: 24px; } " + "#suggestionmain .smallcopy { width: 855px; min-height: 70px; max-height: 70px; overflow: hidden; } " + "#suggestionmain .progress { margin-top: -12px; } " + "#leftAreaContainer > table:nth-child(5) > tbody:nth-child(1) > tr > td:nth-child(1) { vertical-align: top; } " + "#leftAreaContainer > table:nth-child(5), #leftAreaContainer > table:nth-child(5) th, #leftAreaContainer > table:nth-child(5) td " + " { border: 1px solid; border-collapse: collapse; padding: 4px; } " + "#suggestions_box { margin-top: 1px !important; } " + "#suggestions_iframe { min-height: 100px !important; } " + "#keylist td:nth-child(1) > div:hover " + " { background-repeat: no-repeat; background-position: center; background-color: #0D0D0D !important; } " + ".progress h1 { display: inline-block; } " + "div#suggestions_box iframe { background-color: #1D1D1D !important; } " + ".stsh_btn { width: 90px; } " + ".stsh_btnLong { min-width: 130px; } " + ".stsh_btnRight { position: relative; float: right; } " + ".stsh_suggestion_header { color: #A4B23C; } " + ".stsh_suggestion_comment:before { background-color: #CF8B37 !important; } " + ".stsh_suggestion_pending:before { background-color: #FFF !important; } " + ".stsh_suggestion_approved:before { background-color: #A4B23C !important; } " + ".stsh_suggestion_declined:before { background-color: red !important; } " + ".stsh_suggestion_applied:before { background-color: #2EBCEB !important; } " + ".stsh_suggestion_removed:before { background-color: #555 !important; } " + ".stsh_suggestion { list-style: none; } " + ".stsh_suggestion:before " + " { content: ''; display: inline-block; position: relative; height: 6px; width: 6px; " + " border-radius: 3px; background-clip: padding-box; margin-right: -6px; top: -1px; left: -12px; background-color: green; }" + "#stsh_frame { text-align: center; } " + ".stsh_blue { color: #2ebceb; } " + ".stsh_green { color: #a4b23c; } " + ".stsh_red { color: #F00; } " + ".stsh_white { color: #fff; } " + ".stsh_orange { color: #CF8B37; } " + ".stsh_pink { color: pink; } " + "#stsh_showing { color: #CCDAD6; position: fixed; z-index: 4; right: 12px; bottom: 12px; text-align: right; line-height: 14px;} " + ".stsh_showing_counter { display: inline-block; min-width: 60px; text-align: center; } " + ".stsh_showing_header { color: #CCDAD6; display: inline-block; width: 135px; text-align: center; padding-top: 10px; } " + ".stsh_showing_button { min-width: 135px; } " + ".stsh_showing_group { position: fixed; z-index: 3; right: 12px; top: 84px; line-height: 24px; text-align: right; } " + ".stsh_scroll_header { color: #CCDAD6; display: inline-block; width: 130px; text-align: center; padding-top: 10px; } " + "#stsh_specialEvent { position: absolute; z-index: 2; right: 164px; top: 11px; } " + ".stsh_snapshot { position: absolute; top: 320px; left: 790px; width: 140px; text-align: center; color: #FFF; } " + ".suggestion_signature input[value~='APPROVE'], .suggestion_signature input[value~='Next'] { color: #A4B23C } " + ".suggestion_signature input[value~='DECLINE'], .suggestion_signature input[value~='Next']:nth-child(5) { color: #F22 } " + ".suggestion_signature input[disabled='disabled'] { color: #777 !important; } " + ".lbAction input[value~='COMMENT'] { vertical-align: top; margin-top: 1px; height: 52px; } " + ".lbAction input[value~='DISCUSS'] { vertical-align: top; margin-top: 1px; height: 36px; } " ); function attachOnLoad(callback) { window.addEventListener("load", function (e) { callback(); }); } function attachOnReady(callback) { document.addEventListener("DOMContentLoaded", function (e) { callback(); }); } function addKeyCtrl(ele, input, keyCode, keyName) { if (ele != null && input != null) { //if (input.getAttribute("disabled") == null) // return; if (keyName != null && keyName != "") { input.value += " (Ctrl+" + keyName + ")"; } ele.addEventListener("keydown", function (e) { //console.log("Key: " + e.keyCode); if (e.ctrlKey && e.keyCode == keyCode) { input.focus(); input.click(); return false; } }, true); } } function addKeyAlt(ele, input, keyCode, keyName) { if (ele != null && input != null) { if (keyName != null && keyName != "") { input.value += " (Alt+" + keyName + ")"; } ele.addEventListener("keydown", function (e) { if (e.altKey && e.keyCode == keyCode) { input.focus(); input.click(); return false; } }, true); } } function addKeyCtrlEnter(form, input) { addKeyCtrl(form, input, 13, "Enter") } function disableAfterClick(ele) { ele.addEventListener("click", function (e) { // don't change color after disable e.target.style.setProperty("color" , window.getComputedStyle(e.target).color, "important"); e.target.disabled = true; }, true); } function resizeSuggestionBox() { var script = document.createElement('script'); script.innerHTML = " \ var stsh_showSuggestionsBox_start = new Date(); \ var stsh_showSuggestionsBox_itv = setInterval(function() \ { \ var stsh_showSuggestionsBox_isEnd = false; \ var stsh_showSuggestionsBox_cur = new Date(); \ if (typeof showSuggestionsBox != 'undefined') \ { \ showSuggestionsBox = function(url) \ { \ g_suggestionsBoxIsOpen = true; \ $('suggestions_box_outer').appear( \ { \ duration : 0.1 \ } \ ); \ $('suggestions_iframe').setAttribute('src', url); \ if (!Prototype.Browser.IE) \ { \ $('suggestions_iframe').focus(); \ } \ $('suggestions_iframe').style.height = (document.viewport.getHeight() * 0.99) + 'px'; \ return false; \ }; \ stsh_showSuggestionsBox_isEnd = true; \ } \ if (stsh_showSuggestionsBox_isEnd || stsh_showSuggestionsBox_cur - stsh_showSuggestionsBox_start > 10000) \ { \ clearInterval(stsh_showSuggestionsBox_itv); \ } \ }, 300); \ "; document.head.appendChild(script); window.addEventListener("resize", function() { var iframe = document.querySelector("#suggestions_iframe"); iframe.style.height = (window.innerHeight * 0.99) + "px"; }); } function getQueryByName(name, url) { if (url == null) url = location.search; name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = regex.exec(url); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } function checkSpecialCharMatched(str1, str2) { // return (status, numSp1, numSp2) // status: 0:Match, 1:NotMatch, 2:NotEqual var sp1 = ""; var sp2 = ""; var sp3 = ""; var sp4 = ""; var sp5 = ""; var sp6 = ""; var sp7 = ""; var sp8 = ""; var strOut1 = ""; var strOut2 = ""; if (str1 != null && str2 != null) { for (var i = 0; i < str1.length; i++) { if (str1[i] == sp1 || str1[i] == sp2 || str1[i] == sp3 || str1[i] == sp4 || str1[i] == sp5 || str1[i] == sp6 || str1[i] == sp7 || str1[i] == sp8) { strOut1 += str1[i]; } } for (var i = 0; i < str2.length; i++) { if (str2[i] == sp1 || str2[i] == sp2 || str2[i] == sp3 || str2[i] == sp4 || str2[i] == sp5 || str2[i] == sp6 || str2[i] == sp7 || str2[i] == sp8) { strOut2 += str2[i]; } } } var retVal = 0; if (strOut1 == strOut2) retVal = 0; else if (strOut1.length == strOut2.length) retVal = 1; else retVal = 2; return new Array(retVal, strOut1.length, strOut2.length); } function reload() { window.location = window.location.href; } function getCookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start, c_end)); } return c_value; } function main() { var url = document.documentURI; var lang = getCookie("Language"); // Auto refresh when error { var h1 = document.querySelector("#leftAreaContainer > h1"); if (h1 != null) { if (h1.textContent.trim() == "Steam Translation Server - Maintenance Warning") { console.log("stsh: refresh"); setTimeout(reload, 60000); return; } } } // Clean links { var pattT1 = /\?t=[0-9]{6,}\&/g; var pattT2 = /\&t=[0-9]{6,}/g; var pattT3 = /\?t=[0-9]{6,}/g; var as = document.querySelectorAll("a"); for (var i = 0; i < as.length; i++) { var href = as[i].href; if (pattT1.test(href)) { as[i].href = href.replace(pattT1,"?"); } else if (pattT2.test(href)) { as[i].href = href.replace(pattT2,""); } else if (pattT3.test(href)) { as[i].href = href.replace(pattT3,""); } } } var eleLogout = document.querySelector("#logout"); if (eleLogout != null) { var logoutHtml = ' <input value="My Profile" type="button" onmouseup="window.open(\'/user_activity.php\',\'_blank\'); return false;" /> ' + ' <input name="login_button" value="Logout?" type="submit" onmouseup="return confirm(\'Logout?\');" /> '; eleLogout.innerHTML = logoutHtml; } // Special event button { var eleLogoff = document.querySelector("#logoff"); if (eleLogoff != null) { var d = new Date(); if ((d.getUTCMonth() > 8) || (d.getUTCMonth() == 8 && d.getUTCDate() >= 25) || (d.getUTCMonth() == 0 && d.getUTCDate() <= 1)) { var divSpecial = document.createElement("div"); divSpecial.id = "stsh_specialEvent"; divSpecial.innerHTML = '<input value="Year-End Rally" type="button" onmouseup="window.open(\'/rally' + d.getUTCFullYear() + '.php\',\'_blank\'); return false;" />'; eleLogoff.appendChild(divSpecial); } } } if (url.indexOf("Us_And_Them.php") > -1) { var container = "\""; var tdEng = document.querySelector("#leftAreaContainer > table:nth-child(5) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2)"); if (tdEng != null) { tdEng.innerHTML = container + tdEng.innerHTML + container; } var h1 = document.querySelector("#leftAreaContainer > h1:nth-child(2)"); if (h1 != null) { var header = h1.textContent.trim(); var key = header.split(" ")[0]; h1.innerHTML = header.replace(key, "<a href='http://translation.steampowered.com/translate.php?search_input=" + encodeURIComponent(key) + "' >" + key + "</a>"); document.title = key + " - " + document.title; } } // End Us_And_Them.php if (url.indexOf("suggestions.php") > -1) { var ele = document.querySelector("#suggestionmain > div:nth-child(4) > form:nth-child(2) > div:nth-child(1) > textarea:nth-child(1)"); if (ele != null) { ele.style.width = "960px"; ele.style.height = "64px"; ele.style.marginLeft = "3px"; } var inputClose = document.querySelector("#suggestions_nav > input[value^='Close']"); if (inputClose != null) { inputClose.value = "Close (Esc)"; } var td = document.querySelector(".progress > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(3)"); if (td != null && td.textContent.trim() == "") { td.innerHTML = ' <input value="Move Suggestion Box Here" type="button" onmouseup="moveSuggestionBox(); return false;" /> '; } var textarea = document.querySelector("form.lbAction > div:nth-child(1) > textarea:nth-child(1)"); if (textarea != null) { textarea.focus(); textarea.style.height = textarea.scrollHeight + "px"; } var br = document.querySelector("form.lbAction:nth-child(2) > div:nth-child(2) > br:nth-child(1)"); if (br != null) { br.parentElement.removeChild(br); } var key = ""; var divNav = document.querySelector("div#suggestions_nav"); if (divNav != null) { var insert = ""; var spliter = "_"; var regApp = /[0-9]{2,}/; var aKey = document.querySelector(".smallcopy > font:nth-child(2) > a:nth-child(1)"); if (aKey != null) { insert += ' <br/> '; key = encodeURIComponent(aKey.textContent.trim()); if (key == "token-key") { aKey = document.querySelector(".smallcopy > a:nth-child(3)"); if (aKey != null) { key = encodeURIComponent(aKey.textContent.trim()); } } if (key != "") { document.title = key + " - " + document.title; if (key.split(spliter).length > 1) { if (key.indexOf("%23") == 0) { var firstSpliter = key.indexOf(spliter); var keySharp = key.substring(0, firstSpliter); insert += ' <input value="Search by Sharp" type="button" onmouseup="window.open(\'/translate.php?search_input=' + keySharp + '\',\'_blank\'); return false;"> '; } var lastSpliter = key.lastIndexOf(spliter); var keyGroup = key.substring(0, lastSpliter); insert += ' <input value="Search by Group" type="button" onmouseup="window.open(\'/translate.php?search_input=' + keyGroup + '\',\'_blank\'); return false;"> '; } insert += ' <input value="Search by Key" type="button" onmouseup="window.open(\'/translate.php?search_input=' + key + '\',\'_blank\'); return false;"> '; } } var tdText = document.querySelector(".progress > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(1)"); if (tdText != null) { if (tdText.textContent.trim() == "") { tdText = document.querySelector(".progress > tbody:nth-child(2) > tr:nth-child(3) > td:nth-child(1)"); } } if (tdText != null) { var text = encodeURIComponent(tdText.textContent.trim()).replace(/(%20|%09)/g,"+") .replace(/'/g,"\\'").replace("%0A","+").replace(/\++/g,"+").substr(0, 80); if (text.length >= 80) { text = text.substr(0,text.lastIndexOf("+")); } if (text != "") { insert += ' <br/> <input value="Search by String" type="button" onmouseup="window.open(\'/translate.php?search_input=' + text + '\',\'_blank\'); return false;"> '; } } var app = regApp.exec(key.replace("%23","")); if (key.indexOf("faq") < 0 && app != null) { insert += ' <br/> '; if (key.indexOf("SharedFiles_App_") == 0) { insert += ' <input value="View Workshop" type="button" onmouseup="window.open(\'http://steamcommunity.com/workshop/browse?appid=' + app + '\',\'_blank\'); return false;"> '; } insert += ' <input value="View Community" type="button" onmouseup="window.open(\'http://steamcommunity.com/app/' + app + '/\',\'_blank\'); return false;"> ' insert += ' <input value="View App" type="button" onmouseup="window.open(\'http://store.steampowered.com/app/' + app + '/\',\'_blank\'); return false;"> '; } var src = document.documentURI; var insertBefore = " <input value=\"Refresh\" onmouseup=\"window.location = window.location.href; return false;\" type=\"button\"> " + " <input value=\"Frame\" onmouseup=\"window.open('" + src + "','_blank'); return false;\" type=\"button\"> "; var innerNew = divNav.innerHTML .replace('<input value="Previous',' <input value="Prev') .replace('<input value="Close',' <input value="Close'); divNav.innerHTML = insertBefore + innerNew + insert; } // Regroup glossary var stsh_regroupGlossary_start = new Date(); var stsh_regroupGlossary_itv = setInterval(function() { var stsh_regroupGlossary_isEnd = false; var stsh_regroupGlossary_cur = new Date(); var divSgts = document.querySelectorAll("div.suggestions_list"); if (divSgts.length > 0) { var noResult = "No results"; var br = "<br>"; var brSpace = " <br> "; var tag = "<"; var colon = ":"; var comma = ","; var isEdit = false; var p = divSgts[divSgts.length - 1].nextSibling; if (p == null || p.tagName != "P") { p = document.querySelector("#suggestionmain > p"); } if (p != null) { var inner = p.innerHTML; if (inner.indexOf("GLOSSARY FEATURE") > -1) { var glossaries = inner.split(br); for (var i = 0; i < glossaries.length; i++) { var glossary = glossaries[i].trim(); if (glossary.length > 0 && glossary.indexOf(tag) != 0 && glossary != noResult) { var colonIndex = glossary.indexOf(colon); var contentHead = glossary.substr(0, colonIndex + 2); var contentAll = glossary.substr(colonIndex + 1); var contents = contentAll.split(comma).sort(); var contentsNew = contents.filter(function(elem, pos) { return contents.indexOf(elem) == pos; }); for (var j = 0; j < contentsNew.length; j++) { contentsNew[j] = " <span onclick='clickToSelect(this)'>" + contentsNew[j].trim() + "</span>"; } glossaries[i] = contentHead + contentsNew.join(comma); isEdit = true; } } if (isEdit) { p.innerHTML = glossaries.join(brSpace); stsh_regroupGlossary_isEnd = true; } } } } if (stsh_regroupGlossary_isEnd || stsh_regroupGlossary_cur - stsh_regroupGlossary_start > 10000) { clearInterval(stsh_regroupGlossary_itv); } }, 300); // Auto link http { var regUrl = /http[^ "]+/ig; var eleComments = document.querySelectorAll("" + ".suggestion_signature > i:nth-child(3), " + ".suggestion_signature div:nth-child(1) > i:nth-child(6), " + ".row0 > td:nth-child(2), .row1 > td:nth-child(2), .row2 > td:nth-child(2), " + ".row-1 > td:nth-child(2) "); for (var i = 0; i < eleComments.length; i++) { var comment = eleComments[i].innerHTML + " "; if (comment.indexOf("<a") == -1) { var commentUrls = comment.match(regUrl) || []; for (var j = 0; j < commentUrls.length; j++) { var commentUrl = commentUrls[j] + " "; comment = comment.replace(commentUrl,"<a target='_blank' href='" + commentUrls[j] + "' >" + decodeURIComponent(commentUrls[j]) + "</a> "); } } comment = comment.trim(); if (comment.indexOf("Comment:") == 0) { comment = comment //.replace("Comment:", "<span class='stsh_white'>Comment:</span>") .replace(/\-\>\;/g, "<span class='stsh_white'>-></span>") .replace(/\,/g, "<span class='stsh_white'>,</span>"); } eleComments[i].innerHTML = comment; var eleAs = eleComments[i].querySelectorAll("a"); for (var j = 0; j < eleAs.length; j++) { var href = eleAs[j].getAttribute("href"); if (href.indexOf("#") > -1) { eleAs[j].setAttribute("href", href.replace(/\#/g,"%23")); } } } } var divIntro = document.querySelector("#suggestionmain > div.smallcopy"); if (divIntro != null) { var qBranch = getQueryByName("branch"); var htmlToken = "You are editing"; var htmlTokenReplace = ""; var htmlToken2 = "token-key"; var htmlToken2Replace = "Token-key"; var htmlFile = "of file"; var htmlFileReplace = '<br>File: <font class="stsh_blue" onclick="clickToSelect(this)">' + qBranch + '</font> >> '; var htmlSugg = 'You have <font style="'; var htmlSuggReplace = 'You have <font title="Enter and submit new suggestions below. Do not alter HTML tags or variables." style="cursor: pointer; '; var htmlIntro = "Enter and submit new suggestions below. Do not alter HTML tags or variables."; var htmlIntroReplace = ' <a href="mailto:[email protected]" ' + 'title="Please report truncated tokens to [email protected]">' + '<font style="color:white;">Report Tokens</font></a>'; var htmlContact = '<br>Please report truncated tokens to: <a href="mailto:[email protected]"><font style="color:white;">[email protected]</font></a>'; var htmlContactReplace = ''; if (key != "") { htmlIntroReplace += ' <br>Share: <font class="stsh_green" style="font-size: 0.8em;" onclick="clickToSelect(this)">' + 'http://translation.steampowered.com/translate.php?search_input=' + key + "</font> <br>"; } var isComplete = (divIntro.innerHTML.indexOf(htmlContact) > -1); divIntro.innerHTML = divIntro.innerHTML .replace(htmlToken, htmlTokenReplace) .replace(htmlToken2, htmlToken2Replace) .replace(htmlFile, htmlFileReplace) .replace(htmlSugg, htmlSuggReplace) .replace(htmlIntro, htmlIntroReplace) .replace(htmlContact, htmlContactReplace) .trim(); if (!isComplete) { var stsh_introReplace_start = new Date(); var stsh_introReplace_itv = setInterval(function(divIntro, htmlContact, htmlContactReplace) { var stsh_introReplace_isEnd = false; var stsh_introReplace_cur = new Date(); if (divIntro.innerHTML.indexOf(htmlContact) > -1) { divIntro.innerHTML = divIntro.innerHTML .replace(htmlContact, htmlContactReplace); stsh_introReplace_isEnd = true; } if (stsh_introReplace_isEnd || stsh_introReplace_cur - stsh_introReplace_start > 10000) { clearInterval(stsh_introReplace_itv); } }, 100, divIntro, htmlContact, htmlContactReplace); } } var formComments = document.querySelectorAll(".lbAction"); for (var i = 0; i < formComments.length; i++) { var formComment = formComments[i]; var inputComment = formComment.querySelector("input[type=submit]"); if (inputComment != null) { addKeyCtrlEnter(formComment, inputComment); } } var inputApprove = document.querySelector(".suggestion_signature input[value~='APPROVE']"); if (inputApprove != null) { addKeyAlt(document, inputApprove, 219, "["); // [ addKeyAlt(document, inputApprove, 0, ""); // [ addKeyAlt(document, inputApprove, 79, ""); // O addKeyAlt(document, inputApprove, 65, ""); // A } var inputApproveNext = document.querySelector(".suggestion_signature input[value~='Next']"); if (inputApproveNext != null) { inputApproveNext.value = "Next"; addKeyAlt(document, inputApproveNext, 221, "]"); // ] addKeyAlt(document, inputApproveNext, 188, ""); // ] addKeyAlt(document, inputApproveNext, 80, ""); // P addKeyAlt(document, inputApproveNext, 83, ""); // S disableAfterClick(inputApproveNext); } var inputDeclineNext = document.querySelector(".suggestion_signature input[value~='Next']:nth-child(5)"); if (inputDeclineNext != null) { inputDeclineNext.value = "Next"; } var inputPrev = document.querySelector("#suggestions_nav > input[value^='Prev']"); if (inputPrev != null) { addKeyCtrl(document, inputPrev, 219, "["); addKeyCtrl(document, inputPrev, 0, ""); disableAfterClick(inputPrev); } var inputNext = document.querySelector("#suggestions_nav > input[value~='Next']"); if (inputNext != null) { addKeyCtrl(document, inputNext, 221, "]"); addKeyCtrl(document, inputNext, 188, ""); disableAfterClick(inputNext); } // Check special chars { var h1s = document.querySelectorAll(".progress h1"); if (h1s.length == 2) { var h1Org = h1s[0]; var h1Trn = h1s[1]; var tdOrg = document.querySelector(".progress tr:nth-child(2) > td:nth-child(1)"); var tdTrn = document.querySelector(".progress tr:nth-child(2) > td:nth-child(3)"); if (tdOrg != null && tdTrn != null) { var strOrg = tdOrg.textContent.trim(); var strTrn = tdTrn.textContent.trim(); var statusTrnArr = checkSpecialCharMatched(strOrg, strTrn); var statusTrnMatched = statusTrnArr[0]; var spOrg = statusTrnArr[1]; var spTrn = statusTrnArr[2]; if (spOrg > 0) { var spanSpOrg = document.createElement("span"); spanSpOrg.id = "stsh_spanSpOrg"; spanSpOrg.classList.add("stsh_blue"); spanSpOrg.innerHTML = " SpecialChar: " + spOrg; h1Org.parentElement.appendChild(spanSpOrg); // Check chars in translated if (strTrn != "") { var spanSpTrn = document.createElement("span"); spanSpTrn.id = "stsh_spanSpTrn"; if (statusTrnMatched == 0) { spanSpTrn.classList.add("stsh_green"); } else { spanSpTrn.classList.add("stsh_red"); } var outputTrn = " SpecialChar: " + spTrn; if (statusTrnMatched == 0) { outputTrn += " (Matched)"; } else if (statusTrnMatched == 1) { outputTrn += " (Order not matched)"; } else { outputTrn += " (Not matched)"; } spanSpTrn.innerHTML = outputTrn; h1Trn.parentElement.appendChild(spanSpTrn); } // Check chars in suggested var divSugs = document.querySelectorAll(".suggestion_text"); for (var i = 0; i < divSugs.length; i++) { var divSug = divSugs[i]; var strSug = divSug.textContent.trim(); var statusSugArr = checkSpecialCharMatched(strOrg, strSug); var statusSugMatched = statusSugArr[0]; var spSug = statusSugArr[2]; var spanSpSug = document.createElement("span"); spanSpSug.classList.add("stsh_spanSpSug"); if (statusSugMatched == 0) { spanSpSug.classList.add("stsh_green"); } else { spanSpSug.classList.add("stsh_red"); } var outputSug = " SpecialChar: " + spSug; if (statusSugMatched == 0) { outputSug += " (Matched)"; } else if (statusSugMatched == 1) { outputSug += " (Order not matched)"; } else { outputSug += " (Not matched)"; } outputSug += " <br/><br/> "; spanSpSug.innerHTML = outputSug; divSug.insertBefore(spanSpSug, divSug.firstChild); } } } } } // Trim string in same token { var p = document.querySelector("#suggestionmain > div:nth-child(5) > p:nth-child(4)"); if (p != null) { for (var i = 0; i < p.childNodes.length; i++) { child = p.childNodes[i]; if (child.nodeName == "#text") { child.nodeValue = child.nodeValue.trim(); } } } } // Display newlines { var tdOrg = document.querySelector(".progress tr:last-child > td:nth-child(1)"); var tdTrn = document.querySelector(".progress tr:last-child > td:nth-child(3)"); if (tdOrg != null && tdTrn != null) { var htmlOrg = tdOrg.innerHTML.trim(); if ((htmlOrg.indexOf("\n") > -1 || htmlOrg.indexOf("\\n") > -1) && htmlOrg.indexOf("<br") < 0 && htmlOrg.indexOf("<p") < 0 && htmlOrg.indexOf("<div") < 0 && htmlOrg.indexOf("<li") < 0 ) { var h2SugHeader = document.querySelector("#suggestionmain > div > h2"); if (h2SugHeader != null) { var btn = document.createElement("input"); btn.setAttribute("class", "stsh_btnRight"); btn.setAttribute("type", "button"); btn.setAttribute("value", "Display Newlines"); function displayNewlines(ele) { if (ele != null) { ele.innerHTML = ele.innerHTML.trim().replace(/\n/g,"\n<br>").replace(/\\n/g," \\n<br>"); } } btn.addEventListener("click", function(e) { e.target.disabled = true; var tdOrg = document.querySelector(".progress tr:last-child > td:nth-child(1)"); var tdTrn = document.querySelector(".progress tr:last-child > td:nth-child(3)"); displayNewlines(tdOrg); displayNewlines(tdTrn); var divSugs = document.querySelectorAll(".suggestion_text"); for (var i = 0; i < divSugs.length; i++) { var divSug = divSugs[i]; displayNewlines(divSug); } var textarea = document.querySelector("form.lbAction > div:nth-child(1) > textarea:nth-child(1)"); if (textarea != null) { textarea.focus(); } }); h2SugHeader.appendChild(btn); } } } } // Convert time { //var d2 = new Date("2014-10-03T21:18:00-07:00") } } // End suggestions.php if (url.indexOf("translate.php") > -1) { var searchText = getQueryByName("search_input"); if (searchText != "") { document.title = searchText + " - " + document.title; } else { var fileID = getQueryByName("file_ID"); if (fileID != "") { var eleFile = document.querySelector("#leftAreaContainer > div:nth-child(12)"); if (eleFile != null) { var file = eleFile.textContent.trim(); if (file.indexOf("select file") == 0) { file = file.substring(33); var fileNew = file.split("#").reverse().join(" # ").trim(); document.title = fileNew + " - " + document.title; } } } } var outer = document.getElementById("suggestions_box_outer"); if (outer != null) { outer.setAttribute("onclick","hideSuggestionsBox();"); } var divBtn = document.createElement("div"); document.body.appendChild(divBtn); divBtn.innerHTML = ' \ <div class="stsh_showing_group"> \ <input value="Hide App" class="stsh_btn" type="button" onmouseup="hideKeyAppInterval(); return false;" /> \ <br/> <input value="Hide Game" class="stsh_btn" type="button" onmouseup="hideKeyGameInterval(); return false;" /> \ <br/> <input value="Hide FAQ" class="stsh_btn" type="button" onmouseup="hideKeyFaqInterval(); return false;" /> \ <br/> <input value="Hide Support" class="stsh_btn" type="button" onmouseup="hideKeySupportInterval(); return false;" /> \ <br/> <input value="Hide Promo" class="stsh_btn" type="button" onmouseup="hideKeyPromoInterval(); return false;" /> \ <br/> \ <br/> <input value="Hide not similar" class="stsh_btnLong" type="button" onmouseup="hideStrNotMatchInterval(); return false;" /> \ <br/> <input value="Hide very long" class="stsh_btnLong" type="button" onmouseup="hideStrLongInterval(); return false;" /> \ \ <br/> <span class="stsh_showing_header">Hide Suggestions</span>\ <br/> <input id="stsh_showing_notTranslated" value="Not Translated (0)" class="stsh_showing_button" type="button" /> \ <br/> <input id="stsh_showing_suggested" value="Suggested (0)" class="stsh_showing_button" type="button" /> \ <br/> <input id="stsh_showing_resuggested" value="Resuggested (0)" class="stsh_showing_button" type="button" /> \ <br/> <input id="stsh_showing_approved" value="Approved (0)" class="stsh_showing_button" type="button" /> \ <br/> <input id="stsh_showing_declined" value="Declined (0)" class="stsh_showing_button" type="button" /> \ <br/> <input id="stsh_showing_translated" value="Translated (0)" class="stsh_showing_button" type="button" /> \ <br/> \ <br/> <input value="Sort by Key" class="stsh_btn" type="button" onmouseup="sortKeyInterval(); return false;" /> \ <br/> \ <br/> <input id="stsh_showing_refresh" value="Refresh" class="stsh_btn" type="button" onmouseup="hideSuggestionsBox(); return false;" /> \ <br/> <input id="stsh_showing_all" value="Show All" class="stsh_btn" type="button" onmouseup="showKey(); return false;" /> \ <br/><br/> <span id="stsh_showing"></span> \ </div> \ '; // Count showing function countShowing() { var trKeys = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr"); var countAll = document.querySelectorAll("#keylist .copysmall").length; var countShow = 0; var countSuggest = 0; var countResuggest = 0; var countApprove = 0; var countDecline = 0; var countNotTranslated = 0; var countTranslated = 0; var txtApprove = "ready for Admin"; var txtDecline = "ready for removal"; var txtSuggest = "suggestion"; for (var i = 0; i < trKeys.length; i++) { if (trKeys[i].style.display != "none") { var eleCounter = trKeys[i].querySelector("tr.copysmall > td:nth-child(3)"); if (eleCounter != null) { countShow++; var txtCounter = eleCounter.textContent.trim(); if (txtCounter.indexOf(txtApprove) > -1) { countApprove++; } else if (txtCounter.indexOf(txtDecline) > -1) { countDecline++; } else if (txtCounter.indexOf(txtSuggest) > -1) { var eleNotTranslated = trKeys[i].querySelector("span.token_nottranslated"); if (eleNotTranslated != null) { countSuggest++; } else { countResuggest++; } } else { var eleNotTranslated = trKeys[i].querySelector("span.token_nottranslated"); if (eleNotTranslated != null) { countNotTranslated++; } else { countTranslated++; } } } else { var eleTd = trKeys[i].querySelector("td"); if (eleTd != null) { if (eleTd.textContent.trim() == "") { trKeys[i].parentElement.removeChild(trKeys[i]); } } } } } var eleShowing = document.getElementById("stsh_showing"); if (eleShowing != null) { var newHtml = "Showing: <span class=\"stsh_showing_counter\">" + countShow + " of " + countAll + "</span>" + "<!-- " + countNotTranslated + ", " + countSuggest + ", " + countResuggest + ", " + countApprove + ", " + countDecline + ", " + countTranslated + " -->"; if (eleShowing.innerHTML != newHtml) { eleShowing.innerHTML = newHtml; var eleBtnShowings = document.querySelectorAll("#stsh_showing_notTranslated, #stsh_showing_suggested, #stsh_showing_resuggested" + ", #stsh_showing_approved, #stsh_showing_declined, #stsh_showing_translated"); if (eleBtnShowings.length == 6) { var counterArr = [countNotTranslated, countSuggest, countResuggest, countApprove, countDecline, countTranslated ]; var counterTextArr = ["Not Translated", "Suggested", "Resuggested" , "Approved", "Declined", "Translated" ]; for (var i = 0; i < eleBtnShowings.length; i++) { eleBtnShowings[i].value = counterTextArr[i] + " ("+ counterArr[i] +")" ; }; } } } } countShowing(); setInterval(countShowing, 1000); // End Count showing // Hide suggestions { function hideSuggestions(mode) { // mode: 0-5 (0: "Not Translated", 1: "Suggested", 2: "Resuggested", 3: "Approved", 4: "Declined", 5: "Translated") if (mode < 0 || mode > 5) return; var display = "none"; var txtApprove = "ready for Admin"; var txtDecline = "ready for removal"; var txtSuggest = "suggestion"; var trKeys = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr"); for (var i = 0; i < trKeys.length; i++) { if (trKeys[i].style.display != display) { var curMode = -1; var eleCounter = trKeys[i].querySelector("tr.copysmall > td:nth-child(3)"); if (eleCounter != null) { var txtCounter = eleCounter.textContent.trim(); if (txtCounter.indexOf(txtApprove) > -1) { curMode = 3; // Approved } else if (txtCounter.indexOf(txtDecline) > -1) { curMode = 4; // Declined } else if (txtCounter.indexOf(txtSuggest) > -1) { var eleNotTranslated = trKeys[i].querySelector("span.token_nottranslated"); if (eleNotTranslated != null) { curMode = 1; // Suggested } else { curMode = 2; // Resuggested } } else { var eleNotTranslated = trKeys[i].querySelector("span.token_nottranslated"); if (eleNotTranslated != null) { curMode = 0; // Not Translated } else { curMode = 5; // Translated } } } if (curMode == mode) { trKeys[i].style.display = display; } } } } var itvTime = 300; var itvIdHider = [0, 0, 0, 0, 0, 0]; var eleBtnShowings = document.querySelectorAll("#stsh_showing_notTranslated, #stsh_showing_suggested, #stsh_showing_resuggested" + ", #stsh_showing_approved, #stsh_showing_declined, #stsh_showing_translated"); if (eleBtnShowings.length == 6) { for (var i = 0; i < eleBtnShowings.length; i++) { eleBtnShowings[i].param = i; eleBtnShowings[i].addEventListener("click", function(ev) { var mode = ev.target.param; clearInterval(itvIdHider[mode]); itvIdHider[mode] = setInterval(function(ev) { hideSuggestions(mode); }, itvTime); hideSuggestions(mode); countShowing(); eleBtnShowings[mode].setAttribute("disabled", "disabled"); }); } var eleBtnShowAll = document.querySelector("#stsh_showing_all"); if (eleBtnShowAll != null) { eleBtnShowAll.addEventListener("click", function() { for (var i = 0; i < eleBtnShowings.length; i++) { clearInterval(itvIdHider[i]); countShowing(); eleBtnShowings[i].removeAttribute("disabled"); } }); } } } // End Hide suggestions resizeSuggestionBox(); var ifrm = document.querySelector("#suggestions_iframe"); if (ifrm != null) { ifrm.addEventListener("DOMAttrModified", function (ev) { if (ev.attrName === "src") { var divFrame = document.querySelector("#stsh_frame"); if (divFrame == null) { var divOuter = document.querySelector("#suggestions_box_outer"); if (divOuter != null) { divFrame = document.createElement("div"); divFrame.id = "stsh_frame"; divOuter.appendChild(divFrame); } } if (divFrame != null) { var src = ifrm.getAttribute("src"); divFrame.innerHTML = "<br/><input value=\"Frame\" onmouseup=\"window.open('" + src + "','_blank'); return false;\" type=\"button\">"; } } }, false); } } // End translate.php if (url.indexOf("user_activity.php") > -1) { var aAvatars = document.querySelectorAll(".friend_block_avatar > a[href^='https://steamcommunity.com']"); for (var i = 0; i < aAvatars.length; i++) { aAvatars[i].href = aAvatars[i].href.replace("https://steamcommunity.com","http://steamcommunity.com"); document.title = aAvatars[i].querySelector("img").getAttribute("title") + " - " + document.title; } var stsh_activityAddLink_start = new Date(); var stsh_activityAddLink_itv = setInterval(function() { var stsh_activityAddLink_isEnd = false; var stsh_activityAddLink_cur = new Date(); var h3s = document.querySelectorAll("#leftAreaContainer h3"); if (h3s.length == 2) { var td = h3s[1].parentElement; var matchArr = td.innerHTML.match(/<\/h3>.+<br>/i); if (matchArr != null) { var user = url.replace("http://translation.steampowered.com/user_activity.php?user=",""); var name = matchArr[0].replace("</h3>-","").replace("-<br>","").replace("<br>","").trim(); var tagNew = ""; if (user.indexOf("http") == 0) { tagNew = "</h3><a id='stsh_id' class='stsh_blue' target='_blank' href='http://steamcommunity.com/my'>" + name + "</a>" + ", <a class='stsh_green' target='_blank' href='http://translation.steampowered.com/WhereIsEsty.php'>Esty</a><br><br>"; } else { tagNew = "</h3><a id='stsh_id' class='stsh_blue' target='_blank' href='http://steamcommunity.com/profiles/" + user + "'>" + name + "</a>" + ", <a class='stsh_green' target='_blank' href='http://translation.steampowered.com/WhereIsEsty.php?collectionof=" + user + "'>Esty</a><br><br>"; } td.innerHTML = td.innerHTML.replace(/<\/h3>.+<br>/i, tagNew); stsh_activityAddLink_isEnd = true; } if (stsh_activityAddLink_isEnd || stsh_activityAddLink_cur - stsh_activityAddLink_start > 10000) { clearInterval(stsh_activityAddLink_itv); } } }, 300); var countWord = ""; var countSugg = ""; var inputDials = document.querySelectorAll("#leftAreaContainer input.dial"); if (inputDials.length == 2) { countWord = inputDials[0].getAttribute("title").replace("words", "").trim(); countSugg = inputDials[1].getAttribute("title").replace("suggestions", "").trim(); } var tdCount = document.querySelector("#leftAreaContainer td[align='left']"); if (tdCount != null) { tdCount.innerHTML = '<div style="width: 100px; display: inline-block; text-align: center;">Word: ' + countWord + '</div> <div style="width: 100px; display: inline-block; text-align: center; margin-left: 13px;">Suggestion: ' + countSugg + '</div>'; } var sug = document.body.textContent; var regComment = /VIEW COMMENT/g; var regSuggest = /VIEW SUGGESTION/g; var strComment = "...RECEIVED A MODERATOR COMMENT"; var strPending = "...ARE PENDING"; var strApproved = "...WERE APPROVED"; var strDeclined = "...WERE DECLINED"; var strApplied = "...HAVE BEEN APPLIED WITHIN THE LAST 14 DAYS"; var strRemoved = "...HAVE BEEN REMOVED WITHIN THE LAST 14 DAYS"; var startComment = sug.indexOf(strComment); var startPending = sug.indexOf(strPending); var startApproved = sug.indexOf(strApproved); var startDeclined = sug.indexOf(strDeclined); var startApplied = sug.indexOf(strApplied); var startRemoved = sug.indexOf(strRemoved); var sugComment = sug.substring(startComment,startPending); var sugPending = sug.substring(startPending,startApproved); var sugApproved = sug.substring(startApproved,startDeclined); var sugDeclined = sug.substring(startDeclined,startApplied); var sugApplied = sug.substring(startApplied,startRemoved); var sugRemoved = sug.substring(startRemoved); var countComment = (sugComment.match(regComment) || []).length; var countPending = (sugPending.match(regSuggest) || []).length; var countApproved = (sugApproved.match(regSuggest) || []).length; var countDeclined = (sugDeclined.match(regSuggest) || []).length; var countApplied = (sugApplied.match(regSuggest) || []).length; var countRemoved = (sugRemoved.match(regSuggest) || []).length; var divBtn = document.createElement("div"); document.body.appendChild(divBtn); divBtn.innerHTML = ' \ <div style="position: fixed; z-index: 3; right: 12px; top: 84px; line-height: 24px; text-align: right;"> \ <input value="To Progress" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'stsh_id\', -50); return false;" /> \ \ <br/> <span class="stsh_scroll_header">Scroll To</span>\ <br/> <input value="Comment (' + countComment + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionComment\'); return false;" /> \ <br/> <input value="Pending (' + countPending + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionPending\'); return false;" /> \ <br/> <input value="Approved (' + countApproved + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionApproved\'); return false;" /> \ <br/> <input value="Declined (' + countDeclined + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionDeclined\'); return false;" /> \ <br/> <input value="Applied (' + countApplied + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionApplied\'); return false;" /> \ <br/> <input value="Removed (' + countRemoved + ')" class="stsh_btnLong" type="button" onmouseup="scrollToId(\'sectionRemoved\'); return false;" /> \ <br/> \ <br/> <input value="Hide Suggestions" class="stsh_btnLong" type="button" onmouseup="hideSuggestion(); return false;" /> \ <br/> <input value="Show Suggestions" class="stsh_btnLong" type="button" onmouseup="showSuggestion(); return false;" /> \ <br/> \ <br/> <input value="Refresh" class="stsh_btnLong" type="button" onmouseup="window.location = window.location.href; return false;" /> \ </div> \ '; var divContainer = document.querySelector("#leftAreaContainer"); if (divContainer != null) { divContainer.innerHTML = divContainer.innerHTML .replace("...RECEIVED A MODERATOR COMMENT","<span id='sectionComment' class='stsh_suggestion_header'>...RECEIVED A MODERATOR COMMENT (" + countComment + ")</span>") .replace("...ARE PENDING","<span id='sectionPending' class='stsh_suggestion_header'>...ARE PENDING (" + countPending + ")</span>") .replace("...WERE APPROVED","<span id='sectionApproved' class='stsh_suggestion_header'>...WERE APPROVED (" + countApproved + ")</span>") .replace("...WERE DECLINED","<span id='sectionDeclined' class='stsh_suggestion_header'>...WERE DECLINED (" + countDeclined + ")</span>") .replace("...HAVE BEEN APPLIED WITHIN THE LAST 14 DAYS","<span id='sectionApplied' class='stsh_suggestion_header'>...HAVE BEEN APPLIED WITHIN THE LAST 14 DAYS (" + countApplied + ")</span>") .replace("...HAVE BEEN REMOVED WITHIN THE LAST 14 DAYS","<span id='sectionRemoved' class='stsh_suggestion_header'>...HAVE BEEN REMOVED WITHIN THE LAST 14 DAYS (" + countRemoved + ")</span>"); } var cans = document.querySelectorAll("canvas"); for (var i = 0; i < cans.length; i++) { cans[i].parentElement.removeChild(cans[i]); } var aKeys = document.querySelectorAll("#leftAreaContainer li > a:nth-child(1)"); for (var i = 0; i < aKeys.length; i++) { var key = aKeys[i].textContent; var keyArr = key.substr(21).trim().split(" >> "); keyArr[0] = "<span style='color: #FFF !important;'>" + keyArr[0] + "</span>"; var keyNew = key.substr(0,21) + keyArr.join(" >> ") + ""; aKeys[i].innerHTML = keyNew; } var liMode = strComment; var liSugs = document.querySelectorAll("#leftAreaContainer > li, #leftAreaContainer > form > li"); for (var i = 0; i < liSugs.length; i++) { if (liMode == strComment) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_comment"); } else if (liMode == strPending) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_pending"); } else if (liMode == strApproved) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_approved"); } else if (liMode == strDeclined) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_declined"); } else if (liMode == strApplied) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_applied"); } else if (liMode == strRemoved) { liSugs[i].setAttribute("class", "stsh_suggestion stsh_suggestion_removed"); } var content = liSugs[i].textContent; if (content.indexOf(strRemoved) > -1) { liMode = strRemoved; } else if (content.indexOf(strApplied) > -1) { liMode = strApplied; } else if (content.indexOf(strDeclined) > -1) { liMode = strDeclined; } else if (content.indexOf(strApproved) > -1) { liMode = strApproved; } else if (content.indexOf(strPending) > -1) { liMode = strPending; } } // change language & correct url { var aProgresses = document.querySelectorAll("div > .friend_block_avatar a[onmouseout]"); for (var i = 0; i < aProgresses.length; i++) { var langCur = getQueryByName("lang", aProgresses[i].href); if (langCur == "") { aProgresses[i].href = aProgresses[i].href + lang; } else { if (langCur != lang) { var langQuery = (url.indexOf("?") > -1) ? "&lang=" : "?lang="; window.location = url + langQuery + langCur; } } var aContent = aProgresses[i].textContent.trim(); if (aContent.indexOf("SUGGESTIONS") > -1) { aProgresses[i].href = aProgresses[i].href + "&listsort=5&liststatus=1&paginationrows=5000"; } else if (aContent.indexOf("REVIEWS") > -1) { aProgresses[i].href = aProgresses[i].href + "&listsort=5&liststatus=3&paginationrows=5000"; } } } } // End user_activity.php if (url.indexOf("rally.php") > -1 || url.indexOf("rally2013.php") > -1 || url.indexOf("rally2014.php") > -1) { resizeSuggestionBox(); var outer = document.getElementById("suggestions_box_outer"); if (outer != null) { outer.setAttribute("onclick","hideSuggestionsBox();"); } var first = document.querySelector(".gradienttable tr:nth-child(6)"); var cur = null; var tdLangs = document.querySelectorAll(".gradienttable tr > td:nth-child(1)"); for (var i = 0; i < tdLangs.length; i++) { if (lang == tdLangs[i].textContent.trim().toLowerCase()) { cur = tdLangs[i].parentElement; break; } } if (cur != null) { first.parentElement.insertBefore(cur, first); } var inputClose = document.querySelector("td:nth-child(3) > input:nth-child(1)"); if (inputClose != null) { inputClose.value = "Close (Esc)"; } } // End rally.php if (url.indexOf("rally_results.php") > -1 || url.indexOf("rally_results_2013.php") > -1 || url.indexOf("rally_results_2014.php") > -1) { var h3 = document.querySelector("table.curved h3"); if (h3 != null) { document.title = h3.textContent.trim(); } var inputClose = document.querySelector("td:nth-child(3) > input:nth-child(1)"); if (inputClose != null) { inputClose.value = "Close (Esc)"; } var src = document.documentURI; var insert = "<input value=\"Frame\" onmouseup=\"window.open('" + src + "','_blank'); return false;\" type=\"button\">"; var tdFirst = document.querySelector("td:nth-child(1)"); if (tdFirst != null) { var ele = document.createElement("td"); ele.setAttribute("align", "right"); ele.innerHTML = insert; tdFirst.parentElement.insertBefore(ele, tdFirst); } } // End rally_results.php if (url.indexOf("WhereIsEsty.php") > -1) { resizeSuggestionBox(); var outer = document.getElementById("suggestions_box_outer"); if (outer != null) { outer.setAttribute("onclick","hideSuggestionsBox();"); } var divContainer = document.querySelector("#pageContainer"); if (divContainer != null) { var ele = document.createElement("div"); ele.id = "logout"; ele.innerHTML = '<input value="Home" type="button" onmouseup="window.open(\'/home.php\',\'_blank\'); return false;" />'; divContainer.appendChild(ele); } var divContent = document.querySelector("#leftAreaContainer > div"); if (divContent != null) { var countSnap = document.querySelectorAll("div.box").length; var user = ""; var name = ""; var eleImg = document.querySelector("#leftAreaContainer > div > div > a > img "); if (eleImg != null) { name = eleImg.getAttribute("title"); user = eleImg.parentElement.getAttribute("href").replace("https://steamcommunity.com/profiles/", ""); } var ele = document.createElement("div"); ele.setAttribute("class", "stsh_snapshot"); ele.innerHTML = "<a class='stsh_blue' target='_blank' href='http://translation.steampowered.com/user_activity.php?user=" + user + "'>" + name + "</a>" + "<br>Snapshot: " + countSnap; divContent.appendChild(ele); } } // End WhereIsEsty.php } var clientScript = ' \ \ var itvTime = 300; \ var itvIdHideKeyApp = 0; \ var itvIdHideKeyGame = 0; \ var itvIdHideKeyFaq = 0; \ var itvIdHideKeySupport = 0; \ var itvIdHideKeyPromo = 0; \ var itvIdHideStrNotMatch = 0; \ var itvIdHideStrLong = 0; \ var itvIdSortKey = 0; \ \ function setVisibleKey(startKey, visible) \ { \ startKey = startKey.toLowerCase(); \ var display = visible != true ? "none" : ""; \ var eleKeys = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr > td:nth-child(1) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(1)"); \ for (var i = 0; i < eleKeys.length; i++) \ { \ try \ { \ if (eleKeys[i].textContent.trim().toLowerCase().indexOf(startKey) > -1) \ { \ var eleTarget = eleKeys[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; \ if (eleTarget.style.display != display) \ { \ eleTarget.style.display = display; \ } \ } \ } \ catch (ex) \ { \ } \ } \ } \ \ function hideKeyGame() \ { \ setVisibleKey("GAMES/", false); \ } \ \ function hideKeyApp() \ { \ setVisibleKey("# storefront_english_apps.txt #", false); \ setVisibleKey("# storefront_english_main.txt # #app_", false); \ setVisibleKey("# community_english.txt # SharedFiles_App_", false); \ } \ \ function hideKeyFaq() \ { \ setVisibleKey("# support_faq_english.txt #", false); \ } \ \ function hideKeySupport() \ { \ setVisibleKey("# supportui_english.txt #", false); \ } \ \ function hideKeyPromo() \ { \ setVisibleKey("#promo", false); \ } \ \ function showKey() \ { \ clearInterval(itvIdHideKeyApp); \ clearInterval(itvIdHideKeyGame); \ clearInterval(itvIdHideKeyFaq); \ clearInterval(itvIdHideKeySupport); \ clearInterval(itvIdHideKeyPromo); \ clearInterval(itvIdSortKey); \ clearInterval(itvIdHideStrNotMatch); \ clearInterval(itvIdHideStrLong); \ setVisibleKey("", true); \ \ hideSuggestionsBox(); \ } \ \ function sortKey() \ { \ var keyArr = new Array(); \ var valArr = new Array(); \ \ var eleKeys = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr > td:nth-child(1) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(1)"); \ for (var i = 0; i < eleKeys.length; i++) \ { \ try \ { \ key = eleKeys[i].textContent.trim(); \ keyArr.push(key); \ valArr[key] = eleKeys[i].parentElement.parentElement.parentElement \ .parentElement.parentElement.parentElement.outerHTML.trim(); \ } \ catch (ex) \ { \ } \ } \ \ var keyArrTmp = keyArr.slice(); \ keyArr.sort(); \ \ var isSame = true; \ for (var i = 0; i < keyArr.length; i++) \ { \ if (keyArr[i] != keyArrTmp[i]) \ { \ isSame = false; \ } \ } \ \ if (!isSame) \ { \ var eleTable = document.querySelector("#keylist > table:nth-child(1) > tbody:nth-child(1)"); \ if (eleTable != null) \ { \ var newInner = ""; \ \ for (var i = 0; i < keyArr.length; i++) \ { \ newInner += valArr[keyArr[i]]; \ } \ \ eleTable.innerHTML = newInner; \ } \ } \ } \ \ function scrollToId(id, offset) \ { \ if (typeof offset == "undefined") \ { \ offset = -20; \ } \ \ var ele = document.getElementById(id); \ if (ele != null) \ { \ ele.scrollIntoView(true); \ window.scrollBy(0, offset); \ } \ } \ \ function setVisibleSuggestion(visible) \ { \ var display = visible != true ? "none" : ""; \ var els = document.querySelectorAll(".copy"); \ for (var i = 0; i < els.length; i++) \ { \ if (els[i].id.indexOf("showwalletkeys") < 0 && els[i].id != "abuse_report" \ && els[i].id != "moderator_announcement") \ { \ if (els[i].style.display != display) \ { \ els[i].style.display = display; \ } \ } \ } \ } \ \ function showSuggestion() \ { \ setVisibleSuggestion(true); \ } \ \ function hideSuggestion() \ { \ setVisibleSuggestion(false); \ } \ \ function hideKeyAppInterval() \ { \ clearInterval(itvIdHideKeyApp); \ itvIdHideKeyApp = setInterval(hideKeyApp, itvTime); \ } \ \ function hideKeyGameInterval() \ { \ clearInterval(itvIdHideKeyGame); \ itvIdHideKeyGame = setInterval(hideKeyGame, itvTime); \ } \ \ function hideKeyFaqInterval() \ { \ clearInterval(itvIdHideKeyFaq); \ itvIdHideKeyFaq = setInterval(hideKeyFaq, itvTime); \ } \ \ function hideKeySupportInterval() \ { \ clearInterval(itvIdHideKeySupport); \ itvIdHideKeySupport = setInterval(hideKeySupport, itvTime); \ } \ \ function hideKeyPromoInterval() \ { \ clearInterval(itvIdHideKeyPromo); \ itvIdHideKeyPromo = setInterval(hideKeyPromo, itvTime); \ } \ \ function sortKeyInterval() \ { \ clearInterval(itvIdSortKey); \ itvIdSortKey = setInterval(sortKey, itvTime); \ } \ \ function pressHideSuggestion() \ { \ document.addEventListener("keydown", function(e) { \ if (e.keyCode == 27) { \ if (parent != null) \ { \ parent.hideSuggestionsBox(); \ } \ else \ { \ hideSuggestionsBox(); \ } \ } \ return false; \ }); \ } \ pressHideSuggestion(); \ \ function moveSuggestionBox() \ { \ var td = document.querySelector(".progress > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(3)"); \ if (td != null && td.textContent.trim() == "") \ { \ td.innerHTML = ""; \ var div = document.querySelector("#suggestionmain > div:nth-child(4)"); \ if (div != null) \ { \ var br = div.querySelector("br"); \ if (br != null) \ { \ div.removeChild(br); \ } \ td.innerHTML = div.outerHTML; \ td.style.padding = "0px"; \ div.innerHTML = ""; \ \ var textarea = document.querySelector("form.lbAction > div:nth-child(1) > textarea:nth-child(1)"); \ if (textarea != null) \ { \ textarea.focus(); \ textarea.style.height = textarea.scrollHeight + "px"; \ textarea.style.width = "98%"; \ textarea.style.marginLeft = "0px"; \ } \ } \ } \ } \ \ function hideStrNotMatch() \ { \ var display = "none"; \ \ var searchStr = decodeURIComponent(document.documentURI.replace(/^.*search_input=/i,"").replace(/&.*$/i,"")) \ .replace(/\\+/g," ").trim(); \ searchStr = searchStr.toLowerCase(); \ \ var eleStrs = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr > td:nth-child(1) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(1)"); \ for (var i = 0; i < eleStrs.length; i++) \ { \ try \ { \ var valStr = eleStrs[i].textContent.trim().toLowerCase(); \ if (valStr != searchStr) \ { \ var eleTarget = eleStrs[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; \ if (eleTarget.style.display != display) \ { \ eleTarget.style.display = display; \ } \ } \ } \ catch (ex) \ { \ } \ } \ } \ \ function hideStrNotMatchInterval() \ { \ clearInterval(itvIdHideStrNotMatch); \ itvIdHideStrNotMatch = setInterval(hideStrNotMatch, itvTime); \ } \ \ function hideStrLong() \ { \ var display = "none"; \ var dot = "..."; \ var dotLengthMinus = 0 - dot.length; \ \ var eleStrs = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr > td:nth-child(1) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(2) > td:nth-child(1)"); \ for (var i = 0; i < eleStrs.length; i++) \ { \ try \ { \ var valStr = eleStrs[i].textContent.trim(); \ if (valStr.substr(dotLengthMinus) == dot) \ { \ var eleTarget = eleStrs[i].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; \ if (eleTarget.style.display != display) \ { \ eleTarget.style.display = display; \ } \ } \ } \ catch (ex) \ { \ } \ } \ } \ \ function hideStrLongInterval() \ { \ clearInterval(itvIdHideStrLong); \ itvIdHideStrLong = setInterval(hideStrLong, itvTime); \ } \ \ function clickToSelect(ele) \ { \ var range = document.createRange(); \ range.setStartBefore(ele.firstChild); \ range.setEndAfter(ele.lastChild); \ var sel = window.getSelection(); \ sel.removeAllRanges(); \ sel.addRange(range); \ } \ \ function syncUrlArray() \ { \ var displayNone = "none"; \ var strStart = "showSuggestionsBox( \'"; \ var strEnd = "\' ); return false;"; \ var strCur = "&list_id="; \ var strAll = "&endnext="; \ var regPos = /&list_id=\\d+&endnext=\\d+/g; \ var isEdit = false; \ var eleDivs = []; \ var urls = []; \ \ var trKeys = document.querySelectorAll("#keylist > table:nth-child(1) > tbody:nth-child(1) > tr"); \ for (var i = 0; i < trKeys.length; i++) \ { \ if (trKeys[i].style.display != displayNone) \ { \ var eleDiv = trKeys[i].childNodes[0].childNodes[0]; \ if (typeof eleDiv.getAttribute != "undefined" \ && eleDiv.getAttribute("onclick") != null) \ { \ eleDivs.push(eleDiv); \ } \ } \ } \ \ for (var i = 0, l = eleDivs.length; i < l; i++) \ { \ var evOld = eleDivs[i].getAttribute("onclick"); \ if (evOld != null) \ { \ var url = evOld.replace(strStart,"").replace(strEnd,"").replace(regPos,""); \ url = url + strCur + i + strAll + l; \ urls.push(url); \ \ var evNew = strStart + url + strEnd; \ if (evOld != evNew) \ { \ eleDivs[i].setAttribute("onclick", evNew); \ isEdit = true; \ } \ } \ } \ \ if (isEdit || typeof URLarray == "undefined" || URLarray.length != urls.length) \ { \ URLarray = urls; \ } \ } \ \ function doInstant() \ { \ var url = document.documentURI; \ if (url.indexOf("user_activity.php") > -1) \ { \ showSuggestion(); \ \ document.addEventListener("DOMContentLoaded", function (e) \ { \ if (typeof $ != "undefined") \ { \ $(".dial").hide(); \ setTimeout(function() \ { \ /* Restore drawing progress */ \ $(function() { \ $(".dial").knob({ \ "draw" : function () { \ $(this.i).val(this.cv + "%"); \ $(".dial").show(); \ } \ }) \ }) \ }, 50); \ } \ }); \ } \ else if (url.indexOf("translate.php") > -1) \ { \ setInterval(function() \ { \ syncUrlArray(); \ }, itvTime); \ } \ \ } \ doInstant(); \ \ '; var eleClientScript = document.createElement("script"); eleClientScript.innerHTML = clientScript; document.head.appendChild(eleClientScript); attachOnReady(main); // End
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址