[Hadzy] Youtube Comment Analytics

Hadzy - The best youtube comment picker and great tool to search for all comments, open it with 'Activate' menu button

当前为 2020-12-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name [Hadzy] Youtube Comment Analytics
  3. // @namespace https://greasyfork.org/en/users/10118-drhouse
  4. // @version 3.0
  5. // @description Hadzy - The best youtube comment picker and great tool to search for all comments, open it with 'Activate' menu button
  6. // @include https://www.youtube.com/watch?*
  7. // @include https://hadzy.com/analytics/youtube/
  8. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  9. // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @grant GM_registerMenuCommand
  13. // @author drhouse
  14. // @icon https://www.google.com/s2/favicons?domain=youtube.com
  15. // ==/UserScript==
  16. this.$ = this.jQuery = jQuery.noConflict(true);
  17.  
  18. (function($){
  19.  
  20. GM_registerMenuCommand("Activate", function(){
  21. if (location !== "https://hadzy.com/analytics/youtube/"){
  22. var here = window.location.href;
  23. GM_setValue("ytube", here);
  24. window.location.href = 'https://hadzy.com/analytics/youtube/';
  25. }
  26. }, "A");
  27.  
  28. if (window.location.href === 'https://hadzy.com/analytics/youtube/'){
  29. var storedObject = GM_getValue("ytube");
  30. var target1 = $('.MuiInputBase-input');
  31. var target2 = $('.MuiButtonBase-root');
  32. $(target1).val(storedObject);
  33. $(target2).click();
  34. setTimeout(function(){
  35. var loadButton = $('.MuiButtonBase-root.MuiFab-root');
  36. $(loadButton).click();
  37. }, 1000);
  38.  
  39. function waitForElementToDisplay(selector, time) {
  40. if($(selector)!=null) {
  41. $(selector).click();
  42. return;
  43. }
  44. else {
  45. setTimeout(function() {
  46. waitForElementToDisplay(selector, time);
  47. }, time);
  48. }
  49. }
  50.  
  51. var target3 = "div.MuiPaper-root > div.MuiCardContent-root > button"
  52. waitForElementToDisplay(target3, 1000)
  53. var target4 = "div.MuiCardContent-root > a:nth-child(2) > button";
  54. waitForElementToDisplay(target4, 1000)
  55. }
  56. })(jQuery);