Weinur / Pokemon Sword/Shield trashed files search

// ==UserScript==
// @namespace     https://openuserjs.org/users/Weinur
// @name          Pokemon Sword/Shield trashed files search
// @description   https://gamebanana.com/search?mid=SearchResults&query=&game=7676&section=Skin&vl[page]=1
// @copyright     2021, Weinur (https://openuserjs.org/users/Weinur)
// @license       MIT
// @version       0.0.0
// @author        Weinur
// @match         https://gamebanana.com/search?mid=SearchResults&query=&game=7676&section=Skin&vl[page]=*
// @require       https://code.jquery.com/jquery-3.5.1.min.js
// @run-at        document-start
// @grant         GM_setValue
// @grant         GM_getValue
// @grant         GM_listValues
// ==/UserScript==

var saveItem = "skinsb";
var loadString = "eyIxNzMyMTUiOmZhbHNlLCIxNzMyNDciOnRydWUsIjE3MzI0OSI6ZmFsc2UsIjE3MzI1MSI6ZmFsc2UsIjE3MzI3MiI6ZmFsc2UsIjE3MzI4MiI6ZmFsc2UsIjE3MzI4MyI6ZmFsc2UsIjE3MzI4OCI6ZmFsc2UsIjE3MzI5MiI6ZmFsc2UsIjE3MzI5NSI6ZmFsc2UsIjE3MzI5NyI6ZmFsc2UsIjE3MzMwNCI6ZmFsc2UsIjE3MzMxNCI6ZmFsc2UsIjE3MzMxOSI6ZmFsc2UsIjE3MzMzMCI6ZmFsc2UsIjE3MzMzMyI6dHJ1ZSwiMTczMzM3IjpmYWxzZSwiMTczMzQwIjpmYWxzZSwiMTczMzQ0IjpmYWxzZSwiMTczMzQ2IjpmYWxzZSwiMTczMzQ5IjpmYWxzZSwiMTczMzUwIjp0cnVlLCIxNzMzNTEiOmZhbHNlLCIxNzMzNTMiOmZhbHNlLCIxNzMzNTQiOmZhbHNlLCIxNzMzNTYiOnRydWUsIjE3MzM1NyI6ZmFsc2UsIjE3MzM1OCI6dHJ1ZSwiMTczMzYwIjpmYWxzZSwiMTczMzY0IjpmYWxzZSwiMTczMzY2IjpmYWxzZSwiMTczMzcyIjpmYWxzZSwiMTczMzczIjpmYWxzZSwiMTczNDAwIjpmYWxzZSwiMTczNDA1Ijp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NTE3MyI6ZmFsc2UsIjE4NTIyNyI6ZmFsc2UsIjE4NTMxOCI6ZmFsc2UsIjE4NjIwNiI6ZmFsc2UsIjE4NjQ3NSI6ZmFsc2UsIjE4NjUwNiI6ZmFsc2UsIjE4NjUyMyI6ZmFsc2UsIjE4NjU3MCI6ZmFsc2UsIjE4Njg3MSI6ZmFsc2UsIjE4Nzg5MyI6ZmFsc2UsIjE4ODI5OCI6ZmFsc2UsIjE4OTEzNCI6ZmFsc2UsIjE4OTIwNCI6ZmFsc2UsIjE4OTc1NiI6ZmFsc2UsIjE5MDU4OCI6ZmFsc2UsIjE5MDY0NSI6ZmFsc2UsIjE5MDY0NiI6ZmFsc2UsIjE5MDY3MiI6ZmFsc2UsIjE5MTIxOCI6ZmFsc2UsIjE5MTU1MCI6ZmFsc2UsIi0xIjp0cnVlfQ==";
var currentSkins = JSON.parse(atob(loadString));

function log(message, varName, debug)
{
    if(varName)
    {
        message = varName + ": " + message;
    }
    if(debug) {
        alert(message);
    } else {
        console.log(message);
    }
}

function copyToClipboard (text) {
  if (navigator.clipboard) { // default: modern asynchronous API
    return navigator.clipboard.writeText(text);
  } else if (window.clipboardData && window.clipboardData.setData) {     // for IE11
    window.clipboardData.setData('Text', text);
    return Promise.resolve();
  } else {
    // workaround: create dummy input
    var input = $('<input type="text" value="test">');
    input.val(text);
    document.body.append(input.get(0));
    input.focus();
    input.select();
    document.execCommand('copy');
    input.remove();
    return Promise.resolve();
  }
}

function deleteMe(id)
{
   var record = $(this).closest("record");
   if(!record.length) {
      var ele = "a.weSkinId_" + id;
      record = $(ele).closest("record");
   }
   if(record.length) {
     record.remove();
   }
   log("buja");
}

function save(id, set)
{
    currentSkins[id] = set;
    GM_setValue(id, set);
}

function toInt(number)
{
    var typeOfNumber = typeof number;
    switch(typeOfNumber)
    {
        case "number": return number;
        break;

        case "string": return parseInt(number, 10);
        break;

        case "default": return -1;
        break;
    }
    return -1;
}

function saveItems()
{
    var newSkins = {};
    var skins = currentSkins;
    for (let key of Object.keys(skins)) {
        key = toInt(key);
        let value = skins[key];
        if(value !== undefined) newSkins[key] = value;
    }
    for (let key of GM_listValues()) {
        key = toInt(key);
        let value = GM_getValue(key);
        if(value !== undefined) newSkins[key] = value;
    }
    currentSkins = newSkins;
    var saveString = btoa(JSON.stringify(newSkins));
    localStorage.setItem(saveItem, saveString);
    return saveString;
}

function load()
{
   var saveString = saveItems();
   console.log("saveThis (to clipboard):");
   console.log(saveString);
   copyToClipboard(saveString);
}
load();

function getCurrentSkin(id)
{
    return currentSkins[id];
}

function isBan(id, callback)
{
    var skin = getCurrentSkin(id);
    if(skin !== undefined) {
        if(!skin) callback(id);
        return;
    }
    $.getJSON("https://api.gamebanana.com/Core/Item/Data", {
        itemtype: "Skin",
        fields: "Trash().bIsTrashed()",
        itemid: id,
    }, function(response) {
        log(response, "response");
        var string = response.toString().toLowerCase();
        var good = string.indexOf("true") >= 0;
        save(id, good);
        if(!good) {
            callback(id);
        }
    }).done(function() { log('getJSON request succeeded!'); })
      .fail(function(jqXHR, textStatus, errorThrown) { log('getJSON request failed! ' + textStatus); })
      .always(function() { log('getJSON request ended!');});
}

function getButtonHtml(id, title)
{
    var html = `<div style="float: left; margin-left: 1em;" id="${id}Div"><button type="button" class="ExtendedContentButton" id="${id}Button"><spriteicon class="MiscIcon ShowContentIcon"></spriteicon><span>${title}</span></button></div>`;
    return html;
}

function createButtons(cssStyles) {
   $( ".InfiniteScroller" ).css(cssStyles).after( getButtonHtml("trashedFilesOnly", "Show trashed files only!") )
                                           .after( getButtonHtml("autoScroll", "Show all elements!") );
   $( "#trashedFilesOnlyDiv, #autoScrollDiv" ).css(cssStyles).css("margin-left", "1em");
}

function handler(cssStyles)
{
    if( $( "#trashedFilesOnlyDiv" ).length ) return;
    createButtons(cssStyles);
    $(window).on("scroll", function() {
        if( ! $( "#trashedFilesOnlyDiv" ).length ) createButtons(cssStyles);
        var element = $( ".InfiniteScroller" );
        if(element.length) {
            element.css(cssStyles);
        } else {
            $( "#autoScrollDiv" ).remove();
            $( "#trashedFilesOnlyDiv[style]" ).removeAttr("style");
        }
    });
}

function infiScroller() {
   var infi = $(".InfiniteScroller");
   if(infi.length) {
      infi.get(0).scrollIntoView();
      infi.find("button").trigger("click");
   } else {
      $("body, html").toggleClass("loading", false);
      var element = $( "#trashedFilesOnlyDiv" );
      if(element.length) element.get(0).scrollIntoView();
      return;
   }
   window.setTimeout(infiScroller, 500);
}

function getCss() {
    var style = document.createElement("style");
    style.innerHTML = `
        html.loading {
            overflow-y: hidden;
            pointer-events: none;
        }

        body.not(.loading) .loadingspinner {
            display: none;
        }

        body.loading .loadingspinner {
             pointer-events: none;
             width: 200px;
             height: 200px;
             border: 20px solid transparent;
             border-color: #eee;
             border-top-color: #3E67EC;
             border-radius: 100%;
             animation: loadingspin 1s linear infinite;
             z-index: 10000000000000000000;
             left: calc(50% - 100px);
             top: calc(50% - 100px);
             position: fixed;
             box-sizing: border-box;
        }

        @keyframes loadingspin {
	        100% {
			     transform: rotate(360deg)
	        }
        }

        body.loading {
             height: 100vh;
             margin: 0;
             padding: 0;
             display: flex;
             justify-content: center;
             align-items: center;
             width: 100%;
             overflow-y: scroll;
             display: block;
             pointer-events: none;
       }

       body.loading:after {
           display: block;
           content: "";
           position: absolute;
           top: 0;
           left: 0;
           right: 0;
           bottom: 0;
           background-color: grey;
           pointer-events: none;
           z-index: 999999999999999;
           opacity: 0.5;
       }
   `;
   return $(style);
}

function getLoading()
{
   return $('<div class="loadingspinner"></div>');
}

$(document).ready(function() {
    getCss().appendTo("body");
    getLoading().appendTo("body");
    var cssStyles = {
                 "margin-top": "2em",
                 "margin-bottom": "2em",
                 "float": "left"
              };
    var buttonCss = {
        "background": "#1c272e",
        "color": "var(--DefaultBlueColor)"
    };
    handler(cssStyles);
    $("body").on("click", ".Controls a[title]", function() {
          $(".InfiniteScroller").triggerHandler("check");
    });
    $("body").on("mouseover touchmove touchend touchcancel check", ".InfiniteScroller", function(e) {
        handler(cssStyles);
    });
    $("body").on("click", "#autoScrollDiv", function() {
       var answer = window.confirm("Show all elements? (Ok => Yes)");
       if (!answer) {
            return;
       }
       $("body, html").toggleClass("loading", true);
       infiScroller();
    });
    $("body").on("click", "#trashedFilesOnlyDiv", function() {
        var answer = window.confirm("Show trashed files only? (Ok => Yes)");
        if (!answer) {
            return;
        }
        $("body, html").toggleClass("loading", true);
        var elements = $('records.List recordcell a.Name[href^="https://gamebanana.com/skins/"]');
        var length = elements.length;
        elements.each(function(i) {
            console.log("Element: " + i);
            var that = this;
            var id = $(that).attr("href").split("skins/");
            id = parseInt(id[1], 10);
            $(that).toggleClass("weSkinId_" + id, true);
            setTimeout(function() {
                isBan(id, deleteMe.bind(that));
                if(i + 1 == length) $("body, html").toggleClass("loading", false);
            }, 3600);
        });
        var button = $("#trashedFilesOnlyButton").css(buttonCss);
        setTimeout(function() { button.filter("[style]").removeAttr("style"); }, 700);
        return false;
    });
});