TyA (Message Wall | contribs) m (plus thing from Sactage) |
TyA (Message Wall | contribs) m (lers see what vanilla looks like) |
||
Line 1: | Line 1: | ||
− | importScriptURI('http://internal.vstf.wikia.com/index.php?title=User:TyA/scripts.js&action=raw&ctype=text/javascript'); |
||
− | |||
− | // Script config area |
||
− | AjaxRCRefreshText = 'Auto-refresh'; |
||
− | AjaxRCRefreshHoverText = 'Automatically refresh the page'; |
||
− | ajaxPages = ["Special:RecentChanges","Special:Log","Special:Contributions"]; |
||
− | var ajaxindicator = 'http://images1.wikia.nocookie.net/__cb20100617113125/dev/images/e/e4/3D_throbber.gif' |
||
− | |||
− | InactiveUsers = { months: 2 }; |
||
− | |||
− | var AutoEditDropdownConfig = { expandedAreaEdit: true }; |
||
− | |||
− | //script imports |
||
− | importArticles({ |
||
− | type: 'script', |
||
− | articles: [ |
||
− | 'w:c:vstf:User:Joeyaa/wham.js', |
||
− | 'w:c:dev:DisplayClock/code.js', |
||
− | 'w:c:vstf:User:Sactage/EasyCURangeCalc.js', |
||
− | 'w:c:dev:AjaxRC/code.js', |
||
− | 'w:c:dev:InactiveUsers/code.js', |
||
− | 'w:c:dev:AutoEditDropdown/code.js' |
||
− | ] |
||
− | }); |
||
− | |||
− | importScriptPage("User:TyA/namespaceNotify.js","ty"); |
||
− | importScriptPage("User:TyA/accountNavigation.js","c"); |
||
− | |||
− | /* Custom edit buttons */ |
||
− | if ( mwCustomEditButtons ) { |
||
− | mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
− | "imageFile": "http://images3.wikia.nocookie.net/zammy/images/0/0d/Global_page.png", |
||
− | "speedTip": "Global userpage", |
||
− | "tagOpen": "{{w:User:TyA}}", |
||
− | "tagClose": "", |
||
− | "sampleText": "" |
||
− | }; |
||
− | |||
− | mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
− | "imageFile": "http://images2.wikia.nocookie.net/zammy/images/b/b3/Bot_page.png", |
||
− | "speedTip": "Bot userpage", |
||
− | "tagOpen": "{{w:User:TyBot}}", |
||
− | "tagClose": "", |
||
− | "sampleText": "" |
||
− | }; |
||
− | |||
− | mwCustomEditButtons[mwCustomEditButtons.length] = { |
||
− | "imageFile": "http://images3.wikia.nocookie.net/zammy/images/f/ff/Signature_two.png", |
||
− | "speedTip": "Sign on Wikis without Template:NoSubst", |
||
− | "tagOpen": "{{User:TyA/sig}} " + "~~"+"~~"+"~", |
||
− | "tagClose": "", |
||
− | "sampleText": "" |
||
− | }; |
||
− | |||
− | } |
||
− | |||
− | /* Lets the join chat button open in a new tab + let the /chat.css and /chat.js pages work. Taken from Monchoman */ |
||
− | $(setTimeout('ChatCheck()', 200)); |
||
− | |||
− | function ChatCheck() { |
||
− | if($('.chat-join button').length != 0) { |
||
− | $('.chat-join button').replaceWith('<a class="wikia-button" onclick="OpenChatWindow()"><img src="http://images.wikia.com/zammy/images/c/c2/Chat_icon.png" style="margin-right:3px;">Join the Chat</a>'); |
||
− | } else { |
||
− | setTimeout('ChatCheck()', 200); |
||
− | } |
||
− | } |
||
− | |||
− | function OpenChatWindow() { |
||
− | window.chatwindow = window.open('/index.php?title=Special:Chat&useskin=wikia'); |
||
− | window.chatwindow.onload = function () { |
||
− | //addOnloadHook, importScript, and importStylesheet |
||
− | window.chatwindow.$('body').prepend('<script>\nfunction importScript(b){var a=wgScript+"?title="+encodeURIComponent(b.replace(/ /g,"_")).replace(/%2F/ig,"/").replace(/%3A/ig,":")+"&action=raw&ctype=text/javascript";return importScriptURI(a)}\nfunction importScriptURI(a){var b=document.createElement("script");b.setAttribute("src",a);b.setAttribute("type","text/javascript");document.getElementsByTagName("head")[0].appendChild(b);return b}\nfunction importScriptPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/javascript";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importScriptURI(a)}\nfunction importStylesheet(a){return importStylesheetURI(wgScript+"?action=raw&ctype=text/css&title="+encodeURIComponent(a.replace(/ /g,"_")))}\nfunction importStylesheetURI(b,d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.href=b;if(d){a.media=d}document.getElementsByTagName("head")[0].appendChild(a);return a}\nfunction importStylesheetPage(b,d){var a="/index.php?title="+encodeURIComponent(b.replace(/ /g,"_")).replace("%2F","/").replace("%3A",":")+"&action=raw&ctype=text/css";if(typeof d=="string"){if(d.indexOf("://")==-1){a="http://"+d+".wikia.com"+a}else{a=d+a}}return importStylesheetURI(a)}\n//This isn\'t the same as the regular addOnloadHook, because the regular one runs from a script tag in the body that I don\'t feel like appending. It\'s easier to just make it $(function), which is essentially equivalent\nfunction addOnloadHook(func) {$(func);}\n</script>'); |
||
− | //global.js |
||
− | window.chatwindow.importScriptURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.js&action=raw&ctype=text/javascript'); |
||
− | //chat.js |
||
− | window.chatwindow.importScriptURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.js&action=raw&ctype=text/javascript'); |
||
− | //global.css |
||
− | window.chatwindow.importStylesheetURI('http://community.wikia.com/index.php?title=User:' + wgUserName + '/global.css&action=raw&ctype=text/css'); |
||
− | //chat.css |
||
− | window.chatwindow.importStylesheetURI(wgServer + '/index.php?title=User:' + wgUserName + '/chat.css&action=raw&ctype=text/css'); |
||
− | |||
− | |||
− | } |
||
− | } |
||
− | |||
− | /* end moncho's chat thing */ |
||
− | |||
− | /* Sactage's "show YouTube info in hoverover" thing */ |
||
− | 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 Sactage's "show YouTube info in hoverover" thing */ |