4

I've been developing a JavaScript snippet for Youtube which uses Greasemonkey, and also imports Bootstrap and jQuery libraries. This application has to add a button for each one of the search list results and when the user clicks it, it must bring the user uploaded videos from his channel. I've tested the button and it works well on Firefox 29.

Nevertheless, recently I updated Firefox to version 30, and now I'm unable to see/debug the code I wrote, although Firefox executes it. I'd like to know, if is there any solution to this issue?

Here is the code if you would like seeing it:

// ==UserScript==
// @name Requerimiento2-2-Guille.user.js
// @description   Rodrigo
// @include         http://www.youtube.com/*
// @include         https://www.youtube.com/*
// @grant           none
// ==/UserScript== 

/* Here it's the Bootstrap and jQuery code pasted (I know it should be done with an include).*/

var boton='<button  style="float:right;" type="button" class="verVideos btn btn-lg yt-uix-button yt-uix-button-size-default yt-uix-button-primary">'+'<span class="glyphicon glyphicon-list"></span>Ver videos del usuario'+
    '</button>';

    $(function(){
        iniciarScript();
    });
    function iniciarScript(){
        $("#search-results li.yt-lockup div.yt-lockup-content").before(boton);
        $("#verVideos").click(mostrarVideosUsr);
    }
    function mostrarVideosUsr(){        
        alert("Se pulso el boton!");
    }

PD: I've tried starting Firefox with other user profile, but it keeps not working.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Matthew
  • 41
  • 1
  • 3
  • How are you trying to "see" the code? What version of Greasemonkey? (GM 2 was just released and it changes things a fair bit.) – Brock Adams Jun 21 '14 at 19:59
  • Hello @BrockAdams, I'm trying to locate and debug my code with Firebug 1.12.18 and I'm using GM 1.15. – Matthew Jun 21 '14 at 22:09
  • This question is a duplicate of ["How to debug Greasemonkey script with the Firebug extension?"](http://stackoverflow.com/q/3490062/331508) then. Except that FF 30 is giving people grief. Will investigate later if somebody doesn't beat me to it. – Brock Adams Jun 21 '14 at 22:18
  • Yes it actually does that's why I reposted the issue. None of the solutions I've been searching works all the other Firefox versions are older. – Matthew Jun 21 '14 at 22:35

2 Answers2

1

The only way I found to do it actually (v.42) is to use the remote debugging system. If you want to reproduce:

  1. create a profile without addon to considerably increase speed.
  2. install greasemonkey addon on it.
  3. use remote debugging: https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop
  4. use another firefox profile to start webIDE, no success in debugging same profile.
  5. distant debug the profile in 1..While selecting go "Open app" > "RUNTIME APPS", select main process.

Your script will appear in the debugger tab under "file://". You will be able to set breakpoints, spy, ...

bewam
  • 31
  • 6
1

Or if you simply want to debug your script then you can use Chrome with Tampermonkey.

Tampermonkey works almost identical to Greasemonkey so if your script works on Tampermonkey it should work on Greasemonkey.

Just remember that if install from file system then you need to enable access for Tampermonkey. See video in the FAQ on how to enable this: http://tampermonkey.net/faq.php#Q204

Nux
  • 9,276
  • 5
  • 59
  • 72