FANDOM


/*

Wikimarks Server

More info at: http://wikimarks.wikia.com/Code

© Peter Coester, 2012

Module "Linker"

 */
 
(function (ns) {
 
    function parseLink (link) {
 
        var urlRegex = /^(?:https?:\/\/.+|\/(?:index|api|wikia)\.php|\/wiki\/.+|\?.+|javascript:.+|\#[^#]+)/i;
 
        var interwikiMap = {w:'http://community.wikia.com/wiki/$1',abbenormal:'http://ourpla.net/cgi/pikie?$1',acronym:'http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1',advisory:'http://advisory.wikimedia.org/wiki/$1',advogato:'http://www.advogato.org/$1',aew:'http://wiki.arabeyes.org/$1',aiwiki:'http://www.ifi.unizh.ch/ailab/aiwiki/aiw.cgi?$1',allwiki:'http://allwiki.com/index.php/$1',appropedia:'http://www.appropedia.org/$1',aquariumwiki:'http://www.theaquariumwiki.com/$1',arborwiki:'http://arborwiki.org/city/$1',arxiv:'http://arxiv.org/abs/$1',atmwiki:'http://www.otterstedt.de/wiki/index.php/$1',battlestarwiki:'http://en.battlestarwiki.org/wiki/$1',bcnbio:'http://historiapolitica.bcn.cl/resenas_parlamentarias/wiki/$1',bemi:'http://bemi.free.fr/vikio/index.php?$1',benefitswiki:'http://www.benefitslink.com/cgi-bin/wiki.cgi?$1',betawiki:'http://translatewiki.net/wiki/$1',biblewiki:'http://bible.tmtm.com/wiki/$1',bluwiki:'http://bluwiki.com/go/$1',blw:'http://britainloveswikipedia.org/wiki/$1',botwiki:'http://botwiki.sno.cc/wiki/$1',boxrec:'http://www.boxrec.com/media/index.php?$1',brickwiki:'http://lego.wikia.com/index.php?title=$1',bugzilla:'https://bugzilla.wikimedia.org/show_bug.cgi?id=$1',bulba:'http://bulbapedia.bulbagarden.net/wiki/$1',buzztard:'http://buzztard.org/index.php/$1',bytesmiths:'http://www.Bytesmiths.com/wiki/$1',c2:'http://c2.com/cgi/wiki?$1',c2find:'http://c2.com/cgi/wiki?FindPage&value=$1',cache:'http://www.google.com/search?q=cache:$1',canyonwiki:'http://www.canyonwiki.com/wiki/index.php/$1',canwiki:'http://www.can-wiki.info/$1',cej:'http://esperanto.blahus.cz/cxej/vikio/index.php/$1',cellwiki:'http://cell.wikia.com/wiki/$1',centralwikia:'http://community.wikia.com/wiki/$1',chej:'http://esperanto.blahus.cz/cxej/vikio/index.php/$1',choralwiki:'http://www.cpdl.org/wiki/index.php/$1',citizendium:'http://en.citizendium.org/wiki/$1',ckwiss:'http://ck-wissen.de/ckwiki/index.php?title=$1',cndbname:'http://cndb.com/actor.html?name=$1',cndbtitle:'http://cndb.com/movie.html?title=$1',comixpedia:'http://www.comixpedia.org/index.php?title=$1',commons:'http://commons.wikimedia.org/wiki/$1',communityscheme:'http://community.schemewiki.org/?c=s&key=$1',communitywiki:'http://www.communitywiki.org/$1',comune:'http://rete.comuni-italiani.it/wiki/$1',corpknowpedia:'http://corpknowpedia.org/wiki/index.php/$1',crazyhacks:'http://www.crazy-hacks.org/wiki/index.php?title=$1',creativecommons:'http://creativecommons.org/licenses/$1',creativecommonswiki:'http://wiki.creativecommons.org/$1',creatureswiki:'http://creatures.wikia.com/wiki/$1',cxej:'http://esperanto.blahus.cz/cxej/vikio/index.php/$1',dcc:'http://www.dccwiki.com/$1',dcdatabase:'http://dc.wikia.com/$1',dcma:'http://www.christian-morgenstern.de/dcma/$1',dejanews:'http://www.deja.com/=dnc/getdoc.xp?AN=$1',delicious:'http://www.delicious.com/tag/$1',demokraatia:'http://wiki.demokraatia.ee/index.php/$1',devmo:'https://developer.mozilla.org/en/docs/$1',dictionary:'http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',dict:'http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',disinfopedia:'http://www.sourcewatch.org/wiki.phtml?title=$1',distributedproofreaders:'http://www.pgdp.net/wiki/$1',distributedproofreadersca:'http://www.pgdpcanada.net/wiki/index.php/$1',dmoz:'http://www.dmoz.org/$1',dmozs:'http://www.dmoz.org/cgi-bin/search?search=$1',docbook:'http://wiki.docbook.org/topic/$1',doi:'http://dx.doi.org/$1',donate:'http://donate.wikimedia.org/wiki/$1',doom_wiki:'http://doom.wikia.com/wiki/$1',download:'http://download.wikimedia.org/$1',dbdump:'http://download.wikimedia.org/$1/latest/',drae:'http://buscon.rae.es/draeI/SrvltGUIBusUsual?LEMA=$1',dreamhost:'http://wiki.dreamhost.com/index.php/$1',drumcorpswiki:'http://www.drumcorpswiki.com/index.php/$1',dwjwiki:'http://www.suberic.net/cgi-bin/dwj/wiki.cgi?$1',ecei:'http://www.ikso.net/cgi-bin/wiki.pl?$1',echei:'http://www.ikso.net/cgi-bin/wiki.pl?$1',ecoreality:'http://www.EcoReality.org/wiki/$1',ecxei:'http://www.ikso.net/cgi-bin/wiki.pl?$1',elibre:'http://enciclopedia.us.es/index.php/$1',emacswiki:'http://www.emacswiki.org/cgi-bin/wiki.pl?$1',encyc:'http://encyc.org/wiki/$1',energiewiki:'http://www.netzwerk-energieberater.de/wiki/index.php/$1',eokulturcentro:'http://esperanto.toulouse.free.fr/nova/wikini/wakka.php?wiki=$1',etherpad:'http://etherpad.wikimedia.org/$1',ethnologue:'http://www.ethnologue.com/show_language.asp?code=$1',ethnologuefamily:'http://www.ethnologue.com/show_family.asp?subid=$1',evowiki:'http://wiki.cotch.net/index.php/$1',exotica:'http://www.exotica.org.uk/wiki/$1',fanimutationwiki:'http://wiki.animutationportal.com/index.php/$1',finalempire:'http://final-empire.sourceforge.net/cgi-bin/wiki.pl?$1',finalfantasy:'http://finalfantasy.wikia.com/wiki/$1',finnix:'http://www.finnix.org/$1',flickruser:'http://www.flickr.com/people/$1',flickrphoto:'http://www.flickr.com/photo.gne?id=$1',floralwiki:'http://www.floralwiki.co.uk/wiki/$1','flyerwiki-de':'http://de.flyerwiki.net/index.php/$1',foldoc:'http://www.foldoc.org/$1',forthfreak:'http://wiki.forthfreak.net/index.cgi?$1',foundation:'http://wikimediafoundation.org/wiki/$1',foxwiki:'http://fox.wikis.com/wc.dll?Wiki~$1',freebio:'http://freebiology.org/wiki/$1',freebsdman:'http://www.FreeBSD.org/cgi/man.cgi?apropos=1&query=$1',freeculturewiki:'http://wiki.freeculture.org/index.php/$1',freedomdefined:'http://freedomdefined.org/$1',freefeel:'http://freefeel.org/wiki/$1',freekiwiki:'http://wiki.freegeek.org/index.php/$1',freenode:'irc://irc.freenode.net/$1',ganfyd:'http://ganfyd.org/index.php?title=$1',gardenology:'http://www.gardenology.org/wiki/$1',gausswiki:'http://gauss.ffii.org/$1','gentoo-wiki':'http://gentoo-wiki.com/$1',genwiki:'http://wiki.genealogy.net/index.php/$1',gerrit:'https://gerrit.wikimedia.org/r/$1',git:'https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/$1;a=log;h=refs/heads/master',globalvoices:'http://cyber.law.harvard.edu/dyn/globalvoices/wiki/$1',glossarwiki:'http://glossar.hs-augsburg.de/$1',glossarywiki:'http://glossary.hs-augsburg.de/$1',google:'http://www.google.com/search?q=$1',googledefine:'http://www.google.com/search?q=define:$1',googlegroups:'http://groups.google.com/groups?q=$1',gotamac:'http://www.got-a-mac.org/$1',greatlakeswiki:'http://greatlakeswiki.org/index.php/$1',guildwarswiki:'http://www.wiki.guildwars.com/wiki/$1',guildwiki:'http://guildwars.wikia.com/wiki/$1',gutenberg:'http://www.gutenberg.org/etext/$1',gutenbergwiki:'http://www.gutenberg.org/wiki/$1',h2wiki:'http://halowiki.net/p/$1',hammondwiki:'http://www.dairiki.org/HammondWiki/index.php3?$1',heroeswiki:'http://heroeswiki.com/$1',hrwiki:'http://www.hrwiki.org/index.php/$1',hrfwiki:'http://fanstuff.hrwiki.org/index.php/$1',hupwiki:'http://wiki.hup.hu/index.php/$1',imdbname:'http://www.imdb.com/name/nm$1/',imdbtitle:'http://www.imdb.com/title/tt$1/',imdbcompany:'http://www.imdb.com/company/co$1/',imdbcharacter:'http://www.imdb.com/character/ch$1/',incubator:'http://incubator.wikimedia.org/wiki/$1',infoanarchy:'http://www.infoanarchy.org/en/$1',infosecpedia:'http://infosecpedia.org/wiki/$1',infosphere:'http://theinfosphere.org/$1',irc:'irc://irc.freenode.net/$1',ircrc:'irc://irc.wikimedia.org/$1',rcirc:'irc://irc.wikimedia.org/$1','iso639-3':'http://www.sil.org/iso639-3/documentation.asp?id=$1',issn:'http://www.worldcat.org/issn/$1',iuridictum:'http://iuridictum.pecina.cz/w/$1',jameshoward:'http://jameshoward.us/$1',javanet:'http://wiki.java.net/bin/view/Main/$1',javapedia:'http://wiki.java.net/bin/view/Javapedia/$1',jefo:'http://esperanto-jeunes.org/wiki/$1',jiniwiki:'http://www.cdegroot.com/cgi-bin/jini?$1',jira:'https://jira.toolserver.org/browse/$1',jspwiki:'http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1',jstor:'http://www.jstor.org/journals/$1',kamelo:'http://kamelopedia.mormo.org/index.php/$1',karlsruhe:'http://ka.stadtwiki.net/$1',kerimwiki:'http://wiki.oxus.net/$1',kinowiki:'http://kino.skripov.com/index.php/$1',kmwiki:'http://kmwiki.wikispaces.com/$1',kontuwiki:'http://kontu.merri.net/wiki/$1',koslarwiki:'http://wiki.koslar.de/index.php/$1',kpopwiki:'http://www.kpopwiki.com/$1',labsconsole:'https://labsconsole.wikimedia.org/wiki/$1',linguistlist:'http://linguistlist.org/forms/langs/LLDescription.cfm?code=$1',linuxwiki:'http://www.linuxwiki.de/$1',linuxwikide:'http://www.linuxwiki.de/$1',liswiki:'http://liswiki.org/wiki/$1',literateprograms:'http://en.literateprograms.org/$1',livepedia:'http://www.livepedia.gr/index.php?title=$1',lojban:'http://www.lojban.org/tiki/tiki-index.php?page=$1',lostpedia:'http://lostpedia.wikia.com/wiki/$1',lqwiki:'http://wiki.linuxquestions.org/wiki/$1',lugkr:'http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?$1',luxo:'http://toolserver.org/~luxo/contributions/contributions.php?user=$1',mail:'https://lists.wikimedia.org/mailman/listinfo/$1',mailarchive:'http://lists.wikimedia.org/pipermail/$1',mariowiki:'http://www.mariowiki.com/$1',marveldatabase:'http://www.marveldatabase.com/wiki/index.php/$1',meatball:'http://meatballwiki.org/wiki/$1',mediawikiwiki:'http://www.mediawiki.org/wiki/$1',mediazilla:'https://bugzilla.wikimedia.org/$1',memoryalpha:'http://memory-alpha.org/wiki/$1',metawiki:'http://sunir.org/apps/meta.pl?$1',metawikipedia:'http://meta.wikimedia.org/wiki/$1',mineralienatlas:'http://www.mineralienatlas.de/lexikon/index.php/$1',moinmoin:'http://moinmo.in/$1',monstropedia:'http://www.monstropedia.org/?title=$1',mosapedia:'http://mosapedia.de/wiki/index.php/$1',mozcom:'http://mozilla.wikia.com/wiki/$1',mozillawiki:'https://wiki.mozilla.org/$1',mozillazinekb:'http://kb.mozillazine.org/$1',musicbrainz:'http://musicbrainz.org/doc/$1',mw:'http://www.mediawiki.org/wiki/$1',mwod:'http://www.merriam-webster.com/cgi-bin/dictionary?book=Dictionary&va=$1',mwot:'http://www.merriam-webster.com/cgi-bin/thesaurus?book=Thesaurus&va=$1',nkcells:'http://www.nkcells.info/wiki/index.php/$1',nara:'http://research.archives.gov/description/$1',nosmoke:'http://no-smok.net/nsmk/$1',nost:'http://nostalgia.wikipedia.org/wiki/$1',nostalgia:'http://nostalgia.wikipedia.org/wiki/$1',oeis:'http://oeis.org/$1',oldwikisource:'http://wikisource.org/wiki/$1',olpc:'http://wiki.laptop.org/go/$1',onelook:'http://www.onelook.com/?ls=b&w=$1',openfacts:'http://openfacts.berlios.de/index-en.phtml?title=$1',openlibrary:'http://openlibrary.org/$1',openstreetmap:'http://wiki.openstreetmap.org/wiki/$1',openwetware:'http://openwetware.org/wiki/$1',openwiki:'http://openwiki.com/?$1',opera7wiki:'http://operawiki.info/$1',organicdesign:'http://www.organicdesign.co.nz/$1',orthodoxwiki:'http://orthodoxwiki.org/$1',osi:'reference',osmwiki:'http://wiki.openstreetmap.org/wiki/$1',otrs:'https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=$1',otrswiki:'http://otrs-wiki.wikimedia.org/wiki/$1',ourmedia:'https://www.socialtext.net/ourmedia/index.cgi?$1',outreach:'http://outreach.wikimedia.org/wiki/$1',outreachwiki:'http://outreach.wikimedia.org/wiki/$1',panawiki:'http://wiki.alairelibre.net/index.php?title=$1',patwiki:'http://gauss.ffii.org/$1',perlnet:'http://perl.net.au/wiki/$1',personaltelco:'http://www.personaltelco.net/$1',phwiki:'http://wiki.pocketheaven.com/$1',phpwiki:'http://phpwiki.sourceforge.net/phpwiki/index.php?$1',planetmath:'http://planetmath.org/?op=getobj&from=objects&id=$1',pmeg:'http://www.bertilow.com/pmeg/$1',pyrev:'http://www.mediawiki.org/wiki/Special:Code/pywikipedia/$1',pythoninfo:'http://www.python.org/cgi-bin/moinmoin/$1',pythonwiki:'http://www.pythonwiki.de/$1',pywiki:'http://c2.com/cgi/wiki?$1',psycle:'http://psycle.sourceforge.net/wiki/$1',quality:'http://quality.wikimedia.org/wiki/$1',rev:'http://www.mediawiki.org/wiki/Special:Code/MediaWiki/$1',revo:'http://purl.org/NET/voko/revo/art/$1.html',rfc:'http://tools.ietf.org/html/rfc$1',rheinneckar:'http://rhein-neckar-wiki.de/$1',robowiki:'http://robowiki.net/?$1',reuterswiki:'http://glossary.reuters.com/index.php/$1',rowiki:'http://wiki.rennkuckuck.de/index.php/$1',rtfm:'ftp://rtfm.mit.edu/pub/faqs/$1',s23wiki:'http://s23.org/wiki/$1',scholar:'http://scholar.google.com/scholar?q=$1',schoolswp:'http://schools-wikipedia.org/wiki/$1',scores:'http://imslp.org/wiki/$1',scoutwiki:'http://en.scoutwiki.org/$1',scramble:'http://www.scramble.nl/wiki/index.php?title=$1',seapig:'http://www.seapig.org/$1',seattlewiki:'http://seattlewiki.org/wiki/$1',seattlewireless:'http://seattlewireless.net/?$1',slwiki:'http://wiki.secondlife.com/wiki/$1','semantic-mw':'http://www.semantic-mediawiki.org/wiki/$1',senseislibrary:'http://senseis.xmp.net/?$1',silcode:'http://www.sil.org/iso639-3/documentation.asp?id=$1',slashdot:'http://slashdot.org/article.pl?sid=$1',smikipedia:'http://www.smiki.de/$1',sourceforge:'http://sourceforge.net/$1',spcom:'http://spcom.wikimedia.org/wiki/$1',species:'http://species.wikimedia.org/wiki/$1',squeak:'http://wiki.squeak.org/squeak/$1',stats:'http://stats.wikimedia.org/$1',stewardry:'http://toolserver.org/~pathoschild/stewardry/?wiki=$1',strategy:'http://strategy.wikimedia.org/wiki/$1',strategywiki:'http://strategywiki.org/wiki/$1',sulutil:'http://toolserver.org/~quentinv57/sulinfo/$1',swtrain:'http://train.spottingworld.com/$1',svn:'http://svn.wikimedia.org/viewvc/mediawiki/$1?view=log',svgwiki:'http://wiki.svg.org/index.php/$1',swinbrain:'http://mercury.it.swin.edu.au/swinbrain/index.php/$1',swingwiki:'http://www.swingwiki.org/$1',tabwiki:'http://www.tabwiki.com/index.php/$1',tavi:'http://tavi.sourceforge.net/$1',tclerswiki:'http://wiki.tcl.tk/$1',technorati:'http://www.technorati.com/search/$1',tesoltaiwan:'http://www.tesol-taiwan.org/wiki/index.php/$1',tenwiki:'http://ten.wikipedia.org/wiki/$1',testwiki:'http://test.wikipedia.org/wiki/$1',thelemapedia:'http://www.thelemapedia.org/index.php/$1',theopedia:'http://www.theopedia.com/$1',thinkwiki:'http://www.thinkwiki.org/wiki/$1',tibiawiki:'http://tibia.erig.net/$1',ticket:'https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketNumber=$1',tmbw:'http://tmbw.net/wiki/$1',tmnet:'http://www.technomanifestos.net/?$1',tmwiki:'http://www.EasyTopicMaps.com/?page=$1',tools:'http://toolserver.org/$1',tswiki:'https://wiki.toolserver.org/view/$1',translatewiki:'http://translatewiki.net/wiki/$1',turismo:'http://www.tejo.org/turismo/$1',tviv:'http://tviv.org/wiki/$1',tvtropes:'http://www.tvtropes.org/pmwiki/pmwiki.php/Main/$1',twiki:'http://twiki.org/cgi-bin/view/$1',tyvawiki:'http://www.tyvawiki.org/wiki/$1',unreal:'http://wiki.beyondunreal.com/wiki/$1',urbandict:'http://www.urbandictionary.com/define.php?term=$1',usej:'http://www.tejo.org/usej/$1',usemod:'http://www.usemod.com/cgi-bin/wiki.pl?$1',usability:'http://usability.wikimedia.org/wiki/$1',valuewiki:'http://www.valuewiki.com/w/$1',vinismo:'http://vinismo.com/en/$1',vlos:'http://www.thuvienkhoahoc.com/tusach/$1',vkol:'http://kol.coldfront.net/thekolwiki/index.php/$1',voipinfo:'http://www.voip-info.org/wiki/view/$1',webisodes:'http://www.webisodes.org/$1',wg:'http://wg.en.wikipedia.org/wiki/$1',wiki:'http://c2.com/cgi/wiki?$1',wikia:'http://www.wikia.com/wiki/c:$1',wikiasite:'http://www.wikia.com/wiki/c:$1',wikibooks:'http://en.wikibooks.org/wiki/$1',wikichat:'http://www.wikichat.org/$1',wikichristian:'http://www.wikichristian.org/index.php?title=$1',wikicities:'http://www.wikia.com/wiki/$1',wikicity:'http://www.wikia.com/wiki/c:$1',wikif1:'http://www.wikif1.org/$1',wikifur:'http://en.wikifur.com/wiki/$1',wikihow:'http://www.wikihow.com/$1',wikiindex:'http://wikiindex.org/$1',wikilemon:'http://wiki.illemonati.com/$1',wikilivres:'http://wikilivres.ca/wiki/$1','wikimac-de':'http://apfelwiki.de/wiki/Main/$1',wikimedia:'http://wikimediafoundation.org/wiki/$1',wikinews:'http://en.wikinews.org/wiki/$1',wikinfo:'http://www.wikinfo.org/index.php/$1',wikinvest:'http://www.wikinvest.com/$1',wikipaltz:'http://www.wikipaltz.com/wiki/$1',wikipedia:'http://en.wikipedia.org/wiki/$1',wikipediawikipedia:'http://en.wikipedia.org/wiki/Wikipedia:$1',wikiquote:'http://en.wikiquote.org/wiki/$1',wikischool:'http://www.wikischool.de/wiki/$1',wikisophia:'http://wikisophia.org/index.php?title=$1',wikisource:'http://en.wikisource.org/wiki/$1',wikispecies:'http://species.wikimedia.org/wiki/$1',wikispot:'http://wikispot.org/?action=gotowikipage&v=$1',wikiskripta:'http://www.wikiskripta.eu/index.php/$1',wikitech:'http://wikitech.wikimedia.org/view/$1',wikiti:'http://wikiti.denglend.net/index.php?title=$1',wikitravel:'http://wikitravel.org/en/$1',wikitree:'http://wikitree.org/index.php?title=$1',wikiversity:'http://en.wikiversity.org/wiki/$1',betawikiversity:'http://beta.wikiversity.org/wiki/$1',wikiweet:'http://wikiweet.nl/wiki/$1',wikiwikiweb:'http://c2.com/cgi/wiki?$1',wiktionary:'http://en.wiktionary.org/wiki/$1',wipipedia:'http://www.londonfetishscene.com/wipi/index.php/$1',wlug:'http://www.wlug.org.nz/$1',wmar:'http://www.wikimedia.org.ar/wiki/$1',wmau:'http://wikimedia.org.au/wiki/$1',wmbd:'http://bd.wikimedia.org/wiki/$1',wmbe:'http://be.wikimedia.org/wiki/$1',wmbr:'http://br.wikimedia.org/wiki/$1',wmca:'http://wikimedia.ca/wiki/$1',wmch:'http://www.wikimedia.ch/$1',wmcz:'http://meta.wikimedia.org/wiki/Wikimedia_Czech_Republic/$1',wmdc:'http://wikimediadc.org/wiki/$1',securewikidc:'https://secure.wikidc.org/$1',wmde:'http://wikimedia.de/wiki/$1',wmfi:'http://fi.wikimedia.org/wiki/$1',wmfr:'http://wikimedia.fr/$1',wmhk:'http://wikimedia.hk/index.php/$1',wmhu:'http://wiki.media.hu/wiki/$1',wmid:'http://www.wikimedia.or.id/wiki/$1',wmil:'http://www.wikimedia.org.il/$1',wmin:'http://wiki.wikimedia.in/$1',wmit:'http://wiki.wikimedia.it/wiki/$1',wmmx:'http://mx.wikimedia.org/wiki/$1',wmnl:'http://nl.wikimedia.org/wiki/$1',wmnyc:'http://nyc.wikimedia.org/wiki/$1',wmno:'http://no.wikimedia.org/wiki/$1',wmpl:'http://pl.wikimedia.org/wiki/$1',wmrs:'http://rs.wikimedia.org/wiki/$1',wmru:'http://ru.wikimedia.org/wiki/$1',wmse:'http://se.wikimedia.org/wiki/$1',wmtw:'http://wikimedia.tw/wiki/index.php5/$1',wmua:'http://ua.wikimedia.org/wiki/$1',wmuk:'http://uk.wikimedia.org/wiki/$1',wm2005:'http://wikimania2005.wikimedia.org/wiki/$1',wm2006:'http://wikimania2006.wikimedia.org/wiki/$1',wm2007:'http://wikimania2007.wikimedia.org/wiki/$1',wm2008:'http://wikimania2008.wikimedia.org/wiki/$1',wm2009:'http://wikimania2009.wikimedia.org/wiki/$1',wm2010:'http://wikimania2010.wikimedia.org/wiki/$1',wm2011:'http://wikimania2011.wikimedia.org/wiki/$1',wm2012:'http://wikimania2012.wikimedia.org/wiki/$1',wm2013:'http://wikimania2013.wikimedia.org/wiki/$1',wmania:'http://wikimania.wikimedia.org/wiki/$1',wmteam:'http://wikimaniateam.wikimedia.org/wiki/$1',wmf:'http://wikimediafoundation.org/wiki/$1',wmfblog:'http://blog.wikimedia.org/$1',wookieepedia:'http://starwars.wikia.com/wiki/$1',world66:'http://www.world66.com/$1',wowwiki:'http://www.wowwiki.com/$1',wqy:'http://wqy.sourceforge.net/cgi-bin/index.cgi?$1',wurmpedia:'http://www.wurmonline.com/wiki/index.php/$1',viaf:'http://viaf.org/viaf/$1',zrhwiki:'http://www.zrhwiki.ch/wiki/$1',zum:'http://wiki.zum.de/$1',zwiki:'http://www.zwiki.org/$1'};
 
        if (/^(?:win|url)\(/.test(link)) link = 'javascript:' + link;
        if (/^javascript:/.test(link)) link = link.replace(/"/g, '"');
        if (urlRegex.test(link)) return link;
 
        var href, p = link.split(/\:/);
        if (1 == p.length || 'undefined' == typeof interwikiMap[p[0].toLowerCase()]) {
            href = '/wiki/' + p.join(':');
        } else {
            var inter = p.shift().toLowerCase();
            if ('w' == inter && /^c$/i.test(p[0])) {
                p.shift();
                if (!p.length) {
                    href = false;
                } else {
                    href = 'http://' + p.shift() + '.wikia.com/wiki/' + p.join(':');
                }
            } else {
                href = interwikiMap[inter].replace(/\$1/, p.join(':'));
            }
        }
        return href;
    }
 
    function win (link) {
        if (!link.length) return;
        var href = parseLink(link);
        void(window.open(href));
    }
 
    function url (link) {
        if (!link.length) return;
        var href = parseLink(link);
        location.href = href;
    }
 
    function e (component) {
        return encodeURIComponent(component);
    }
 
    function q (url, params) {
 
        function splitParams (params) {
            var p = {};
            if (params.length) {
                var s = params.split('&');
                for (var i = 0, c = s.length; i < c; i++) {
                    var nameValue = s[i].split('=');
                    p[nameValue[0]] = nameValue[1];
                }
            }
            return p;
        }
 
        function buildQuery (paramsObj) {
            var p = [];
            for (var i in paramsObj) {
                //if (!i.length) continue; // necessary ????
                p.push(i + '=' + paramsObj[i]);
            }
            return p.length ? '?' + p.join('&') : '';
        }
 
        var locParts = url.split('#');
        url = locParts.shift();
        var hash = locParts.length ? '#' + locParts.shift() : '';
 
        var locQuery = params.split('#');
        params = locQuery.shift();
        hash = locQuery.length ? '#' + locQuery.shift() : hash;
 
 
        var urlParts = url.split('?'),
            baseUrl = urlParts.shift();
            query = urlParts.length ? urlParts.shift() : '';
 
        var paramsObj = $.extend(
            splitParams(query),
            splitParams(params)
        );
 
        return baseUrl + buildQuery(paramsObj) + hash;
    }
 
    function execute (code) {
        return function (event) {
            try {
                eval(code);
            } catch (error) {
                alert(error);
            }
            event.preventDefault();
        }
    }
 
    ns.Linker = {
        parseLink: parseLink,
        execute: execute
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
/*

Module "Parser"

*/
 
(function (ns) {
 
 
    function parse (wikitext) {
 
        ns.Document.resetDoc();
 
        var NORMAL = 0, NO_LINK = 1, UNREADABLE = 2, BAD_NESTING = 4, BAD_LINK = 5;
 
        var prevLevel = 0, currentLine = -1;
        var level, title, href, parts, shade;
        var lines = wikitext.split(/\r\n|\r|\n/);
 
        if (ns.Shadow) {
            ns.Shadow.init();
            currentLine = ns.Shadow.getCurrentLine();
        }
 
        for (var i = 0, n = lines.length; i < n; i++) {
            parts = lines[i].match(/^[ \t]*(\*{1,3})([^*=][^=]*)(?:=(.+))?$/);
            //console.log('parts: ', parts);
            if (!parts) {
                shade = UNREADABLE;
            } else {
                level = parts[1].length;
                if (prevLevel != 3 && Math.abs(prevLevel - level) > 1) {
                    shade = BAD_NESTING;
                } else {
                    prevLevel = level;
                    title = parts[2].trim();
                    href = false;
                    if (!parts[3]) {
                        shade = NO_LINK;
                    } else {
                        href = ns.Linker.parseLink(parts[3].trim());
                        if (!href) {
                            shade = BAD_LINK;
                        } else {
                            shade = NORMAL;
                        }
                    }
                    //console.log('level: ', level, ', title: ', title, ', href: ', href);
                    ns.Document.addLink(level, href, title, i == currentLine, i);
                }
            }
            if (ns.Shadow) ns.Shadow.setShadow(i, shade);
        }
    }
 
    ns.Parser = {
        parse: parse
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
/*

Module "Document"

*/
 
(function (ns) {
 
    var doc = [];
 
    var chevronClasses = ['chevron', 'chevron-right', false];
    function getChevron (depth) {
        var c = chevronClasses[depth];
        if (!c) return '';
        return ' <img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" class="' + c + '">';
    }
 
    function addLink (level, href, title, hover, line) {
        var link = {
            href:  href ? href.replace(/</g, '&lt;').replace(/>/g, '&gt;') : false,
            title: title.replace(/</g, '&lt;').replace(/>/g, '&gt;'),
            hover: hover, line: line,
            sublist: []
        };
        function pushLinkAtDepth (depth, sublist) {
            if (depth == level) {
                sublist.push(link);
            } else {
                pushLinkAtDepth(depth+1, sublist[sublist.length-1].sublist);
            }
        }
        pushLinkAtDepth(1, doc);
    }
 
    var format;
    var saveOnly;
    function getRenderer (cssClasses) {
        return function () {
            saveOnly = arguments.length ? Boolean(arguments[0]) : false;
            format = function (element, depth, attributes) {
                var e = '<' + element;
                var c = cssClasses[element][depth]
                if (c) e += ' class="' + c + '"';
                if (attributes) e += ' ' + attributes;
                return e + '>';
            }
            return render();
        };
    }
 
    function render () {
 
        function renderList (list, d) {
            var html = format('ul', d, false);
            for (var i = 0; i < list.length; i++) {
                html += format('li', d, false);
                var attributes = list[i].href ? 'href="' + list[i].href + '"': 'name="menu"';
                if (ns.Editor && !saveOnly) {
                    if (list[i].hover) attributes += ' rel="current"';
                    attributes += ' line="' + list[i].line + '"';
                }
                html += format('a' , d, attributes);
                html += list[i].title;
                if (list[i].sublist.length) {
                    html += getChevron(d);
                    html += '</a>';
                    html += renderList(list[i].sublist, d + 1);
                } else {
                    html += '</a>';
                }
                html += '</li>';
            }
            return html + '</ul>';
        }
 
        return renderList(doc, 0);
    }
 
    var getRestyle = getRenderer({
        ul: ['subnav-2 accent', 'subnav subnav-3', false],
        li: ['subnav-2-item', false, false],
        a:  ['subnav-2a', 'subnav-3a', false]
    });
 
    ns.Document = {
        resetDoc: function () { doc = []; },
        isEmpty: function () { return doc.length === 0; },
        addLink: addLink,
        getMenu: getRestyle
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
/*

Module "Storage"

*/
 
(function (ns) {
 
    var expires = Date.now().valueOf() + 60 * 60 * 1000, // 60 minutes from now
        debug = Boolean(sessionStorage.getItem('debug')),
        storage = {};
 
    function storageAvailable (user) {
        if (!storage) return false;
        if (!storage.user || !storage.expires || !storage.menu) return false;
        if (storage.user !== user) return false;
        if (storage.expires < Date.now().valueOf()) return false;
        return true;
    }
 
    function logData () {
        console.log('Wikimarks Server: processed data: ', storage);
        console.log('Wikimarks Server: localStorage: ', localStorage.getItem('Wikimarks'));
    }
 
    function getMenu (user) {
 
        var defer = $.Deferred();
 
        storage = JSON.parse(localStorage.getItem('Wikimarks'));
 
        if (storageAvailable(user)) {
            if (debug) logData();
            defer.resolve(storage.menu);
        } else {
            localStorage.removeItem('Wikimarks');
            storage = { user: user, expires: expires };
            $.ajax({
                dataType: 'html',
                url: '//wikimarks.wikia.com/wiki/User:' + encodeURIComponent(user) + '/Wikimarks?action=raw&maxage=0&smaxage=0',
                success: function (data) {
                    ns.Parser.parse(data);
                    storage.menu = ns.Document.getMenu();
                    localStorage.setItem('Wikimarks', JSON.stringify(storage));            
                    if (debug) logData();
                    defer.resolve(storage.menu);
                },
                error: function (data) {
                    defer.resolve('<ul class="subnav-2 accent firstChild"><li class="subnav-2-item"><a href="/wiki/Special:WikiActivity" class="subnav-2a">Wiki Activity</a></li><li class="subnav-2-item"><a href="/wiki/Special:Random" class="subnav-2a">Random page</a></li><li class="subnav-2-item"><a href="/wiki/Special:Videos" class="subnav-2a">Videos</a></li><li class="subnav-2-item"><a href="/wiki/Special:NewFiles" class="subnav-2a">New Photos</a></li><li class="subnav-2-item"><a href="/wiki/Special:Chat" class="subnav-2a">Chat</a></li></ul>');
                }
            });
        }
 
        return defer;
    }
 
    ns.Storage = {
        getMenu: getMenu
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
/*

Module "Server"

*/
 
(function (ns) {
 
    var debug = Boolean(sessionStorage.getItem('debug'));
 
    function processRequest (event) {
        if (!event || !event.data || !event.origin || !/\.(?:wikia|wowwiki)\.com$/i.test(event.origin) || !event.source || top != event.source) {
            console.log('Wikimarks Server: Bad event: ', event);
            return;
        }
        try {
            var request = JSON.parse(event.data);
        } catch (e) {
            console.log('Wikimarks Server: Error:', e, ', event: ', event);
        }
        if (!request || !request.user) return;
        if (debug) console.log('Wikimarks Server: event.data: ', event.data);
 
        ns.Storage.getMenu(request.user)
        .done(function (data) {
            event.source.postMessage(data, event.origin);
        });
    }
 
    function load () {
        if (!window.postMessage || !window.localStorage || !window.JSON) return;
 
        if (window.addEventListener) {
            window.addEventListener('message', processRequest, false);
        } else if (window.attachEvent) {
            window.attachEvent('onmessage', processRequest);
        }
    }
 
    ns.Server = {
        load: load
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
window.Wikimarks.Server.load();
 
//

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.