User:DSquirrelGM/global.js

$('.mw-highlight').removeClass('mw-highlight'); if (mw.config.get('wgAction') === 'delete') { $('#wpReason').removeAttr('value'); }

//mw.loader.load( 'https://dev.fandom.com/wiki/MediaWiki:FD-CSS-VList.js?action=raw&ctype=text/javascript' );

( function { //https://heroicons.dev/#color-swatch const Image_ColorSwatch = '  ' ;

//https://heroicons.dev/#pencil-alt const Image_PencilAlt = '   ' ;

const PageSelector = ' #content .mw-parser-output '; const ColorList = PageSelector + ' #ColorList '; const CSSTokenSeparators = /[\{\}\:\;\0\s\,]/; var s, c , v , CSSTokens ;

if ( $( ColorList ).length > 0 ) { return; }

$( PageSelector ).prepend( '' + Image_ColorSwatch + '' + Image_PencilAlt + ' ' );

//style setting iteration / filters //assumes CSS variable setting intent based on name: // --*-image*, --*-logo* : background image url // --*--rgb : color value triplet for rgb / rgba // --* : any other variable assumed to represent color

var styleSheets = Array.from(document.styleSheets).map(function(styleSheet) {   try {         return Array.from(styleSheet.cssRules);     } catch(e) {         return [];     } });

for ( i = 0 ; i < styleSheets.length ; i++ ) { for ( r = 0 ; r < styleSheets[i].length ; r++ ) { v = styleSheets[i][r].cssText; CSSTokens = v.split(CSSTokenSeparators); for ( d = 0 ; d < CSSTokens.length ; d++ ) { s = CSSTokens[d]; if ( s.startsWith( '--' ) && $( '#CSSVL'+s ).length === 0 ) { c = styleSheets[i][r].style.getPropertyValue(s); if ( s.includes( '-image' ) || s.includes( '-logo' ) ) { $( ColorList ).append( '' + s + ': ' + c + '; ' ); } else if ( s.endsWith( '--rgb' ) ) { $( ColorList ).append( '' + s + ': ' + c + '; ' ); } else { $( ColorList ).append( '' + s + ': ' + c + '; ' ); } } } } } } );