Advertisement
Guest User

RenKoloader 1.1

a guest
Mar 23rd, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     @licstart The following is the entire license notice for the JavaScript code in this page.
  3.    
  4.     This software is intended to restore freedoms to users that were taken by Gelbooru's use of crippleware proprietary scripts.
  5.     RenKoloader - Copyright (C) 2017 CommonJunko
  6.  
  7.     This program is free software: you can redistribute it and/or modify
  8.     it under the terms of the GNU Affero General Public License as
  9.     published by the Free Software Foundation, either version 3 of the
  10.     License, or (at your option) any later version.
  11.  
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU Affero General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU Affero General Public License
  18.     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.    
  20.     @licend The above is the entire license notice for the JavaScript code in this page.
  21. */
  22.  
  23. // ==UserScript==
  24. // @name         RenKoloader
  25. // @namespace    http://tampermonkey.net/
  26. // @version      1.1
  27. // @description  Restores the user's freedoms
  28. // @author       CommonJunko
  29. // @match        http://gelbooru.com/*
  30. // @grant        none
  31. // ==/UserScript==
  32. //WARNING: using this script can effectively double your data consumption. It is not reccomended to use this on a mobile or metered connection.
  33.  
  34. (function() {
  35. "use strict";
  36. function loadItem(){
  37.     //Find the link to the highres image
  38.     var originalImageDom = document.getElementsByTagName('a');
  39.     var originalImageDomItem;
  40.     for (let i = 0; i < originalImageDom.length; i++){
  41.         if (originalImageDom.item(i).text == "Original image"){
  42.             originalImageDomItem = originalImageDom.item(i);
  43.             break;
  44.         }
  45.     }
  46.    
  47.     //Find the antiadblock text
  48.     var textWhere = document.getElementsByTagName('br');
  49.     var textHere;
  50.     var nsaKeywords = /(adblock)|(javascript)/gi;
  51.     const MinaMo = 5;
  52.     for (let i = 0; i < textWhere.length; i++){
  53.         if (nsaKeywords.test(textWhere.item(i).text)){
  54.             textHere = textWhere.item(i);
  55.             break;
  56.         }
  57.     }
  58.    
  59.     //Delete that g-dawful and obnoxious video
  60.     var isVideo = !!(document.getElementById("gelcomVideoPlayer")); //PROTIP for you JS devs out there: the double bang (!!) will return ONLY true/false
  61.     if(isVideo){
  62.     var itemCountainer = document.getElementById("gelcomVideoPlayer");
  63.     itemCountainer.outerHTML = "";
  64.     }
  65.    
  66.     //Insert the iframe
  67.     var fir = document.createElement('iframe');
  68.     var originalURL = originalImageDomItem.href;
  69.     fir.setAttribute('id', 'fir');
  70.     fir.setAttribute('sandbox', 'allow-same-origin');
  71.     fir.setAttribute('src', originalURL);
  72.     fir.style.position = "relative";
  73.     fir.style.height = "75em";
  74.     fir.style.width = "75%";
  75.     var mexicans = document.getElementById('right-col');
  76.     mexicans.parentNode.insertBefore(fir, mexicans);
  77.    
  78.    
  79.     //Find the image that may or may not have shown up
  80.     var isImage = !!(document.getElementById("image"));
  81.     if (isImage){
  82.         var nImageCountainer = document.getElementById("image");
  83.         nImageCountainer.style.display = "none";
  84.     }
  85. }
  86. loadItem();
  87. // window.onload = loadItem; //you should only need that if your script injector is a little stupid
  88. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement