6nw-button

le

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        6nw-button
// @namespace   4077
// @match       *://*.bnw.im/*
// @version     0.21
// @description le
// @grant       none
// ==/UserScript==


var sixnw = '6nw.im';

var btn_styles = [
    ['😐', '#09d'], // bnw
    ['😎', '#333']  // 6nw
];

var btn_click = function () {
    iframe.toggle();
    var mode = +iframe.is(':visible');
    button.html(btn_styles[mode][0]);
    button.css('background-color', btn_styles[mode][1]);
    if (mode) {
        iframe.attr('src', location.protocol+'//'+sixnw+location.pathname+location.hash);
    }
}

$('<style />', {
    type: 'text/css',
    text: '\
      #sixnw-iframe {\
        position: fixed;\
        top: 0;\
        left: 0;\
        width: 100%;\
        height: 100%;\
        z-index: 10000;\
        border: 0;\
        display: none;\
      }\
      #sixnw-button {\
        position: fixed;\
        top: 10px;\
        right: 10px;\
        width: 40px;\
        height: 40px;\
        z-index: 10001;\
        font-size: 30px;\
        color: #eee;\
        background-color: '+btn_styles[0][1]+';\
        text-shadow: 1px 1px 1px #ddd;\
        box-shadow: 2px 2px 2px #333;\
        border-radius: 10px;\
        text-align: center;\
        vertical-align: middle;\
        line-height: 40px; \
        cursor: pointer;\
      }'
}).appendTo('head');

var button = $('<div />', {
    id: 'sixnw-button',
    html: btn_styles[0][0],
    click: btn_click
});

var iframe = $('<iframe />', {
    id: 'sixnw-iframe',
    src: ''
});

$('body').append(button).append(iframe);