MediaWiki:ArticlePreview/code.2.js

importArticles({       type: 'script',        articles: [            'u:dev:Colors/code.js'        ]    }, {        type: 'style',        articles: [            'u:dev:ArticlePreview/code.2.css'        ]    }); mw.hook('dev.colors').add(function(colors){       var css_ = {                '#ArticlePreview .preview-chevron .chevron': {                    'border-left': '7px solid transparent',                    'border-right': '7px solid transparent',                    'border-bottom': '7px solid $menu'                },                '#ArticlePreview .preview-wrapper': {                    'background-color': '$menu'                },                '#ArticlePreview .preview-header': {                    'border-bottom': '2px solid $header',                    'color': '$header'                },                '#ArticlePreview .preview-buttons .preview-button': {                    'color': '$link'                },                '#ArticlePreview .preview-buttons .preview-button:hover': {                    'color': '$hoverlink',                    'background-color': '$hoverbg'                } },           _colors = { hoverlink: (function(colors){                   var link = colors.wikia.link,                        parsed = colors.parse(link),                        res = parsed.lighten(5),                        hex = res.hex;                    return hex;                })(colors), hoverbg: (function(colors){                   var menu = colors.wikia.menu,                        parsed = colors.parse(menu),                        res = parsed.lighten(-6),                        hex = res.hex;                    return hex;                })(colors) };       css_ = $.extend(preview_css, css_); function createCSS(obj){ var css = '', css_arr = Object.keys(obj).map(function(selector){                   var css_res = selector + ' {\n';                    var properties = obj[selector];                    Object.keys(properties).forEach(function(property){ var value = properties[property]; if (typeof value == 'function'){ value = Function.prototype.apply.call(value, window, [properties]); }                       css_res += '\t' + property + ': ' + value + ';\n'; });                   css_res += '}';                    return css_res;                }); css = css_arr.join('\n\n'); return css; }       var final_css = createCSS(css_); colors.css(final_css, {           'hoverlink': _colors.hoverlink,            'hoverbg': _colors.hoverbg        }); });   var mwConfig = mw.config.get([ 'wgArticlePath', 'wgPageName', 'wgUserGroups', 'wgServer', 'skin' ]),       config = $.extend(module, { version: '2.0.0', site_name: mwConfig.wgServer.replace(/http(?:s|):\/\/(.*)\.wikia\.com/g, '$1'), get_links: function(exceptions){ var all_links = $('#WikiaRail .module a, #WikiaRail .rail-module a, .mw-content-text a'); if (typeof exceptions !== 'undefined' && exceptions instanceof Array){ return all_links.filter(function(index){                       return !$(this).is(exceptions.join(', '));                    }); } else { return all_links; }           },            is_current_site: function(url){ var url_regex = /http(?:s|):\/\/(.*)\.wikia\.com\/(?:.*)/g, site_name = url.replace(url_regex, '$1'), value = null; if (site_name == config.site_name){ value = true; } else { value = false; }               return value; },           shorten: function(fullurl){ var link_regex = /http:\/\/(.*)\.wikia\.com\/(?:.*)/g; if (link_regex.test(fullurl)) return fullurl.replace(mwConfig.wgServer, ''); else return fullurl; },           lengthen: function(url){ var link_regex = /http:\/\/(.*)\.wikia\.com\/(?:.*)/g; if (link_regex.test(url)) return url; else return mwConfig.wgServer + url; }       }); })(    this.mediaWiki,    this.jQuery,    this.ArticlePreview = this.ArticlePreview || {},    this.PreviewCSS = this.PreviewCSS || {} );
 * (function(mw, $, module, preview_css){