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.

Fra og med 28.12.2015. Se den nyeste version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @version      1.0.1
// @author       Nmaster64
// @namespace    http://twitter.com/nmaster64
// @match        http://*.rainwave.cc/*
// @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
// @require      https://code.jquery.com/jquery.min.js
// ==/UserScript==

jQuery(document).ready(function($) {
    
    function addGlobalStyle(css) {
        var stylesId = 'tm-custom-styles';
        if($('#'+stylesId).length < 1) {
            $('<style>').attr('id', stylesId).attr('type', 'text/css').html('').appendTo($('head'));
        }
        $('#'+stylesId).append(css);
    }
    
    addGlobalStyle('body.full div.panel.requests.pinned { transform:translateX(-100%) !important; }');
    addGlobalStyle('body.full div.panel.requests.pinned ul.request_icons li { visibility:visible !important; opacity:.5; }');
    
    addGlobalStyle('body.full div.panel.requests > div.close:first-child { display:block !important; }');
    addGlobalStyle('body.full div.panel.requests > div.close:first-child > img.close { display:none; }');
    addGlobalStyle('body.full div.panel.requests > div.close:first-child > img.pin { display:block; }');
    addGlobalStyle('body.full div.panel.requests.pinned > div.close:first-child > img.close { display:block; }');
    addGlobalStyle('body.full div.panel.requests.pinned > div.close:first-child > img.pin {  display:none; }');
    
    var $close = $('body.full div.panel.requests > div.close:first-child');
    $close.find('img').addClass('close').clone().attr('src', 'http://i.imgur.com/waouJLl.png').attr('class', 'pin').appendTo($close);
    $close.off().click(function() {
        $('body.full div.panel.requests').toggleClass('pinned');
    });
    
});