// ==UserScript== // @name Translator Portal Ease of Use // @namespace https://www.roblox.com/games/263761432/Horrific-Housing // @version 1.4.0 // @description Allows you to automate skipping of invalid translations. // @author wut // @match https://www.roblox.com/localization/games/107172930/translations?languageCode=* // @icon https://cdn.discordapp.com/attachments/685584087376986124/859100206297120778/unknown.png // @grant none // @downloadURL none // ==/UserScript== // IS THE SITE LOADED? window.addEventListener("load", function(){ // EXPAND ALL CONTEXT TABS document.querySelectorAll('.section-title')[0].click(); document.querySelectorAll('.section-title')[1].click(); document.querySelectorAll('.section-title')[2].click(); autoskipList = []; autoskipListLength = 0; // CREATING THE SKIP BUTTON skip = document.querySelector('#selenium-save-entry-button').cloneNode( true ); skip.setAttribute('id', 'selenium-skip-button'); document.querySelectorAll('.col-sm-6')[2].appendChild( skip ); skip.innerHTML = "Skip"; document.getElementById("selenium-skip-button").style.marginRight = "10px"; skip.removeAttribute("disabled"); // CREATING THE AUTOSKIP BUTTON autoskipmode = 0; autoskipbtn = document.querySelector('#selenium-save-entry-button').cloneNode( true ); autoskipbtn.setAttribute('id', 'selenium-autoskip-button'); document.querySelectorAll('.col-sm-6')[2].appendChild( autoskipbtn ); autoskipbtn.innerHTML = "Autoskip"; document.getElementById("selenium-autoskip-button").style.marginRight = "10px"; autoskipbtn.removeAttribute("disabled"); autoskipbtn.style.borderColor = "#ff4444" autoskipbtn.style.color = "#ff4444" // DEFINING THE INPUT TEXTBOX inputbox = document.getElementById("selenium-translation-text"); inputbox.style.resize = "none"; // SKIP BUTTON LISTENER FUNCTION document.getElementById("selenium-skip-button").addEventListener("click", function() { // COPYING AND PASTING THE TEXT inputbox.value = document.getElementById("selenium-entry-source-text").innerHTML; inputbox.innerHTML = document.getElementById("selenium-entry-source-text").innerHTML; inputbox.classList.remove("ng-pristine"); inputbox.classList.remove("ng-empty"); inputbox.classList.add("ng-valid"); inputbox.classList.add("ng-not-empty"); inputbox.classList.add("ng-dirty"); inputbox.classList.add("ng-valid-parse"); // MANUAL TEXTBOX UPDATE (IMPORTANT) if ("createEvent" in document) { var evt = document.createEvent("HTMLEvents"); evt.initEvent("change", false, true); inputbox.dispatchEvent(evt); } else { inputbox.fireEvent("onchange"); } // AUTOMATICALLY CLICK SAVE save = document.querySelector('#selenium-save-entry-button'); save.click(); }); document.getElementById("selenium-autoskip-button").addEventListener("click", function() { if (autoskipmode == 0) { autoskipbtn.style.borderColor = "#52ff52" autoskipbtn.style.color = "#52ff52" autoskipmode = 1; // CREATING AUTOSKIP WHITELIST TAB autoskip = document.querySelector('.game-locations-context').cloneNode( true ); autoskip.setAttribute('id', 'autoskip'); document.querySelector('.meta-data-wrapper').appendChild( autoskip ); document.querySelectorAll('.section-title')[3].innerHTML = "Autoskip Locations Whitelist"; autoskipInputContainer = document.querySelector('.translation-input').cloneNode( true ); autoskipInputContainer.setAttribute('id', 'autoskip-input-container'); autoskip.appendChild( autoskipInputContainer ); autoskipInputContainer.style.height = "38px"; document.querySelectorAll('[uib-tooltip]')[16].remove(); document.querySelectorAll('.no-content')[2].remove(); document.querySelectorAll('.pull-right')[14].remove(); autoskipInput = document.querySelectorAll('#selenium-translation-text')[1]; autoskipInput.setAttribute('id', 'autoskip-input'); autoskipInput.setAttribute('placeholder', 'Enter Custom Location Here'); autoskipInput.value = ""; autoskipInput.style.height = "35px"; autoskipInput.style.width = "71.75%"; autoskipInput.style.resize = "none"; autoskipAdd = document.querySelector('#selenium-skip-button').cloneNode( true ); autoskipAdd.setAttribute('id', 'autoskip-add'); autoskipInputContainer.appendChild( autoskipAdd ); autoskipAdd.innerHTML = "Add"; autoskipAdd.style.marginTop = "-33px"; autoskipListClear = autoskipAdd.cloneNode( true ); autoskipListClear.setAttribute('id', 'autoskip-list-clear'); autoskipInputContainer.appendChild( autoskipListClear ); autoskipListClear.innerHTML = "Clear List"; autoskipListClear.style.marginTop = "-33px"; autoskipListClear.style.marginRight = "75px"; // AUTOSKIP ADD BUTTON LISTENER FUNCTION document.getElementById("autoskip-add").addEventListener("click", function() { if (autoskipList.includes(document.querySelectorAll('#autoskip-input')[0].value) == false) { // STORING THE INPUT IN ARRAY autoskipList[autoskipListLength] = document.querySelectorAll('#autoskip-input')[0].value; autoskipListLength += 1; newFilter = document.querySelector('.ellipsis-overflow').cloneNode( true ); autoskipListContainer.appendChild( newFilter ); newFilter.innerHTML = document.querySelectorAll('#autoskip-input')[0].value; document.querySelectorAll('#autoskip-input')[0].value = ""; autoskipListContainer.style.height = 26 * autoskipListLength + "px"; newFilter.style.padding = "3px"; skip.click(); } else { document.querySelectorAll('#autoskip-input')[0].value = "Please fill in a new location!"; autoskipAdd.style.color = "#ff4444"; autoskipAdd.style.borderColor = "#ff4444"; setTimeout(function(){ autoskipAdd.style.color = "#bdbebe"; autoskipAdd.style.borderColor = "#bdbebe"; }, 150); setTimeout(function(){ autoskipAdd.style.color = "#ff4444"; autoskipAdd.style.borderColor = "#ff4444";}, 300); setTimeout(function(){ autoskipAdd.style.color = "#bdbebe"; autoskipAdd.style.borderColor = "#bdbebe";}, 450); setTimeout(function(){ autoskipAdd.style.color = "#ff4444"; autoskipAdd.style.borderColor = "#ff4444";}, 600); setTimeout(function(){ autoskipAdd.style.color = "#bdbebe"; autoskipAdd.style.borderColor = "#bdbebe"; document.querySelectorAll('#autoskip-input')[0].value = ""; }, 750); }; }); autoskipAdd2 = document.querySelector('#autoskip-add').cloneNode( true ); document.querySelectorAll('.collapsible-content')[1].appendChild( autoskipAdd2 ); autoskipAdd2.style.marginTop = "-27px"; document.querySelector('.ellipsis-overflow').style.marginTop = "6px"; autoskipListContainer = document.createElement("div"); autoskip.appendChild( autoskipListContainer ); autoskipListContainer.style.width = "645px" autoskipListContainer.style.height = "0px" //AUTOSKIPADD2 LISTENER autoskipAdd2.addEventListener("click", function() { if (autoskipList.includes(document.querySelector('.ellipsis-overflow').innerHTML) == false) { // STORING THE INPUT IN ARRAY autoskipList[autoskipListLength] = document.querySelector('.ellipsis-overflow').innerHTML; autoskipListLength += 1; newFilter = document.querySelector('.ellipsis-overflow').cloneNode( true ); autoskipListContainer.appendChild( newFilter ); newFilter.innerHTML = document.querySelector('.ellipsis-overflow').innerHTML; autoskipListContainer.style.height = 26 * autoskipListLength + "px"; newFilter.style.padding = "3px"; newFilter.classList.add("skipfilter"); skip.click(); } else { setTimeout(function(){ autoskipAdd2.style.color = "#ff4444"; autoskipAdd2.style.borderColor = "#ff4444"; }, 0); setTimeout(function(){ autoskipAdd2.style.color = "#bdbebe"; autoskipAdd2.style.borderColor = "#bdbebe"; }, 150); setTimeout(function(){ autoskipAdd2.style.color = "#ff4444"; autoskipAdd2.style.borderColor = "#ff4444"; }, 300); setTimeout(function(){ autoskipAdd2.style.color = "#bdbebe"; autoskipAdd2.style.borderColor = "#bdbebe"; }, 450); setTimeout(function(){ autoskipAdd2.style.color = "#ff4444"; autoskipAdd2.style.borderColor = "#ff4444"; }, 600); setTimeout(function(){ autoskipAdd2.style.color = "#bdbebe"; autoskipAdd2.style.borderColor = "#bdbebe"; }, 750); }; }); // CLEARLIST LISTENER autoskipListClear.addEventListener("click", function() { document.querySelectorAll('.skipfilter').forEach(function(elem) { elem.parentNode.removeChild(elem); }); autoskipList = []; autoskipListLength = 0; autoskipListContainer.style.height = 26 * autoskipListLength + "px"; }); } else if (autoskipmode == 1) { autoskipbtn.style.borderColor = "#ff4444" autoskipbtn.style.color = "#ff4444" autoskipmode = 0; document.querySelector('#autoskip').remove(); autoskipAdd2.remove(); document.querySelector('.ellipsis-overflow').style.marginTop = "0px"; autoskipList = []; autoskipListLength = 0; }; }); // AUTOSKIP EXECUTOR const observer = new MutationObserver(mutation => { if (autoskipmode == 1) { if (autoskipList.includes(document.querySelector('.ellipsis-overflow').innerHTML) == true ) { document.getElementById("selenium-skip-button").click(); }; }; }); observer.observe(document.getElementById("selenium-entry-source-text"), { childList: true, attributes: true, subtree: true, characterData: true }); });