Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         Phuks!
  3. // @namespace    https://phuks.co
  4. // @version      0.1
  5. // @description  Browser add-on for Phuks!
  6. // @author       Phuk you buddy
  7. // @match        https://phuks.co
  8. // @match        https://phuks.co/alt
  9. // @match        https://phuks.co/alt#
  10. // @match        https://phuks.co/alt#/
  11. // @match        https://phuks.co/alt#/*
  12. // @exclude      https://phuks.co/u/*
  13. // @grant        none
  14. // ==/UserScript==
  15.  
  16.  
  17. //  css to make it like a menu item
  18. var style = document.createElement('style');
  19. style.type = 'text/css';
  20. style.innerHTML += '#myButton,#OpenExpandos {cursor: pointer;color:#fff;}';
  21. document.getElementsByTagName('head')[0].appendChild(style);
  22.  
  23. // create Expandos link
  24. var ul = document.querySelector('.pure-menu-list');
  25. var newli = document.createElement('li');
  26. newli.innerHTML = '<a class="pure-menu-link" id="OpenExpandos">Expandos</a>';
  27. newli.setAttribute('class', 'pure-menu-item');
  28. ul.appendChild(newli);
  29.  
  30. // activate link
  31. document.getElementById ("OpenExpandos").addEventListener (
  32.     "click", ButtonClickAction, false
  33. );
  34.  
  35. // find expandos
  36. var geta = document.getElementsByClassName("expando");  // expandos
  37.  
  38. function ButtonClickAction (zEvent) {
  39.     var clickEvent  = document.createEvent ("HTMLEvents");
  40.     clickEvent.initEvent ("click", true, true);
  41.     for(var i = 0; i < geta.length; i++) {
  42.       geta[i].dispatchEvent (clickEvent);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement