User:Yatalu/global.js

// ============================================================ // This is all chat hacks, AFK feature, chat box clear, ping feature, multiple PM // ============================================================

importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/ChatPMs.js', 'c');

// ============================================================ // This is the auto-hide TOC line for Yatalu's use only :3 // ============================================================

$(function {$('#togglelink:contains("hide")').click;});

// ============================================================ // Scripts from dev.wikia -- not intended for large-scale use // ============================================================

importArticles({   type: 'script',    articles: [        'u:dev:Message/code.js'    ] });

// ============================================================ // displayTimer // ============================================================ var refreshDate; function addDate { var UTCDate = ((new Date).toUTCString).replace("GMT", "(UTC)"); $('#showdate').empty.append(' ' + UTCDate.substring(5) + ' '); window.clearTimeout(refreshDate); refreshDate = window.setTimeout(addDate, 1000); } $(document).ready(function {   if (skin == 'oasis')         $(' ').appendTo('#GlobalNavigation');    else        $('#p-personal ul').prepend(' ');    addDate;    refreshDate = window.setTimeout(addDate, 1000);    $('#displayTimer').css({'font-size': "12px"}); }); //

// ============================================================ // chat thingy by sactage // ============================================================

if (wgCanonicalSpecialPageName == 'Chat') { NodeChatDiscussion.prototype.ytInfoCache = {}; NodeChatDiscussion.prototype.ytInfo = function(chat) { if(mainRoom.isInitialized && !chat.attributes.isInlineAlert) { var text = chat.attributes.text, search = /https?:\/\/(?:www\.|m\.)?youtube\.com[^ ]+v=([^&# ]*)|https?:\/\/(?:www\.)?youtu\.be\/([^&#\? ]*)/im, match = text.match(search); if (match) { var $link = $("a[href='" + match[0] + "']").last, id = match[1] ? match[1] : match[2]; if (this.ytInfoCache.hasOwnProperty(id)) { return $link.attr('title', this.ytInfoCache[id]); }                               $.get("http://gdata.youtube.com/feeds/api/videos/" + id + "?v=2&alt=jsonc", function (data) {                                        try {                                                data = data.data;                                                var info = data.title + ' | ' + data.uploader + ' | ' + data.uploaded.split(/T/)[0] + ' | ' + (data.viewCount || 0) + ' views';                                                mainRoom.viewDiscussion.ytInfoCache[id] = info;                                                $link.attr('title', info);                                        } catch (e) {                                                console.log('fetching youtube data failed');                                                console.error(e);                                        }                                }); }               }        }        mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.ytInfo, mainRoom.viewDiscussion)); }

// ============================================================ // user page create thing // ============================================================

templateLanguages = ['en', 'ca', 'de', 'es', 'fi', 'fr', 'gl', 'ja', 'ms', 'nl', 'pl', 'pt'] qtUserPageTemplate = '';