Tumblr Fullsize Script

Shows fullsize Image in new tab when pressing F8 while hovering over it

This script is marked as "broken" and is likely not working
Details: Tumblr no longer provides full resolutions
Click here to install Browse More Scripts
// ==UserScript==
// @name         Tumblr Fullsize Script
// @namespace    641ce31663edc6364cfdf8ca3c17b4018a0fa97e
// @version      0.1
// @description  Shows fullsize Image in new tab when pressing F8 while hovering over it
// @author       /u/AyrA_ch
// @match        http://*.tumblr.com/*
// @match        https://*.tumblr.com/*
// @grant        none
// @expired      true
// @broken       Tumblr no longer provides full resolutions
// ==/UserScript==

(function ($, $$) {
	'use strict';
	var urlfilter = /^https?:\/\/\d+\.media\.tumblr\.com\/[a-f0-9]{32}\/tumblr_\w+_\d+\.\w+$/i;

	var display = function (src) {
		if (src.match(urlfilter)) {
			var u = new URL(src);
			u.hostname = "data.tumblr.com";
			u.pathname = u.pathname.replace(/_\d+\./, "_raw.");
			var a = document.createElement("a");
			a.href = u.href;
			a.target = "_blank";
			a.textContent = "Open Image in new Tab";
			a.click();
		}
	};

	var currentElement = null;

	document.body.addEventListener("mouseover", function (e) {
		currentElement = e.target;
	});

	document.body.addEventListener("keydown", function (e) {
		if (currentElement && e.keyCode === 119 /*F8*/) {
			if (currentElement.tagName.toLowerCase() === "img") {
				console.log("Current Element:", currentElement);
				e.stopPropagation();
				e.preventDefault();
				if (currentElement.src) {
					display(currentElement.src);
				}
			}
		}
	});
})(document.querySelector.bind(document), document.querySelectorAll.bind(document));

/*
LICENSE:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
The full license text can be found here: http://creativecommons.org/licenses/by-nc-sa/4.0/
The link has an easy to understand version of the license and the full license text.

DISCLAIMER:
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

Copyright © 2018 by Kevin Gut 📧 | More services | Generated for 3.145.7.245