User:Evanultra01/hideimages.js

( function ( mw, $ ){   var hide_regex = /^(?:https?:)?\/\/upload.wikimedia.org\/wikipedia\/(?:en|commons)\//;

function clickHandler ( e ) { e.stopPropagation; e.preventDefault; $( this.firstChild ).unwrap; }

function makeWrapper { return $( ' ', {           'class': 'hide-images-wrapper',            'click': clickHandler        } ); }

$( 'img' ).each( function {        if (hide_regex.test( this.src ) && mw.config.get('wgCanonicalNamespace') == "" && !( this.closest(".mw-indicators") || this.closest(".navbox") || this.closest(".mw-mmv-image") || this.closest(".flagicon") || this.closest(".infobox-data") || this.closest(".ib-chembox") || this.closest(".mbox-image") || this.closest(".editpage-head-copywarn") || this.closest(".unicode"))) { // hide any images that arent ui related that are in mainspace            $( this ).wrap( makeWrapper );        }        $( this ).addClass( 'hide-images-handled' );    } ); }( mediaWiki, jQuery ) );

// previously was less strict but photomontages suck so its back to the original now lol