我正在为维基百科制作GreaseMonkey脚本。这是我正在使用的代码:
// ==UserScript==
// @name wikipedia
// @namespace wikipedia
// @include http://es.wikipedia.org/wiki/*
// @version 1
// @grant GM_addStyle
// @require http://code.jquery.com/jquery.min.js
// ==/UserScript==
$(document).ready(function(){
$("#mw-panel").remove();
$("#localNotice").remove();
$("#mw-head").remove();
$("#mw-head-base").remove();
$("#mw-page-base").remove();
$("#footer").remove();
$("span[class=\"editsection\"]").remove();
$("#mw-articlefeedback").remove();
$("#content").css("margin-top", "0px");
$("#content").css("margin-left", "0px");
$("#content").css("padding", "0px");
$("body").css("font-family", "Droid Sans");
});
这样可以正常工作,但是这行没有达到预期效果,即删除文章反馈对话框。
$("#mw-articlefeedback").remove();
为什么这不起作用?
答案 0 :(得分:2)
在页面加载后稍后动态添加。
将$(document).ready
替换为$(window).load
如果这不起作用,那么只需几秒钟就可以在setTimeout
内添加代码。