[Hadzy] Youtube Comment Analytics

Hadzy - The best youtube comment picker and great tool to search for all comments, open it with 'Activate' menu 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         [Hadzy] Youtube Comment Analytics
// @namespace    https://greasyfork.org/en/users/10118-drhouse
// @version      3.1
// @description  Hadzy - The best youtube comment picker and great tool to search for all comments, open it with 'Activate' menu button
// @include      https://www.youtube.com/watch?*
// @include      https://hadzy.com/analytics/youtube/
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require      https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @author       drhouse
// @icon         https://www.google.com/s2/favicons?domain=youtube.com
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);

(function($){

    GM_registerMenuCommand("Activate", function(){
        if (location !== "https://hadzy.com/analytics/youtube/"){
            var here = window.location.href;
            GM_setValue("ytube", here);
            // window.location.href = 'https://hadzy.com/analytics/youtube/';
            window.open('https://hadzy.com/analytics/youtube/');
        }
    }, "A");

    if (window.location.href === 'https://hadzy.com/analytics/youtube/'){
        var storedObject = GM_getValue("ytube");
        var target1 = $('.MuiInputBase-input');
        var target2 = $('.MuiButtonBase-root');
        $(target1).val(storedObject);
        $(target2).click();
        setTimeout(function(){
            var loadButton = $('.MuiButtonBase-root.MuiFab-root');
            $(loadButton).click();
        }, 1000);

        function waitForElementToDisplay(selector, time) {
            if($(selector)!=null) {
                $(selector).click();
                return;
            }
            else {
                setTimeout(function() {
                    waitForElementToDisplay(selector, time);
                }, time);
            }
        }

        var target3 = "div.MuiPaper-root > div.MuiCardContent-root > button"
        waitForElementToDisplay(target3, 1000)
        var target4 = "div.MuiCardContent-root > a:nth-child(2) > button";
        waitForElementToDisplay(target4, 1000)
        //#root > div > div.MuiPaper-root.MuiCard-root.sc-kAzzGY.jujnLM.MuiPaper-elevation1.MuiPaper-rounded > div.MuiCardContent-root.sc-kGXeez.dVnFSi > a:nth-child(2) > button
    }
})(jQuery);