User:Fngplg/global.js

//$(function{console.log('fng.g.v', $('div [itemprop=video]').length)}); //redirect mw.log to debug window.fngconsole = window.fngconsole || window.console.log; window.console.log = function { var a = Array.prototype.slice.call(arguments); if (a[0] === '') { window.console.debug.apply(window.console, a); } else { window.fngconsole.apply(window.console, a); } }; (function($) { var scriptUrl = '//dev.wikia.com/load.php?mode=articles&only=scripts&articles=MediaWiki:ViewRemoved/code.js|MediaWiki:AjaxRC/code.js|MediaWiki:CodeQuickLinks/code.js|MediaWiki:View Source/code.js'; var sitename = (/\/{2}(.*)\.wikia\.com/.exec(window.wgServer)||[])[1]; if (sitename !== 'ru.borderlands') {   window.log = window.log ? window.log : function{return console.log.apply(this, arguments);};    window.nQuoteSettings = $.extend(true, window.nQuoteSettings, { //debug: false, useQuoteTemplate: false, quoteStyle: 'border-width:1px;border-style:ridge;', });   mw.loader.load('//ru.borderlands.wikia.com/index.php?title=MediaWiki:Common.js/Quotes.js&action=raw&ctype=text/javascript');    //mw.loader.load('http://dev.wikia.com/index.php?title=MediaWiki:LinkPreview/code.js&action=raw&ctype=text/javascript');    scriptUrl = scriptUrl + '|MediaWiki:LinkPreview/code.js|MediaWiki:CommentPreview/code.js';    //mw.hook('wikipage.content').add(function($c){log('mwh.wp.c:',$c,$c.find('.DiscordIntegrator:not(.loaded)').length)}); } $(function { //replace /message_wall: to /user: for avatars $('.speech-bubble-avatar a').each(function(i,v){v.href = v.href.replace(/(.*\/).*?:/, '$1User:')}); }); //scriptUrl = scriptUrl + '|MediaWiki:VKLikeButton/code.js'; //window.vklikeapiid = 6265945; //window.UserTagsJS = $.extend(true, window.UserTagsJS, {modules:{mwGroups: ['blocked', 'bot', 'bureaucrat', 'chatmoderator', 'checkuser', 'content-moderator', 'council', 'helper', 'rollback', 'staff', 'sysop', 'threadmoderator', 'vanguard', 'vstf', 'global-discussions-moderator']}}); //window.pPreview = window.pPreview || {}; //pPreview.RegExp = pPreview.RegExp || {}; //pPreview.RegExp.dtag = new RegExp('(.*)','gm'); //window.pPreview.debug = true; mw.loader.load(scriptUrl); if (wgNamespaceNumber === 2000) $('.thread-left a').each(function(i,v) {v.title = v.innerText}); /* window.importScriptPage = function (page, server) {   var url = '/index.php?title=' + encodeURIComponent(page.replace(/ /g, '_')).replace('%2F', '/').replace('%3A', ':') + '&action=raw&ctype=text/javascript';    if (typeof server == "string") { if (server.indexOf('://') == -1 && server.indexOf('//') !== 0) url = 'http://' + server + '.wikia.com' + url; else url = server + url; }   return importScriptURI(url); }; (function { //https://stackoverflow.com/a/26596324    if ( typeof window.CustomEvent === "function" ) return false; //If not IE    function CustomEvent ( event, params ) {        params = params || { bubbles: false, cancelable: false, detail: undefined };        var evt = document.createEvent( 'CustomEvent' );        evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );        return evt;    }    CustomEvent.prototype = window.Event.prototype;    window.CustomEvent = CustomEvent; }); //*/ $.fn.filterByData = function(prop, val) { return this.filter(       function {             if (!!val) {                return $(this).data(prop) == val;            }            return !!$(this).data(prop);        }    ); };

/*,{   type: "script", articles:["u:dev:LinkPreview/code.js"] });*/ //$.getScript('http://ru.borderlands.wikia.com/index.php?title=MediaWiki:Common.js/pagePreview.js&action=raw&ctype=text/javascript'); //mw.loader.load('http://ru.borderlands.wikia.com/index.php?title=MediaWiki:Common.js/pagePreview.js&action=raw&ctype=text/javascript'); //mw.loader.load('http://ru.borderlands.wikia.com/index.php?title=MediaWiki:Common.js/emo.js&action=raw&ctype=text/javascript'); //mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript'); //mw.loader.load('https://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-navpop.css&action=raw&ctype=text/css', 'text/css'); /* importScriptPage('BackToTopButton/code.js', 'dev'); //console.log('global'); //switch code editor to classic mode /* importArticles({ type: 'script', articles: [ 'u:dev:MediaWiki:CodeEditorSwitch/code.js' ] }); (function{ //test mode everywhere $('body').on('click', '.content-review-module-test-mode-enable', function(e){       e.preventDefault;        e.stopPropagation;        var data = {pageId: wgArticleId, wikiId: wgCityId, editToken: mw.user.tokens.get('editToken')};        $.nirvana.sendRequest({controller: 'ContentReviewApiController', method: 'enableTestMode', data: data, callback: function { var qs = new Wikia.Querystring; qs.addCb.goTo; },           onErrorCallback: function { console.error('test mode enabler error', arguments); }       });//sendrequest    });//onclick });//test mode everywhere

$(function {    //another jspad    function btnClick (e) {        if (e && e.preventDefault)             e.preventDefault;        gui.find('textarea').val('');        $('body').prepend(gui);        gui.show.find('textarea').focus;    }//btnclick    function btnBClick (e) {        $(' ', {type: 'text/javascript', text: gui.find('textarea').val}).prependTo($('head'));        $('#ngui').remove;    }//btnbclick    var hs = '.wds-community-header__top-container .wds-community-header__wiki-buttons';    var btn = $('', {class: 'wds-button wds-is-squished wds-is-secondary', text: 'JS', href: '#', id: 'nbtnshowgui'});    var gui = $(' ', {id: 'ngui', style: 'position:absolute;left:0;top:100px;width:100%;height:90%;z-index:10000;visibility:visible;'});    var guib = $(' ', {type: 'button', class: 'wikia-button', value: 'start', id: 'nbtnstart'});    var guit = $(' ', {id: 'ntxtscript', style: 'display:block;margin: 0 5%;width:80%;height:auto;min-height:100px;max-height:80%;'}); gui.append(guib).append(guit); if ($(hs).length) { //oasis $(hs).append(btn); } else { //monobook $('#p-personal .pBody ul').append(btn); }//append js button $('body').on('keydown', function (e) {       if (e.ctrlKey && e.keyCode === 8) { //ctrl+bckspc            btnClick;            return false;        }    });//body keydown $('body').on('click', '#nbtnshowgui', btnClick); $('body').on('click', '#nbtnstart', btnBClick); $('body').on('keydown', '#ntxtscript', function (e) {       if (e.keyCode >= 37 && e.keyCode <= 40) return true; //arrows        if (!e.shiftKey && e.keyCode === 13) {            btnBClick;            return false;        }        switch (e.keyCode) {            case 9:                jQuery.event.trigger({type: 'keypress', which: '    '});                return false;            case 27:                $('#ngui').remove;                return false;        }        if ($('#ntxtscript').val.length > 100) $('#ntxtscript').height($('#ntxtscript').get(0).scrollHeight);    });//txt keydown });//js pad /* (function ($) { //promise polyfill for ie   if (typeof Promise === 'function') return; function Promis (f) { var p = new $.Deferred; f(p.resolve, p.reject); return p;   }//promise window.Promise = Promis; }(jQuery));

})(jQuery);