4chan json Image Viewer - Thread Float Link

Float URL to View Thread using "4chan json Image Viewer" (https://greatest.deepsurf.us/en/scripts/418726-4chan-json-image-viewer)

  1. // ==UserScript==
  2. // @name 4chan json Image Viewer - Thread Float Link
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.2
  5. // @description Float URL to View Thread using "4chan json Image Viewer" (https://greatest.deepsurf.us/en/scripts/418726-4chan-json-image-viewer)
  6. // @author Czy [2020]
  7. // @match https://boards.4chan.org/*/thread/*
  8. // @match https://boards.4channel.org/*/thread/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. // #######REQUIRES "4chan json Image Viewer" for full use.
  13.  
  14. // -- keep up to date, may add New Functions in the future.
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19.  
  20. var el ;
  21. function dirco(a){ return window.location.pathname.split("/")[a]};
  22. // displays Thread number (Lower right corner)
  23. var dirhref = dirco(3); // thread number
  24. var dirthread = dirco(1); // thread name
  25.  
  26.  
  27. el =`
  28. <div style="background:#eeeeee; position:fixed; bottom:0px; right:0px;">
  29. <a href="https://a.4cdn.org/`+dirthread+`/thread/`+dirhref+`.json" target="_blank" onclick="window.close();">
  30. <h1>ImgViewer</h1>
  31. </a>
  32. </div>`;
  33.  
  34. //ADDS el to PAGE
  35. document.body.innerHTML += el;
  36. })();