|
|
| Line 1: |
Line 1: |
| − | WikiaEnableNewCreatepage = false;
| |
| − | WikiaDisableDynamicLinkCreatePagePopup = true;
| |
| | | | |
| − | function setCookie(c_name,value,expiredays) {
| |
| − | var exdate=new Date();
| |
| − | exdate.setDate(exdate.getDate()+expiredays);
| |
| − | document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
| |
| − | }
| |
| − |
| |
| − | function getCookie(c_name) {
| |
| − | if (document.cookie.length>0) {
| |
| − | c_start=document.cookie.indexOf(c_name + "=");
| |
| − | if (c_start!=-1) {
| |
| − | c_start=c_start + c_name.length+1;
| |
| − | c_end=document.cookie.indexOf(";",c_start);
| |
| − | if (c_end==-1) c_end=document.cookie.length;
| |
| − | return unescape(document.cookie.substring(c_start,c_end));
| |
| − | }
| |
| − | }
| |
| − | return "";
| |
| − | }
| |
| − |
| |
| − | var autoCollapse = 2;
| |
| − | var collapseCaption = "hide";
| |
| − | var expandCaption = "show";
| |
| − |
| |
| − | function collapseTable(i) {
| |
| − | var Button = $("#collapseButton" + i);
| |
| − | var Table = $("#collapsibleTable" + i);
| |
| − | if (Table.length<1 || Button.length<1) return false;
| |
| − | if (Button.text() == collapseCaption) {
| |
| − | Table.find("tr").not(":has('#collapseButton"+i+"')").hide();
| |
| − | setCookie("hideTable-" + wgArticleId + "-" + i,1,30);
| |
| − | Button.text(expandCaption);
| |
| − | } else {
| |
| − | Table.find("tr").not(":has('#collapseButton"+i+"')").show();
| |
| − | setCookie("hideTable-" + wgArticleId + "-" + i,0,30);
| |
| − | Button.text(collapseCaption);
| |
| − | }
| |
| − | }
| |
| − |
| |
| − | function createCollapseButtons() {
| |
| − | var tch = $("table.collapsible tr th");
| |
| − | tch.each(function (i) {
| |
| − | $(this).closest("table").attr("id", "collapsibleTable" + i);
| |
| − | $(this).prepend('<span style="float:right; font-weight:normal; text-align:right; width:6em">[<a href="javascript:collapseTable('+i+');" style="color:'+$(this).css("color")+';" id="collapseButton'+i+'">'+collapseCaption+'</a>]</span>');
| |
| − | if ($(this).closest("table").hasClass("collapsed") || (getCookie("hideTable-" + wgArticleId + "-" + i) == 1) || (tch.length >= autoCollapse && $(this).closest("table").hasClass("autocollapse"))) collapseTable(i);
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | var nbh = '['+collapseCaption+']';
| |
| − | var nbs = '['+expandCaption+']';
| |
| − | function toggleNavigationBar(i) {
| |
| − | var NavToggle = $("#NavToggle" + i);
| |
| − | var NavFrame = $("#NavFrame" + i);
| |
| − | if (NavFrame.length<1 || NavToggle.length<1) return false;
| |
| − | ncd=(NavToggle.text()==nbh)?'none':'block';
| |
| − | NavFrame.children(".NavPic,.NavContent").css("display",ncd);
| |
| − | nct=(NavToggle.text()==nbh)?nbs:nbh;
| |
| − | NavToggle.text(nct);
| |
| − | }
| |
| − |
| |
| − | // adds show/hide-button to navigation bars
| |
| − | function createNavigationBarToggleButton() {
| |
| − | $("div.NavFrame").each(function (i) {
| |
| − | NavToggleText = ($(this).children(".NavPic:visible,.NavContent:visible").length>0)?nbh:nbs;
| |
| − | $(this).children(".NavHead").append('<a href="javascript:toggleNavigationBar('+i+');" id="NavToggle'+i+'" class="NavToggle">'+NavToggleText+'</a>');
| |
| − | $(this).attr("id","NavFrame"+i);
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | // tooltips
| |
| − | if (getCookie("wiki-tiploader") != "no") document.write('<scr'+'ipt type="text/javascript" src="http://www.wowwiki.com/index.php?title=MediaWiki:Tooltips.js&action=raw&ctype=text/javascript&smaxage=18000"></scr'+'ipt>');
| |
| − |
| |
| − | // extract a URL parameter from the current URL
| |
| − | // From wikipedia:User:Lupin/autoedit.js
| |
| − | // paramName : the name of the parameter to extract
| |
| − |
| |
| − | function getParamValue(paramName) {
| |
| − | var cmdRe=RegExp( '[&?]' + paramName + '=([^&]*)' );
| |
| − | var h = document.location.href;
| |
| − | var m=cmdRe.exec(h);
| |
| − | if (m) {
| |
| − | try {
| |
| − | return decodeURIComponent(m[1]);
| |
| − | } catch (someError) {}
| |
| − | }
| |
| − | return null;
| |
| − | }
| |
| − |
| |
| − | // &withJS= URL parameter
| |
| − | // Allow to try custom scripts on the MediaWiki namespace without
| |
| − | // editing [[Special:Mypage/myskin.js]]
| |
| − | // from Wikipedia
| |
| − |
| |
| − | {
| |
| − | var extraJS = getParamValue("withJS");
| |
| − | if (extraJS) importScript(extraJS);
| |
| − | }
| |
| − |
| |
| − | // patching in changes to table sorting and alt rows
| |
| − | function changeTS() {
| |
| − | window['ts_alternate'] = function (table) {
| |
| − | $(table).find("tbody").find("tr:odd").removeClass("alt");
| |
| − | $(table).find("tbody").find("tr:even").addClass("alt");
| |
| − | }
| |
| − | window['ts_makeSortable'] = function (table) {
| |
| − | if ($(table).find("tr").length>0) firstRow = ($(table).find("th").length>0)?$(table).find("tr:has(th)").eq(0):$(table).find("tr").eq(0);
| |
| − | if (!firstRow) return;
| |
| − | firstRow.children(":not('.unsortable')").append(' <a href="javascript:;" class="sortheader" onclick="ts_resortTable(this); return false;"><span class="sortarrow"><img src="'+ts_image_path+ts_image_none+'" alt="↓"/></span></a>');
| |
| − | if (ts_alternate_row_colors) ts_alternate(table);
| |
| − | }
| |
| − | }
| |
| − |
| |
| − | // add scribblemap processing
| |
| − | function wwScribbleMaps() {
| |
| − | $("div.wwSM").each(function (i) {
| |
| − | mapID = $(this).attr("class").replace("wwSM map-","");
| |
| − | if (mapID.length > 20) mapID = "";
| |
| − | $(this).html('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="smwidget" align="middle"><param name="allowFullScreen" value="true" /><param name="FlashVars" value="id='+mapID+'&p=true&mt=false&d=true&z=true" /><param name="movie" value="http://widgets.scribblemaps.com/wowsmwidget.swf"/><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src="http://widgets.scribblemaps.com/wowsmwidget.swf" FlashVars="id='+mapID+'&p=true&mt=false&d=true&z=true" "quality="high" bgcolor="#000000" width="550" height="400" name="smwidget" align="middle" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
| |
| − | });
| |
| − | }
| |
| − |
| |
| − | function requireImageLicense() {
| |
| − | if (wgPageName == "Special:Upload" && getParamValue("wpDestFile") == null) {
| |
| − | $("[name=wpUpload]").not("#wpUpload").attr("disabled","true");
| |
| − | $("#wpLicense").change(function () {
| |
| − | if ($("#wpLicense").val()) {
| |
| − | $("[name=wpUpload]").removeAttr("disabled");
| |
| − | } else {
| |
| − | $("[name=wpUpload]").attr("disabled","true");
| |
| − | }
| |
| − | });
| |
| − | }
| |
| − | }
| |
| − |
| |
| − | /** Username replace function ([[template:USERNAME]]) *******************************
| |
| − | * Inserts user name into <span class="insertusername"></span>
| |
| − | * Originally by [[wikia:User:Splarka|Splarka]]
| |
| − | * New version by [[User:Spang|Spang]]
| |
| − | */
| |
| − | function UserNameReplace() {
| |
| − | if(typeof(disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName == null) return;
| |
| − | $("span.insertusername").html(wgUserName);
| |
| − | }
| |
| − |
| |
| − | function aCharLoad() {
| |
| − | for (x=0;x<$(".aChar").length;x++) {
| |
| − | data = $(".aChar").eq(x).text().split(";");
| |
| − | realm = data[0];
| |
| − | loc = (data[1].toLowerCase()=="eu")?"eu":"www";
| |
| − | character = data[2];
| |
| − | height = (data[3])?588:444;
| |
| − | $(".aChar").eq(x).html('<iframe src="http://'+loc+'.wowarmory.com/character-model-embed.xml?r='+realm+'&cn='+character+'&rhtml=true" scrolling="no" height="'+height+'" width="321" frameborder="0"></iframe>');
| |
| − | }
| |
| − | $(".aChar").css("display","block");
| |
| − | }
| |
| − |
| |
| − | function sortDays(a, b) {
| |
| − | return b.substring(b.indexOf(";")+1)-a.substring(a.indexOf(";")+1);
| |
| − | }
| |
| − |
| |
| − | function loadGSList(){
| |
| − | if ($("#gslist").length>0) {
| |
| − | var timestamp = 0;
| |
| − | var today = new Date();
| |
| − | var tsDate = new Date();
| |
| − | var dateRE = /(\d{4})-(\d\d)-(\d\d).*/;
| |
| − | var pArr = new Array();
| |
| − | $.getJSON("http://www.wowwiki.com/api.php?action=query&generator=categorymembers&gcmlimit=500&gcmsort=timestamp&gcmdir=desc&gcmtitle=Category:Guild_stubs&prop=revisions&rvprop=timestamp&format=json&callback=?", function(data) {
| |
| − | if (data.query) {
| |
| − | pages = data.query.pages;
| |
| − | for (pageID in pages) {
| |
| − | timestamp = pages[pageID].revisions[0].timestamp;
| |
| − | dateREd = dateRE.exec(timestamp);
| |
| − | tsDate.setFullYear(dateREd[1],dateREd[2]-1,dateREd[3]);
| |
| − | daysElapsed = Math.round((today - tsDate) / 86400000);
| |
| − | pArr[pArr.length] = pages[pageID].title + ";" + daysElapsed;
| |
| − | }
| |
| − | pArr2 = pArr.sort(sortDays);
| |
| − | gslBuffer = "<ul>";
| |
| − | for (n in pArr2) {
| |
| − | guild = pArr2[n].substring(0,pArr2[n].indexOf(";"));
| |
| − | daysE = pArr2[n].substring(pArr2[n].indexOf(";")+1);
| |
| − | daysE = (daysE < 0)?0:daysE;
| |
| − | daysE = (daysE > 29)?'<span style="color:red;">('+daysE+' days)</span>':'('+daysE+' days)';
| |
| − | gslBuffer += '<li><a href="/'+guild+'" title="'+guild+'">'+guild+'</a> ' + daysE + ' - <a href="/'+guild+'?action=history">History</a> • <a href="/'+guild+'?action=delete">Delete</a></li>';
| |
| − | }
| |
| − | gslBuffer += "</ul>";
| |
| − | $("#gslist").html(gslBuffer);
| |
| − | }
| |
| − | });
| |
| − | }
| |
| − | }
| |
| − |
| |
| − | $(function () {
| |
| − | if (wgAction == "view" && wgArticleId == 0 && wgNamespaceNumber == 0 && document.referrer.indexOf("search") == -1) document.location = "/?search=" + wgTitle;
| |
| − | createCollapseButtons();
| |
| − | createNavigationBarToggleButton();
| |
| − | changeTS();
| |
| − | wwScribbleMaps();
| |
| − | requireImageLicense();
| |
| − | UserNameReplace();
| |
| − | aCharLoad();
| |
| − | loadGSList();
| |
| − | $("ul.special>li:has(a[href*='Special:Log/useravatar'])").hide();
| |
| − | $(".new").unbind("click");
| |
| − | $(".quote").prepend("<span class='quotemark' style='float:right;'>”</span><span class='quotemark' style='float:left;'>“</span>").css("max-width","75%").after("<br clear='left' />");
| |
| − | $(".mw-mpt-link").html("<a href='/Special:WhatLinksHere/"+$(".firstHeading").text().replace("Move ","")+"'>Links to the old page title</a>");
| |
| − | });
| |