// ==UserScript== // @name MALFunction - "Fix" ERRORS on MAL + Text AutoSaver // @namespace MALFunction // @version 1.0.21 // @description When MAL bugs showing ERROR messages or is blank and doesn't load the script reloads the page until MAL is successfully loaded... The script also AutoSaves any text that you are writing on MAL so that you will never again lose an UnSubmitted text! // @author hacker // @noframes // @match https://myanimelist.net/* // @icon https://t3.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=http://myanimelist.net&size=64 // @grant GM_setValue // @grant GM_getValue // @run-at document-end // @downloadURL none // ==/UserScript== // the text "ㅤㅤ" contains the right to left mark use to bypass mal character counter (function() { 'use strict'; if ((document.querySelector("body").innerHTML.length < 3100 && document.body.innerText.search('Please click "Submit" to verify that you are not a bot.') === -1 && (location.href.match('ajaxtb') === null)) || (document.title.match(/500 Internal Server Error|504 Gateway Time-out|ERROR: The request could not be satisfied/) !== null)) { location.reload(); //Reloads the page } //Finishes the if condition if (document.querySelector('div > h1:not(.forum_locheader)') !== null && document.querySelector('div > h1:not(.forum_locheader)').innerText.match(/400 Invalid recaptcha.|400 Bad Request/) !== null && document.querySelector('div > h1:not(.forum_locheader)').innerText.match(/400 Invalid recaptcha.|400 Bad Request/)[0] !== '') { window.history.back(); //Go Back } //Finishes the if condition if (document.body.innerText.search('Please click "Submit" to verify that you are not a bot.') > -1) { setTimeout(function() { //Starts the setTimeout function when the "website finishes loading" document.querySelector("#reform").requestSubmit(); //Auto "click on the submit button" }, 0); //Finishes the setTimeout function setTimeout(function() { //Starts the setTimeout function after 20 secs, and reload the page to see if we are already able to use MAL or if we need to resubmit again location.reload(); //Reloads the page }, 20000); //Finishes the setTimeout function } //Finishes the if condition var SpanElements = document.querySelectorAll("span"); //Get all span elements on the page for (var i = SpanElements.length; i--;) { //For every single span element if (SpanElements[i].style.fontSize !== undefined) { //Check if the element has the font-size css attribute if (parseInt(SpanElements[i].style.fontSize) > 1000) { //If the element has the font-size css attribute and the font-size css value is bigger than 1000% SpanElements[i].style.fontSize = '1000%'; //Change the span element font-size css attribute to be only 1000% } //Finishes the if condition } //Finishes the if condition } //Finishes the for condition if (location.href.match('https://myanimelist.net/profile/') !== null || location.href.match('comtocom.php') !== null) //If the url is an profile or comments page { //Starts the if condition var ProfileComments = document.querySelectorAll('div[id*="comtext"]'); //Get all span elements on the page for (i = ProfileComments.length; i--;) { //For every single span element ProfileComments[i].setAttribute('style', 'overflow:hidden !important;'); } //Finishes the for condition } //Finishes the if condition if (location.href.match('login.php') === null) //If the url ISN'T the mal login page { //Starts the if condition document.body.onkeyup = function() { //Detects when the user is writing on the page var FocusedElementText = document.activeElement.value; //Save the actual focused element txt to a variable var FocusedElementclassName = document.activeElement.className; //Save the actual focused element className to a variable if (FocusedElementText !== '' && FocusedElementText !== undefined && FocusedElementclassName.match(/^inputtext js-advancedSearchText$|^inputtext fl-l$/) === null) //If the focused element contains text and is not = undefined, and isn't the search bar { //Starts the if condition GM_setValue("Recovered text", FocusedElementText); //Save the text that is being written } //Finishes the if condition }; //Finishes the onkeypress advent listener window.addEventListener('mousedown', function(e) { //Detects when the user middle clicks on the page if (e.button === 1 && document.activeElement.value !== undefined) { //Starts the if condition If the middle mouse button was clicked and the focused element is not = undefined document.activeElement.value = GM_getValue("Recovered text"); //Add the text that the script recovered previously to the element that is actually focused e.preventDefault(); //Prevent the default middle button action from executing } //Finishes the if condition }); //Finishes the mousedown advent listener } //Finishes the if condition })();