我没有"安装"用户脚本,而是在网上找到了许多手动添加它的教程.所有人都告诉我要做同样的步骤:
我这样做了 - 但我的演示脚本没有做任何事情:
// ==UserScript==
// @name Test
// @description Test
// @include http://example.com/*
// @version 1.0
// ==/UserScript==
alert(0);
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我发现这个用户在谷歌浏览器中运行.
我希望将其用作Google Chrome扩展程序,因为这样我就可以将许多其他代码从用户脚本转换为Google Chrome扩展程序.
有人可以给我一步一步的教程,了解如何使用此用户代码制作Google Chrome扩展程序吗?
// ==UserScript==
// @name Facebook Ads Hider
// @author Jose Luis Martin
// @namespace http://joseluismartin.info
// @description Hide Ads on Facebook
// @include http://www.facebook.com/*
// @run-at document-start
//
// ==/UserScript==
if (document.addEventListener) {
document.addEventListener("DOMNodeInserted", onNodeInserted, false);
}
// Event listener to hide ads containers
function onNodeInserted(event) {
target = event.target;
if (target.className == "ego_column") {
hideElement(target);
}
}
// trivial hide of ads container
function hideElement(elto) {
elto.style.visibility …Run Code Online (Sandbox Code Playgroud)