1

I am making a GreaseMonkey script for Wikipedia. Here is the code I am using:

// ==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");
});

This works fine, but this line does not have the desired effect, which is remove the articles feedback dialog.

    $("#mw-articlefeedback").remove();

Why does this not work?

4

1 に答える 1

2

Its being added dynamically later on after the page has been loaded.

Replace $(document).ready with $(window).load

If that doesnt work, then simple add your code inside a setTimeout with a couple of seconds.

于 2012-11-18T21:21:12.510 に答える