Google Images Randomizer

try to take over the world!

  1. // ==UserScript==
  2. // @name Google Images Randomizer
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://*/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /**
  12. *
  13. *
  14. */
  15.  
  16. ////////////////////////////////////////////////////////////////////////
  17. // RANDOM-GOOGLE-IMAGES.JS //
  18. ////////////////////////////////////////////////////////////////////////
  19.  
  20. (function(){
  21. 'use strict';
  22.  
  23. /*
  24. USAGE:
  25. ..
  26. */
  27.  
  28. const host = document.querySelector('#sfdiv');
  29. const ston = (s)=>Number('0x'+s);
  30. const mask = (l)=>ston('ffffffffffffffff'.substr(0,l||0));
  31. const rand_fd = function(l,e){
  32. return Math.floor(Math.random()*mask(l)).toString(16)+e;
  33. };
  34.  
  35. const next = ()=>'https://www.google.de/search?client=windows&hs=8TF&tbm=isch&sa=1&q=%22'+rand_fd(8,'.')+'%22';
  36. window.rurl = next();
  37.  
  38. ////////////////////////////////////////////////////////////////////////
  39.  
  40. const button = document.createElement('div');
  41.  
  42. button.innerHTML=`
  43. <div id="random_web" onclick="window.location.href=rurl">
  44. <style>
  45. #random_web {
  46. width: 35px;
  47. height: 35px;
  48. background-color: gray;
  49. background-image: url(https://cdn.discordapp.com/avatars/147556783412477952/50d3f9d47bbe9ec84ce1e157ce812a64.png?size=128);
  50. position: absolute;
  51. background-position: 50%;
  52. z-index: 50000;
  53. background-size: 100%;
  54. top: 5px;
  55. right: -41px;
  56. }
  57. </style>
  58. </div>
  59. `;
  60.  
  61. ////////////////////////////////////////////////////////////////////////
  62.  
  63. host.appendChild(button);
  64.  
  65. })();