Upgrades history.js to use a fork that properly deals with URL-encoding.
authordsc <dsc@less.ly>
Wed, 29 Feb 2012 23:37:27 +0000 (15:37 -0800)
committerdsc <dsc@less.ly>
Wed, 29 Feb 2012 23:37:27 +0000 (15:37 -0800)
13 files changed:
data/enwp_articles_created.yaml
data/visitor_reach_by.timestamp.region.csv [changed mode: 0755->0644]
data/visitors_by.timestamp.region.csv [changed mode: 0755->0644]
data/visitors_by.timestamp.source.csv [changed mode: 0755->0644]
lib/server/server.co
lib/vis/vis-model.co
msc/dygraph-options/data.yaml
static/vendor/jquery.history-1.7.0.min.js [new file with mode: 0644]
static/vendor/jquery.history-1.7.1rc2.js [new file with mode: 0644]
static/vendor/jquery.history-1.7.1rc2.min.js [new file with mode: 0644]
static/vendor/jquery.history.js [new symlink]
static/vendor/jquery.history.min.js [changed from file to symlink]
www/graph/root.yaml

index ca01666..ba52268 100644 (file)
@@ -8,4 +8,4 @@ format: csv
 id: enwp_articles_created
 name: Articles created over time
 timespan: {end: 2012-01, start: 2001-01, step: 1mo}
-url: data/enwp_articles_created.csv
+url: /data/enwp_articles_created.csv
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 3281595..7532b68 100755 (executable)
@@ -116,7 +116,7 @@ app.get '/', (req, res) ->
 
 app.get '/graph/:id', (req, res, next) ->
     {id} = req.params
-    console.log req.url
+    # console.log req.url
     if exists("#WWW/graph/#id.yaml") or exists("#WWW/graph/#id.json")
         req.url += '.json'
     next()
index 99cd073..a3ec515 100644 (file)
@@ -27,7 +27,7 @@ VisModel = exports.VisModel = BaseModel.extend do # {{{
             slug    : ''
             name    : ''
             desc    : ''
-            dataset : '/data/pageviews_by.timestamp.language.csv'
+            dataset : '/data/pageviews_by.timestamp.mobile.csv'
             # presets : []
             width   : 'auto'
             height  : 320
index 0426e56..0da7cd5 100644 (file)
     - callback
     type: function(e, point)
     default: null
-    desc: A function to call when a data point is clicked. The function should take
+    desc: "A function to call when a data point is clicked. The function should take
         two arguments, the event object for the click, and the point that was clicked.
-        The 'point' argument has these properties:\n - xval/yval: The data coordinates
-        of the point (with dates/times as millis since epoch) \n - canvasx/canvasy:
-        The canvas coordinates at which the point is drawn. \n name: The name of
-        the data series to which the point belongs.
+        The 'point' argument has these properties:\n * xval/yval: The data coordinates
+        of the point (with dates/times as millis since epoch) \n * canvasx/canvasy:
+        The canvas coordinates at which the point is drawn. \n * name: The name of
+        the data series to which the point belongs."
     examples:
     - annotation
     - callback
diff --git a/static/vendor/jquery.history-1.7.0.min.js b/static/vendor/jquery.history-1.7.0.min.js
new file mode 100644 (file)
index 0000000..8d4edcd
--- /dev/null
@@ -0,0 +1 @@
+window.JSON||(window.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";return e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g,e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)d=rep[c],typeof d=="string"&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));return e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g,e}}"use strict",typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var JSON=window.JSON,cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(!b||typeof b=="function"||typeof b=="object"&&typeof b.length=="number")return str("",{"":a});throw new Error("JSON.stringify")}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(a,b){"use strict";var c=a.History=a.History||{},d=a.jQuery;if(typeof c.Adapter!="undefined")throw new Error("History.js Adapter has already been loaded...");c.Adapter={bind:function(a,b,c){d(a).bind(b,c)},trigger:function(a,b,c){d(a).trigger(b,c)},extractEventData:function(a,c,d){var e=c&&c.originalEvent&&c.originalEvent[a]||d&&d[a]||b;return e},onDomLoad:function(a){d(a)}},typeof c.init!="undefined"&&c.init()}(window),function(a,b){"use strict";var c=a.document,d=a.setTimeout||d,e=a.clearTimeout||e,f=a.setInterval||f,g=a.History=a.History||{};if(typeof g.initHtml4!="undefined")throw new Error("History.js HTML4 Support has already been loaded...");g.initHtml4=function(){if(typeof g.initHtml4.initialized!="undefined")return!1;g.initHtml4.initialized=!0,g.enabled=!0,g.savedHashes=[],g.isLastHash=function(a){var b=g.getHashByIndex(),c;return c=a===b,c},g.saveHash=function(a){return g.isLastHash(a)?!1:(g.savedHashes.push(a),!0)},g.getHashByIndex=function(a){var b=null;return typeof a=="undefined"?b=g.savedHashes[g.savedHashes.length-1]:a<0?b=g.savedHashes[g.savedHashes.length+a]:b=g.savedHashes[a],b},g.discardedHashes={},g.discardedStates={},g.discardState=function(a,b,c){var d=g.getHashByState(a),e;return e={discardedState:a,backState:c,forwardState:b},g.discardedStates[d]=e,!0},g.discardHash=function(a,b,c){var d={discardedHash:a,backState:c,forwardState:b};return g.discardedHashes[a]=d,!0},g.discardedState=function(a){var b=g.getHashByState(a),c;return c=g.discardedStates[b]||!1,c},g.discardedHash=function(a){var b=g.discardedHashes[a]||!1;return b},g.recycleState=function(a){var b=g.getHashByState(a);return g.discardedState(a)&&delete g.discardedStates[b],!0},g.emulated.hashChange&&(g.hashChangeInit=function(){g.checkerFunction=null;var b="",d,e,h,i;return g.isInternetExplorer()?(d="historyjs-iframe",e=c.createElement("iframe"),e.setAttribute("id",d),e.style.display="none",c.body.appendChild(e),e.contentWindow.document.open(),e.contentWindow.document.close(),h="",i=!1,g.checkerFunction=function(){if(i)return!1;i=!0;var c=g.getHash()||"",d=g.unescapeHash(e.contentWindow.document.location.hash)||"";return c!==b?(b=c,d!==c&&(h=d=c,e.contentWindow.document.open(),e.contentWindow.document.close(),e.contentWindow.document.location.hash=g.escapeHash(c)),g.Adapter.trigger(a,"hashchange")):d!==h&&(h=d,g.setHash(d,!1)),i=!1,!0}):g.checkerFunction=function(){var c=g.getHash();return c!==b&&(b=c,g.Adapter.trigger(a,"hashchange")),!0},g.intervalList.push(f(g.checkerFunction,g.options.hashChangeInterval)),!0},g.Adapter.onDomLoad(g.hashChangeInit)),g.emulated.pushState&&(g.onHashChange=function(b){var d=b&&b.newURL||c.location.href,e=g.getHashByUrl(d),f=null,h=null,i=null,j;return g.isLastHash(e)?(g.busy(!1),!1):(g.doubleCheckComplete(),g.saveHash(e),e&&g.isTraditionalAnchor(e)?(g.Adapter.trigger(a,"anchorchange"),g.busy(!1),!1):(f=g.extractState(g.getFullUrl(e||c.location.href,!1),!0),g.isLastSavedState(f)?(g.busy(!1),!1):(h=g.getHashByState(f),j=g.discardedState(f),j?(g.getHashByIndex(-2)===g.getHashByState(j.forwardState)?g.back(!1):g.forward(!1),!1):(g.pushState(f.data,f.title,f.url,!1),!0))))},g.Adapter.bind(a,"hashchange",g.onHashChange),g.pushState=function(b,d,e,f){if(g.getHashByUrl(e))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.pushState,args:arguments,queue:f}),!1;g.busy(!0);var h=g.createStateObject(b,d,e),i=g.getHashByState(h),j=g.getState(!1),k=g.getHashByState(j),l=g.getHash();return g.storeState(h),g.expectedStateId=h.id,g.recycleState(h),g.setTitle(h),i===k?(g.busy(!1),!1):i!==l&&i!==g.getShortUrl(c.location.href)?(g.setHash(i,!1),!1):(g.saveState(h),g.Adapter.trigger(a,"statechange"),g.busy(!1),!0)},g.replaceState=function(a,b,c,d){if(g.getHashByUrl(c))throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(d!==!1&&g.busy())return g.pushQueue({scope:g,callback:g.replaceState,args:arguments,queue:d}),!1;g.busy(!0);var e=g.createStateObject(a,b,c),f=g.getState(!1),h=g.getStateByIndex(-2);return g.discardState(f,e,h),g.pushState(e.data,e.title,e.url,!1),!0}),g.emulated.pushState&&g.getHash()&&!g.emulated.hashChange&&g.Adapter.onDomLoad(function(){g.Adapter.trigger(a,"hashchange")})},typeof g.init!="undefined"&&g.init()}(window),function(a,b){"use strict";var c=a.console||b,d=a.document,e=a.navigator,f=a.sessionStorage||!1,g=a.setTimeout,h=a.clearTimeout,i=a.setInterval,j=a.clearInterval,k=a.JSON,l=a.alert,m=a.History=a.History||{},n=a.history;k.stringify=k.stringify||k.encode,k.parse=k.parse||k.decode;if(typeof m.init!="undefined")throw new Error("History.js Core has already been loaded...");m.init=function(){return typeof m.Adapter=="undefined"?!1:(typeof m.initCore!="undefined"&&m.initCore(),typeof m.initHtml4!="undefined"&&m.initHtml4(),!0)},m.initCore=function(){if(typeof m.initCore.initialized!="undefined")return!1;m.initCore.initialized=!0,m.options=m.options||{},m.options.hashChangeInterval=m.options.hashChangeInterval||100,m.options.safariPollInterval=m.options.safariPollInterval||500,m.options.doubleCheckInterval=m.options.doubleCheckInterval||500,m.options.storeInterval=m.options.storeInterval||1e3,m.options.busyDelay=m.options.busyDelay||250,m.options.debug=m.options.debug||!1,m.options.initialTitle=m.options.initialTitle||d.title,m.intervalList=[],m.clearAllIntervals=function(){var a,b=m.intervalList;if(typeof b!="undefined"&&b!==null){for(a=0;a<b.length;a++)j(b[a]);m.intervalList=null}},m.debug=function(){(m.options.debug||!1)&&m.log.apply(m,arguments)},m.log=function(){var a=typeof c!="undefined"&&typeof c.log!="undefined"&&typeof c.log.apply!="undefined",b=d.getElementById("log"),e,f,g,h,i;a?(h=Array.prototype.slice.call(arguments),e=h.shift(),typeof c.debug!="undefined"?c.debug.apply(c,[e,h]):c.log.apply(c,[e,h])):e="\n"+arguments[0]+"\n";for(f=1,g=arguments.length;f<g;++f){i=arguments[f];if(typeof i=="object"&&typeof k!="undefined")try{i=k.stringify(i)}catch(j){}e+="\n"+i+"\n"}return b?(b.value+=e+"\n-----\n",b.scrollTop=b.scrollHeight-b.clientHeight):a||l(e),!0},m.getInternetExplorerMajorVersion=function(){var a=m.getInternetExplorerMajorVersion.cached=typeof m.getInternetExplorerMajorVersion.cached!="undefined"?m.getInternetExplorerMajorVersion.cached:function(){var a=3,b=d.createElement("div"),c=b.getElementsByTagName("i");while((b.innerHTML="<!--[if gt IE "+ ++a+"]><i></i><![endif]-->")&&c[0]);return a>4?a:!1}();return a},m.isInternetExplorer=function(){var a=m.isInternetExplorer.cached=typeof m.isInternetExplorer.cached!="undefined"?m.isInternetExplorer.cached:Boolean(m.getInternetExplorerMajorVersion());return a},m.emulated={pushState:!Boolean(a.history&&a.history.pushState&&a.history.replaceState&&!/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(e.userAgent)&&!/AppleWebKit\/5([0-2]|3[0-2])/i.test(e.userAgent)),hashChange:Boolean(!("onhashchange"in a||"onhashchange"in d)||m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8)},m.enabled=!m.emulated.pushState,m.bugs={setHash:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),safariPoll:Boolean(!m.emulated.pushState&&e.vendor==="Apple Computer, Inc."&&/AppleWebKit\/5([0-2]|3[0-3])/.test(e.userAgent)),ieDoubleCheck:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<8),hashEscape:Boolean(m.isInternetExplorer()&&m.getInternetExplorerMajorVersion()<7)},m.isEmptyObject=function(a){for(var b in a)return!1;return!0},m.cloneObject=function(a){var b,c;return a?(b=k.stringify(a),c=k.parse(b)):c={},c},m.getRootUrl=function(){var a=d.location.protocol+"//"+(d.location.hostname||d.location.host);if(d.location.port||!1)a+=":"+d.location.port;return a+="/",a},m.getBaseHref=function(){var a=d.getElementsByTagName("base"),b=null,c="";return a.length===1&&(b=a[0],c=b.href.replace(/[^\/]+$/,"")),c=c.replace(/\/+$/,""),c&&(c+="/"),c},m.getBaseUrl=function(){var a=m.getBaseHref()||m.getBasePageUrl()||m.getRootUrl();return a},m.getPageUrl=function(){var a=m.getState(!1,!1),b=(a||{}).url||d.location.href,c;return c=b.replace(/\/+$/,"").replace(/[^\/]+$/,function(a,b,c){return/\./.test(a)?a:a+"/"}),c},m.getBasePageUrl=function(){var a=d.location.href.replace(/[#\?].*/,"").replace(/[^\/]+$/,function(a,b,c){return/[^\/]$/.test(a)?"":a}).replace(/\/+$/,"")+"/";return a},m.getFullUrl=function(a,b){var c=a,d=a.substring(0,1);return b=typeof b=="undefined"?!0:b,/[a-z]+\:\/\//.test(a)||(d==="/"?c=m.getRootUrl()+a.replace(/^\/+/,""):d==="#"?c=m.getPageUrl().replace(/#.*/,"")+a:d==="?"?c=m.getPageUrl().replace(/[\?#].*/,"")+a:b?c=m.getBaseUrl()+a.replace(/^(\.\/)+/,""):c=m.getBasePageUrl()+a.replace(/^(\.\/)+/,"")),c.replace(/\#$/,"")},m.getShortUrl=function(a){var b=a,c=m.getBaseUrl(),d=m.getRootUrl();return m.emulated.pushState&&(b=b.replace(c,"")),b=b.replace(d,"/"),m.isTraditionalAnchor(b)&&(b="./"+b),b=b.replace(/^(\.\/)+/g,"./").replace(/\#$/,""),b},m.store={},m.idToState=m.idToState||{},m.stateToId=m.stateToId||{},m.urlToId=m.urlToId||{},m.storedStates=m.storedStates||[],m.savedStates=m.savedStates||[],m.normalizeStore=function(){m.store.idToState=m.store.idToState||{},m.store.urlToId=m.store.urlToId||{},m.store.stateToId=m.store.stateToId||{}},m.getState=function(a,b){typeof a=="undefined"&&(a=!0),typeof b=="undefined"&&(b=!0);var c=m.getLastSavedState();return!c&&b&&(c=m.createStateObject()),a&&(c=m.cloneObject(c),c.url=c.cleanUrl||c.url),c},m.getIdByState=function(a){var b=m.extractId(a.url),c;if(!b){c=m.getStateString(a);if(typeof m.stateToId[c]!="undefined")b=m.stateToId[c];else if(typeof m.store.stateToId[c]!="undefined")b=m.store.stateToId[c];else{for(;;){b=(new Date).getTime()+String(Math.random()).replace(/\D/g,"");if(typeof m.idToState[b]=="undefined"&&typeof m.store.idToState[b]=="undefined")break}m.stateToId[c]=b,m.idToState[b]=a}}return b},m.normalizeState=function(a){var b,c;if(!a||typeof a!="object")a={};if(typeof a.normalized!="undefined")return a;if(!a.data||typeof a.data!="object")a.data={};b={},b.normalized=!0,b.title=a.title||"",b.url=m.getFullUrl(m.unescapeString(a.url||d.location.href)),b.hash=m.getShortUrl(b.url),b.data=m.cloneObject(a.data),b.id=m.getIdByState(b),b.cleanUrl=b.url.replace(/\??\&_suid.*/,""),b.url=b.cleanUrl,c=!m.isEmptyObject(b.data);if(b.title||c)b.hash=m.getShortUrl(b.url).replace(/\??\&_suid.*/,""),/\?/.test(b.hash)||(b.hash+="?"),b.hash+="&_suid="+b.id;return b.hashedUrl=m.getFullUrl(b.hash),(m.emulated.pushState||m.bugs.safariPoll)&&m.hasUrlDuplicate(b)&&(b.url=b.hashedUrl),b},m.createStateObject=function(a,b,c){var d={data:a,title:b,url:c};return d=m.normalizeState(d),d},m.getStateById=function(a){a=String(a);var c=m.idToState[a]||m.store.idToState[a]||b;return c},m.getStateString=function(a){var b,c,d;return b=m.normalizeState(a),c={data:b.data,title:a.title,url:a.url},d=k.stringify(c),d},m.getStateId=function(a){var b,c;return b=m.normalizeState(a),c=b.id,c},m.getHashByState=function(a){var b,c;return b=m.normalizeState(a),c=b.hash,c},m.extractId=function(a){var b,c,d;return c=/(.*)\&_suid=([0-9]+)$/.exec(a),d=c?c[1]||a:a,b=c?String(c[2]||""):"",b||!1},m.isTraditionalAnchor=function(a){var b=!/[\/\?\.]/.test(a);return b},m.extractState=function(a,b){var c=null,d,e;return b=b||!1,d=m.extractId(a),d&&(c=m.getStateById(d)),c||(e=m.getFullUrl(a),d=m.getIdByUrl(e)||!1,d&&(c=m.getStateById(d)),!c&&b&&!m.isTraditionalAnchor(a)&&(c=m.createStateObject(null,null,e))),c},m.getIdByUrl=function(a){var c=m.urlToId[a]||m.store.urlToId[a]||b;return c},m.getLastSavedState=function(){return m.savedStates[m.savedStates.length-1]||b},m.getLastStoredState=function(){return m.storedStates[m.storedStates.length-1]||b},m.hasUrlDuplicate=function(a){var b=!1,c;return c=m.extractState(a.url),b=c&&c.id!==a.id,b},m.storeState=function(a){return m.urlToId[a.url]=a.id,m.storedStates.push(m.cloneObject(a)),a},m.isLastSavedState=function(a){var b=!1,c,d,e;return m.savedStates.length&&(c=a.id,d=m.getLastSavedState(),e=d.id,b=c===e),b},m.saveState=function(a){return m.isLastSavedState(a)?!1:(m.savedStates.push(m.cloneObject(a)),!0)},m.getStateByIndex=function(a){var b=null;return typeof a=="undefined"?b=m.savedStates[m.savedStates.length-1]:a<0?b=m.savedStates[m.savedStates.length+a]:b=m.savedStates[a],b},m.getHash=function(){var a=m.unescapeHash(d.location.hash);return a},m.unescapeString=function(b){var c=b,d;for(;;){d=a.unescape(c);if(d===c)break;c=d}return c},m.unescapeHash=function(a){var b=m.normalizeHash(a);return b=m.unescapeString(b),b},m.normalizeHash=function(a){var b=a.replace(/[^#]*#/,"").replace(/#.*/,"");return b},m.setHash=function(a,b){var c,e,f;return b!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.setHash,args:arguments,queue:b}),!1):(c=m.escapeHash(a),m.busy(!0),e=m.extractState(a,!0),e&&!m.emulated.pushState?m.pushState(e.data,e.title,e.url,!1):d.location.hash!==c&&(m.bugs.setHash?(f=m.getPageUrl(),m.pushState(null,null,f+"#"+c,!1)):d.location.hash=c),m)},m.escapeHash=function(b){var c=m.normalizeHash(b);return c=a.escape(c),m.bugs.hashEscape||(c=c.replace(/\%21/g,"!").replace(/\%26/g,"&").replace(/\%3D/g,"=").replace(/\%3F/g,"?")),c},m.getHashByUrl=function(a){var b=String(a).replace(/([^#]*)#?([^#]*)#?(.*)/,"$2");return b=m.unescapeHash(b),b},m.setTitle=function(a){var b=a.title,c;b||(c=m.getStateByIndex(0),c&&c.url===a.url&&(b=c.title||m.options.initialTitle));try{d.getElementsByTagName("title")[0].innerHTML=b.replace("<","&lt;").replace(">","&gt;").replace(" & "," &amp; ")}catch(e){}return d.title=b,m},m.queues=[],m.busy=function(a){typeof a!="undefined"?m.busy.flag=a:typeof m.busy.flag=="undefined"&&(m.busy.flag=!1);if(!m.busy.flag){h(m.busy.timeout);var b=function(){var a,c,d;if(m.busy.flag)return;for(a=m.queues.length-1;a>=0;--a){c=m.queues[a];if(c.length===0)continue;d=c.shift(),m.fireQueueItem(d),m.busy.timeout=g(b,m.options.busyDelay)}};m.busy.timeout=g(b,m.options.busyDelay)}return m.busy.flag},m.busy.flag=!1,m.fireQueueItem=function(a){return a.callback.apply(a.scope||m,a.args||[])},m.pushQueue=function(a){return m.queues[a.queue||0]=m.queues[a.queue||0]||[],m.queues[a.queue||0].push(a),m},m.queue=function(a,b){return typeof a=="function"&&(a={callback:a}),typeof b!="undefined"&&(a.queue=b),m.busy()?m.pushQueue(a):m.fireQueueItem(a),m},m.clearQueue=function(){return m.busy.flag=!1,m.queues=[],m},m.stateChanged=!1,m.doubleChecker=!1,m.doubleCheckComplete=function(){return m.stateChanged=!0,m.doubleCheckClear(),m},m.doubleCheckClear=function(){return m.doubleChecker&&(h(m.doubleChecker),m.doubleChecker=!1),m},m.doubleCheck=function(a){return m.stateChanged=!1,m.doubleCheckClear(),m.bugs.ieDoubleCheck&&(m.doubleChecker=g(function(){return m.doubleCheckClear(),m.stateChanged||a(),!0},m.options.doubleCheckInterval)),m},m.safariStatePoll=function(){var b=m.extractState(d.location.href),c;if(!m.isLastSavedState(b))c=b;else return;return c||(c=m.createStateObject()),m.Adapter.trigger(a,"popstate"),m},m.back=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.back,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.back(!1)}),n.go(-1),!0)},m.forward=function(a){return a!==!1&&m.busy()?(m.pushQueue({scope:m,callback:m.forward,args:arguments,queue:a}),!1):(m.busy(!0),m.doubleCheck(function(){m.forward(!1)}),n.go(1),!0)},m.go=function(a,b){var c;if(a>0)for(c=1;c<=a;++c)m.forward(b);else{if(!(a<0))throw new Error("History.go: History.go requires a positive or negative integer passed.");for(c=-1;c>=a;--c)m.back(b)}return m};if(m.emulated.pushState){var o=function(){};m.pushState=m.pushState||o,m.replaceState=m.replaceState||o}else m.onPopState=function(b,c){var e=!1,f=!1,g,h;return m.doubleCheckComplete(),g=m.getHash(),g?(h=m.extractState(g||d.location.href,!0),h?m.replaceState(h.data,h.title,h.url,!1):(m.Adapter.trigger(a,"anchorchange"),m.busy(!1)),m.expectedStateId=!1,!1):(e=m.Adapter.extractEventData("state",b,c)||!1,e?f=m.getStateById(e):m.expectedStateId?f=m.getStateById(m.expectedStateId):f=m.extractState(d.location.href),f||(f=m.createStateObject(null,null,d.location.href)),m.expectedStateId=!1,m.isLastSavedState(f)?(m.busy(!1),!1):(m.storeState(f),m.saveState(f),m.setTitle(f),m.Adapter.trigger(a,"statechange"),m.busy(!1),!0))},m.Adapter.bind(a,"popstate",m.onPopState),m.pushState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.pushState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.pushState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0},m.replaceState=function(b,c,d,e){if(m.getHashByUrl(d)&&m.emulated.pushState)throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(e!==!1&&m.busy())return m.pushQueue({scope:m,callback:m.replaceState,args:arguments,queue:e}),!1;m.busy(!0);var f=m.createStateObject(b,c,d);return m.isLastSavedState(f)?m.busy(!1):(m.storeState(f),m.expectedStateId=f.id,n.replaceState(f.id,f.title,f.url),m.Adapter.trigger(a,"popstate")),!0};if(f){try{m.store=k.parse(f.getItem("History.store"))||{}}catch(p){m.store={}}m.normalizeStore()}else m.store={},m.normalizeStore();m.Adapter.bind(a,"beforeunload",m.clearAllIntervals),m.Adapter.bind(a,"unload",m.clearAllIntervals),m.saveState(m.storeState(m.extractState(d.location.href,!0))),f&&(m.onUnload=function(){var a,b;try{a=k.parse(f.getItem("History.store"))||{}}catch(c){a={}}a.idToState=a.idToState||{},a.urlToId=a.urlToId||{},a.stateToId=a.stateToId||{};for(b in m.idToState){if(!m.idToState.hasOwnProperty(b))continue;a.idToState[b]=m.idToState[b]}for(b in m.urlToId){if(!m.urlToId.hasOwnProperty(b))continue;a.urlToId[b]=m.urlToId[b]}for(b in m.stateToId){if(!m.stateToId.hasOwnProperty(b))continue;a.stateToId[b]=m.stateToId[b]}m.store=a,m.normalizeStore(),f.setItem("History.store",k.stringify(a))},m.intervalList.push(i(m.onUnload,m.options.storeInterval)),m.Adapter.bind(a,"beforeunload",m.onUnload),m.Adapter.bind(a,"unload",m.onUnload));if(!m.emulated.pushState){m.bugs.safariPoll&&m.intervalList.push(i(m.safariStatePoll,m.options.safariPollInterval));if(e.vendor==="Apple Computer, Inc."||(e.appCodeName||"")==="Mozilla")m.Adapter.bind(a,"hashchange",function(){m.Adapter.trigger(a,"popstate")}),m.getHash()&&m.Adapter.onDomLoad(function(){m.Adapter.trigger(a,"hashchange")})}},m.init()}(window)
\ No newline at end of file
diff --git a/static/vendor/jquery.history-1.7.1rc2.js b/static/vendor/jquery.history-1.7.1rc2.js
new file mode 100644 (file)
index 0000000..0c4bf76
--- /dev/null
@@ -0,0 +1,2671 @@
+/**
+ * History.js jQuery Adapter
+ * @author Benjamin Arthur Lupton <contact@balupton.com>
+ * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
+ * @license New BSD License <http://creativecommons.org/licenses/BSD/>
+ */
+
+// Closure
+(function(window,undefined){
+       "use strict";
+
+       // Localise Globals
+       var
+               History = window.History = window.History||{},
+               jQuery = window.jQuery;
+
+       // Check Existence
+       if ( typeof History.Adapter !== 'undefined' ) {
+               throw new Error('History.js Adapter has already been loaded...');
+       }
+
+       // Add the Adapter
+       History.Adapter = {
+               /**
+                * History.Adapter.bind(el,event,callback)
+                * @param {Element|string} el
+                * @param {string} event - custom and standard events
+                * @param {function} callback
+                * @return {void}
+                */
+               bind: function(el,event,callback){
+                       jQuery(el).bind(event,callback);
+               },
+
+               /**
+                * History.Adapter.trigger(el,event)
+                * @param {Element|string} el
+                * @param {string} event - custom and standard events
+                * @param {Object=} extra - a object of extra event data (optional)
+                * @return {void}
+                */
+               trigger: function(el,event,extra){
+                       jQuery(el).trigger(event,extra);
+               },
+
+               /**
+                * History.Adapter.extractEventData(key,event,extra)
+                * @param {string} key - key for the event data to extract
+                * @param {string} event - custom and standard events
+                * @param {Object=} extra - a object of extra event data (optional)
+                * @return {mixed}
+                */
+               extractEventData: function(key,event,extra){
+                       // jQuery Native then jQuery Custom
+                       var result = (event && event.originalEvent && event.originalEvent[key]) || (extra && extra[key]) || undefined;
+
+                       // Return
+                       return result;
+               },
+
+               /**
+                * History.Adapter.onDomLoad(callback)
+                * @param {function} callback
+                * @return {void}
+                */
+               onDomLoad: function(callback) {
+                       jQuery(callback);
+               }
+       };
+
+       // Try and Initialise History
+       if ( typeof History.init !== 'undefined' ) {
+               History.init();
+       }
+
+})(window);
+
+/**
+ * History.js HTML4 Support
+ * Depends on the HTML5 Support
+ * @author Benjamin Arthur Lupton <contact@balupton.com>
+ * @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
+ * @license New BSD License <http://creativecommons.org/licenses/BSD/>
+ */
+
+(function(window,undefined){
+       "use strict";
+
+       // ========================================================================
+       // Initialise
+
+       // Localise Globals
+       var
+               document = window.document, // Make sure we are using the correct document
+               setTimeout = window.setTimeout||setTimeout,
+               clearTimeout = window.clearTimeout||clearTimeout,
+               setInterval = window.setInterval||setInterval,
+               History = window.History = window.History||{}; // Public History Object
+
+       // Check Existence
+       if ( typeof History.initHtml4 !== 'undefined' ) {
+               throw new Error('History.js HTML4 Support has already been loaded...');
+       }
+
+
+       // ========================================================================
+       // Initialise HTML4 Support
+
+       // Initialise HTML4 Support
+       History.initHtml4 = function(){
+               // Initialise
+               if ( typeof History.initHtml4.initialized !== 'undefined' ) {
+                       // Already Loaded
+                       return false;
+               }
+               else {
+                       History.initHtml4.initialized = true;
+               }
+
+
+               // ====================================================================
+               // Properties
+
+               /**
+                * History.enabled
+                * Is History enabled?
+                */
+               History.enabled = true;
+
+
+               // ====================================================================
+               // Hash Storage
+
+               /**
+                * History.savedHashes
+                * Store the hashes in an array
+                */
+               History.savedHashes = [];
+
+               /**
+                * History.isLastHash(newHash)
+                * Checks if the hash is the last hash
+                * @param {string} newHash
+                * @return {boolean} true
+                */
+               History.isLastHash = function(newHash){
+                       // Prepare
+                       var oldHash = History.getHashByIndex(),
+                               isLast;
+
+                       // Check
+                       isLast = newHash === oldHash;
+
+                       // Return isLast
+                       return isLast;
+               };
+
+               /**
+                * History.isHashEqual(newHash, oldHash)
+                * Checks to see if two hashes are functionally equal
+                * @param {string} newHash
+                * @param {string} oldHash
+                * @return {boolean} true
+                */
+               History.isHashEqual = function(newHash, oldHash){
+                       newHash = encodeURIComponent(newHash).replace(/%25/g, "%");
+                       oldHash = encodeURIComponent(oldHash).replace(/%25/g, "%");
+                       return newHash === oldHash;
+               };
+
+               /**
+                * History.saveHash(newHash)
+                * Push a Hash
+                * @param {string} newHash
+                * @return {boolean} true
+                */
+               History.saveHash = function(newHash){
+                       // Check Hash
+                       if ( History.isLastHash(newHash) ) {
+                               return false;
+                       }
+
+                       // Push the Hash
+                       History.savedHashes.push(newHash);
+
+                       // Return true
+                       return true;
+               };
+
+               /**
+                * History.getHashByIndex()
+                * Gets a hash by the index
+                * @param {integer} index
+                * @return {string}
+                */
+               History.getHashByIndex = function(index){
+                       // Prepare
+                       var hash = null;
+
+                       // Handle
+                       if ( typeof index === 'undefined' ) {
+                               // Get the last inserted
+                               hash = History.savedHashes[History.savedHashes.length-1];
+                       }
+                       else if ( index < 0 ) {
+                               // Get from the end
+                               hash = History.savedHashes[History.savedHashes.length+index];
+                       }
+                       else {
+                               // Get from the beginning
+                               hash = History.savedHashes[index];
+                       }
+
+                       // Return hash
+                       return hash;
+               };
+
+
+               // ====================================================================
+               // Discarded States
+
+               /**
+                * History.discardedHashes
+                * A hashed array of discarded hashes
+                */
+               History.discardedHashes = {};
+
+               /**
+                * History.discardedStates
+                * A hashed array of discarded states
+                */
+               History.discardedStates = {};
+
+               /**
+                * History.discardState(State)
+                * Discards the state by ignoring it through History
+                * @param {object} State
+                * @return {true}
+                */
+               History.discardState = function(discardedState,forwardState,backState){
+                       //History.debug('History.discardState', arguments);
+                       // Prepare
+                       var discardedStateHash = History.getHashByState(discardedState),
+                               discardObject;
+
+                       // Create Discard Object
+                       discardObject = {
+                               'discardedState': discardedState,
+                               'backState': backState,
+                               'forwardState': forwardState
+                       };
+
+                       // Add to DiscardedStates
+                       History.discardedStates[discardedStateHash] = discardObject;
+
+                       // Return true
+                       return true;
+               };
+
+               /**
+                * History.discardHash(hash)
+                * Discards the hash by ignoring it through History
+                * @param {string} hash
+                * @return {true}
+                */
+               History.discardHash = function(discardedHash,forwardState,backState){
+                       //History.debug('History.discardState', arguments);
+                       // Create Discard Object
+                       var discardObject = {
+                               'discardedHash': discardedHash,
+                               'backState': backState,
+                               'forwardState': forwardState
+                       };
+
+                       // Add to discardedHash
+                       History.discardedHashes[discardedHash] = discardObject;
+
+                       // Return true
+                       return true;
+               };
+
+               /**
+                * History.discardState(State)
+                * Checks to see if the state is discarded
+                * @param {object} State
+                * @return {bool}
+                */
+               History.discardedState = function(State){
+                       // Prepare
+                       var StateHash = History.getHashByState(State),
+                               discarded;
+
+                       // Check
+                       discarded = History.discardedStates[StateHash]||false;
+
+                       // Return true
+                       return discarded;
+               };
+
+               /**
+                * History.discardedHash(hash)
+                * Checks to see if the state is discarded
+                * @param {string} State
+                * @return {bool}
+                */
+               History.discardedHash = function(hash){
+                       // Check
+                       var discarded = History.discardedHashes[hash]||false;
+
+                       // Return true
+                       return discarded;
+               };
+
+               /**
+                * History.recycleState(State)
+                * Allows a discarded state to be used again
+                * @param {object} data
+                * @param {string} title
+                * @param {string} url
+                * @return {true}
+                */
+               History.recycleState = function(State){
+                       //History.debug('History.recycleState', arguments);
+                       // Prepare
+                       var StateHash = History.getHashByState(State);
+
+                       // Remove from DiscardedStates
+                       if ( History.discardedState(State) ) {
+                               delete History.discardedStates[StateHash];
+                       }
+
+                       // Return true
+                       return true;
+               };
+
+
+               // ====================================================================
+               // HTML4 HashChange Support
+
+               if ( History.emulated.hashChange ) {
+                       /*
+                        * We must emulate the HTML4 HashChange Support by manually checking for hash changes
+                        */
+
+                       /**
+                        * History.hashChangeInit()
+                        * Init the HashChange Emulation
+                        */
+                       History.hashChangeInit = function(){
+                               // Define our Checker Function
+                               History.checkerFunction = null;
+
+                               // Define some variables that will help in our checker function
+                               var lastDocumentHash = '',
+                                       iframeId, iframe,
+                                       lastIframeHash, checkerRunning;
+
+                               // Handle depending on the browser
+                               if ( History.isInternetExplorer() ) {
+                                       // IE6 and IE7
+                                       // We need to use an iframe to emulate the back and forward buttons
+
+                                       // Create iFrame
+                                       iframeId = 'historyjs-iframe';
+                                       iframe = document.createElement('iframe');
+
+                                       // Adjust iFarme
+                                       iframe.setAttribute('id', iframeId);
+                                       iframe.style.display = 'none';
+
+                                       // Append iFrame
+                                       document.body.appendChild(iframe);
+
+                                       // Create initial history entry
+                                       iframe.contentWindow.document.open();
+                                       iframe.contentWindow.document.close();
+
+                                       // Define some variables that will help in our checker function
+                                       lastIframeHash = '';
+                                       checkerRunning = false;
+
+                                       // Define the checker function
+                                       History.checkerFunction = function(){
+                                               // Check Running
+                                               if ( checkerRunning ) {
+                                                       return false;
+                                               }
+
+                                               // Update Running
+                                               checkerRunning = true;
+
+                                               // Fetch
+                                               var
+                                                       documentHash = History.getHash(),
+                                                       iframeHash = History.getHash(iframe.contentWindow.document.location);
+
+                                               // The Document Hash has changed (application caused)
+                                               if ( documentHash !== lastDocumentHash ) {
+                                                       // Equalise
+                                                       lastDocumentHash = documentHash;
+
+                                                       // Create a history entry in the iframe
+                                                       if ( iframeHash !== documentHash ) {
+                                                               //History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);
+
+                                                               // Equalise
+                                                               lastIframeHash = iframeHash = documentHash;
+
+                                                               // Create History Entry
+                                                               iframe.contentWindow.document.open();
+                                                               iframe.contentWindow.document.close();
+
+                                                               // Update the iframe's hash
+                                                               iframe.contentWindow.document.location.hash = History.escapeHash(documentHash);
+                                                       }
+
+                                                       // Trigger Hashchange Event
+                                                       History.Adapter.trigger(window,'hashchange');
+                                               }
+
+                                               // The iFrame Hash has changed (back button caused)
+                                               else if ( iframeHash !== lastIframeHash ) {
+                                                       //History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);
+
+                                                       // Equalise
+                                                       lastIframeHash = iframeHash;
+
+                                                       // Update the Hash
+                                                       History.setHash(iframeHash,false);
+                                               }
+
+                                               // Reset Running
+                                               checkerRunning = false;
+
+                                               // Return true
+                                               return true;
+                                       };
+                               }
+                               else {
+                                       // We are not IE
+                                       // Firefox 1 or 2, Opera
+
+                                       // Define the checker function
+                                       History.checkerFunction = function(){
+                                               // Prepare
+                                               var documentHash = History.getHash();
+
+                                               // The Document Hash has changed (application caused)
+                                               if ( documentHash !== lastDocumentHash ) {
+                                                       // Equalise
+                                                       lastDocumentHash = documentHash;
+
+                                                       // Trigger Hashchange Event
+                                                       History.Adapter.trigger(window,'hashchange');
+                                               }
+
+                                               // Return true
+                                               return true;
+                                       };
+                               }
+
+                               // Apply the checker function
+                               History.intervalList.push(setInterval(History.checkerFunction, History.options.hashChangeInterval));
+
+                               // Done
+                               return true;
+                       }; // History.hashChangeInit
+
+                       // Bind hashChangeInit
+                       History.Adapter.onDomLoad(History.hashChangeInit);
+
+               } // History.emulated.hashChange
+
+
+               // ====================================================================
+               // HTML5 State Support
+
+               // Non-Native pushState Implementation
+               if ( History.emulated.pushState ) {
+                       /*
+                        * We must emulate the HTML5 State Management by using HTML4 HashChange
+                        */
+
+                       /**
+                        * History.onHashChange(event)
+                        * Trigger HTML5's window.onpopstate via HTML4 HashChange Support
+                        */
+                       History.onHashChange = function(event){
+                               //History.debug('History.onHashChange', arguments);
+
+                               // Prepare
+                               var currentUrl = ((event && event.newURL) || History.getLocationHref()),
+                                       currentHash = History.getHashByUrl(currentUrl),
+                                       currentState = null,
+                                       currentStateHash = null,
+                                       currentStateHashExits = null,
+                                       discardObject;
+
+                               // Check if we are the same state
+                               if ( History.isLastHash(currentHash) ) {
+                                       // There has been no change (just the page's hash has finally propagated)
+                                       //History.debug('History.onHashChange: no change');
+                                       History.busy(false);
+                                       return false;
+                               }
+
+                               // Reset the double check
+                               History.doubleCheckComplete();
+
+                               // Store our location for use in detecting back/forward direction
+                               History.saveHash(currentHash);
+
+                               // Expand Hash
+                               if ( currentHash && History.isTraditionalAnchor(currentHash) ) {
+                                       //History.debug('History.onHashChange: traditional anchor', currentHash);
+                                       // Traditional Anchor Hash
+                                       History.Adapter.trigger(window,'anchorchange');
+                                       History.busy(false);
+                                       return false;
+                               }
+
+                               // Create State
+                               currentState = History.extractState(History.getFullUrl(currentHash||History.getLocationHref(),false),true);
+
+                               // Check if we are the same state
+                               if ( History.isLastSavedState(currentState) ) {
+                                       //History.debug('History.onHashChange: no change');
+                                       // There has been no change (just the page's hash has finally propagated)
+                                       History.busy(false);
+                                       return false;
+                               }
+
+                               // Create the state Hash
+                               currentStateHash = History.getHashByState(currentState);
+
+                               // Check if we are DiscardedState
+                               discardObject = History.discardedState(currentState);
+                               if ( discardObject ) {
+                                       // Ignore this state as it has been discarded and go back to the state before it
+                                       if ( History.getHashByIndex(-2) === History.getHashByState(discardObject.forwardState) ) {
+                                               // We are going backwards
+                                               //History.debug('History.onHashChange: go backwards');
+                                               History.back(false);
+                                       } else {
+                                               // We are going forwards
+                                               //History.debug('History.onHashChange: go forwards');
+                                               History.forward(false);
+                                       }
+                                       return false;
+                               }
+
+                               // Push the new HTML5 State
+                               //History.debug('History.onHashChange: success hashchange');
+                               History.pushState(currentState.data,currentState.title,encodeURI(currentState.url),false);
+
+                               // End onHashChange closure
+                               return true;
+                       };
+                       History.Adapter.bind(window,'hashchange',History.onHashChange);
+
+                       /**
+                        * History.pushState(data,title,url)
+                        * Add a new State to the history object, become it, and trigger onpopstate
+                        * We have to trigger for HTML4 compatibility
+                        * @param {object} data
+                        * @param {string} title
+                        * @param {string} url
+                        * @return {true}
+                        */
+                       History.pushState = function(data,title,url,queue){
+                               //History.debug('History.pushState: called', arguments);
+
+                               // We assume that the URL passed in is URI-encoded, but this makes
+                               // sure that it's fully URI encoded; any '%'s that are encoded are
+                               // converted back into '%'s
+                               url = encodeURI(url).replace(/%25/g, "%");
+
+                               // Check the State
+                               if ( History.getHashByUrl(url) ) {
+                                       throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
+                               }
+
+                               // Handle Queueing
+                               if ( queue !== false && History.busy() ) {
+                                       // Wait + Push to Queue
+                                       //History.debug('History.pushState: we must wait', arguments);
+                                       History.pushQueue({
+                                               scope: History,
+                                               callback: History.pushState,
+                                               args: arguments,
+                                               queue: queue
+                                       });
+                                       return false;
+                               }
+
+                               // Make Busy
+                               History.busy(true);
+
+                               // Fetch the State Object
+                               var newState = History.createStateObject(data,title,url),
+                                       newStateHash = History.getHashByState(newState),
+                                       oldState = History.getState(false),
+                                       oldStateHash = History.getHashByState(oldState),
+                                       html4Hash = History.getHash();
+
+                               // Store the newState
+                               History.storeState(newState);
+                               History.expectedStateId = newState.id;
+
+                               // Recycle the State
+                               History.recycleState(newState);
+
+                               // Force update of the title
+                               History.setTitle(newState);
+
+                   &n