/* * Parchment * Built: 2010-10-16 * * Copyright (c) 2008-2010 The Parchment Contributors * Licenced under the GPL v2 * http://code.google.com/p/parchment */ jQuery.ajaxSetup({cache:true,dataType:"text",ifModified:location.protocol!=="file:"});var parchment={options:{container:"#parchment",default_story:"stories/troll.z5.js",lib_path:"lib/",lock_story:0,page_title:1,proxy_url:"http://zcode.appspot.com/proxy/"},lib:{}}; /* * Simple JavaScript Inheritance * http://ejohn.org/blog/simple-javascript-inheritance/ * * By John Resig * Released into the public domain? * * Inspired by base2 and Prototype */ (function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;Object.subClass=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=typeof g[d]=="function"&&typeof f[d]=="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}})(d,g[d]):g[d]}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.subClass=arguments.callee;return c}})();(function(){function b(h,i){return h[i]<<24|h[i+1]<<16|h[i+2]<<8|h[i+3]}function c(h){return[(h>>24)&255,(h>>16)&255,(h>>8)&255,h&255]}function e(i,j){var h=String.fromCharCode;return h(i[j])+h(i[j+1])+h(i[j+2])+h(i[j+3])}function g(h){return[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]}var f=Object.subClass({init:function a(k){this.type="";this.chunks=[];if(k){if(e(k,0)!="FORM"){throw new Error("Not an IFF file")}this.type=e(k,8);var j=12,h=k.length;while(jh){throw new Error("IFF: Chunk out of range")}this.chunks.push({type:e(k,j),offset:j,data:k.slice(j+8,j+8+m)});j+=8+m;if(m%2){j++}}}},write:function d(){var m=g(this.type);for(var n=0,j=this.chunks.length;n/g,">")};String.prototype.quote=function(){var e,b,a=this.length,d='"';for(b=0;b=" "){if(e==="\\"||e==='"'){d+="\\"}d+=e}else{switch(e){case"\b":d+="\\b";break;case"\f":d+="\\f";break;case"\n":d+="\\n";break;case"\r":d+="\\r";break;case"\t":d+="\\t";break;default:e=e.charCodeAt();d+="\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)}}}return d+'"'};String.prototype.supplant=function(a){return this.replace(/{([^{}]*)}/g,function(d,c){var e=a[c];return typeof e==="string"||typeof e==="number"?e:d})};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};(function(a){window.FatalError=function(b){this.message=b;this.traceback=this._makeTraceback(arguments.callee);this.onError(this);if(a(".load").length>0){a(".load").detach()}};FatalError.prototype={onError:function(c){var b=c.message;if(typeof c.message=="string"){b=b.entityify()}a("#content").append('
An error occurred:
'+b+"\n\n"+c.traceback+"
")},_makeTraceback:function(b){var f="";var d=0;var c=100;while(b!=null&&d>4);o=((v&15)<<4)+(u>>2);n=((u&3)<<6)+t;p.push(s,o,n)}if(t==64){p.pop()}if(u==64){p.pop()}return p},h=function(r,p){var p=p||"",s,o,n,w,v,u,t,q=0,m=r.length;while(q>2;v=((s&3)<<4)+(o>>4);u=((o&15)<<2)+(n>>6);t=n&63;p+=(g.charAt(w)+g.charAt(v)+g.charAt(u)+g.charAt(t))}if(isNaN(o)){p=p.slice(0,-2)+"=="}else{if(isNaN(n)){p=p.slice(0,-1)+"="}}return p}}var k=jQuery.ajaxSettings.xhr(),i={binary:k.overrideMimeType!==undefined&&!(d.browser.opera&&parseFloat(d.browser.version)<10.5),cross_origin:k.withCredentials!==undefined};k=null;function e(l,s){var m=/^(file:|(\w+:)?\/\/[^\/?#]+)/,u;if(d.isArray(l)){u=l[1];l=l[0]}var t=m.exec(location)[0],q=m.exec(l),o=q?q[0]:t,p=/chrome\/(.)/i.exec(navigator.userAgent),n=o==="file:"&&p&&parseInt(p[1])>4?0:i.binary,v,r=function(w){f.processBase64Zcode=function(x){s(c(x));f.processBase64Zcode=null;try{delete f.processBase64Zcode}catch(y){}};d.getScript(w)};if(l.slice(-3).toLowerCase()==".js"){r(l);return}if(o=="file:"&&(t!=o||(!n&&!u))){throw"Can't load local files with this browser, sorry!"}if(n&&t==o){v={beforeSend:function(w){w.overrideMimeType("text/plain; charset=x-user-defined")},success:function(w){s(a(d.trim(w)))},url:l}}else{if(u){r(u);return}v={data:{encode:"base64",url:l},dataType:"jsonp",success:function(w){s(c(d.trim(w)))},url:parchment.options.proxy_url}}v.error=function(w,x){throw new FatalError("Error loading story: "+x)};d.ajax(v)}f.file={text_to_array:a,array_to_text:j,base64_decode:c,base64_encode:h,download_to_array:e,support:i}})(window,jQuery);(function(f){var e=this,g=f(document),a=/iPhone|iPod|iPad|Android/i,d=/\S/,c=e.scrollByPages||function(i){var h=g[0].documentElement.clientHeight,j=h-Math.min(h/10,parseInt(f("body").css("line-height"))*2);scrollBy(0,j*i)},b=e.getSelection||(document.selection&&function(){return document.selection.createRange().text})||function(){return""};e.gIsIphone=a.test(navigator.userAgent);if(f.browser.msie&&parseInt(f.browser.version)<7){f(function(){var i=f("#top-window"),h=function(){i.style.top=document.documentElement.scrollTop+"px"};i.css("position","absolute").resize(h).scroll(h)})}parchment.lib.UI=Object.subClass({stylesheet_add:function(){var h=arguments,j;for(j=1;j",{rel:"alternate stylesheet",href:h[j],title:h[0]}).appendTo("head")[0].disabled=true}},stylesheet_switch:function(i,h){f("link[rel*=stylesheet][title="+i+"]").each(function(){this.disabled=!h})}});parchment.lib.TextInput=Object.subClass({init:function(h,l){var i=this,h=f(h),k=f("",{autocapitalize:"off",keydown:function(n){var o=n.which,m;if(o==38){i.prev_next(1);m=1}if(o==40){i.prev_next(-1);m=1}if(o==33){c(-1);m=1}if(o==34){c(1);m=1}if(m){return false}}}),j=f("",{"class":"CharInput",keydown:function(m){i.keyCode=m.which},keypress:function(m){i.charCode=m.which;i.submitChar();return false},keyup:function(m){i.submitChar()}});i.form=f("
",{"class":"LineInput",submit:function(){i.submitLine();return false}}).append(k);h.bind("click.TextInput",function(){if(b()==""){if(f(".LineInput").length){k.focus()}if(f(".CharInput").length){j.focus()}}});i.history=[];i.container=h;i.stream=f(l);i.lineInput=k;i.charInput=j},die:function(){this.container.unbind(".TextInput")},getLine:function(l,k){var j=this,h=j.stream.children().last(),i=j.lineInput;j.callback=l||f.noop;j.current=0;j.mutable_history=j.history.slice();j.mutable_history.unshift("");j.style=k||"";i.width(j.stream.width()-h.width()).val("").addClass(j.style);h.append(j.form);setTimeout(function(){i.focus()},1)},submitLine:function(){var h=this,i=h.lineInput.val();h.form.detach();h.lineInput.removeClass(h.style);f(''+i.entityify()+"
").appendTo(h.stream.children().last());if(i!=h.history[0]&&d.test(i)){h.history.unshift(i)}g.trigger({type:"LineInput",input:i});h.callback(i)},prev_next:function(m){var i=this,h=i.lineInput,j=i.mutable_history,k=i.current,l=k+m;if(l=0){j[k]=h.val();h.val(j[l]);i.current=l}},getChar:function(j){var i=this,h=i.charInput;i.callback=j||f.noop;i.keyCode=i.charCode=0;i.container.append(h);setTimeout(function(){h.focus()},1)},submitChar:function(){var j=this,k=j.keyCode,h=j.charCode,i={keyCode:k,charCode:h};if(!k&&!h){return}j.charInput.detach();g.trigger({type:"CharInput",input:i});j.callback(i)}})})(jQuery);(function(e,f){var h=IFF.subClass({init:function a(p,k){this.title=k;if(p[0]<9){this.filetype="ok story naked zcode";this._super();this.chunks.push({type:"ZCOD",data:p});this.zcode=p}else{if(IFF.text_from(p,0)=="FORM"){this._super(p);if(this.type=="IFRS"){for(var n=0,j=this.chunks.length;n

Parchment is loading.

> _')},load:function(p){var j=this,l=parchment.options;f("body").append(j.load_indicator);if(l.lock_story){var n=l.default_story}else{var i=new Querystring(),n=i.get("story",l.default_story)}var k=f.isArray(n)?n[0]:n;j.url=k;storyName=k.slice(k.lastIndexOf("/")+1);storyName=storyName?storyName+" - Parchment":"Parchment";if(l.page_title){e.document.title=storyName}if(j.stories.url[k]){var m=j.stories.url[k]}else{f("#progress-text").html("Retrieving story file...");try{c(n,j)}catch(o){throw new FatalError(o)}}},stories:new d(),savefiles:{}});parchment.lib.Library=g})(window,jQuery);(function(a,c){var d=a.parchment;function b(){if(a.parchment_options){c.extend(d.options,parchment_options)}c("#about").remove();var e=new d.lib.Library();d.library=e;e.load();if(location.href.slice(0,31)=="http://parchment.googlecode.com"){c.getScript("http://www.google-analytics.com/ga.js",function(){_gat._getTracker("UA-7949545-1")._trackPageview()})}}c(b)})(window,jQuery);