NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name DeviantArt Auto-Zoom // @namespace Yavos' Toolbox // @match *://*.deviantart.com/* // @match *://sta.sh/* // @version 2 // @grant none // @description This script will automatically zoom in all deviations to either their maximum size or to fit the screen if they are too big. (This script will work while browsing as well.) // @oujs:author Yavos // @copyright 2014, Yavos // ==/UserScript== var click = document.createEvent("MouseEvents"); click.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); var devN = 'dev-content-normal'; var devF = 'dev-content-full'; // create an observer instance var observer = new MutationObserver(checkMutations); function resizeImage() { img = document.getElementsByClassName(devN)[0]; img2 = document.getElementsByClassName(devF)[0]; if (img != undefined && img2 != undefined && img2.style.display != 'block') { img.dispatchEvent(click); }; }; function checkMutations(mutations) { mutations.forEach(function(mutation) { var testNodes = mutation.addedNodes; for (var i = 0; i < testNodes.length; ++i) { if (testNodes[i].className == devN) resizeImage(); }; }); }; window.addEventListener ("load", function() { resizeImage(); // select the target node var target = document.body; // configuration of the observer: var config = { subtree: true, childList: true }; // pass in the target node, as well as the observer options observer.observe(target, config); }, false);