So long t.co

This commit is contained in:
Shadowfacts 2016-09-10 15:41:14 -04:00
parent 8dc3589f02
commit 5c9ff2c02c
No known key found for this signature in database
GPG Key ID: F802198A7D7F309D
2 changed files with 41 additions and 0 deletions

20
.js/com/twitter.js Normal file
View File

@ -0,0 +1,20 @@
// go directly to links, bypassing t.co
(function() {
$("a[data-expanded-url]").each((i, el) => {
el = $(el);
el.attr("href", el.attr("data-expanded-url"));
});
$("ol.stream-items").each((i, list) => {
let observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((it) => {
$(it).find("a[data-expanded-url]").each((i, el) => {
el = $(el);
el.attr("href", el.attr("data-expanded-url"));
});
});
});
});
observer.observe(list, { childList: true });
})
})();

View File

@ -0,0 +1,21 @@
// go directly to links, bypassing t.co
(function() {
$("a[data-full-url]").each((i, el) => {
el = $(el);
el.attr("href", el.attr("data-full-url"));
});
$(".js-chirp-container").each((i, container) => {
let observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((it) => {
$(it).find("a[data-full-url]").each((i, el) => {
el = $(el);
el.attr("href", el.attr("data-full-url"));
});
});
});
});
observer.observe(container, { childList: true });
});
})();