User:Kung Führer/global.js

'use strict'; require(['jquery', 'mw', 'wikia.ui.factory', 'wikia.browserDetect', 'wikia.location'], function ($, mw, ui, bd, loc) { var config = mw.config.get(['wgCanonicalNamespace', 'wgUserName', 'wgUserGroups', 'wgPageName', 'skin']);  if (bd.isMobile || config['skin'] !== 'oasis' && config['skin'] !== 'wikia' || !$('.page-header__contribution-buttons .wds-list') || $('#ca-monaco').length) {    return;  }  var isPersonalCSS = loc.pathname.match(new RegExp('^/wiki/.*?:' + config['wgUserName'].split(' ').join('_') + '/.*?\\.css$')) && config['wgCanonicalNamespace'] === 'User';  var isSiteCSS = loc.pathname.match(new RegExp('^/wiki/MediaWiki:.*?\\.css$')) && config['wgUserGroups'].indexOf('sysop') !== -1;  if (isPersonalCSS || isSiteCSS) {    ui.init(['modal']).then(function (uimodal) { console.log('test'); var modalconfig = { type: 'default', vars: { id: 'monaco-editpage', title: config['wgPageName'], content: 'test', size: 'large', buttons: [{ vars: { value: 'Test', data: [{ key: 'event', value: 'close' }]           }          }]        }      };      var $editbutton = $('Monaco'); $editbutton.click(function (event) {       event.preventDefault;        uimodal.createComponent(modalconfig, function (modal) { $('#blackout_monaco-editpage, #monaco-editpage .close').click(function (e) {           e.preventDefault;            console.log('close');          }); modal.show; });     });      $('.page-header__contribution-buttons .wds-list').append($editbutton); }); } });