Patreon.lib

Adds Patreon Context Menu

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/14852/93835/Patreonlib.js

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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 सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

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

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

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

$(function() {
    $('<div id="contextMenuContainer" style="display: none; position: fixed; border: 1px solid gray; background: #f3f3f3; width:auto; z-index: 100;"><ul id="contextMenu" style="list-style: none; padding: 0px; font-size: 20px;"><li style="font-size: 20px; cursor: pointer; padding-top: 5px; padding-left: 20px; padding-right: 20px; padding-bottom: 5px; text-align: center;"><a href="https://www.patreon.com/bePatron?patAmt=10&u=2614470" target="_new"><img src="https://orig14.deviantart.net/ca4f/f/2015/039/1/5/oox0e_patreon_logo_shine_by_artbrosean-d8h8tmp.png" height="50px" width="50px"/></a></li></ul></div>').appendTo('body');
    var doubleClicked = false;
    $(document).on("contextmenu", function (e) {
        if(doubleClicked == false) {
            e.preventDefault(); // To prevent the default context menu.
            var windowHeight = $(window).height()/2;
            var windowWidth = $(window).width()/2;
            if(e.clientY > windowHeight && e.clientX <= windowWidth) {
                $("#contextMenuContainer").css("left", e.clientX);
                $("#contextMenuContainer").css("bottom", $(window).height()-e.clientY);
                $("#contextMenuContainer").css("right", "auto");
                $("#contextMenuContainer").css("top", "auto");
            } else if(e.clientY > windowHeight && e.clientX > windowWidth) {
                $("#contextMenuContainer").css("right", $(window).width()-e.clientX);
                $("#contextMenuContainer").css("bottom", $(window).height()-e.clientY);
                $("#contextMenuContainer").css("left", "auto");
                $("#contextMenuContainer").css("top", "auto");
            } else if(e.clientY <= windowHeight && e.clientX <= windowWidth) {
                $("#contextMenuContainer").css("left", e.clientX);
                $("#contextMenuContainer").css("top", e.clientY);
                $("#contextMenuContainer").css("right", "auto");
                $("#contextMenuContainer").css("bottom", "auto");
            } else {
                $("#contextMenuContainer").css("right", $(window).width()-e.clientX);
                $("#contextMenuContainer").css("top", e.clientY);
                $("#contextMenuContainer").css("left", "auto");
                $("#contextMenuContainer").css("bottom", "auto");
            }
            $("#contextMenuContainer").fadeIn(500, FocusContextOut());
            doubleClicked = true;
        } else {
            e.preventDefault();
            doubleClicked = false;
            $("#contextMenuContainer").fadeOut(500);
        }
    });
    function FocusContextOut() {
        $(document).on("click", function () {
            doubleClicked = false; 
            $("#contextMenuContainer").fadeOut(500);
            $(document).off("click");           
        });
    }
    GM_registerMenuCommand('Become a Patron', function() { 
        GM_openInTab("https://www.patreon.com/bePatron?patAmt=10&u=2614470");
    }, 'p');
});