User:繁星春水/global.js

$(function{ const PageSelector = ' #content .mw-parser-output '; const ColorList = PageSelector + ' #ColorList '; const CSSTokenSeparators = /[\{\}\:\;\0\s\,]/; var $Loaded = Boolean(window.FDCSSVList_Loaded); var $O = Boolean(window.FDCSSVList_Open); var $S = Boolean(window.FDCSSVList_Side); var $T = Boolean(window.FDCSSVList_Text); var s, c , v , CSSTokens ; if (!$Loaded) { $(PageSelector).first.prepend(

'   \  \  \   \  \  \   '

);  if (!$O) { $(ColorList).toggle }   //style setting iteration / filters   //assumes CSS variable setting intent based on name:   //--*-image: 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);       var entry = $( ' ', { id: 'CSSVL'+s , title: s+': '+c , text: s+($T?': '+c:'') , css: { display: 'inline-block' , padding: '0.25em' , margin: '0' , overflow: 'wrap' , wordWrap: 'break-word' , width: '10em' , maxWidth: '10em' , minWidth: '10em' , color: 'var(--theme-page-color)' , textShadow: '1px 1px 2px var(--theme-link-color)' } } );      if ( s.includes('-image') || s.includes('-logo') ) {        entry.css( { backgroundColor: 'transparent' , backgroundPosition: 'left top' , backgroundSize: 'contain' , backgroundRepeat: 'no-repeat' , backgroundImage: c       } );      } else if ( s.endsWith( '--rgb' ) ) {       entry.css( 'backgroundColor', 'rgb(' + c + ')' );      } else {       entry.css( 'backgroundColor', c );      }      $(ColorList).append(entry);     } } } } } window.FDCSSVList_Loaded = true; $Loaded = Boolean(window.FDCSSVList_Loaded); }); importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:PageCreator/code2.js',    ]}); importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:EmeraldGlobalNav.js',
 * root {

--navemerald1: #53bd6d; /* elements */ --navemerald2: #282f3a; /* background */ --navemerald3: #bdcbe2; /* links */ --navemerald4: #000000; /* notifications */ --navemerald5: #414b58; /* border */ /* choose 1 of 3 variables for navemeraldblur--rgb */ --navemeraldblur--rgb: 250,250,250; /* for your color */ --navemeraldblur--rgb: var(--theme-page-background-color--rgb); /* for page color */ --navemeraldblur--rgb: var(--theme-accent-color--rgb); /* for theme color */ --navemeraldblur: 80px; /* your blur coef */ --navemeraldbg--rgb: .5; /* your transparency coef */ } if (window.location.search.search("section=new") !== -1) { $("#wpSummaryLabel").detach.prependTo(".editOptions"); } importArticles({   type: 'script',    articles: [        'u:dev:MediaWiki:SandboxLink/code.js',    ]}); // (function {   if (window.AjaxTemplateLoaded || mw.config.get('wgNamespaceNumber') === -1) {        return;    }    window.AjaxTemplateLoaded = true;    var AjaxTemplate = {        init: function(i18n) {            this.i18n = i18n;            this.api = new mw.Api;            this.$element = $('', { 'class': 'wds-button wds-is-secondary', 'click': $.proxy(this.click, this), 'text': i18n.msg('button').plain });           this.config = mw.config.get([ 'wgNamespaceNumber', 'wgPageName' ]);           $('.page-header__contribution-buttons, .page-header__actions')                .append(this.$element);        },        click: function {            var text = prompt(this.i18n.msg('insert').plain);            if (!text) {                return;            }            var talk = this.config.wgNamespaceNumber % 2 === 0,                options = {                    action: 'edit',                    title: this.config.wgPageName,                    summary: this.i18n                        .inContentLang                        .msg('reason')                        .plain                };            if (this.config.wgNamespaceNumber % 2 === 0) {                options.prependtext = ' ';            } else {                options.appendtext = '

' + '';           }            this.api .postWithEditToken(options) .then($.proxy(this.callback, this)); },       callback: function(d) { if (!d.error) { mw.notify(this.i18n.msg('added').escape); }       },        hook: function(i18n) { $.when(               i18n.loadMessages('AjaxTemplate'),                mw.loader.using('mediawiki.api')            ).then($.proxy(this.init, this)); }   };    mw.hook('dev.i18n').add($.proxy(AjaxTemplate.hook, AjaxTemplate)); importArticle({       type: 'script',        article: 'u:dev:MediaWiki:I18n-js/code.js'    }); }); //