Wikimarks Wiki
Advertisement

/*

Wikimarks Client

© Peter Coester, 2012

Namespace Module[]

 */

(function (ns) { // namespace module
    var debug = -1, userPage = -1, userName = -1;
    
    function isDebug () {
        if (-1 === debug) {
            debug = Boolean(sessionStorage.getItem('debug'));
        }
        return debug;
    }
    
    function isUserPage () {
        if (-1 === userPage) {
            userPage = "http://wikimarks.wikia.com" == wgServer &&
                       wgTitle == wgUserName + '/Wikimarks' &&
                       'User' == wgCanonicalNamespace;
        }
        return userPage;
    }
    
    ns.isDebug = isDebug;
    ns.isUserPage = isUserPage;
    
}(window.Wikimarks = window.Wikimarks || {}));

/*

Module "Linker"[]

*/

(function (ns) {
    
    function parseLink (link) {
    
        var urlRegex = /^(?:https?:\/\/.+|\/(?:index|api|wikia)\.php|\/wiki\/.+|\?.+|javascript:.+|\#\w+)/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 "Menu"[]

*/

(function (ns) {
    
    function populate (html) {
        
        $('#WikiHeader').find('ul.nav').find('li:first')
        .replaceWith('<li id="wikimarks" class="nav-item">' +
            '<a href="http://wikimarks.wikia.com/wiki/User:' + encodeURIComponent(wgUserName) +
            '/Wikimarks" class="wikimarks-logo">Wikim<span class="wikimarks-star"></span>rks</a>' +
            html +
        '</li>');
        
        var wikimarks = $('#wikimarks');
        var level2 = wikimarks.find('ul.subnav-2 > li');
        
        wikimarks.add(wikimarks.siblings())
        .off('mouseover').on('mouseover', function () {
            var $this = $(this);
            $this.addClass('marked')
            .find('.subnav-2').css('display', 'block');
            $this.siblings()
            .each(function () {
                $(this).removeClass('marked')
                .find('.subnav-2').css('display', 'none')
                .find('.marked2').removeClass('marked2');
            });
        })
        
        level2
        .mouseover(function () {
            var $this = $(this);
            $this.has('ul').addClass('marked2');
            $this.siblings().each(function () {
                $(this).removeClass('marked2');
            });
        })
        .mouseout(function () {
             $(this).removeClass('marked2');
        });
        
        var totalWidth = 0;
        wikimarks.mouseover()
        //level2
        .children('ul').children('li').each(function () {
            totalWidth += $(this).width();
            if (totalWidth > 720) {
                $(this).css('visibility', 'hidden');
                if (ns.Shadow) {
                    $(this).find('a').each(function () {
                        ns.Shadow.setShadow($(this).attr('line'), 2);
                    });
                }
            }
        });
        
        //console.log(wikimarks.children('ul').children('li'), '<->', level2);
        //level2
        wikimarks.children('ul').children('li')
        .one('mouseover', function () {
            var sub = $(this).children('ul');
            var w = parseInt(sub.width(), 10);
            sub.find('ul').each(function () {
                $(this).css('left', w - 10 + 'px');
            });
        });
        
        wikimarks
        .find('.subnav-3').children('li').children('ul')
        .css({ backgroundColor: ns.menuColor });
        
        if (ns.Shadow) {
            $('a', '#wikimarks').mouseover(function () {
                $('a[rel="current"]', '#wikimarks').removeAttr('rel');
                $(this).attr('rel', 'current');
                var line =  $(this).attr('line');
                ns.Shadow.update(line);
                //console.log('this: ', $(this), 'line: ', line)
            });
        }
        
        wikimarks.find('a')
        .each(function () {
            var href = $(this).attr('href') || ''
            var m = href.match(/^javascript:(.+)/i);
            if (m) $(this).click(ns.Linker.execute(m[1]));
        });
        
        wikimarks
        .mouseenter(function () {
            $(document)
            .on('keydown.wikimarks', function (e) {
                if (e.ctrlKey) {
                    $('.add-here').parent().css('display', 'block');
                } else {
                    $('.add-here').parent().css('display', 'none');
                }
            })
            .on('keyup.wikimarks', function () {
                $('.add-here').parent().css('display', 'none');
            });
        })
        .mouseleave(function () {
            $(document).off('keyup.wikimarks').off('keydown.wikimarks');
            $('.add-here').parent().css('display', 'none');
        });
        
        wikimarks.find('ul')
        .each(function () {
            $(this).append('<li style="display: none;"><span class="add-here" title="add link here">+</span></li>');
        })
        
        var h = null;
        $('#wikimarks').find('.subnav-3 > li').one('mouseover', function () {
            if (h) return;
            h = $(this).height();
            //console.log('height: ', h);
            css = '';
            for (var i = 0; i < 30; i++) {
                css += '.WikiNav .nav .subnav-3 li:nth-child(' + (i + 1) + ') ul { top: ' + Math.round(h * i)  +'px !important; }' + "\r\n";
            }
            $('head').append('<style type="text/css">' + css + '</style>');
        });
    }
    
    function init () {
        
        var c = dev.colors,
            menuColor = c.parse(c.wikia.menu),
            menuBright = menuColor.isBright(),
            pageColor = c.parse(c.wikia.page),
            pageBright = pageColor.isBright(),
            menuBorder = menuColor.lighten(pageBright ? -10 : 10).hex(),
            menuHover = menuColor.mix(pageColor, pageBright ? 20 : 80).hex();
            
        dev.colors.css(
            '#wikimarks li:last-child { background: none repeat scroll 0 0 $page;' +
                'border: 1px solid $add-button-border; border-radius: 6px 6px 6px 6px; bottom: -16px;' +
                'box-shadow: 1px 2px 12px 0 black; cursor: pointer; height: 20px; ' +
                'left: 10px; line-height: 18px; position: absolute; text-align: center; width: 22px; }' +
            '#wikimarks > ul.subnav-2 > li:last-child { left: 745px; position: absolute; top: 15px; }' +
            '#wikimarks li:last-child:hover { background: none repeat scroll 0 0 $add-button-hover;}', {
                'add-button-border' : menuBorder,
                'add-button-hover'  : menuHover
            }
        );
        
        $('#WikiHeader')
        .addClass(menuBright ? 'menu-bright' : 'menu-dark')
        .addClass(pageBright ? 'bg-bright' : 'bg-dark')
        .addClass(/rtl/i.test($(document.documentElement).attr('dir')) ? 'rtl' : 'ltr');
    }
    
    ns.Menu = {
        init: init,
        populate: populate
    };
    
}(window.Wikimarks = window.Wikimarks || {}));

/*

Module "Client"[]

*/

(function (ns) { 
 
    var iframe;
    
    function loadStylesheet () {
        var stylesheet = 'http://wikimarks.wikia.com/wiki/Client.css?action=raw&ctype=text/css';
        if (ns.isDebug()) stylesheet += '&maxage=0&smaxage=0';
        $('head').append(
            '<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Chela+One|Sancreek&text=Wikima*rks" />' +
            '<link rel="stylesheet" type="text/css" href="' + stylesheet + '" />'
        );
    }
    
    function menuReady (event) {
        if ('http://wikimarks.wikia.com' != event.origin || iframe.contentWindow != event.source) return;
        if (ns.isDebug()) {
            console.log('Wikimarks Client: reply from server: %o', event);
        }
        ns.Menu.populate(event.data);
        
        if (window.removeEventListener) {
            window.removeEventListener('message', menuReady, false);
        } else if (window.detachEvent) {
            window.detachEvent('onmessage', menuReady);
        }
        
        $(iframe).remove();
    }
    
    function serverReady () {
        if (ns.isDebug()) console.log('Wikimarks Client: server ready, posting message');
        var type = 'restyle';
        var request = JSON.stringify({ user: wgUserName, type: type });
        iframe.contentWindow.postMessage(request, 'http://wikimarks.wikia.com');
    }
 
    function load () {
        
        if ((window.skin != 'oasis' && window.skin != 'wikia') || !window.postMessage || !window.localStorage || !window.JSON) return;
        
        if (self != top || ('Special' == wgCanonicalNamespace && 'ThemeDesigner' == wgCanonicalSpecialPageName)) return;
        
        if ('?debug' == location.search) return;
        
        if (ns.isUserPage()) {  // sysop ?? vstf ?? staff ??
            
            var action = $.getUrlVar('action');
            if ((!action || 'view' == action || 'purge' == action) && !$.getUrlVar('oldid')) {
                
                $(function () {
                    
                    loadStylesheet();
                    
                    var article = $('#WikiaMainContent');
                    var lid =  $('<div id="article-lid"></div').appendTo(article);
                    var throbber = $('<div id="article-throbber"></div').appendTo(article);
                    var height = article.height();
                    throbber.css({
                        height: height,
                        backgroundPosition: 'center ' + Math.min(200, ($(window).height() - throbber.offset().top) / 2) + 'px'
                    });
                    lid.css({
                        height: height
                    });
                });
                
                if (!ns.Editor) {
                    if (ns.isDebug()) console.log('Wikimarks Client: loading editor...');
                    $.getScript('http://wikimarks.wikia.com/wiki/Editor.js?action=raw&ctype=text/javascript', function () {
                        ns.Editor.load();
                    });
                } else {
                    ns.Editor.load();
                }
                
                return;
            }
        }
        
        $(function () {
        
            if (!$('#WikiHeader nav').length) return;
            
            $.getScript('/load.php?debug=false&only=scripts&mode=articles&articles=u:dev:Colors/code.js')
            .done(ns.Menu.init);
            
            $('.WikiNav').find('.nav-item:first')
            .css({
                backgroundImage: 'url("http://slot1.images.wikia.nocookie.net/__cb61884/common/skins/common/images/ajax.gif")',
                backgroundPosition: 'center center',
                backgroundRepeat: 'no-repeat'
            })
            .find('a:first')
            .css('color', 'transparent');
            
            loadStylesheet();
            
            var server = 'http://wikimarks.wikia.com/wiki/Server?action=render';
            if ($('#wikimarks-server').length) $('#wikimarks-server').remove();
            $(document.body).append(
                '<iframe id="wikimarks-server" src="' + server + '" style="position: absolute; width: 1px; height: 1px; left: -9999px;"><'+'/iframe>'
            );
            iframe = document.getElementById('wikimarks-server');
            
            if (window.addEventListener) {
                iframe.addEventListener('load', serverReady, false);
                window.addEventListener('message', menuReady, false);
            } else if (window.attachEvent) {
                iframe.attachEvent('onload', serverReady);
                window.attachEvent('onmessage', menuReady);
            }
        });
    }
    
    ns.Client = {
        load: load
    };
    
}(window.Wikimarks = window.Wikimarks || {}));

window.Wikimarks.Client.load();

//
Advertisement