User:Ultimate Dark Carnage/wikia.js

importArticles({   type: 'script',    articles: [        'User:Ultimate_Dark_Carnage/advancedui.js'    ] });

importArticles({   type: 'style',    articles: [        'User:Ultimate_Dark_Carnage/advancedui.css'    ] });

$('.WikiaRail').delegate('*', 'DOMNodeInserted', function(event){   $('.WikiaRail #RecentWikiActivity').after( $(' ').html(' Test ' +                   _advancedui.input({ placeholder: 'Type here...', id: 'test-input', autocomplete: true }, 'test-input-wrapper', 'User:' + wgUserName + '/selectbox')       ) ); });

$('.WikiaBarWrapper ul.tools').append(   $(' ', { "class": "GoToWiki", "id": "go-to-wiki", "data-title": "Go To Wiki", append: function{ if ($(this).is('.GoToWiki')){ return $('', {                   "class": "go-to-wiki",                    css: {                        "cursor": "pointer"                    },                    text: $(this).attr("data-title"),                    on: {                        'click': function(event){                            function close_form(value, delay){                                var dialog = $('#GoToWikiModal');                                if (!delay && !value && (value === false)) return;                                else if (value === true && !delay){                                    dialog.closeModal;                                }                                else if (value === true && delay){                                    setInterval(function{ dialog.closeModal; }, delay);                               }                            }                            function submit_form{                                if (!$('#wiki-name').val && !$('p.error-msg').length){                                    $('.go-to-wiki-form section').children.eq(1).after($('', {                                        "class": "error-msg",                                        css: {                                            "color": "red"                                        },                                        text: 'Please add your wiki name!'                                    }));                                }                                else if ($('#wiki-name').val != /(This wiki)/gi){                                    window.location.href = 'http://' + $('#wiki-name').val + '.wikia.com';                                } else if ($('#wiki-name').val == /(This wiki)/gi){ window.location.href = wgServer; }                               else if ($('#wiki-name').val == /(This wiki)/gi && ($('select#namespace').children(':checked') && $('input#pagename').val)){ switch ($('select#namespace').children(':checked')){ case 'Main': window.location.href = 'http://' + $("#wiki-name").val + '.wikia.com/wiki/' + $("input#pagename").val.replace(/ /g, '_'); break; default: window.location.href = 'http://' + $("#wiki-name").val + '.wikia.com/wiki/' + $("select#namespace").children(":checked").text + ':' + $("input#pagename").val.replace(/ /g, '_'); }                           }                            var namespaces = ['Main', 'Talk', 'User', 'User talk', 'User blog', 'Blog', 'Blog talk', 'Message Wall', 'Board', 'Thread', 'Message Wall Greeting', 'Board Thread', 'Topic',   'Project', 'Project talk', 'File', 'File talk', 'MediaWiki', 'MediaWiki talk', 'Template', 'Template talk', 'Help', 'Help talk', 'Category', 'Category talk', 'Forum', 'Forum talk']; var go_to_wiki_form = '' + ' ' +                                    ' Select the wiki that you want to go to ' + ' ' +                                       'Wiki Name: ' + '' + ' ' + '' + ' ' +                               ' ' +                            ' ';                            $.showCustomModal(event.target.text, go_to_wiki_form, {                                id: 'GoToWikiModal',                                width: 650,                                buttons: [                                    {                                        id: 'cancel-button',                                        message: 'Cancel',                                        handler: function{                                            close_form(true);                                        }                                    },                                    {                                        id: 'submit-button',                                        defaultButton: true,                                        message: 'Submit', handler: function{ submit_form; }                                   }                                ]                            });                            for (var ns = 0; ns < namespaces.length; ns++){                                var namespace = namespaces[ns];                                if (namespace){                                    $('select#namespace').append( $(' ', {                                           "value": namespace,                                            text: namespace                                        }) );                               }                            }                        }                    }                });            }        }    }) );

/* $('.WikiaBarWrapper .tools').find('a.go-to-wiki').on('click', function(event){   var go_to_wiki_form =        '' +             ' ' +                 ' '    $.openCustomModal(event.target.text, go_to_wiki_form, { id: 'GoToWikiModal', width: 650, }); });

jQuery(function($){   if (!$('a.wikia-button.breakpoint-button').length){        $('.WikiaPageHeader .tally').before($('', {            "class": "wikia-button breakpoint-button",            "id": "breakpoint-button",            text: "Breakpoint Options",            on: {                "click": function(event){                    if (!$('#breakpoint-menu').length){                        _advancedui.openMenu(event.target.text, 'breakpoint-menu', { content: ' ' + _advancedui.radio('Breakpoint:', 'breakpoint', (_advancedui.createRadio('breakpoint', { id: 'breakpoint-on', title: 'On' }) + _advancedui.createRadio('breakpoint', { id: 'breakpoint-off', title: 'Off' }))) + (_advancedui.radio('Typography:', 'typography', _advancedui.createRadio('typography', { id: 'typography-on', title: 'On' }) + _advancedui.createRadio('typography', { id: 'typography-off', title: 'Off' }))) + ' ', footer: _advancedui.button('Cancel', {                               'cancel-action': 'Cancel',                                handler: function{                                    cancel;                                }                            }) + _advancedui.button('Submit', {                                'submit-action': 'Submit',                                handler: function{                                    submit;                                }                            }) });                       _advancedui.createRadio('typography', [{ id: 'typography-on', title: 'On'}, { id: 'typography-off', title: 'Off' }]);                    }                }            }        }));    } });

jQuery(function($){   if ($('.ChatWindow').length && wgCanonicalSpecialPageName('Chat') === true){        $('.ChatWindow').delegate('.Chat li:not(.inline-alert):last', 'DOMNodeInserted', function(event){ $(event.target).children('.message').each(function{               if (this.innerHTML.match(/(troll|negro)/gi)){                    $(this).replace(/(troll|negro)/gi, ' $1 ');                }            }); });   } });

jQuery(function($){   $('head').append($(' ', {        "rel": "stylesheet",        "href": "//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css",        "type": "text/css"    }));    /*     var action = {};    action.openModal = function(config){        var heading = config.heading,            content = config.content,            buttons = config.buttons,            id = config.id,            name = config.name,            modal_html =                 '' +                    '' +                    ' ' +                ' ';        if (!heading || !content || !buttons || !id){            console.log('Modal creation failed');        }        else {            $('.WikiaSiteWrapper', document.body).append($(' ', {                "class": "custom-modal-blackout page-width", "id": id, html: modal_html, }));       }    };    action.block = function(user, expiry, reason){ };   */ });

if ($('#WikiaRail').length) { //only on pages where the rail is present $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.   if ($('.ChatModule').length && !$("#NewFilesModule").length) { // Only add it once      if (typeof $temp == "undefined") { // Only load it once        $temp = $(' '); // this line, and the next, originate from http://dev.wikia.com/wiki/AjaxRC/code.js <3        $temp.load("/Special:NewFiles/13" + " #gallery-", function  { $('.ChatModule').after(" New FilesUpload</a> "); if (typeof NewFilesModuleCompact != "undefined" && NewFilesModuleCompact) { $('#gallery-', $temp).html($('#gallery-', $temp).html.replace(/\/scale-to-width\/\d*\?/g, "/scale-to-width/80?")); $("#NewFilesModule").addClass("compact"); }         $("#NewFilesModule").append($('#gallery-', $temp)); $("#NewFilesModule .wikia-photogallery-add").remove; delete $temp; //delete it, in case the rail is wiped after this point. });     }    }  });  //end of DOMNodeInserted block $('head').append('<style type="text/css">\n#gallery- { height:452px; overflow-y:auto; clear: both; text-align:center; padding-bottom: 5em;}\n#NewFilesModule .gallery-image-wrapper { top: 0 !important; height: auto !important; border:none; }\n#NewFilesModule.compact .gallery-image-wrapper { width: auto !important; }\n#NewFilesModule .thumb { height:auto !important; }\n#NewFilesModule .wikia-gallery-item { margin: 1px !important; padding: 0 !important; height: auto !important; border: none !important; width: 40%; }\n#NewFilesModule.compact .wikia-gallery-item { width: auto !important; }\n#NewFilesModule .wikia-gallery-item .lightbox-caption { display: none; }\n#NewFilesModule .wikia-gallery-item:hover .lightbox-caption { display: block; }\n#NewFilesModule.compact .wikia-gallery-item:hover .lightbox-caption { display: none; }\n#NewFilesModule h1 {margin: 0 2em 0 0;}\n#NewFilesModule h1 a:first-child {color:inherit;}\n#NewFilesModule img { display: block; }\n.wikia-gallery-item .gallery-image-wrapper a { width: auto !important; height: auto !important; }\n.wikia-gallery-item .gallery-image-wrapper a.image-no-lightbox { line-height: normal; display: block; padding: 1em; }\n '); }

(function($, mw){   if (mw.config.get('skin') == "oasis" || mw.config.get('skin') == "wikia" || mw.config.get('skin') == "venus"){        // Add clock to global navigation        var clock_style =             '.clock-container {' +                '\npadding-left: 10px;' +                 '\n}' +             '\n.clock-container .clock {' +                 '\ncolor: black;' +            '\n}';        function addZero(i){            if (i < 10) i = "0" + i;            return i;        }        if ($('.global-navigation').length && !$('.clock-container').length){            $('.global-navigation > .global-navigation-container').append($(' ', {                "class": "clock-container table-cell",                html: '</a>'            }));            $('head').append('<style type="text/css" media="all" id="clock-container-style">' + clock_style + ' ');            setInterval(function{ var d;               if (new Date){ d = new Date; $('.clock-container .clock').html(addZero(d.getHours) + ':' + addZero(d.getMinutes) + ':' + addZero(d.getSeconds)); }           }, 1000);        }        // Add username to global navigation        if (mw.config.get('wgUserName')){            $('.global-navigation a[data-id="userpage"]').append(function{ if (!$('.global-navigation a[data-id="userpage"] > span.user-name').length){ return $(' ', {                       "class": "user-name",                        "data-user": mw.config.get('wgUserName'),                        text: mw.config.get('wgUserName')                    }); }           });        }    } })(jQuery, mediaWiki);

navigator.info = (function{   var N = navigator.appName,        ua = navigator.userAgent,         tem,        M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);    if (M && (tem = ua.match(/version\/([\.\d]+)/i))!== null) M[2] = tem[1];    M = M? [M[1], M[2]] : [N, navigator.appVersion, '-?'];    return M; }); function getBrowserName(name){ var browserName; if (name){ switch (name){ case 'MSIE': case 'Netscape': browserName = 'Internet Explorer'; break; case 'Firefox': browserName = 'Mozilla Firefox'; break; case 'Chrome': browserName = 'Google Chrome'; break; default: browserName = name; }       return browserName; } } function getBrowserVersion(value){ var v;   if (v > -1){ v = parseInt(value, 10); return v;   } } var browser = getBrowserName(navigator.info[0]), version = getBrowserVersion(navigator.info[1]); console.log('You are currently using ' + browser + ' ' + version + '!');