0

I'm writing a small userscript that hides recommended videos in the sidebar for the new material beta design in jquery. it works in firefox and chrome developer console but not in greasemonkey or tampermonkey. i've tried //run-at document-idle,

 $(function(){
});

but it still doesnt work :/. m current code is:

// ==UserScript==
// @name        j,m
// @namespace   hjgfn
// @description g
// @include     https://www.youtube.com/watch?v=eLuBPKSnsxc
// @version     1
// run-at       document-idle
// @grant       none
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js
// ==/UserScript==
$(function(){
   $(".style-scope ytd-compact-video-renderer:contains('Empfohlenes Video')").hide();
});

how can I fix this ?

anideath
  • 11
  • 3
  • Are you sure that jquery is loading? Try just running an alert or something simple in pure javascript and see if that works. If it does, then it's likely that jquery isn't loading. – CalvT Apr 10 '17 at 23:28
  • Also, see here - http://stackoverflow.com/questions/859024/how-can-i-use-jquery-in-greasemonkey - to make sure you can use `@require` – CalvT Apr 10 '17 at 23:30
  • I've used `$(document).ready(function(){ if (jQuery) { // jQuery is loaded alert("Yeah!"); } else { // jQuery is not loaded alert("Doesn't Work"); } });` and it shows that it's loaded – anideath Apr 11 '17 at 00:11
  • `if ('undefined' == typeof window.jQuery) { alert("1") } else { alert("0") }` shows its not loaded – anideath Apr 11 '17 at 00:14
  • 1
    I have got it to working with the waitforkeyelements library :) – anideath Apr 11 '17 at 02:00

0 Answers0