View difference between Paste ID: H9jFNnqV and 1TNcgPHx
SHOW: | | - or go back to the newest paste.
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 button
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 Expando link
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 button
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-
       a = geta[i].dispatchEvent (clickEvent);
42+
      geta[i].dispatchEvent (clickEvent);
43-
       //a = geta[(i + 1)].dispatchEvent (clickEvent);
43+
44
}