【发布时间】:2019-10-28 02:13:47
【问题描述】:
我可以使用 jQuery 来添加 Removed += 1 就像它在顶部函数中使用的一样吗?如果属性被删除,我可以让它只加1吗?
window.onload = function() {
let Removed = 0
const anchorElements = document.getElementsByTagName('A')
for (element of anchorElements) {
if (!element.getAttribute('ping')) continue
console.log("Removed ping: " + element.getAttribute('ping'))
element.removeAttribute('ping')
Removed += 1
chrome.extension.sendMessage(Removed)
}
}
link();
function link(){
jQuery("a[onclick*='ga']").removeAttr('onclick');
jQuery("a[onclick*='_gaq.push']").removeAttr('onclick');
jQuery("link[rel*='pingback']").removeAttr('rel');
}
【问题讨论】:
-
不清楚你在问什么,因为我们不知道这段代码在哪里运行,也不知道你想让你的 jQuery 在哪里运行。
标签: google-chrome google-chrome-extension firefox-addon firefox-addon-webextensions browser-extension