User:Josephyr/global.js

// ******************* // Hello, this is my global Javascript. Feel free to copy and use it! Just remember that some things are customized for me, so you might want to change it. =) // *******************

/* Imports */

$.getScript('https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js'); importScriptPage('ChatOptions/code.js','dev'); importScriptPage("ChatTags/code.js", "dev"); importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); importScriptPage('User:Joeytje50/tabinsert.js','rs'); importScriptPage('MessageBlocker/code.js', 'dev'); importScriptPage('PurgeButton/code.js', 'dev'); importScriptPage('WHAM/code.js', 'dev'); importScriptPage('MarkForDeletion/code.js', 'dev'); importScriptPage('ArchiveTool/code.js', 'dev'); importScriptPage('EditcountTag/code.js', 'dev'); importScriptPage('AjaxUndo/code.js', 'dev' ); importScriptPage('AjaxRC/code.js', 'dev'); importScriptPage('AjaxPatrol/code.js', 'dev'); importScriptPage('SearchGoButton/code.js', 'dev'); importScriptPage('User:Sactage/scripts/Speedy-Comments.js', 'cod'); importScriptPage('QQX/code.js', 'dev'); importScriptPage('WallGreetingButton/code.js', 'dev'); importScriptPage('ChatBlockButton/code.js', 'dev'); importScriptPage('MediaWiki:Gadget-HotCat.js', 'dev' ); importScriptPage('CacheCheck/code.js', 'dev' ); importScriptPage('CategoryRenameAuto-update/code.js', 'dev' ); importScriptPage('QuickComments/code.js', 'dev' ); importScriptPage('Tools/Quick_User_Switch/code.js', 'gamedezyner'); importScriptPage('SkinSwitchButton/code.js', 'dev');

importArticles({ type:'script', articles:[ 'w:c:dev:RevealAnonIP/code.js', //Reveal Anonymous User IP  'w:c:dev:ShowHide/code.js',  'w:c:dev:DisplayClock/code.js',  'w:c:dev:QuickTools/advanced.js',  'w:c:dev:AutoEditDropdown/code.js',  'w:c:dev:HideRail/code.js',  'w:c:dev:BackToTopButton/code.js',  'w:c:coreychambers:MediaWiki:VectorSkin.js',  'u:dev:MiniComplete/code.js',  'u:dev:HeaderLinks/code.js',  'u:wikimarks:Client.js',  'u:dev:ListFiles/code.js',  'u:dev:NullEditButton/code.js',  'u:dev:Message/code.js',  'u:dev:SearchSuggest/code.js',  'u:dev:QuickModTools/loader.js',  'u:dev:PageMakerPro/code.js',  'u:dev:PurgeButton/code.js',  'u:dev:UserRightsRecord/code.js',  'u:dev:ChatBlockButton/code.js',  'u:dev:UserRightsRecord/code.js'    ] });

/* End Imports */

// ******************* // Custom Buttons // ******************* $(function { $('Sandbawx').insertBefore('.AccountNavigation .subnav li:first'); });

$(function { $('Sysops').insertBefore('.AccountNavigation .subnav li:first'); });

$(function { $('Leaderboard').insertBefore('.AccountNavigation .subnav li:first'); });

$(function { $('Contribs').insertBefore('.AccountNavigation .subnav li:first'); }); $(function { $('<a href="http://community.wikia.com/wiki/User:JosephHawk/global.js">Global.js</a></li>').insertBefore('.AccountNavigation .subnav li:first'); });

$(function { $('<a href="http://community.wikia.com/wiki/Template:User:JosephHawk">Userpage</a></li>').insertBefore('.AccountNavigation .subnav li:first'); });

// ******************* // Custom edit buttons // *******************

if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/central/images/b/b4/Button_category03.png", "speedTip": "Category", "tagOpen": "[[Category:",    "tagClose": "]]", "sampleText": "Category name"}; }

if (wgAction == "edit" || wgAction == "submit") { /***** Custom edit buttons *****/ if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#redirect",               "tagClose": "", "sampleText": "PAGE"};

mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images2.wikia.nocookie.net/__cb20100502153339/callofduty/images/1/17/Button_Ssig.jpg", "speedTip": "Signature", "tagOpen": "", "sampleText": ""};

} }

// *********************** // End custom edit buttons // ***********************

// ********** // Fastdelete // ********** var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Unnecessary ', 'label': 'Unnec'}; fdButtons[fdButtons.length] = { 'summary': 'Off Topic', 'label': 'Off topic'}; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'Spam'}; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'Housekeeping'}; // Import for Delete & Delete and Protect buttons if (wgNamespaceNumber == 0) { importScriptPage('User:The Mol Man/FastDeleteProtect.js', 'a'); } else { importScriptPage('FastDelete/code.js', 'dev'); }; // ************** // End Fastdelete // **************

/* change publish to save and rename to move */ function PublishToSave { $('#wpSave').val('Save changes'); $('a[data-id="move"]').html('Move'); } window.onload=PublishToSave

/* Extra Links to Toolbar */ $('ul.tools li:first-child').before('<a href="http://c.wikia.com/wiki/Special:RandomWiki">Random Wiki</a></li>'); $('ul.tools li:first-child').before('<a href="/wiki/Special:Log/block">Block Log</a></li>'); $('ul.tools li:first-child').before('<a href="/wiki/Special:Log">Logs</a></li>'); $('ul.tools li:first-child').before('<a href="/wiki/Special:RecentChanges?hideenhanced=1&hidelogs=1">Recent changes</a></li>'); $('ul.tools li:first-child').before('<a href="http://community.wikia.com/wiki/Adoption:Requests">Adoption Requests</a></li>');

/* Quick Create User Page */

importArticles({   type: 'script',    articles: [        'w:dev:QuickCreateUserPage/code.js'    ] }); var qtEnableUserPageOverwrite = true; var qtUserPageTemplate = '';

/* End of Quick Create User Page */

/* Quick Create Message Wall Greeting */

importArticles({   type: 'script',    articles: [        'w:dev:QuickCreateMessageWallGreeting/code.js'    ] }); var qtEnableMessageWallGreetingOverwrite = true; var qtMessageWallGreetingTemplate = '';

/* End of Quick Create Message Wall Greeting */

/** * To use this script, install it and view:  Special:BlankPage?blankspecial=interlanguage * Borrowed from Thisismyrofl, made by Mathmagician */ if (mediaWiki.config.get('wgCanonicalSpecialPageName') === 'Blankpage' && $.getUrlVar('blankspecial') === 'interlanguage') { (function ($, mw) {		var url = mw.config.get('wgServer') + '/api.php?action=query&meta=siteinfo&siprop=interwikimap&format=json';		// get local interwiki map		$.getJSON(url, function (data) { var interlanguageWikis = [], map = data.query.interwikimap; for (var i = 0, len = map.length; i < len; i++) { if (map[i].language) { interlanguageWikis[interlanguageWikis.length] = map[i]; }			}			// display results in an HTML table $(function {				// generate html				var wiki, link, html, message;				message = ' The ' + mw.config.get('wgSiteName') + ' appears to be available in ' + interlanguageWikis.length + ' language(s).  Do you know of a version of this wiki in a language not listed here? You can make a request <a title="Community Central:Interlanguage link requests" href="http://community.wikia.com/wiki/Community_Central:Interlanguage_link_requests">here</a> for it to be <a title="Help:Interlanguage links" href="http://community.wikia.com/wiki/Help:Interlanguage_links">interlanguage linked</a>. ';				html = ' ' + message + ' ';				// insert html				document.title = 'Interlanguage wikis';				$('#firstHeading, #WikiaArticle h1').first.text('Interlanguage wikis');				$('#mw-content-text').html(html);			}); });	}(jQuery, mediaWiki)); }

/* Sactage's show YouTube info */ 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)); } /* end show Youtube Info */