【发布时间】:2014-06-21 11:37:38
【问题描述】:
我一直在为 Youtube 开发一个 JavaScript sn-p,它使用 Greasemonkey,还导入了 Bootstrap 和 jQuery 库。此应用程序必须为每个搜索列表结果添加一个按钮,并且当用户单击它时,它必须将用户上传的视频从他的频道带入。我已经测试了这个按钮,它在 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,但始终无法正常工作。
【问题讨论】:
-
您如何尝试“查看”代码?什么版本的 Greasemonkey? (GM 2 刚刚发布,它改变了一些事情。)
-
你好@BrockAdams,我正在尝试使用 Firebug 1.12.18 定位和调试我的代码,而我正在使用 GM 1.15。
-
这个问题与"How to debug Greasemonkey script with the Firebug extension?" then 是重复的。除了 FF 30 给人们带来悲伤。如果有人没有打败我,稍后会调查。
-
是的,它确实如此,这就是我重新发布该问题的原因。我一直在搜索的解决方案都不适用于所有其他 Firefox 版本较旧的版本。
标签: jquery twitter-bootstrap debugging firefox greasemonkey