×
Create a new article
Write your page title here:
We currently have 87 articles on Nova Online Wiki. Type your article name above or click on one of the titles below and start writing!



Nova Online Wiki

MediaWiki:Common.js: Difference between revisions

mNo edit summary
mNo edit summary
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:
});
});


/** Show username ********************************************************
/*  
  * The annoying hack used by [[Template:USERNAME]]!
* Script Name: InputUsername
  * Inserts user name into <span class='insertusername'></span>
* Author: Ihojose
  * Originally by [[wikia:User:Splarka|Splarka]], [[User:Spang]]
*
  * New version by [[User:Bizzeebeever]]
* Adds the username of the user viewing the page.
* Only works for logged in users.
*
  * Added by Spottra 5-Apr-2015:
  * Individual users can define "window.disableUsernameReplace = true;" in their
  * global.js or local common.js file to disable the replacement for themselves if
  * they so desire.
  */
  */
$j( function() {
var name = mw.config.get( 'wgUserName' );
if ( !window.disableUsernameReplace && name ) {
$j( 'span.insertusername' ).text( name );
}


} );
;(function ($, mw) {
    'use strict';
    var username = mw.config.get('wgUserName');
    if (
        window.disableUsernameReplace ||
        !username
    ) {
        return;
    }
    window.disableUsernameReplace = true;
    var $rail = $('#WikiaRail'),
        customSelector = window.UsernameReplaceSelector
            ? ', ' + window.UsernameReplaceSelector
            : '';
    function inputUsername($content) {
        $content.find('.InputUsername, .insertusername' + customSelector).text(username);
    }
    mw.hook('wikipage.content').add(inputUsername);
    if ($rail.hasClass('loaded')) {
        inputUsername($rail);
    } else if ($rail.length) {
        $rail.on('afterLoad.rail',
            inputUsername.bind(null, $rail)
        );
    }
})(window.jQuery, window.mediaWiki);

Latest revision as of 00:16, 17 July 2024

/* Any JavaScript here will be loaded for all users on every page load. */

mw.loader.load("https://commons.wiki.gg/wiki/MediaWiki:DiscordIntegrator.js?action=raw\u0026ctype=text/javascript");

$(document).ready(function() { 
    var footerIcon = document.createElement('div');
    footerIcon.id = 'customFooterIcon';
    footerIcon.innerHTML = '<a href="https://herdcowproject.xyz/" title="Hosted by HCP"><img src="https://novaonline.wiki/resources/assets/HerdCowProject.png" alt=""></a>';
 
    $('#footer-places').append(footerIcon);
});

/* 
 * Script Name: InputUsername
 * Author: Ihojose
 *
 * Adds the username of the user viewing the page.
 * Only works for logged in users.
 *
 * Added by Spottra 5-Apr-2015:
 * Individual users can define "window.disableUsernameReplace = true;" in their
 * global.js or local common.js file to disable the replacement for themselves if
 * they so desire.
 */

;(function ($, mw) {
    'use strict';
    var username = mw.config.get('wgUserName');
    if (
        window.disableUsernameReplace ||
        !username
    ) {
        return;
    }
    window.disableUsernameReplace = true;
    var $rail = $('#WikiaRail'),
        customSelector = window.UsernameReplaceSelector
            ? ', ' + window.UsernameReplaceSelector
            : '';
    function inputUsername($content) {
        $content.find('.InputUsername, .insertusername' + customSelector).text(username);
    }
    mw.hook('wikipage.content').add(inputUsername);
    if ($rail.hasClass('loaded')) {
        inputUsername($rail);
    } else if ($rail.length) {
        $rail.on('afterLoad.rail',
            inputUsername.bind(null, $rail)
        );
    }
})(window.jQuery, window.mediaWiki);