* initial commit
commit
ce4cf78dec
|
@ -0,0 +1,22 @@
|
|||
function getUrl(e) {
|
||||
var target = e.target;
|
||||
console.log(e);
|
||||
while ((target.tagName != "A" || !target.href) && target.parentNode) {
|
||||
target = target.parentNode;
|
||||
}
|
||||
if (target.tagName != "A") return;
|
||||
if (target.href.startsWith("https://t.co")) {
|
||||
let url = '';
|
||||
e.preventDefault();
|
||||
console.log(e.target.children);
|
||||
url = e.target.textContent.replace("…","")
|
||||
if(url.startsWith("http")) {
|
||||
window.open(url, '_blank');
|
||||
} else {
|
||||
window.open(target.href, '_blank'); // opengraph cards don't contain the original URLs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
window.addEventListener("click", getUrl);
|
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Twitter t.co remover",
|
||||
"description": "recovers original URLs where possible",
|
||||
"version": "1.0",
|
||||
"icons": {
|
||||
"64": "icons/icon.png"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"*://*.twitter.com/*",
|
||||
"*://twitter.com/*"
|
||||
],
|
||||
"js": [
|
||||
"content_script.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue