dotfiles/.js/com/twitter.js

20 lines
558 B
JavaScript
Raw Normal View History

2016-09-10 19:41:14 +00:00
// 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 });
})
})();