User:Ultimate Dark Carnage/global.js

cacheSkip = []; cacheSkipLimit = 1000;

importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('MessageBlocker/code.js', 'dev');

importArticles({   type: 'script',    articles: [        'u:dev:NullEditButton/code.js',        'u:dev:AntiUnicruft/code.js',        'u:dev:BackToTopButton/code.js',        'u:dev:PortableCSSPad/code.js',        'u:dev:WHAM/code.js',        'u:dev:QuickModTools/loader.js',        'u:dev:CacheCheck/code.js',        'u:dev:MassNullEdit/code.js'    ] });

var skin = mw.config.get('skin', skin); if (['oasis', 'wikia'].indexOf(skin) === -1) return; var $WikiaRail = $('#WikiaRail'); if ($WikiaRail.hasClass('loaded')){ $WikiaRail.find(['section', 'div'].join(', ')).filter(function{           var cname = 'module',                isModule = $(this).hasClass(cname);            return isModule;        }).removeClass('module').addClass('rail-module'); } else { $WikiaRail.on('DOMNodeInserted', function(event){           if ($(event.target).hasClass('module')){                $(event.target).removeClass('module');                $(event.target).addClass('rail-module');            }        }); } })(this.mediaWiki, this.jQuery);
 * (function(mw, $){

/** * ArticlePreview v1.0 * - Allows a user to see a preview of an article by hovering on a local link * - Allows a user to go to a page by clicking on the link * * @author Ultimate Dark Carnage **/   // Importing the required stylesheet importArticles({       type: 'style',        articles: [            'u:dev:ArticlePreview/code.css'        ]    }); // Setting MediaWiki variables var mwVars = mw.config.get([           'wgServer', // host (server) name            'wgPageName', // page name            'wgNamespaceNumber', // namespace number            'wgArticlePath' // article path        ]), // Setting default configurations for the module config = $.extend(module, {           // Create the database name from host            dbName: mwVars.wgServer.replace(/http:\/\/(.*)\.wikia\.com/g, '$1'),            // Array of selectors that will be excluded            exceptions: ['.new', '.free', '.toc a', '.wikia-button', '.button a', '.wikia-menu-button a'],            // Get all links that are not excluded            // @returns jQuery object            links: function{                return $('.mw-content-text a').filter(function{ var isNormalLink = !$(this).is(config.exceptions.join(', ')); return isNormalLink; });           },            // Check if the database name of the link matches the            // database name of the current wiki            // @returns Boolean            isCurrentServer: function(link){                var link_regex = /http:\/\/(.*)\.wikia\.com\/(?:.*)/g,                    link_dbname = link.replace(link_regex, '$1'),                    value = null;                if (link_dbname == config.dbName){                    value = true;                } else {                    value = false;                }                return value;            },            // Shortens the URL            // @returns String            shorten: function(fullurl){                var link_regex = /http:\/\/(.*)\.wikia\.com\/(?:.*)/g;                if (link_regex.test(fullurl))                    return fullurl.replace(wgServer, '');                else                    return fullurl; },           // Lengthens the URL // @returns String lengthen: function(url){ var link_regex = /http:\/\/(.*)\.wikia\.com\/(?:.*)/g; if (link_regex.test(url)) return url; else return wgServer + url; }       });    $(document).ready(function initialize{ // Setting a variable for the links that will have a mouse event var $links = config.links; // Binding all links $links.each(function bind{           // returns a hyperlink            var link = $(this).attr('href'),                // returns the element's height                height = $(this).height,                // lengthens the hyperlink                link_l = config.lengthen(link),                // regex to check if the link contains a url variable                varr = /(?:.*)[?&](?:[a-z0-9])=(.*)/g,                // namespaces to be excluded                ns = ['Template', 'MediaWiki', 'Category', 'Forum'],                // regex for the excluded namespaces                nsr = new RegExp('http\:\/\/(?:.*)\.wikia\.com\/wiki\/(' + ns.join('|') + ')\:(?:.*)');            // if the link has a url variable, an excluded namespace, or is not local, do not run            if (varr.test(link) || !config.isCurrentServer(link_l) || nsr.test(link_l)) return;            // otherwise, bind the element with a "mouseover" event to add the module $(this).on('mouseover', function show(event){               var offset = $(event.target).offset, // returns the link's offset                    $preview_wrapper = $(''), // article preview module                    $header = $('').text($(event.target).text), // article preview header                    $container = $(' '), // article preview container                    $more_button = $('').text('See More'), // see more link                    link_s = config.shorten(link_l); // shorten long url                $more_button.attr('href', $more_button.attr('href').replace('$link', link_l)); // replace the "$link" variable with the long link                // ...then run the AJAX request                $.ajax({ method: 'GET', dataType: 'json', url: mw.util.wikiScript('api'), data: { page: link_s.replace('/wiki/', ''), // remove the "/wiki/" from the short link action: 'parse', format: 'json' }               }).done(function add_preview(data){ // parse HTML from the page var code = data.parse.text['*'], // Find the source of the first image image_src = $(code).find('img').eq(0).attr('src') || 'https://vignette4.wikia.nocookie.net/dev/images/2/20/Image_Placeholder.png/revision/latest?cb=20170506185541', $image = $('').attr('src', image_src), paragraph = $(code).find('p').eq(0).html, $description = $('').html(paragraph); $container.html([$image, $description]); // apply HTML to the container // apply all parts of the module and set the position of the module $preview_wrapper.html([$header, $container, $more_button]).css({                       'left': offset.left + 'px',                        'top': (offset.top + height) + 'px'                    }); // prevent the module from appending twice if (!$('#article-preview').exists) $('.WikiaSiteWrapper').append($preview_wrapper); });           });            // ...then create a "mouseout" to remove the module $(this).on('mouseout', function hide(event){               if ($('#article-preview').exists){                    $('#article-preview').remove;                }            }); });   }); })(this.mediaWiki, this.jQuery, (window.preview = window.preview || {}));
 * (function(mw, $, module){