2012-11-18 38 views
1

我正在爲Wikipedia製作一個GreaseMonkey腳本。這裏是我使用的代碼:jquery刪除問題

// ==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

您確定在http://es.wikipedia.org/wiki/上有id = mw-articlefeedback元素嗎?我找不到一個,如果它不是頁面,你可以添加你正在工作的例子鏈接? –

+0

http://es.wikipedia.org/wiki/Computaci%C3%B3n_paralela –

回答

2

它在頁面加載後被動態添加。

更換$(document).ready$(window).load

如果不工作,然後用簡單幾秒鐘增加一個setTimeout內部代碼。

+0

是的。現在工作正常,謝謝。 –