我在飞机上,他们强制每个页面(包括这个 Stack Overflow 页面)在顶部有一个横幅,上面有他们的广告。
这是我在 Firefox 中为我的 UserScript 编写的代码,但它不起作用:
// ==UserScript==
// @name SW Ad remover
// @namespace seangates.com/sw_ad_remover
// @include *
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
// ==/UserScript==
$(document).ready(function(){
$('script[src$="swa.py"]').remove();
$('div[id^="__swa"]').hide();
$('body').css('padding',0);
console.log('working');
});
关于为什么这不起作用的任何想法?即使我将它放在 ready() block 的开头,我什至无法让 console.log 工作。
最佳答案
Greasemonkey does not work with jQuery 1.4.4.
使用 jQuery 1.3.2。
请注意,您必须先卸载然后重新安装脚本,以确保将正确的 jQuery 文件复制到您的 PC。
关于javascript - 删除服务器端生成的横幅广告 - Greasemonkey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4515405/