如何在Firefox 30上调试Greasemonkey脚本? [英] How to debug Greasemonkey script on Firefox 30?

查看:197
本文介绍了如何在Firefox 30上调试Greasemonkey脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为Youtube开发一个使用Greasemonkey的JavaScript代码片段,并且还引入了Bootstrap和jQuery库。此应用程序必须为每个搜索列表结果添加一个按钮,用户点击该按钮时,必须将用户上传的视频从他的频道中移出。我已经测试了按钮,它在Firefox 29上运行良好。

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.

然而,最近我更新了Firefox到30版,现在我无法看到/调试我写的代码,尽管Firefox执行它。我想知道,如果有任何解决这个问题的解决方案?

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:我已经尝试使用其他用户配置文件启动Firefox,但它保持不能正常工作。

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

推荐答案

或者,如果您只想调试脚本,那么您可以使用Chrome与 Tampermonkey

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

Tampermonkey与Greasemonkey几乎相同,所以如果你的脚本在Tampermonkey上工作,它应该工作在Greasemonkey上。

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

只要记住,如果从文件系统安装,那么您需要启用Tampermonkey的访问。请参阅FAQ中的视频,了解如何启用:
http://tampermonkey.net/faq。 php#Q204

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

这篇关于如何在Firefox 30上调试Greasemonkey脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆