jquery - 如何在 Firefox 30 上调试 Greasemonkey 脚本?

标签 jquery twitter-bootstrap debugging firefox greasemonkey

我一直在为 Youtube 开发一个 JavaScript 片段,它使用 Greasemonkey,并且还导入了 Bootstrap 和 jQuery 库。该应用程序必须为每个搜索列表结果添加一个按钮,当用户单击该按钮时,它必须带出用户从其 channel 上传的视频。我已经测试过该按钮,它在 Firefox 29 上运行良好。

尽管如此,最近我将 Firefox 更新到了版本 30,现在我无法查看/调试我编写的代码,尽管 Firefox 会执行它。我想知道这个问题有什么解决办法吗?

如果您想查看以下代码:

// ==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:我尝试使用其他用户配置文件启动 Firefox,但始终无法正常工作。

最佳答案

我发现实际执行此操作的唯一方法(v.42)是使用远程调试系统。如果您想重现:

  1. 创建一个不带插件的配置文件以显着提高速度。
  2. 在其上安装greasemonkey插件。
  3. 使用远程调试:https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Debugging_Firefox_Desktop
  4. 使用另一个firefox配置文件启动webIDE,调试相同的配置文件没有成功。
  5. 远程调试1中的配置文件。选择“打开应用程序”>“运行时应用程序”时,选择主进程。

您的脚本将出现在“file://”下的调试器选项卡中。您将能够设置断点、监视……

关于jquery - 如何在 Firefox 30 上调试 Greasemonkey 脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24341199/

相关文章:

javascript - 如何在 jquery-mobile/phonegap 的 $(document).ready()/onDeviceReady() 上加载脚本

jquery - TableSorter + AJAX从MySQL获取数据

javascript - 将 Bootstrap-select 与 MVC 下拉列表一起使用

html - Bootstrap 新手;我怎样才能清理这段代码+达到预期的效果?

debugging - Firebug 调试在不存在的断点上跳转/中断!

vba - 单元格内容自动移动到另一张纸上的同一单元格

javascript - 是否可以使用 ie 选项卡 View 在 chrome 上调试 javascript?

javascript - Select2minimumInputLength在append()之后不起作用

javascript - 在每个 ng-repeat 之后添加元素

javascript - MooTools 拖动/ slider 无法正常运行