MediaWiki:Thongbao.js

/** Bản cũ cần lưu tâm: http://sonako.wikia.com/wiki/MediaWiki:Thongbao.js?oldid=99216 **/ /* Image Rail */ $(function {   if ((mw.config.get('wgAction') === 'view') && (mediaWiki.config.get('wgPageName') !== 'Sonako_Light_Novel') && (mediaWiki.config.get('wgCanonicalSpecialPageName') !== 'WikiActivity') && (mediaWiki.config.get('wgNamespaceNumber') === 0 || mediaWiki.config.get('wgNamespaceNumber') === 4 || mediaWiki.config.get('wgNamespaceNumber') === 6 || mediaWiki.config.get('wgNamespaceNumber') === 14 || mediaWiki.config.get('wgNamespaceNumber') === 112 || mediaWiki.config.get('wgNamespaceNumber') === 114 || mediaWiki.config.get('wgNamespaceNumber') === 500 || mediaWiki.config.get('wgNamespaceNumber') === 1201)) {        $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place. if ($('#WikiaRail section').length && !$("#ImageModule").length && typeof $ImageModulePage == "undefined") { // Only add it once $ImageModulePage = $(' '); $ImageModulePage.load("/index.php?title=Template:ImageRail&action=render", function {           $('#WikiaRail>section:last-of-type').after(' ');        }); delete $ImageModulePage; } }); //end of DOMNodeInserted block   }    if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'WikiActivity') {        $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place. if ($('#WikiaRail section.CommunityCornerModule').length && !$("#ImageModule").length) { // Only add it once var ImgSection = ' '; $('#WikiaRail>section:last-of-type').after(ImgSection); $.getJSON('/api.php?action=parse&text=&format=json', function(data) {                   var img = data.parse.text['*'];                    $('section#ImageModule').append(img);                }); }       }); //end of DOMNodeInserted block    }    /* Thong bao Module */    /* For most of pages */    if ((mw.config.get('wgAction') === 'view') && (mediaWiki.config.get('wgPageName') !== 'Sonako_Light_Novel') && (mediaWiki.config.get('wgCanonicalSpecialPageName') !== 'WikiActivity') && (mediaWiki.config.get('wgNamespaceNumber') === 0 || mediaWiki.config.get('wgNamespaceNumber') === 4 || mediaWiki.config.get('wgNamespaceNumber') === 6 || mediaWiki.config.get('wgNamespaceNumber') === 14 || mediaWiki.config.get('wgNamespaceNumber') === 112 || mediaWiki.config.get('wgNamespaceNumber') === 114 || mediaWiki.config.get('wgNamespaceNumber') === 500 || mediaWiki.config.get('wgNamespaceNumber') === 1201)) {        $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place. if ($('#WikiaRail section').length && !$("#ThongBaoModule").length && !$("#wikia-recent-activity").hasClass("replaced")) { // Only add it once var newSection = '' + 'Thông báo' + ' ' + ' '; $('#WikiaRail>section:first-of-type').after(newSection); $.getJSON('/api.php?action=parse&text=&format=json', function(data) {                   var code = data.parse.text['*'];                    $('section#ThongBaoModule').append(code);                    // Embed The Facebook Widget to sidebar. Because ?action=render only pull some text and therefore the default embed code for FB by Wikia doesn't work                    document.getElementById('fbbox').innerHTML = ' ';                    $('#ThongBaoModule a').attr('target', '_blank').attr('title', 'Mở link sang Tab mới.'); tabberAutomatic; });           }        }); //end of DOMNodeInserted block }   /* For Wiki Activity page only */ if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'WikiActivity') { $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.           if ($('#WikiaRail section').length && !$("#ThongBaoModule").length) { // Only add it once                var newSection = '' +                    'Thông báo' + ' ' + ' ';                $('#WikiaRail>section:first-child').after(newSection);                $.getJSON('/api.php?action=parse&text=&format=json', function(data) { var code = data.parse.text['*']; $('section#ThongBaoModule').append(code); // Embed The Facebook Widget to sidebar. Because ?action=render only pull some text and therefore the default embed code for FB by Wikia doesn't work document.getElementById('fbbox').innerHTML = ' '; $('#ThongBaoModule a').attr('target', '_blank').attr('title', 'Mở link sang Tab mới.'); impart('u:dev:MediaWiki:TopEditors/code.js'); tabberAutomatic; });           }        }); //end of DOMNodeInserted block }   //add diff links for wikia recent activity module $('#WikiaRail').bind('DOMNodeInserted', function(event) { //fires after lazy-loading takes place.       //add diff links and replace 'a wikia contributor' with the IP address.        if ($("#wikia-recent-activity").size && !$("#wikia-recent-activity").hasClass("replaced")) {            //Only run if #wikia-recent-activity has been added, and it has not already been replaced, because #wikia-recent-activity is replaced twice when logged out.            $("#wikia-recent-activity").addClass("replaced");            $("#wikia-recent-activity li").each(function { if ($(".edit-info-user", this).attr("href").indexOf("/Special:Contributions/") != -1) $(".edit-info-user", this).html($(".edit-info-user", this).attr("href").replace("/wiki/Special:Contributions/", "")); $(this).prepend(''); });       }    }); //end of DOMNodeInserted block

$('#WikiaRail').trigger('DOMNodeInserted'); //Bypass race condition by firing the event. });