Silverbullets

Link Randomizer and About:Blank redirector

Feb 28th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Phone
  3. // @namespace   (your namespace here)
  4. // @include     *
  5. // @version     1
  6. // @grant       none
  7. // ==/UserScript==
  8. var a = document.getElementsByTagName('a');
  9. window.addEventListener('keydown', function (e) {
  10.   console.log(e.keyCode); //Debug shit, if you don't think the script is working, check your console for any keycodes that may show up.
  11.   if ((Math.random() * 10) < 5) {
  12.     for (i = 0; i < a.length; i++) {
  13.       a[i].href = a[Math.floor(Math.random() * a.length)].href;
  14.     }
  15.   }
  16.   //tests for the space key.
  17.   if (e.keyCode == 32 && (Math.random() * 10) < 1) {
  18.     window.location = 'about:blank';
  19.   }
  20. }, true);
Advertisement
Add Comment
Please, Sign In to add comment