User:Shining-Armor/global.js

importScriptURI('http://vstf.wikia.com/index.php?title=User:Sactage/EasyCURangeCalc.js&action=raw&ctype=text/javascript');

if (mw.config.get('wgPageName') === 'Special:Torus') { importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:Torus.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); $('head').append(' \            #torus { \                 position: fixed !important; \	         margin-top: 0 !important; \                 top: 0 !important; \	         left: 0 !important; \	         width: 100% !important; \	         height: 100% !important; \             } \             #WikiHeader, \             #WikiaHeader, \             #WikiaBar, \             #globalNavigation { \                 display: none; \             } \        '); } window.ajaxPages = [ "Special:RecentChanges", "Special:Watchlist", "Special:Log", "Special:Contributions" ];

var qtUserPageTemplate = ""; var qtEnableUserPageOverwrite = true;

var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': 'Spam', 'label': 'S' }; fdButtons[fdButtons.length] = { 'summary': 'Housekeeping', 'label': 'H' };

importArticles({   type: "script",    articles: [        "u:dev:WHAM/code.js",        "u:cpw:MediaWiki:Gadget-HotCat.js",        "u:dev:FastDelete/code.js",        "u:dev:AjaxBatchDelete/code.js",        "u:dev:AjaxRC/code.js",        "u:dev:AjaxUndo/code.js",        "u:dev:RevealAnonIP/usercode.js",        "u:dev:QuickCreateUserPage/code.js"    ] });

// Youtube info // Written by User: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)); }

// Written by User:Shining-Armor var ctt = window.ctt || {}; ctt.FormHTML = '\  \ \		 File delimiter: \  \ \		 Valid CSV document. \			 \ \ '; ctt.startParse = function(doc, del) { if (!doc) { alert('You must enter a valid CSV document to be parsed.'); return; } else if (!del) { alert('You must enter a CSV delimiter.'); return; }	var file = "{| class=\"wikitable\"\n"; var lines = doc.split("\n"); var headers = lines[0].split(del); var keys = []; for (var i = 0; i < headers.length; i++) { file += "! " + headers[i] + "\n"; }	file += "|-\n"; lines.shift; for (var i = 0; i < lines.length; i++) { keys = lines[i].split(del); for (var j = 0; j < keys.length; j++) { if (j === 0) { file += "| " + keys[j]; } else { file += " || " + keys[j]; }		}		file += "\n|-\n"; }	file += "|}"; $('#csv-2-table-document').val(file); }; ctt.closeModal = function { $('#form-csv2table').closeModal; }; ctt.showModal = function { $.showCustomModal('CSV 2 Table', ctt.FormHTML, {		id: 'form-csv2table',		width: 500,		buttons: [{			id: 'start-button',			message: 'Convert',			defaultButton: true,			handler: function {				var doc = $('#csv-2-table-document').val;				var del = $('#csv-2-table-delimiter').val;				ctt.startParse(doc, del);   			}		}, {			message: 'Cancel',			handler: function {				ctt.closeModal;			}		}]	}); }; ctt.init = function { if (mw.config.get('skin') === 'monobook') { mw.util.addPortletLink('p-tb', '#', 'CSV 2 Table', 't-csv'); } else { $('#my-tools-menu').prepend(' CSV 2 Table'); }	document.getElementById('t-csv').addEventListener('click', function {		ctt.showModal	}); }; $(document).ready(function {	ctt.init; });

importScriptPage( 'User:Shining-Armor/scripts/SpeedyDeleteComments.js', 'community' );