// ==UserScript== // @include https://medium.com/* // @include *.medium.com/* // ==/UserScript== (function(opera){ var once = true; var ScriptName = 'medium.com.js'; //e.element.text opera.addEventListener("BeforeExternalScript",function(e){ e.preventDefault(); if (once) once = opera.postError(ScriptName+' block: * '+e.element.src); },false); opera.addEventListener("BeforeScript",function(e){ e.preventDefault(); if (once) once = opera.postError(ScriptName+' block *'); },false); document.addEventListener('DOMContentLoaded',function(){ if (once) once = opera.postError(ScriptName); Array.from(document.querySelectorAll('figure')).forEach(function(f,i){ if (f.outerHTML.indexOf('<noscript')>-1) { var thumb = f.innerText.match(/src="([^"]+)/)[1].replace(/\/max\/\d+\//,'/max/680/'); var img = thumb.replace('/max/680/','/'); var a = document.createElement('a'); f.outerHTML = '<a style="display:block; padding:10px" href="'+img+'"><img src="'+thumb+'"></a>'; } }); },false); })(opera) |