Rainwave v5: Pin Request Pane

Adds a pin/close button to the top-right of the requests pane. Pane stays fully open w/o hovering when pinned.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @version      2.0.0
// @author       Nmaster64
// @namespace    http://twitter.com/nmaster64
// @match        https://*.rainwave.cc/*
// @exclude      /rainwave.cc/(forums|pages|api)/
// @name         Rainwave v5: Pin Request Pane
// @description  Adds a pin/close button to the top-right of the requests pane. Pane stays fully open w/o hovering when pinned.
// @grant        none
// ==/UserScript==

// Helper Functions
var rwAddStyles = function(css) {
    var rwStyle = document.createElement('style');
    rwStyle.textContent = css.join("\n");
    document.head.appendChild(rwStyle);
}
var rwReady = function(cb) {
    if(document.readyState == "complete" || document.readyState == "loaded") {
        cb();
    } else {
        window.addEventListener("load", cb, false);
    }
};

// Style Updates
rwAddStyles([
    'body.full div.panel.requests.pinned { transform:translateX(-100%) !important; background: rgba(38, 39, 42, .9); }',
    'body.full div.panel.requests.pinned ul.request_icons li { visibility:visible; opacity:.5; }',
    'body.full div.panel.requests > div.close { display:block !important; }',
    'body.full div.panel.requests > div.close > img { display:none; }',
    'body.full div.panel.requests > div.close > img.pin  { display:block !important; }',
    'body.full div.panel.requests.pinned > div.close > img { display:block; }',
    'body.full div.panel.requests.pinned > div.close > img.pin {  display:none !important; }',
]);

// Pin Button
rwReady(function() {
    var requestsPane = document.querySelector('body.full div.panel.requests');
    var closeBtn = requestsPane.querySelector('div.close');

    var pinImg = document.createElement('img');
    pinImg.setAttribute('class', 'pin');
    pinImg.setAttribute('src', 'https://rainwave.cc/static/images4/request_pause.png');
    closeBtn.appendChild(pinImg);

    closeBtn.addEventListener('click', function(e) {
        requestsPane.classList.toggle('pinned');
    }, false);
});