// ==UserScript== // @name Tumblr Plain Blog Links // @namespace the.vindicar.scripts // @description Allows you to disable Peepr side panel that pops up when you click on a blog name. // @version 1.1.0 // @run-at document-end // @include http://www.tumblr.com/dashboard // @include https://www.tumblr.com/dashboard // @grant unsafeWindow // @downloadURL none // ==/UserScript== (function(){ //kill_redirects(); disable_links_dashboard(); disable_links_notifications(); disable_links_indash_post_content(); disable_links_post_content(); function kill_redirects() { var re = /https?:\/\/t\.umblr\.com\/redirect\?(?:.+?&)?z=([^&]+)(?:&|$)/; var links = document.getElementsByTagName('a'); var match; for (var i = 0; i < links.length; i++) if (match = re.exec(links[i].getAttribute('href'))) { console.log(links[i].getAttribute('href') + ' -> ' + decodeURIComponent(match[1])); links[i].setAttribute('href', decodeURIComponent(match[1])); } var link_observer = new MutationObserver(function (mutations) { //checking the list of mutations for (var i=0; i ' + decodeURIComponent(match[1])); node.setAttribute('href', decodeURIComponent(match[1])); } } } }); link_observer.observe(document.body, { attributes: false, childList: true, characterData: false, subtree: true, }); } function disable_links_dashboard() { if (typeof unsafeWindow.Tumblr.Events === 'undefined') { console.log('[Tumblr Plain Blog Links] Events object is not ready.'); return; } // we have no way of accessing the object that controls Peepr side-drawer directly. // however, we can track it by Tumblr custom event handlers this object employs, specifically, peepr-open-request event. var events = unsafeWindow.Tumblr.Events._events; var peepr_handlers = events['peepr-open-request']; var peepr = undefined; for (var i=0; i