Skip to content

Instantly share code, notes, and snippets.

@0mg
Created September 21, 2010 11:42
Show Gist options
  • Select an option

  • Save 0mg/589554 to your computer and use it in GitHub Desktop.

Select an option

Save 0mg/589554 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Twitter No XSS
// @include http://twitter.com/*
// @include https://twitter.com/*
// ==/UserScript==
["load", "unload", "click", "dblclick", "mousedown", "mouseup", "mouseover",
"mousemove", "mouseout", "focus", "blur", "keypress", "keydown", "keyup",
"submit", "reset", "select", "change"].
forEach(function(s) {
window.addEventListener(s, function(v) {
if (v.target instanceof Element &&
v.target.parentNode.className === "entry-content") {
v.stopPropagation();
}
}, true);
});
addEventListener("DOMContentLoaded", function(v) {
var entryContent = document.evaluate('//span[@class="entry-content"]//a',
document, null, 7, null);
for (var i = 0; i < entryContent.snapshotLength; ++i) {
var tweetUrl = entryContent.snapshotItem(i);
var href = tweetUrl.href;
while (tweetUrl.hasAttributes()) {
tweetUrl.removeAttribute(tweetUrl.attributes[0].nodeName);
}
tweetUrl.href = href;
}
}, false);
@Korb
Copy link

Korb commented Jul 27, 2022

What exactly does this script do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment