User:Jormun/global.js

// 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)); }

//Back To Top button //Created by Noemon from Dead Space Wiki, translate from ru.elderscrolls.wikia function hideFade { // hide #backtotop first $( "#backtotop" ).hide ; // fade in #backtotop $( function {		$( window ).scroll( function  { if ( $( this ).scrollTop > ButtonStart ) { $( '#backtotop' ).fadeIn ; } else { $( '#backtotop' ).fadeOut ; }		});	}); } function goToTop { // scroll body to 0px on click $( 'body,html' ).animate ({		scrollTop: 0	}, ScrollSpeed ); return false; } function addBackToTop { if( skin == 'oasis' ) { $('Наверх ').appendTo('#WikiaBarWrapper .toolbar > .tools'); hideFade ; }	} var ButtonStart = 800; var ScrollSpeed = 600; if( !window.BackToTop ) { $( document ).ready( function { 		addBackToTop ; 	}); } var BackToTop = true; // prevent duplication

//Chat Quote

function ChatQuote { $('.Chat li .message').each(function {        if ($(this).children.length === 0) {            $(this).append(' [quote] ').click(function  { $('.message > textarea').val($('.message > textarea').val + ' ' + $(this).prevAll('.username:first').text + ': "' + $(this).text.toString.replace('[quote]', '') + '"'); });       }    }); } setInterval(ChatQuote, 1000);

//Auto Edit Dropdown window.AutoEditDropdownConfig = { expandedAreaContribute: true, expandedAreaEdit: false }; importArticles({ type: 'script', articles: [ 'w:c:dev:AutoEditDropdown/code.js' ] });

//Wall Greeting Button importArticles({   type: 'script',    articles: [        'w:dev:WallGreetingButton/code.js'    ] });

//CSS Pad importArticles({   type: 'script',    articles: [        'w:dev:PortableCSSPad/code.js'    ] });

//logo-link fix $('#hubsEntryPoint .wikia-logo').attr('href', 'http://ru.community.wikia.com/');

//Purge importScriptPage( 'PurgeButton/code.js', 'dev' ); // Кнопка очистки кэша страницы var PurgeButtonText = 'Обновить';

//WHAM importScriptPage('WHAM/code.js', 'dev');

//Batch Delete importScriptPage('AjaxBatchDelete/code.js', 'dev');

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

//Advanced Wiki-Activity importScriptPage('User:Wildream/AdvancedWikiActivity/code.js', 'ru.community');

//Notifications //importScriptPage('User:Wildream/SoundNotifications.js', 'ru.community');

//Force Prewiew //importScriptURI('https://internal.wikia-inc.com/index.php?title=MediaWiki:ForcePreview.js&action=raw&ctype=text/javascript');

//Nav-menu hack importScriptPage('User:Wildream/UserFriendlyGlobalNav.js', 'ru.community');