User:Mendes2/chat.js

//PM Alert var PrivateMessageAlert = { notifications: true, alertWhileFocused: true };

//Imports importArticles({   type: 'script',    articles: [        'u:dev:NewMessageCount.js',        'u:dev:MediaWiki:BlockedByChatUsers/code.js',        'u:dev:MediaWiki:ChatOptions/beta.js',        'u:dev:MediaWiki:PrivateMessageAlert/code.js',        'u:dev:MediaWiki:ChatNotifications/code.js'    ] });

//UTC version of u:dev:ChatTimestamps $(function { var chatLoader = setInterval(function{ if (typeof mainRoom !== "undefined") { chatTimestampsMain; clearInterval(chatLoader); } }, 200);

function chatTimestampsMain { var twentyFourHours = false; mw.util.addCSS('.custom-time { font-weight:normal; color: #C0C0C0; text-decoration: none !important; cursor: default !important; float: right; font-size: 12px;} .Chat .message { display: inline !important; }'); mainRoom.model.chats.bind("afteradd", function (el) {       var obj = $('#entry-' + el.cid),        time = new Date,        hours = time.getUTCHours,        minutes = time.getUTCMinutes,        seconds = time.getUTCSeconds,        milli = time.getUTCMilliseconds,        m = "AM";        if (hours > 12)            m = "PM";        if (hours > 12 && !twentyFourHours)            hours -= 12;        if (minutes < 10)            minutes = "0" + minutes;        if (seconds < 10)            seconds = "0" + seconds;        if (milli < 10)            milli = "00" + milli;        else if (milli < 100)            milli = "0" + milli;        if (obj.children('.time').length)            obj.children('.time').remove;        obj.append(' ' + hours + ':' + minutes + ':' + seconds + ':' + milli  + ' ' + m + ' ');    }); }

});