SweClike

More visible active like button

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला 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         SweClike
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  More visible active like button
// @author       flashen
// @match        https://www.sweclockers.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=sweclockers.c....
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    var element = document.getElementsByClassName("like");

    for (var i = 0; i < element.length; i++) {
        element[i].addEventListener("click", buttonClick(i));
    }

    function buttonClick(i) {
        var isLiked = "";
        var isToggle = false;
        var isClassName = document.getElementsByClassName.bind(document);

        return function() {

            if (!isToggle) {

                isToggle = true;

                if (window.getComputedStyle(isClassName("like")[i].children[0]).getPropertyValue("fill") == "rgb(210, 96, 0)") {
                    isLiked = "rgb(210, 96, 0)";
                }

                isClassName('like')[i].setAttribute("style", "background-color: #546678 !important; color: #fff! important; border: 1px solid #424242 !important");
                isClassName('like')[i].children[0].setAttribute("style", "fill: #fff !important");
            } else {
                isToggle = false;

                if (isLiked == 'rgb(210, 96, 0)') {
                    isClassName('like')[i].setAttribute("style", "background-color: #f7f6f5 !important; color: #d26000 !important;");
                    isClassName('like')[i].children[0].setAttribute("style", "fill: #d26000 !important");
                } else {
                    isClassName('like')[i].setAttribute("style", "background-color: #f7f6f5 !important; color: dimgray !important;");
                    isClassName('like')[i].children[0].setAttribute("style", "fill: dimgray !important");
                }
            }
        };
    }
})();