MediaWiki:Common.js

Z MediaWiki SPŠ a VOŠ Písek
Přejít na: navigace, hledání

Poznámka: Po uložení musíte smazat cache vašeho prohlížeče, jinak změny neuvidíte.

  • Firefox / Safari: Při kliknutí na Aktualizovat držte Shift nebo stiskněte Ctrl-F5 nebo Ctrl-R (na Macu ⌘-R).
  • Google Chrome: Stiskněte Ctrl-Shift-R (na Macu ⌘-Shift-R).
  • Internet Explorer: Při kliknutí na Aktualizovat držte Ctrl nebo stiskněte Ctrl-F5.
  • Konqueror: Klikněte na Aktualizovat nebo stiskněte F5.
  • Opera: Smažte obsah cache v menu Nástroje → Nastavení.
/* Zde uvedený JavaScript bude použit pro všechny uživatele při načtení každé stránky.  */
 
importScriptURI('http://wiki.sps-pi.com/ExternalJs/Cites.js&action=raw&ctype=text/javascript');
 
 
/* ProveIt, commit e99b01a23e00, Copyright 2010, Georgia Tech
   Available under the GNU Free Documentation License, Creative Commons Attribution/Share-Alike License 3.0, and the GNU General Public License version 2
   This is a minified version.  Changes can be made through our Google Code Project (http://code.google.com/p/proveit-js/) */window.proveit=jQuery.extend({HALF_EDIT_BOX_HEIGHT:200,LANG:"en",NEW_PARAM_PREFIX:"newparam",EDIT_PARAM_PREFIX:"editparam",STATIC_BASE:"http://proveit-js.googlecode.com/hg/static/",JQUERYUI_SCRIPT_URL:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/jquery-ui.min.js",JQUERYUI_STYLES_URL:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/base/jquery-ui.css",descriptions:{en:{agency:"Agency",name:"Name",author:"Author (L, F)",author2:"Author two (L, F)",author3:"Author three (L, F)",author4:"Author four (L, F)",
author5:"Author five (L, F)",author6:"Author six (L, F)",author7:"Author seven (L, F)",author8:"Author eight (L, F)",author9:"Author nine (L, F)",last:"Last name",last2:"Last name (auth. two)",last3:"Last name (auth. three)",last4:"Last name (auth. four)",last5:"Last name (auth. five)",last6:"Last name (auth. six)",last7:"Last name (auth. seven)",last8:"Last name (auth. eight)",last9:"Last name (auth. nine)",first:"First name",first2:"First name (auth. two)",first3:"First name (auth. three)",first4:"First name (auth. four)",
first5:"First name (auth. five)",first6:"First name (auth. six)",first7:"First name (auth. seven)",first8:"First name (auth. eight)",first9:"First name (auth. nine)",authorlink:"Author article name",title:"Title",publisher:"Publisher",year:"Year",location:"Location",place:"Location of work",isbn:"ISBN",id:"ID",doi:"DOI",page:"Page",pages:"Pages",quote:"Quote",month:"Month",journal:"Journal",edition:"Edition",volume:"Volume",issue:"Issue",url:"URL",date:"Publication date",accessdate:"Access date",
coauthors:"Co-authors",booktitle:"Title of Proceedings",contribution:"Contribution/Chapter",encyclopedia:"Encyclopedia",newsgroup:"Newsgroup",version:"Version",site:"Site",newspaper:"Newspaper","publication-place":"Publication location",editor:"Editor (L, F)",article:"Article",pubplace:"Publisher location",pubyear:"Publication year",inventor:"Inventor (L, F)","issue-date":"Issue date","patent-number":"Patent number","country-code":"Country code (XX)",work:"Work",format:"Format",issn:"ISSN",pmid:"PMID",
chapter:"Chapter",web:"Web",book:"Book",conference:"Conference",news:"News",paper:"Paper","press release":"Press release",interview:"Interview",subject:"Subject",subjectlink:"Subject article name",subject2:"Subject two",subjectlink2:"Subject two article name",subject3:"Subject three",subjectlink3:"Subject three article name",subject4:"Subject four",interviewer:"Interviewer",cointerviewers:"Co-interviewers",type:"Type",program:"Program",callsign:"Call sign",city:"City",archiveurl:"Archive URL",archivedate:"Date archived",
episode:"Episode",episodelink:"Episode article name",series:"Series",serieslink:"Series article name",credits:"Credits",network:"Network",station:"Station",airdate:"Airdate",began:"Start date",ended:"End date",season:"Season number",seriesno:"Season number",number:"Number",minutes:"Minutes",transcript:"Transcript",transcripturl:"Transcript URL",video:"Video",people:"People",medium:"Production medium",language:"Language",time:"Time",oclc:"OCLC",ref:"Anchor ID",months:"January,February,March,April,May,June,July,August,September,October,November,December".split(",")},
fi:{agency:"Edustaja",name:"Nimi",author:"Tekij\u00e4",author2:"Tekij\u00e4 kaksi",author3:"Tekij\u00e4 kolme",author4:"Tekij\u00e4 nelj\u00e4",author5:"Tekij\u00e4 viisi",author6:"Tekij\u00e4 kuusi",author7:"Tekij\u00e4 seitsem\u00e4n",author8:"Tekij\u00e4 kahdeksan",author9:"Tekij\u00e4 yhdeks\u00e4n",last:"Sukunimi",last2:"Sukunimi (tekij\u00e4 2)",last3:"Sukunimi (tekij\u00e4 3)",last4:"Sukunimi (tekij\u00e4 4)",last5:"Sukunimi (tekij\u00e4 5)",last6:"Sukunimi (tekij\u00e4 6)",last7:"Sukunimi (tekij\u00e4 7)",
last8:"Sukunimi (tekij\u00e4 8)",last9:"Sukunimi (tekij\u00e4 9)",first:"Etunimi",first2:"Etunimi (tekij\u00e4 2)",first3:"Etunimi (tekij\u00e4 3)",first4:"Etunimi (tekij\u00e4 4)",first5:"Etunimi (tekij\u00e4 5)",first6:"Etunimi (tekij\u00e4 6)",first7:"Etunimi (tekij\u00e4 7)",first8:"Etunimi (tekij\u00e4\t8)",first9:"Etunimi (tekij\u00e4 9)",authorlink:"Tekij\u00e4st\u00e4 kertova sivu",title:"Otsikko",publisher:"Julkaisija",year:"Vuosi",location:"Paikka",place:"Ty\u00f6n paikka",isbn:"ISBN",id:"ID",
doi:"DOI",page:"Sivu",pages:"Sivuja",quote:"Lainaus",month:"Kuukausi",journal:"Aikakauslehti",edition:"Painos",volume:"Vuosikerta",issue:"Numero",url:"Osoite",date:"Julkaisup\u00e4iv\u00e4",accessdate:"Luettu",coauthors:"Muut tekij\u00e4t",booktitle:"Jatko-osien otsikko",contribution:"Osallistuminen/yhteisty\u00f6",encyclopedia:"Tietosanakirja",newsgroup:"Uutisryhm\u00e4",version:"Versio",site:"Sivusto",newspaper:"Sanomalehti","publication-place":"Julkaisupaikka",editor:"Toimittaja",article:"Artikkeli",
pubplace:"Julkaisijan paikka",pubyear:"Julkaisuvuosi",inventor:"Keksij\u00e4","issue-date":"Saatavilla p\u00e4iv\u00e4n\u00e4","patent-number":"Patenttinumero","country-code":"Maakoodi (XX)",work:"Ty\u00f6",format:"Muoto",issn:"ISSN",pmid:"PMID",chapter:"Luku",web:"Verkko",book:"Kirja",conference:"Kokous",news:"Uutiset",paper:"Lehti","press release":"Lehdist\u00f6tiedote",interview:"Haastattelu",subject:"Otsikko",subjectlink:"Artikkelin otsikko",subject2:"Otsikko kaksi",subjectlink2:"Artikkelin kaksi otsikko",
subject3:"Otsikko kolme",subjectlink3:"Artikkelin kolme otsikko",subject4:"Otsikko nelj\u00e4",interviewer:"Haastattelija",cointerviewers:"Muut haastattelijat",type:"Tyyppi",program:"Ohjelma",callsign:"Call sign",city:"Kaupunki",archiveurl:"Arkiston osoite",archivedate:"Arkistointip\u00e4iv\u00e4m\u00e4\u00e4r\u00e4",episode:"Jakso",episodelink:"Jakson sivun nimi",series:"Sarja",serieslink:"Sarjan sivun nimi",credits:"Tekij\u00e4t",network:"Verkko",station:"Asema",airdate:"L\u00e4hetysp\u00e4iv\u00e4",
began:"Aloitusp\u00e4iv\u00e4",ended:"Lopetusp\u00e4iv\u00e4",season:"Kauden numero",seriesno:"Kauden numero",number:"Numero",minutes:"Minuutit",transcript:"Puhtaaksi kirjoitettu teksti",transcripturl:"Puhtaaksikirjoitetun osoite",video:"Video",people:"Ihmiset",medium:"Tuotantomedia",language:"Kieli",time:"Aika",oclc:"OCLC",ref:"Ankkurin ID-tunnus",months:"tammikuu,helmikuu,maaliskuu,huhtikuu,toukokuu,kes\u00e4kuu,hein\u00e4kuu,elokuu,syyskuu,lokakuu,marraskuu,joulukuu".split(",")}},getDescriptions:function(){return this.descriptions[proveit.LANG]},
log:function(a){typeof console==="object"&&console.log&&console.log("[ProveIt] %o",a)},isSupportedEditPage:function(){return(wgCanonicalNamespace==""||wgPageName=="Wikipedia:Sandbox")&&(wgAction=="edit"||wgAction=="submit")},getRefBox:function(){return jQuery("#refs")},getPosition:function(a){var c=0,b=0;do c+=a.offsetLeft,b+=a.offsetTop;while(a=a.offsetParent);return{left:c,top:b}},highlightLengthAtIndex:function(a,c){(a<0||c<0)&&this.log("highlightStringAtIndex: invalid negative arguments");var b=
this.getMWEditBox(),d=b.value,e=this.getPosition(b).top;b.value=d.substring(0,a);b.focus();b.scrollTop=1E6;e=b.scrollTop;b.value+=d.substring(a);if(e>0)b.scrollTop=e+this.HALF_EDIT_BOX_HEIGHT;jQuery(b).focus().textSelection("setSelection",{start:a,end:a+c});e=this.getPosition(b).top;window.scroll(0,e);return!0},highlightTargetString:function(a){var c=this.getMWEditValue().indexOf(a);return c==-1?(this.log('Target string "'+a+'" not found.'),!1):this.highlightLengthAtIndex(c,a.length)},getMWEditBox:function(){return jQuery("#wpTextbox1")[0]},
getMWEditValue:function(){var a=this.getMWEditBox(),c=a.value;!a.selectionStart&&document.selection&&(c=c.replace(/\r\n/g,"\n"));return c},getMWEditForm:function(){return jQuery("#editform")[0]},addOnsubmit:function(a){var c=this.getMWEditForm();if(!c)throw Error("No edit form, possibly due to protected page.");c.addEventListener("submit",a,!1)},getEditSummary:function(){return jQuery("#wpSummary")[0]},summaryFunctionAdded:!1,shouldAddSummary:!0,loadMaximized:!1,includeProveItEditSummary:function(){if(this.shouldAddSummary&&
!this.summaryFunctionAdded)try{var a=this;this.addOnsubmit(function(){var c=a.getEditSummary();c.value.indexOf("ProveIt")==-1&&(c.value+=" (edited with [[User:ProveIt_GT|ProveIt]])")});this.summaryFunctionAdded=!0}catch(c){this.log("Failed to add onsubmit handler. e.message: "+c.message)}},load:function(){this.summaryFunctionAdded=!1;this.isSupportedEditPage()&&jQuery.getScript(proveit.JQUERYUI_SCRIPT_URL,function(){addOnloadHook(function(){proveit.createGUI()})});return!0},clearRefBox:function(){var a=
this.getRefBox();if(a==null)return this.log("Ref box is not loaded yet."),!1;a=jQuery("tr:not('tr#dummyRef')",a);jQuery(a).remove()},insertRefIntoMWEditBox:function(a,c){var b=this.getMWEditBox();if(!b)return this.log("insertRefIntoMWEditBox: txtarea is null"),!1;var b=jQuery(b),d=a.getInsertionText(c);b.textSelection("encapsulateSelection",{peri:d,replace:!0});b=b.textSelection("getCaretPosition",{startAndEnd:!0});this.highlightLengthAtIndex(b[0],b[1]-b[0]);this.includeProveItEditSummary()},changeRefFromEditPane:function(a,
c){var b=jQuery("div.input-row",c),d=jQuery("#editrefname").val();a.name=d!=""?d:null;a.params={};for(var e,f,d=0;d<b.length;d++)e=b[d],f=jQuery(".paramvalue",e)[0],e=jQuery(e).hasClass("addedrow")?jQuery(".paramdesc",e)[0].value.trim():f.id.substring(this.EDIT_PARAM_PREFIX.length),this.log("paramName: "+e),f=f.value.trim(),this.log("paramVal: "+f),e!=""&&f!=""&&(a.params[e]=f);if(a.toString()!=a.orig)a.save=!1;a.update();return a},saveRefFromEdit:function(a){if(!a.save){var c=this.makeRefBoxRow(a,
!0),b=jQuery(".selected",this.getRefBox()).get(0);this.log("newRichItem: "+c+", oldRichItem: "+b+"oldRichItem.parentNode: "+b.parentNode);var d=jQuery("td.number",b).text();jQuery("td.number",c).text(d);b.parentNode.replaceChild(c,b);jQuery(c).addClass("selected");a.updateInText();this.includeProveItEditSummary()}},updateEditPane:function(a){jQuery("#editrefname").val(a.name||"");var c={},b;for(b in a.params)c[b]=a.params[b];var d=a.getDefaultParams();for(b=0;b<d.length;b++)c[d[b]]||(c[d[b]]="");
var d=a.getRequiredParams(),e=[],f;for(f in c)e.push(f);(f=a.getSorter())?e.sort(f):e.sort();jQuery("#edit-fields").children(".paramlist").children().remove("div:not(.hidden)");for(b=0;b<e.length;b++)this.addPaneRow(jQuery("#edit-pane").get(),c,this.getDescriptions(),e[b],d[e[b]],!0);var g=jQuery("#edit-buttons .accept"),i=function(){proveit.log("Entering acceptEdit");proveit.changeRefFromEditPane(a,jQuery("#edit-pane").get());proveit.saveRefFromEdit(a);g.unbind("click",i);jQuery("#edit-pane").hide();
jQuery("#view-pane").show()};setTimeout(function(){jQuery("#edit-fields").scrollTop(0)},0);g.click(i);jQuery(".tab-link").one("click",function(){g.unbind("click",i)})},addPaneRow:function(a,c,b,d,e,f){var g=jQuery("#"+(f?"preloadedparamrow":"addedparamrow")).clone();jQuery(g).attr("id","");var i=jQuery(".paramdesc",g).eq(0),j=jQuery(".paramvalue",g).eq(0);jQuery(".paramlist",a).append(g);e?(jQuery(i).addClass("required"),jQuery(".delete-field",g).remove()):this.activateRemoveField(g);f?(i.attr("for",
this.EDIT_PARAM_PREFIX+d),j.attr("id",this.EDIT_PARAM_PREFIX+d),a=b[d],a||(this.log("Undefined description for param: "+d+".  Using directly as description."),a=d),jQuery(i).text(a),jQuery(i).attr("title",d),jQuery(j).val(c[d]),jQuery(g).show()):(jQuery(g).show("highlight",{},"slow"),jQuery(".inputs",a).scrollTop(1E5))},togglestyle:!0,toggleinsert:!1,split:function(a,c,b){if(Object.prototype.toString.call(c)!=="[object RegExp]")return proveit.split._nativeSplit.call(a,c,b);var d=[],e=0,f=(c.ignoreCase?
"i":"")+(c.multiline?"m":"")+(c.sticky?"y":""),c=RegExp(c.source,f+"g"),g,i,j;a+="";proveit.split._compliantExecNpcg||(g=RegExp("^"+c.source+"$(?!\\s)",f));if(b===void 0||+b<0)b=Infinity;else if(b=Math.floor(+b),!b)return[];for(;i=c.exec(a);){f=i.index+i[0].length;if(f>e&&(d.push(a.slice(e,i.index)),!proveit.split._compliantExecNpcg&&i.length>1&&i[0].replace(g,function(){for(var a=1;a<arguments.length-2;a++)arguments[a]===void 0&&(i[a]=void 0)}),i.length>1&&i.index<a.length&&Array.prototype.push.apply(d,
i.slice(1)),j=i[0].length,e=f,d.length>=b))break;c.lastIndex===i.index&&c.lastIndex++}e===a.length?(j||!c.test(""))&&d.push(""):d.push(a.slice(e));return d.length>b?d.slice(0,b):d},splitNameVals:function(a){var c={};c.names=proveit.split(a.substring(a.indexOf("|")+1),/=(?:[^|]*?(?:\[\[[^|\]]*(?:\|(?:[^|\]]*))?\]\])?)+(?:\||\}\})/);c.names.length--;c.values=proveit.split(a.substring(a.indexOf("=")+1,a.indexOf("}}")),/\|[^|=]*=/);return c},scanForRefs:function(){this.log("Entering scanForRefs.");this.clearRefBox();
var a=this.getMWEditValue(),c,b={},d=[];a.match(/<[\s]*ref[^\/>]*>/gi);if(a=a.match(/<[\s]*ref[^>]*>(?:[^<]*<[\s]*\/[\s]*ref[\s]*>)?/gi))for(var e=0;e<a.length;e++){var f=this.makeRef(a[e]);f?(c=f.name)||d.push(f):c=(c=a[e].match(this.REF_REGEX))&&(c[1]||c[2]||c[3]);if(c){if(!b[c]&&(b[c]={},!b[c].strings))b[c].strings=[];if(f&&!b[c].reference)b[c].reference=f,d.push(f);b[c].strings.push(a[e])}}for(a=0;a<d.length;a++)d[a].name&&d[a].setCitationStrings(b[d[a].name].strings),this.addNewElement(d[a])},
REF_REGEX:/<[\s]*ref[\s]*name[\s]*=[\s]*(?:(?:\"(.*?)\")|(?:\'(.*?)\')|(?:(.*?)))[\s]*\/?[\s]*>/,makeRef:function(a){var c=/<[\s]*ref[^>]*>[^<]*\S[^<]*<[\s]*\/[\s]*ref[\s]*>/.test(a);this.log("refText: "+a+"; isReference: "+c);if(!c)return null;c=a.match(/{{[\s]*cite/i)?this.CiteReference:a.match(/{{[\s]*Citation/i)?this.CitationReference:this.RawReference;if(c!=this.RawReference){var b=a.match(/{{[\s]*(cite|Citation)[\s\S]*?}}/i)[0],d=a.match(this.REF_REGEX);if(d&&d!=null)var e=d[1]||d[2]||d[3];
d=b.split(/\|/g);if(c==this.CiteReference)var f=d[0].toLowerCase().indexOf("e"),g=d[0].indexOf("}"),f=d[0].substring(f+1,g!=-1?g:d[0].length).trim()}a=new c({name:e,type:f,save:!0,inMWEditBox:!0,orig:a});if(c!=this.RawReference){c=this.splitNameVals(b);b=c.names;c=c.values;for(e=0;e<b.length;e++)d=b[e].trim().replace(/(?:\s*\|)*(.*)/,"$1"),f=c[e].trim(),f!=""&&(a.params[d]=f)}return a},AbstractReference:function(a){if(!this.setType)this.setType=function(a){this.type=a};this.update=function(){var a=
this.toString(),b=this.getCitationStrings();if(b.length>0)for(var d=0;d<b.length;d++)b[d]==this.orig&&(proveit.log("Updating "+b[d]+" to "+a),b[d]=a);else this.name!=null&&(proveit.log("Adding "+a+" to citationStrings"),b.push(a))};this.name=a.name!=""?a.name:null;this.setType(a.type);this.save=a.save;this.inMWEditBox=a.inMWEditBox;this.orig=a.orig;this.params={};this.getSorter=function(){var a=this;return function(b,d){var e=a.getSortIndex(b),f=a.getSortIndex(d);return e!=-1&&f!=-1?e-f:b<d?-1:b==
d?0:1}};this.isValid=function(){return!0};this.getLabel=function(){var a="";if(this.params.author)a=this.params.author+"; ";else if(this.params.last)a=this.params.last,this.params.first&&(a+=", "+this.params.first),a+="; ";this.params.title&&(a+=this.params.title);if(a==""){for(var b in this.params)break;b&&(a=b)}return a};this.getInsertionText=function(a){proveit.log("getInsertionText");if(a)return this.toString();else if(this.name)return'<ref name="'+this.name+'" />';else throw Error("getInsertionText: ref.name is null");
};this.updateInText=function(){var a=proveit.getMWEditBox();if(a&&a!=null){a.focus();var b=proveit.getMWEditValue(),b=b.replace(this.orig,this.toString());a.value=b;this.orig=this.toString();this.save=!0;proveit.highlightTargetString(this.toString())}};this.toStringInternal=function(a,b){var d=this.name?'<ref name="'+this.name+'">':"<ref>";d+="{{"+a+(b?" "+this.type:"");for(var e in this.params)d+=" | "+e+"="+this.params[e];d+="}}</ref>";return d};this.citationStrings=[];this.setCitationStrings=function(a){this.citationStrings=
a};this.getCitationStrings=function(){return this.citationStrings};this.getIcon=function(){return proveit.STATIC_BASE+"page_white.png"}},CiteReference:function(a){var c={web:"web",book:"book",journal:"journal",conference:"conference",encyclopedia:"encyclopedia",news:"news",newsgroup:"newsgroup",paper:"journal","press release":"press release",pressrelease:"press release",interview:"interview",episode:"episode",video:"video"};this.setType=function(a){var b=c[a];this.type=b!=null?b:a};proveit.AbstractReference.call(this,
a);this.getSortIndex=function(a){return jQuery.inArray(a,"url,title,encyclopedia,publisher,work,date,agency,accessdate,author,last,first,subject,subjectlink,inventor,editor,author2,last2,first2,subject2,subjectlink2,author3,last3,first3,subject3,subjectlink3,author4,last4,first4,subject4,author5,last5,first5,author6,last6,first6,author7,last7,first7,author8,last8,first8,author9,last9,first9,authorlink,coauthors,interviewer,cointerviewers,type,newsgroup,journal,booktitle,program,episodelink,series,serieslink,credits,network,station,callsign,city,airdate,began,ended,season,seriesno,number,minutes,transcript,transcripturl,people,year,month,article,contribution,format,medium,newspaper,conference,volume,edition,issue,location,pages,page,language,isbn,issn,oclc,doi,pmid,id,archiveurl,archivedate,time,quote,ref".split(","))};
this.toString=function(){return this.toStringInternal("cite",!0)};var b={web:{url:!0,title:!0},book:{title:!0},journal:{title:!0},conference:{title:!0},encyclopedia:{title:!0,encyclopedia:!0},news:{title:!0,work:!0,date:!0},newsgroup:{title:!0},"press release":{title:!0},interview:{last:!0},episode:{title:!0},video:{title:!0}};this.getRequiredParams=function(){var a=b[this.type];return a?a:{}};var d={web:"url,title,author,accessdate,work,publisher,date,pages".split(","),book:"title,author,authorlink,year,isbn,publisher,location,pages".split(","),
journal:"title,author,journal,volume,issue,year,month,pages,url,doi".split(","),conference:"conference,title,booktitle,author,editor,year,month,url,id,accessdate,location,pages,publisher".split(","),encyclopedia:"title,encyclopedia,author,editor,accessdate,edition,year,publisher,volume,location,pages".split(","),news:"title,author,url,work,date,accessdate,pages,location,agency".split(","),newsgroup:"title,author,date,newsgroup,id,url,accessdate".split(","),"press release":["title","url","publisher",
"date","accessdate"],interview:"last,first,subjectlink,interviewer,title,callsign,city,date,program,accessdate".split(","),episode:"title,series,credits,airdate,city,network,season".split(","),video:"people,date,url,title,medium,location,publisher".split(",")};this.getDefaultParams=function(){var a=d[this.type];return a?a:[]};this.isValid=function(){if(this.type=="")return!1;var a=this.getRequiredParams(),b=!0,c;for(c in a)if(a[c]&&(b&=c in this.params,!b))break;return b};var e={web:"page_white_world.png",
book:"book.png",journal:"page_white_text.png",news:"newspaper.png",newsgroup:"comments.png","press release":"transmit_blue.png",interview:"telephone.png",episode:"television.png",video:"film.png"},f=this.getIcon;this.getIcon=function(){var a=e[this.type];return a?proveit.STATIC_BASE+a:f.call(this)}},CitationReference:function(a){proveit.AbstractReference.call(this,a);var c={},b={web:["url","author","title","date","accessdate"],news:"author,title,newspaper,url,publication-place,volume,issue,date,pages".split(","),
encyclopedia:"author,editor,contribution,title,publisher,place,year,volume,pages".split(","),book:["author","title","publisher","place","year"],journal:"author,title,journal,volume,issue,year,pages".split(","),patent:["inventor","title","issue-date","patent-number","country-code"]};this.getSortIndex=function(a){return"last,first,url,author,editor,contribution,author-link,last2,first2,author2-link,publication-date,inventor,title,issue-date,patent-number,country-code,journal,volume,newspaper,issue,date,publisher,place,year,edition,publication-place,series,version,pages,page,id,isbn,doi,oclc,accessdate".split(",").indexOf(a)};
this.toString=function(){return this.toStringInternal("Citation",!1)};this.getRequiredParams=function(){return c};this.getDefaultParams=function(){return this.type?b[this.type]:["url","title","author","date","publisher"]}},RawReference:function(a){proveit.AbstractReference.call(this,a);this.type="raw";this.toString=function(){return this.orig};this.params.title=this.orig;this.getIcon=function(){return proveit.STATIC_BASE+"raw.png"}},getRefFromAddPane:function(a){for(var c=a.id,c=new (this.togglestyle?
this.CiteReference:this.CitationReference)({name:jQuery("#addrefname").val(),type:c}),b,a=jQuery(".paramlist",a)[0],d=jQuery("div",a),e=0;e<d.length;e++){b=d[e];this.log("getRefFromAddPane: i: "+e+", paramRow: "+b);var f=jQuery(".paramvalue",b)[0],a=jQuery(b).hasClass("addedrow")?jQuery(".paramdesc",b)[0].value.trim():f.id.substring(this.NEW_PARAM_PREFIX.length);this.log("getRefFromAddPane: paramRow.childNodes.length: "+b.childNodes.length);this.log("getRefFromAddPane: valueTextbox.refName: "+f.refName);
this.log("getRefFromAddPane: valueTextbox.id: "+f.id);b=f.value.trim();this.log("getRefFromAddPane: paramName: "+a+"; paramVal: "+b);a!=""&&b!=""&&(c.params[a]=b)}c.update();this.log("Exiting getRefFromAddPane");return c},addReference:function(a){this.addNewElement(a);a.orig=a.toString();this.insertRefIntoMWEditBox(a,!0);a.save=!0;a.inMWEditBox=!0},clearCitePanes:function(a){a.hasChildNodes()&&a.removeChild(a.firstChild)},activateRemoveField:function(a){jQuery(".delete-field",a).click(function(){jQuery(a).hide("highlight",
{},"slow",function(){jQuery(a).remove()})})},changeAddPane:function(a){jQuery("#add-fields").scrollTop(0);jQuery(a.parentNode).show();var c=jQuery(".addpanes",a.parentNode.parentNode).get(0);this.clearCitePanes(c);var b=a.value,d=document.getElementById("dummyCitePane").cloneNode(!0);d.id=b.replace(" ","_");jQuery(".ref-name-row",d).children("input").attr("id","addrefname");jQuery(".ref-name-row",d).children("label").attr("for","addrefname");a=a.id=="citemenu"?new this.CiteReference({}):new this.CitationReference({});
a.type=b;var b=this.getDescriptions(),e=a.getDefaultParams().slice(0);e.sort(a.getSorter());for(var f=0;f<e.length;f++)a.params[e[f]]="";this.log("changeAddPane: newRef: "+a);e=[];for(j in a.params)e.push(j);e.sort(a.getSorter());for(var g=a.getRequiredParams(),i=jQuery(".paramlist",d)[0],f=0;f<e.length;f++){var j=e[f],h;if(b[j]){h=document.getElementById("preloadedparamrow").cloneNode(!0);var k=jQuery(".paramdesc",h);if(g[j]){k.addClass("required");var l=jQuery(".delete-field",h)[0];l.parentNode.removeChild(l)}else this.activateRemoveField(h);
k.text(b[j]);k.attr("for",this.NEW_PARAM_PREFIX+j);j=="accessdate"&&jQuery(".paramvalue",h).val(this.formatDate(new Date))}else h=document.getElementById("addedparamrow").cloneNode(!0),jQuery(".paramdesc",h)[0].setAttribute("value",j);h.id="";this.activateRemoveField(h);jQuery(".paramvalue",h)[0].id=this.NEW_PARAM_PREFIX+j;this.log("changeAddPane: param: "+j+"; newRef.params[param]: "+a.params[j]);jQuery(h).show();i.appendChild(h)}jQuery(d).show();c.insertBefore(d,c.firstChild);this.log("Exiting changeAddPane")},
createGUI:function(){importStylesheetURI(this.JQUERYUI_STYLES_URL);importStylesheetURI(this.STATIC_BASE+"styles.css");var a=jQuery("<div/>",{id:"proveit"}),c=jQuery("<div/>",{id:"tabs"}),b=jQuery("<h1/>"),d=jQuery("<a/>",{title:"Created by the ELC Lab at Georgia Tech",href:"http://proveit.cc.gatech.edu",target:"_blank"}),e=jQuery("<img/>",{src:this.STATIC_BASE+"logo.png",alt:"ProveIt",height:30,width:118});d.append(e);b.append(d);var f=jQuery("<button/>",{text:"show/hide"});b.append(f);c.append(b);
e=jQuery("<ul/>");d=jQuery("<li/>");b=jQuery("<a/>",{id:"view-link","class":"tab-link",href:"#view-tab"});b.append("References (");var g=jQuery("<span/>",{id:"numRefs"}).append("0");b.append(g).append(")");d.append(b);e.append(d);g=jQuery("<li/>");d=jQuery("<a/>",{id:"add-link","class":"tab-link",href:"#add-tab"}).append("Add a Reference");g.append(d);e.append(g);c.append(e);var i=jQuery("<div/>",{id:"view-tab",css:{display:"none"}}),e=jQuery("<div/>",{id:"view-pane"}),g=jQuery("<div/>",{"class":"scroll",
style:"height: 210px;"}),j=jQuery("<table/>",{id:"refs"}),h=jQuery("<tr/>",{id:"dummyRef",style:"display: none;"});h.append(jQuery("<td/>",{"class":"number"})).append(jQuery("<td/>",{"class":"type"})).append(jQuery("<td/>",{"class":"title"}));var k=jQuery("<td/>",{"class":"edit"}).append(jQuery("<button/>",{text:"edit"}));h.append(k);j.append(h);g.append(j);e.append(g);i.append(e);k=jQuery("<div/>",{id:"edit-pane",style:"display: none"});e=jQuery("<div/>",{id:"edit-fields","class":"inputs scroll",
style:"height: 170px",tabindex:0});h=jQuery("<div/>",{"class":"ref-name-row",tabindex:-1});g=jQuery("<label/>",{"for":"editrefname",title:"This is a unique identifier that can be used to refer to this reference elsewhere on the page.","class":"paramdesc"}).append("&lt;ref&gt; name");h.append(g);h.append(jQuery("<input/>",{id:"editrefname","class":"paramvalue"}));g=jQuery("<div/>",{"class":"paramlist"});e.append(h);e.append(g);k.append(e);var l=jQuery("<div/>",{id:"edit-buttons"}),e=jQuery("<button/>",
{style:"margin-right: 50px;"}).append("add field");l.append(e);e=jQuery("<span/>",{"class":"required",text:"bold"});l.append(e).append(" = required field");g=jQuery("<button/>",{"class":"right-side accept",text:"update edit form"});l.append(g);j=jQuery("<button/>",{"class":"right-side cancel",text:"cancel"});l.append(j);k.append(l);i.append(k);c.append(i);k=jQuery("<div/>",{id:"dummyCitePane","class":"typepane",style:"display: none"});h=h.clone();k.append(h);k.append(jQuery("<div/>",{"class":"paramlist"}));
c.append(k);h=jQuery("<div/>",{id:"preloadedparamrow","class":"preloadedrow input-row",style:"display: none"}).append(jQuery("<label/>",{"class":"paramdesc"}));k=jQuery("<input/>",{"class":"paramvalue",tabindex:-1});h.append(k);l=jQuery("<button/>",{"class":"delete-field"}).append("delete field");h.append(l);c.append(h);h=jQuery("<div/>",{id:"addedparamrow","class":"addedrow input-row",style:"display: none"}).append(jQuery("<input/>",{"class":"paramdesc",tabindex:-1})).append(k.clone()).append(l.clone());
c.append(h);var p=jQuery("<div/>",{id:"add-tab",css:{display:"none"}}),h=jQuery("<div/>",{id:"add-fields","class":"inputs scroll",style:"height: 170px"}),n=jQuery("<div/>",{style:"display: none",id:"cite","class":"input-row"}),m=jQuery("<label/>",{"for":"citemenu","class":"paramdesc required",text:"Reference type"});n.append(m);for(var q=jQuery("<select/>",{id:"citemenu",change:function(){proveit.changeAddPane(q.get(0))}}),o=this.CiteReference.getTypes(),k=this.getDescriptions(),l=0;l<o.length;l++)q.append(jQuery("<option/>",
{value:o[l],text:k[o[l]]}));n.append(q);h.append(n);h.append(jQuery("<div/>",{"class":"addpanes",id:"citepanes",tabindex:0}));n=jQuery("<div/>",{style:"display: none",id:"citation","class":"input-row"});m=m.clone().attr("for","citationmenu");n.append(m);for(var r=jQuery("<select/>",{id:"citemenu",change:function(){proveit.changeAddPane(r.get(0))}}),m="web,book,journal,encyclopedia,news,patent".split(","),o=0;o<m.length;o++)r.append(jQuery("<option/>",{value:m[l],text:k[m[l]]}));n.append(r);h.append(n).append(jQuery("<div/>",
{"class":"addpanes",id:"citationpanes",style:"display: none;"}));p.append(h);h=jQuery("<div/>",{id:"add-buttons"});h.append(jQuery("<button/>",{style:"margin-right: 50px;",text:"add field"})).append(e.clone()).append(" = required").append(g.clone().text("insert into edit form")).append(j.clone());p.append(h);c.append(p);a.append(c);jQuery(document.body).prepend(a);var s=function(){jQuery("#edit-pane").hide();jQuery("#view-pane").show()};jQuery("#tabs").tabs({selected:0,show:function(a,b){switch(b.index){case 1:s(),
proveit.changeAddPane(document.getElementById(proveit.togglestyle?"citemenu":"citationmenu"))}}});jQuery(b).click(function(){jQuery(i).is(":hidden")?f.click():s()});jQuery(d).click(function(){jQuery(p).is(":hidden")&&f.click()});jQuery("#add-buttons button:first").button({icons:{primary:"ui-icon-circle-plus"}}).click(function(){proveit.addPaneRow(document.getElementById("add-tab"))}).next().next().button({icons:{primary:"ui-icon-circle-check",secondary:"ui-icon-circle-arrow-e"}}).click(function(){proveit.addReference(proveit.getRefFromAddPane(jQuery("#add-tab .typepane").get(0)));
jQuery("#tabs").tabs({selected:"#view-tab"});jQuery("div.scroll, #view-pane").scrollTop(1E5)}).next().button({icons:{primary:"ui-icon-circle-close"}}).click(function(){jQuery("#tabs").tabs({selected:"#view-tab"})});jQuery("button.cancel").click(s);jQuery("#edit-buttons button:first").button({icons:{primary:"ui-icon-circle-plus"}}).click(function(){proveit.addPaneRow(jQuery("#edit-pane"))}).next().next().button({icons:{primary:"ui-icon-circle-check"}}).next().button({icons:{primary:"ui-icon-circle-close"}});
jQuery(".delete-field").button({icons:{primary:"ui-icon-close"},text:!1});f.button({icons:{primary:"ui-icon-triangle-1-n"},text:!1});var t=jQuery("#view-tab, #add-tab");f.toggle(function(){t.show();f.button("option","icons",{primary:"ui-icon-triangle-1-s"})},function(){t.hide();f.button("option","icons",{primary:"ui-icon-triangle-1-n"})});this.scanForRefs();this.loadMaximized&&f.click();jQuery("#refs tr").eq(0).click().click();jQuery("#refs tr:even").addClass("light");jQuery("#refs tr:odd").addClass("dark")},
makeRefBoxRow:function(a,c){var b=jQuery('<tr><td class="number"></td><td class="type"></td><td class="title"></td><td class="edit"></td></tr>').get(0);a.isValid()||jQuery(b).addClass("invalid");jQuery(".edit button",b).get(0);var d=this,e="",f="";if(a.params.title!=null)e=a.params.title,f=this.truncateTitle(e);jQuery("td.title",b).text(f);jQuery("td.title",b).attr("title",e);e="";a.params.year?e=a.params.year:a.params.date&&(f=a.params.date.match(/^([12]\d{3})/))&&(e=f[1]);var g="";a.params.author?
g=a.params.author:a.params.last&&(g=a.params.last);if(a.params.coauthors||a.params.last2)g+=" <i>et al.</i>";var i=a.getIcon(),j="",f=a.type;switch(f){case "web":j=a.params.url;break;case "book":a.params.isbn!=null&&(j=wgServer+"/w/index.php?title=Special%3ABookSources&isbn="+a.params.isbn);break;case "journal":case "conference":a.params.doi!=null&&(j="http://dx.doi.org/"+a.params.doi);break;case "news":j=a.params.url;break;case "episode":j="http://www.imdb.com/find?s=ep&q="+escape(a.params.title)}jQuery("td.type",
b).css("background-image","url("+i+")");jQuery("td.type",b).attr("title",a.type);var h=i="",k="";g!=""&&(i='By: <span class="author">'+g+"</span>");e!=""&&(h='Date: <span class="date">'+e+"</span>");f!=null&&(j!=""&&(f='<a href="'+j+'" target="_blank">'+f+"</a>"),k='Type: <span class="type">'+f+"</span>");g="";f=="raw"?g=k+" | "+a.toString():i!=""?g=h!=""?k!=""?i+" | "+h+" | "+k:i+" | "+h:k!=""?i+" | "+k:i:h!=""?g=k!=""?h+" | "+k:h:k!=""&&(g=k);g="<p>"+g+"</p>";e=jQuery("<div />",{"class":"expanded"});
jQuery(e).append(g);jQuery("td.title",b).append(e);if(!c)f=jQuery("#refs tr").length,jQuery("td.number",b).text(f),jQuery("#numRefs").text(f);jQuery(b).click(function(){d.highlightTargetString(a.orig);jQuery("#refs tr").removeClass("selected");jQuery(b).addClass("selected")});for(var f=function(){d.updateEditPane(a);jQuery("#view-pane").hide();jQuery("#edit-pane").show()},l=a.getCitationStrings(),g=jQuery('<span class="all-citations" />'),j=0;j<l.length;j++){i=j+1;for(h="";i>0;)k=--i%26,h=String.fromCharCode(97+
k)+h,i=Math.floor(i/26);i=jQuery('<a href="#">'+h+"</a>");h=function(a){return function(){for(var b=0,c=0,d=proveit.getMWEditValue(),c=0;c<a;c++){b=d.indexOf(l[c],b);if(b==-1)return proveit.log("citationStrings["+c+"]: "+l[c]+" not found.  Returning."),!1;b+=l[c].length}b=d.indexOf(l[a],b);b==-1?proveit.log("citationStrings["+a+"]: "+l[a]+" not found."):proveit.highlightLengthAtIndex(b,l[a].length);return!1}}(j);i.click(h);g.append(i)}l.length>1&&(j=jQuery("<p />"),j.append('This reference is cited in the article <span class="num-citations">'+
l.length+" times</span>: ").append(g),e.append(j));a.type!="raw"?(g=jQuery("<button />",{text:"edit"}),jQuery(g).button({icons:{primary:"ui-icon-pencil"},text:!1}),g.click(f),jQuery(".edit",b).append(g),g=jQuery("<button />",{"class":"edit",text:"edit this reference"}),jQuery(g).button({icons:{primary:"ui-icon-pencil"},text:!0}),g.click(f),e.append(g),jQuery(b).dblclick(f)):jQuery(".edit",b).append("&nbsp;");l.length>0&&(f=jQuery("<button />",{"class":"insert",text:"insert this reference at cursor"}),
jQuery(f).button({icons:{primary:"ui-icon-arrowthick-1-e"},text:!0}),f.click(function(){d.insertRefIntoMWEditBox(a,!1);return!1}),e.append(f));return b},truncateTitle:function(a){var c=a;a.length>86&&(c=c.substring(0,86),a=c.lastIndexOf(" "),a!=-1&&(c=c.substr(0,a),c+=" ..."));return c},formatDate:function(a){var c=a.getFullYear(),b=this.getDescriptions().months[a.getMonth()],a=(a.getDate()<10?"0":"")+a.getDate();return b+" "+a+", "+c},addNewElement:function(a){var c=this.getRefBox();jQuery(c).append(this.makeRefBoxRow(a,
!1))}},window.proveit);proveit.CiteReference.getTypes=function(){return"web,book,journal,conference,encyclopedia,news,newsgroup,press release,interview,episode,video".split(",")};if(!String.prototype.trim)String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};proveit.split._compliantExecNpcg=/()??/.exec("")[1]===void 0;proveit.split._nativeSplit=String.prototype.split;proveit.load();
 
/** * mabe-october.js  * Copyright (c) 2011 Marian Beermann * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. */// JS Hint settings (jshint.com)/*global $:true, jQuery:true, browser:true, mw:true *//*jshint strict:false *///TODO:// * compat IE6-8// CSS is dynamically added at runtimemw.loader.implement( "slideshow", [ "//www.mediawiki.org/w/index.php?title=User:Phiarc/October2011/jquery.cycle.all.js&action=raw&ctype=text/javascript", "//www.mediawiki.org/w/index.php?title=User:Phiarc/October2011/jquery.scrollTo.js&action=raw&ctype=text/javascript" ], {}, {} );//------------------------------ Script entry pointmw.loader.using ( "slideshow", function () {	jQuery( document ).ready( function ( $ ) {			// Custom effect for jQuery.Cycle		$.fn.cycle.transitions.SlideshowTransitionFX = function ( $cont, $slides, opts ) {			$cont.width();			$slides.not( ":eq(" + opts.currSlide + ")" ).css( "opacity", 0 );				opts.before.push( function( curr, next, opts, fwd ) {				if( opts.rev )				{					fwd = !fwd;				}								$.fn.cycle.commonReset( curr, next, opts );								opts.cssBefore.left = fwd ? ( next.cycleW - 1 ) : ( 1 - next.cycleW );				opts.cssBefore.opacity = 0;				opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;			} );						opts.cssFirst.left = 0;			opts.cssBefore.top = 0;						opts.animIn.left = 0;			opts.animIn.opacity = 1;						opts.animOut.top = 0;			opts.animOut.opacity = 0;		};				//------------------------------ Slideshow object		var Slideshow = {};				Slideshow.Initialized = false;		Slideshow.Mobile = false;		Slideshow.WikiPath = "//" + document.domain;		Slideshow.CycleOpts = {};				// Simple spin-lock mechanism		Slideshow.lock = false;		Slideshow.Access = function( fn ) {			if( Slideshow.lock ) {				window.setTimeout( function() {					Slideshow.Access( fn );				}, 50 );			} else {				fn();			}		};				//------------------------------ Config		// The config is a mw.Map extended by loading and storing the contained data to cookies		//  and "global" default values		Slideshow.Config = new mw.Map();				Slideshow.Config.load = function () {			Slideshow.Config.values = Slideshow.Config.defaults;						$.each( Slideshow.Config.values, function ( eindex, elem ) {				var a = "Slideshow." + eindex;				var b = $.cookie( a );					// Check if cookie is set				if( b !== null ) {					Slideshow.Config.values[ eindex ] = b;				}			} );		};				Slideshow.Config.store = function () {			$.each( Slideshow.Config.values, function ( eindex, elem ) {				$.cookie( "Slideshow." + eindex, null );				$.cookie( "Slideshow." + eindex, elem, { expires: 3650 } );			} );		};				// Just to implement central default values		Slideshow.Config.getOld = Slideshow.Config.get;		Slideshow.Config.get = function ( selection ) {			var u = this.getOld( selection, Slideshow.Config.defaults[ selection ] );			var v;						switch( u ) {				case "true":					v = true;					break;				case "false":					v = false;					break;				default:					v = u;			}							return v;		};				Slideshow.Config.defaults = {						// Commmons			"Commons.Enable": true,			"Commons.Limit": 10,			"Commons.Symbol12px": "//upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Commons-logo.svg/12px-Commons-logo.svg.png",						// Animation			"Animation.Wrapper": 450,			"Animation.Slides": 500,						// Mobile			"Mobile.Force": false,			"Mobile.Resizing": false,			"Mobile.UI.LeftArrow": "//upload.wikimedia.org/wikipedia/commons/thumb/5/56/Go-previous-grey.svg/40px-Go-previous-grey.svg.png",			"Mobile.UI.RightArrow": "//upload.wikimedia.org/wikipedia/commons/thumb/1/13/Go-next-grey.svg/40px-Go-next-grey.svg.png",			"Mobile.UI.DownArrow": "//upload.wikimedia.org/wikipedia/commons/thumb/2/22/Go-down-grey.svg/40px-Go-down-grey.svg.png",						// Markup (also contains many i18n-relevant strings)			"Markup.Main": '<div id="slideshow-wrapper" style="display: none;"><div id="slideshow-top"></div><div id="slideshow-main"><div class="close">Close</div><div class="secondary-button"></div><div class="left-arrow"></div><div class="slideshow"></div><div class="right-arrow"></div><div class="thumbnails"></div></div><div id="slideshow-bottom"></div></div>',			"Markup.Config": '<div id="preferences" style="display:none; font-size:0.8em;" title="Slideshow settings"><fieldset><legend>Slideshow settings</legend><table class="" id="mw-slideshow-config"><tbody><tr><td class="mw-label"><label for="mw-input-sscommons-enable"> Enable integration with Wikimedia Commons:<br><i>(This uses a AJAX service provided by anyorigin.com)</i></label></td><td class="mw-input"><input type="checkbox" id="mw-input-sscommons-enable" /></td></tr><tr><td class="mw-label"><label for="mw-input-sscommons-limit"> Maximal number of images included from Wikimedia Commons: </label></td><td class="mw-input"><input  type="number" id="mw-input-sscommons-limit" size="20" /></td></tr><tr><td class="mw-label"><label for="mw-input-ssanimation-wrapper"> Duration of the slideshow fade in and out animations (milliseconds): </label></td><td class="mw-input"><input type="number" id="mw-input-ssanimation-wrapper" size="20" /></td></tr><tr><td class="mw-label"><label for="mw-input-ssanimation-slides"> Duration of the animation between the slides (milliseconds): </label></td><td class="mw-input"><input type="number" id="mw-input-ssanimation-slides" size="20" /></td></tr><tr><td class="mw-label"><label for="mw-input-ssmobile-force">Always use the mobile mode</label></td><td class="mw-input"><input type="checkbox" id="mw-input-ssmobile-force" /></td></tr><tr><td class="mw-label"><label for="mw-input-ssmobile-resizing">Enable resizing when in mobile mode</label></td><td class="mw-input"><input type="checkbox" id="mw-input-ssmobile-resizing" /></td></tr><tr><td class="mw-label"><input type="button" id="mw-input-sshide" value="Hide (don\'t save)" /></td><td class="mw-input"><input type="button" id="mw-input-sssave" value="Save" /></td></tr></tbody></table></fieldset></div>',						// Other stuff			"Style.BaseURL": "//www.mediawiki.org/w/index.php?action=raw&ctype=text/css&title=User:Phiarc/October2011/",						// Internationalization			"i18n.StartSlideshow": "Start Slideshow",			"i18n.Slideshow": "Slideshow",			"i18n.SlideshowSettings": "Slideshow settings"		};			//------------------------------ Objects' functions		Slideshow.ShowConfig = function ( e ) {			// This maps the properties of Slideshow.Config to their corresponding input field ids			var config_map = {				"Commons.Enable": "mw-input-sscommons-enable",				"Commons.Limit": "mw-input-sscommons-limit",				"Animation.Wrapper": "mw-input-ssanimation-wrapper",				"Animation.Slides": "mw-input-ssanimation-slides",				"Mobile.Force": "mw-input-ssmobile-force",				"Mobile.Resizing": "mw-input-ssmobile-resizing"			};						function load_fn ( idx, e ) {				var a = $( "#" + config_map[ idx ] );								if( a.attr( "type" ) === "checkbox" ) {					if( e === true || e === "true") {						a.attr( {							value: 1,							checked: "checked"						} );					} else {						a.attr( "value", "0" );						a.removeAttr( "checked" );					}				} else {					a.val( e );				}			}						function save_fn ( idx, e ) {				var a = $( "#" + config_map[ idx ] );				var b = a.val();				var c;					switch( a.attr( "type" ) ) {					case "checkbox":						if( a.filter(":checked").length !== 0 ) {							c = true;						} else {							c = false;						}						break;					case "number":						if( !isNaN( parseInt( b, 10 ) ) ) {							c = parseInt( b, 10 );						}												if( idx === "Animation.Slides" && Slideshow.CycleOpts !== undefined) {							Slideshow.CycleOpts.speed = Slideshow.CycleOpts.speedIn = Slideshow.CycleOpts.speedOut = c;						}						break;					default:						c = b;				}					Slideshow.Config.values[ idx ] = c;			}						function hide_fn () {				$( "#preferences" ).css( "display", "none" );				$( "#pt-slideshow" ).click( Slideshow.ShowConfig );			}						if( $( "#preferences" ).length === 0 ) {				$( "#content" ).prepend( Slideshow.Config.get( "Markup.Config" ) );			}						$( "#preferences" ).css( "display", "block" );						$( this ).unbind( e ).click( hide_fn );						$.each( Slideshow.Config.values, load_fn );						$( "#mw-input-sshide" ).click( hide_fn );			$( "#mw-input-sssave" ).click( function () {				$.each( Slideshow.Config.values, save_fn );				Slideshow.Config.store();					hide_fn();			} );		};				Slideshow.ArticleHasImages = function () {			if( ( $( ".thumb .image img" ).length + $( ".infobox .image" ).length ) === 0 ) {				return false;			}						return true;		};				Slideshow.GetThumbnailURL = function ( BaseURL, ImageId, size ) {			return BaseURL + "thumb" + ImageId + "/" + size + "px-" + ImageId.split( "/", 4)[3];		};				Slideshow.Display = function ( showv, animatev ) {			var show = showv === undefined ? true : showv;			var animate = animatev === undefined ? true : animatev;			var wrapper = $( "#slideshow-wrapper" );			var dur = Slideshow.Config.get( "Animation.Wrapper" );						// Do we actually need to do anything?			if( ( show && wrapper.css( "display" ) === "block" ) || ( !show && wrapper.css( "display" ) === "none" ) ) {				return true;			}						if( animate ) {				if( show ) {					wrapper.fadeIn( dur );				} else {					wrapper.fadeOut( dur );				}			} else {				if( show ) {					wrapper.css( "display", "block" );				} else {					wrapper.css( "display", "none" );					}			}						if( Slideshow.ShouldResize() ) {				Slideshow.OnWindowResize( 0 );			}		};				Slideshow.StartSlideshow = function () {					if( !Slideshow.Initialized ) {							//------------------------------ Insert markup				$( "body" ).append( Slideshow.Config.get( "Markup.Main" ) );								$( "#slideshow-main .slideshow" ).addClass( "loading" );					Slideshow.Display();				Slideshow.OnWindowResize( true );				$( "#slideshow-main .slideshow" ).css( "height", $( "#slideshow-main" ).height() );												// Handles resizing				if( Slideshow.ShouldResize() ) {					$( window ).resize( Slideshow.OnWindowResize );										window.onresize = Slideshow.OnWindowResize;										setInterval( function() {						Slideshow.OnWindowResize();					}, 150 ); 				}								$( "#slideshow-top, #slideshow-bottom, .close" ).click( Slideshow.CloseSlideshow );								// Do the rest asynchronously to not disturb UI rendering etc.				setTimeout( function() {					//------------------------------ START OF HELPER FUNCTIONS					function AddImage ( index, obj, caption ) {						// This Regex explained:						// \w{1}\/\w{2}\/[^\/]+						// Well, we may unescape it:						// \w{1}/\w{2}/[^/]+						// What this does:						//   /     - Find a slash						//   \w{1} - Foloowed by any character						//   /     - Followed by a slash						//   \w{2} - Followed by two characters						//   /     - Followed by jet another slash						//   [^/]+ - Followed by anything of any length, as long as it doesn't include a slash						//						// This basically rips of the filename and basis path of an thumb URL						// For example:						//   http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/Proteles_cristata-map.png/300px-Proteles_cristata-map.png						// The regex would only match						//   0/0d/Proteles_cristata-map.png						//						// This allows us to create thumbs of (effectivly) any size and/or						// to download the image :-)						// One may ask: Why don't you just use the Special:Filepath interface?						//   Well, this way I do not need to do additional request. Imagine we have an article with						//    25 images, then using that interface would result in doing 25 de facto unnecessary						//    requests. As this script uses already many many requests, I try to avoid unnecessary ones						var FindImgId = /\/\w{1}\/\w{2}\/[^\/]+/;												var Id = {							ImageId: obj.attr( "src" ).match( FindImgId )[ 0 ],							BaseURL: obj.attr( "src" ).split( "thumb", 1 )[ 0 ],							Caption: caption						};												// If it the image is *not* embedded as a thumb, the above method for						//  finding the base URL won't work						if( Id.BaseURL.indexOf( Id.ImageId ) !== -1 ) {							Id.BaseURL = obj.attr( "src" ).split( Id.ImageId, 1 )[ 0 ] + "/";						}												Id.ImageName = Id.ImageId.split( "/", 4 )[ 3 ];																// Create "non-intrusive" jump ID						if( obj.attr( "id" ) !== undefined ) {							Id.jumpID = obj.attr( "id" );						} else {							Id.jumpID = "image-" + index;							obj.attr( "id", Id.jumpID );						}												return Id;					}										function AddToSlideshow ( ImageData, index, indirect ) {						var indirectv = false;						var HTMLString;												if ( ( indirect !== undefined ) && indirect ) {							indirectv = true;						}													HTMLString =  "<div style='display:none; opacity: 0;' class='slide' id='slide-" + index + "'><div class='slide-wrapper'><img src='" + ImageData[ index ].BaseURL + ImageData[ index ].ImageId + "' /><p>" + ImageData[ index ].Caption + "</p></div></div>";												if( indirectv ) {							Slideshow.CycleOpts.addSlide( HTMLString );						} else {							$( ".slideshow" ).append( HTMLString );						}					}										function GetImageDimensions ( index, finalise_fn ) {						var Titles = "";												if( index === undefined ) {							$.each( Slideshow.ImageData, function ( eindex, elem ) {								if( eindex > 0 ) {									Titles += "|";								}																Titles += "File:" + elem.ImageName;							} );						} else {							Titles = "File:" + Slideshow.ImageData[ index ].ImageName;						}												// For documentation: http://www.mediawiki.org/wiki/API:Properties#imageinfo_.2F_ii						//  tl;dr: gets image size						// This gets hold of all image information we need with a single query						$.ajax( Slideshow.WikiPath + "/w/api.php?action=query&prop=imageinfo&iiprop=size|url&format=xml&titles=" + Titles, {							async: finalise_fn === undefined ? false : true,							dataType: "xml",							success: function ( data ) {								var pages;																pages = $( data.getElementsByTagName( "page" ) );																pages.each( function( eindex, elem ) {									var ii = $( this ).find( "imageinfo ii" );									var ai;																		if( index === undefined ) {										ai = eindex;									} else {										ai = index;									}																		Slideshow.ImageData[ ai ].Width = ii.attr( "width" );									Slideshow.ImageData[ ai ].Height = ii.attr( "height" );																		if( finalise_fn !== undefined ) {										finalise_fn( ai );									}								} );							}						} );					}										function SetBackgroundURI( e, cfgname ) {						e.css( "background-image", "url(" + Slideshow.Config.get( cfgname ) + ")" );					}					//------------------------------ END OF HELPER FUNCTIONS													//------------------------------ Rip images from article				var Thumbnails = [];				var index = 0;				var bc = $( "#bodyContent" ); // context optimization					// Handles normal thumbs				bc.find( ".thumbinner a.image img" ).each( function( eindex, elem ) {									Thumbnails[ index ] = AddImage( index, $( this ), bc.find( ".thumb .thumbcaption:eq(" + eindex + ")" ).text() );					AddToSlideshow( Thumbnails, index );										index += 1;				} );								// Handles infoboxes, taxoboxes and such - sadly there is no standard class for infoboxes				bc.find( ".infobox, .wikitable, .taxobox, .toccolours" ).each( function ( ibindex, infobox ) {					var InfoboxTitle, InfoboxTitleElem, InfoboxObj;					InfoboxObj = $( infobox );										// The infobox title is nearly always the first cell in the table					InfoboxTitle = InfoboxObj.find( "th" ).first().text();					if( InfoboxTitle === undefined ) {						InfoboxTitle = InfoboxObj.find( "caption" ).first().text();					}					if( InfoboxTitle === undefined ) {						InfoboxTitle = InfoboxObj.find( "td" ).first().text();					}					if( InfoboxTitle === undefined ) {						mw.config.get( "wgTitle" );						}										$( this ).find( ".image img" ).each( function( eindex, elem ) {						Thumbnails[ index ] = AddImage( index, $( this ), InfoboxTitle );						AddToSlideshow( Thumbnails, index );																	index += 1;					} );				} );								// Handles links to Wikimedia Commons				bc.find( ".sisterproject a" ).each( function( eindex, elem ) {					var commons_images = 0;										if( $( this ).attr( "href" ).search( /commons.wikimedia.org/ ) !== -1 && Slideshow.Config.get( "Commons.Enable" ) === true ) {						// anyorigin does not offer a https service						$.ajax( "http://anyorigin.com/get?url=http:" + $( this ).attr( "href" ) , {							dataType: "jsonp",							success: function ( data ) {								$( data.contents ).find( ".thumb a.image img" ).each( function( eindex, elem ) {									commons_images += 1;																		if( commons_images > Slideshow.Config.get( "Commons.Limit" ) ) {										return false;									}																									var entry = AddImage( index, $( this ), $( ".gallerytext:eq(" + eindex + ") p" ).text() + "&nbsp;<img src='" + Slideshow.Config.get( "Commons.Symbol12px" ) + "' width=12 height=16 />" );									var already_exists = false;																		$.each( Slideshow.ImageData, function( aindex, arrayelem ) {										if( arrayelem.ImageId.indexOf( entry.ImageId ) !== -1 ) {											already_exists = true;										}									} );																		if( !already_exists ) {										Slideshow.ImageData[ index ] = entry;																				GetImageDimensions( index, function( ii ) {											// As GetImageDimensions uses an asynchronous query we need											// to delay the execution AddToSlideshow until the query is answered											// Luckily I implemented such a feature earlier :-)											AddToSlideshow( Slideshow.ImageData, ii, true );										} );																					index += 1;									}								} );																Slideshow.OnWindowResize( true );							}						} ); 					}				} );										Slideshow.ImageData = Thumbnails;								GetImageDimensions();								//------------------------------  Click & hover handlers				// Click on the image - open file page in new window/tab				var c = $( "#slideshow-wrapper" );								c.find( ".slide img" ).click( function ( e ) {					index = $( this ).parent().parent().attr( "id" ).match( /[0-9]+/ );										window.open( Slideshow.WikiPath + "/wiki/File:" + Slideshow.ImageData[ index ].ImageName );				} );								if( Slideshow.Mobile ) {					c.find( ".secondary-button" ).click( function ( e ) {						window.location.hash = Slideshow.ImageData[ Slideshow.CycleOpts.currSlide ].jumpID;					} );				}								// Click on the text - jump to the image in the article				c.find( ".slide p" ).click( function ( e ) {					Slideshow.Display( false );										index = $( this ).parent().parent().attr( "id" ).match( /[0-9]+/ );										window.location.hash = Slideshow.ImageData[ index ].jumpID;				} );								if( Slideshow.Mobile ) {					var arrows;					arrows = c.find( ".left-arrow, .right-arrow, .close, .secondary-button" );										SetBackgroundURI( arrows.filter( ".left-arrow" ), "Mobile.UI.LeftArrow" );					SetBackgroundURI( arrows.filter( ".right-arrow" ), "Mobile.UI.RightArrow" );					SetBackgroundURI( arrows.filter(" .secondary-button" ), "Mobile.UI.DownArrow" );										arrows.mouseenter( function ( e ) {						$( this ).animate( {							opacity: 0.85						}, 175 );					} );										arrows.mouseleave( function ( e ) {						$( this ).animate( {							opacity: 0						}, 175 );					} );				}								//------------------------------ Cycle				c.find( ".slideshow" ).cycle( {					fx: 'SlideshowTransitionFX',					speed: parseInt( Slideshow.Config.get( "Animation.Slides" ), 10 ),					timeout: 0,					sync: 0,					height: '100%',					containerResize: false,					pager: '.thumbnails',					prev: '.left-arrow',					next: '.right-arrow',					fit: true,					before: function ( curr, next, opts ) {						Slideshow.CycleOpts = opts;					},					pagerAnchorBuilder: function ( id, slide ) {						var ThumbWidth, ThumbHeight;						var Id = Thumbnails[ id ];												// Calculate width of the thumbnail for a height of exactly 100 pixels						ThumbWidth = 100 * ( Id.Width / Id.Height );												// If the original image is too small, use it instead						if( ( ThumbWidth >= Id.Width ) && ( Id.Height <= 100 ) ) {							return '<a href="#"><img src="' + Id.BaseURL + Id.ImageId + '" height="100" /></a>';						}												if( isNaN( ThumbWidth ) ) {							ThumbWidth = 100;						}												return '<a href="#"><img src="' + Slideshow.GetThumbnailURL( Id.BaseURL, Id.ImageId, ThumbWidth.toFixed( 0 ) ) + '" height="100" /></a>';					},					onPrevNextEvent: function ( isNext, id, slide ) {						c.find( ".thumbnails" ).scrollTo( c.find( ".thumbnails a:eq(" + id + ")" ) );					}				} );								$( document ).keypress( function ( e ) {					var code = 0;										if( e.keyCode === 0 ) {						code = e.charCode;					} else {						code = e.keyCode;					}										switch( code ) {						case 27: // Escape							Slideshow.Display( false );													break;						case 37: // Arrow left						case 97: // A							c.find( ".slideshow" ).cycle( "prev" );													break;						case 39: // Arrow right						case 100: // D							c.find( ".slideshow" ).cycle( "next" );													break;						case 40: // Arrow down						case 115: // S							c.find( ".slide:eq(" + Slideshow.CycleOpts.currSlide + ") p" ).click();													break;						case 38: // Arrow up						case 119: // W							c.find( ".slide:eq(" + Slideshow.CycleOpts.currSlide + ") img" ).click();													break;					}				} );								//------------------------------ Finish				c.find( "#slideshow-main .slideshow" ).removeClass( "loading" );								Slideshow.Initialized = true;								Slideshow.OnWindowResize( true );								}, Slideshow.Config.get( "Animation.Wrapper" ) );			} else {				Slideshow.Display();			}		};				Slideshow.CloseSlideshow = function () {			Slideshow.Display( false );		};				Slideshow.ShouldResize = function () {			return !Slideshow.Mobile || Slideshow.Config.get( "Mobile.Resizing" );		};				Slideshow.CenterVertically = function ( elem ) {			var position;						position  = $( "#slideshow-main" ).height() / 2;			position  = position - $( elem ).height() / 2; 			$( elem ).css( "top", position );						return true;		};				Slideshow.OnWindowResize = function ( e ) {			// context optimization, since this function can be called very often and is thus very CPU intensive			var c = $( "#slideshow-wrapper" );						var r = Slideshow.ShouldResize();			var h = c.find( "#slideshow-main" ).height(), w = c.find( "#slideshow-main" ).width();						if( e === true ) {				r = true;			}						c.css( "height", window.innerHeight );						if( !Slideshow.Mobile) {				Slideshow.CenterVertically( "#slideshow-main .left-arrow, #slideshow-main .right-arrow" );								c.find( ".slideshow" ).css( "height", h - 150 );				c.find( ".slideshow" ).css( "width", w - 380 );				// minus 380px:				//  -the arrows are each 150px wide plus 20 pixels margin on the left (respective right) side				//  -.slideshow has an margin on both sides of 20 pixels			} else {					c.find( ".slideshow" ).css( {					width: w,					height: h				} );			}						c.find( ".slideshow .slide-wrapper" ).css( "width", c.find( ".slideshow" ).css( "width" ) );						// This function is called once when the slideshow is not fully initialized			//  So we need to check if it everything is set up...			if( Slideshow.Initialized &&  r ) {				var Height, Width, Img, Para, d;								c.find( ".slideshow > .slide" ).each( function( index, element ) {					Img = $( this ).find( "img" ).first();					Para = $( this ).find( "p" );					d = Slideshow.ImageData[ index ];										if ( $( this ).css( "display" ) === "block" ) {						if( Slideshow.Mobile ) {							Height = h;						} else {							Height = ( h - 150 ) - Para.outerHeight();						}												//Width = Height * ( c.Height / c.Width );						Width = Height * ( Img.Width / Img.Height ) ;																		if( ( Height > d.Height ) || ( Width > d.Width ) ) {							Height = d.Height;							Width = d.Width;						}												Img.css( {							"width": Width,							"height": Height						} );					}				} );			}		};		//------------------------------ End of object					// This is the 'real' body of the function		// I put everything into this function in order to not pollute the global namespace		// (which I personally feel is bad style and the pre-commit checklist also implies it		//   http://www.mediawiki.org/wiki/Manual:Pre-commit_checklist )				Slideshow.Config.load();				function MobileScreen() {			// Checks screen size considering orientation, i.e. so called landsacpe and			//  portrait orientation			function u ( v, w ) {				if( screen.availWidth <= w && screen.availHeight <= v ) {					return true;				} else {					if( screen.availWidth <= v && screen.availHeight <= w ) {						return true;					} else {						return false;					}				}			}						return u( 960, 640 ); // iPhone 4S, smartphone screen with currently highest resolution		}				if( mw.config.get( "wgIsArticle") && ( mw.config.get( "wgNamespaceNumber" ) === 0 ) && Slideshow.ArticleHasImages() ) {			var css;						if( navigator.userAgent.search( /webOS|iPhone|iPod|iPad|Mobile|Android/i ) !== -1 || MobileScreen() || Slideshow.Config.get( "Mobile.Force" ) === true ) {				Slideshow.Mobile = true;								css = "mabe-october-mobile.css";			} else {				css = "mabe-october.css";				}						mw.loader.load( Slideshow.Config.get( "Style.BaseURL" ) + css, "text/css" );						mw.util.addPortletLink( "p-views",				"#",				Slideshow.Config.get( "i18n.Slideshow" ),				"ca-slideshow",				Slideshow.Config.get( "i18n.StartSlideshow" ),				"",				"#ca-edit" );						// We cannot create links to javascript functions belonging to objects only existing			//  in the local scope of a (anonymous) function. So we just define			//  Slideshow.StartSlideshow as the handler for the onclick event...			$( "#ca-slideshow" ).click( Slideshow.StartSlideshow );		}				// Adds a portlet link to the personal toolbar for the slideshow config		mw.util.addPortletLink( "p-personal",			"#",			Slideshow.Config.get( "i18n.SlideshowSettings" ),			"pt-slideshow",			Slideshow.Config.get( "i18n.SlideshowSettings" ),			"",			"#pt-watchlist" );				$( "#pt-slideshow" ).click( Slideshow.ShowConfig );	} );} );
Osobní nástroje
Jmenné prostory
Varianty
Akce
Rychlá navigace
NEJ aktivity
Nejlepší předměty
Nejlepší MCU
SW-HW
Ostatní
Utility
Nástroje
Tisk/export