Ghost/docs/assets/behavior.js

1012 lines
121 KiB
JavaScript
Raw Normal View History

2013-05-11 20:44:25 +04:00
/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.ou
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.leng
var MAX_FILTER_SIZE, appendSearchNode, buildNav, buildTOCNode, clearFilter, clearHighlight, currentNode$, currentQuery, fileMap, focusCurrentNode, highlightMatch, moveCurrentNode, nav$, searchNodes, searchableNodes, selectNode, selectNodeByDocumentPath, setCurrentNodeExpanded, setTableOfContentsActive, tableOfContents, toc$, toggleTableOfContents, visitCurrentNode;
tableOfContents = [
{
"type": "file",
"data": {
"language": {
"nameMatchers": [".md"],
"commentsOnly": true,
"name": "Markdown"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/README.md",
"projectPath": "README.md",
"targetPath": "index",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Ghost Prototype Project",
"slug": "ghost-prototype-project",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 3,
"title": "To Install:",
"slug": "to-install"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Sqlite3 Install Instructions",
"slug": "sqlite3-install-instructions"
},
"depth": 4
}
]
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Dependencies:",
"slug": "dependencies"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Frontend libraries:",
"slug": "frontend-libraries"
},
"depth": 4
}
]
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Working features:",
"slug": "working-features"
},
"depth": 3
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Front End Work",
"slug": "front-end-work"
},
"depth": 3
}
]
},
"title": "Ghost Prototype Project"
},
"depth": 1,
"outline": [
{
"type": "heading",
"data": {
"level": 3,
"title": "To Install:",
"slug": "to-install"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Sqlite3 Install Instructions",
"slug": "sqlite3-install-instructions"
},
"depth": 4
}
]
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Dependencies:",
"slug": "dependencies"
},
"depth": 3,
"children": [
{
"type": "heading",
"data": {
"level": 4,
"title": "Frontend libraries:",
"slug": "frontend-libraries"
},
"depth": 4
}
]
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Working features:",
"slug": "working-features"
},
"depth": 3
}, {
"type": "heading",
"data": {
"level": 3,
"title": "Front End Work",
"slug": "front-end-work"
},
"depth": 3
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/admin-ui-temp.js",
"projectPath": "core/admin/assets/js/admin-ui-temp.js",
"targetPath": "admin-ui-temp",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Temporary Admin UI",
"slug": "temporary-admin-ui",
"isFileHeader": true
},
"depth": 1
},
"title": "Temporary Admin UI"
},
"depth": 1,
"outline": []
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/app.js",
"projectPath": "app.js",
"targetPath": "app",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Ghost main app file",
"slug": "ghost-main-app-file",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Variables",
"slug": "variables"
},
"depth": 2
}
]
},
"title": "Ghost main app file"
},
"depth": 1,
"outline": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Variables",
"slug": "variables"
},
"depth": 2
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/blog.js",
"projectPath": "core/admin/assets/js/blog.js",
"targetPath": "blog",
"title": "blog"
},
"depth": 1,
"outline": []
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/config.js",
"projectPath": "config.js",
"targetPath": "config",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Ghost Configuration",
"slug": "ghost-configuration",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Admin settings",
"slug": "admin-settings"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Themes",
"slug": "themes"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Homepage settings",
"slug": "homepage-settings"
},
"depth": 2
}
]
},
"title": "Ghost Configuration"
},
"depth": 1,
"outline": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Admin settings",
"slug": "admin-settings"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Themes",
"slug": "themes"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Homepage settings",
"slug": "homepage-settings"
},
"depth": 2
}
]
}, {
"type": "folder",
"data": {
"path": "core",
"title": "core"
},
"depth": 1,
"children": [
{
"type": "folder",
"data": {
"path": "core/frontend",
"title": "frontend"
},
"depth": 2,
"children": [
{
"type": "folder",
"data": {
"path": "core/frontend/helpers",
"title": "helpers"
},
"depth": 3,
"children": [
{
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/frontend/helpers/index.js",
"projectPath": "core/frontend/helpers/index.js",
"targetPath": "core/frontend/helpers/index",
"title": "index"
},
"depth": 4,
"outline": []
}
]
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/ghost.js",
"projectPath": "core/ghost.js",
"targetPath": "core/ghost",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Ghost Module",
"slug": "ghost-module",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 2,
"title": " Setup Prerequisites",
"slug": "-setup-prerequisites"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": " Article Statuses",
"slug": "-article-statuses"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Module Methods",
"slug": "module-methods"
},
"depth": 2
}
]
},
"title": "Ghost Module"
},
"depth": 2,
"outline": [
{
"type": "heading",
"data": {
"level": 2,
"title": " Setup Prerequisites",
"slug": "-setup-prerequisites"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": " Article Statuses",
"slug": "-article-statuses"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Module Methods",
"slug": "module-methods"
},
"depth": 2
}
]
}, {
"type": "folder",
"data": {
"path": "core/lang",
"title": "lang"
},
"depth": 2,
"children": [
{
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/lang/i18n.js",
"projectPath": "core/lang/i18n.js",
"targetPath": "core/lang/i18n",
"title": "i18n"
},
"depth": 3,
"outline": []
}
]
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/editor.js",
"projectPath": "core/admin/assets/js/editor.js",
"targetPath": "editor",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": "Article Editor",
"slug": "article-editor",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Converter Initialisation",
"slug": "converter-initialisation"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Functions",
"slug": "functions"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": " Main Initialisation",
"slug": "-main-initialisation"
},
"depth": 2
}
]
},
"title": "Article Editor"
},
"depth": 1,
"outline": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Converter Initialisation",
"slug": "converter-initialisation"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": "Functions",
"slug": "functions"
},
"depth": 2
}, {
"type": "heading",
"data": {
"level": 2,
"title": " Main Initialisation",
"slug": "-main-initialisation"
},
"depth": 2
}
]
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/settings.js",
"projectPath": "core/admin/assets/js/settings.js",
"targetPath": "settings",
"title": "settings"
},
"depth": 1,
"outline": []
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/shortcuts.js",
"projectPath": "core/admin/assets/js/shortcuts.js",
"targetPath": "shortcuts",
"title": "shortcuts"
},
"depth": 1,
"outline": []
}, {
"type": "file",
"data": {
"language": {
"nameMatchers": [".js"],
"pygmentsLexer": "javascript",
"singleLineComment": ["//"],
"name": "JavaScript"
},
"sourcePath": "/Volumes/Macintosh HD/Dropbox/Archive/W/Work/Clients/Individuals/John O'Nolan/Web/Ghost/ghost_prototype/core/admin/assets/js/toggle.js",
"projectPath": "core/admin/assets/js/toggle.js",
"targetPath": "toggle",
"firstHeader": {
"type": "heading",
"data": {
"level": 1,
"title": " Toggle Support",
"slug": "-toggle-support",
"isFileHeader": true
},
"depth": 1,
"children": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Toggle Up In Your Grill",
"slug": "toggle-up-in-your-grill"
},
"depth": 2,
"children": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Usage",
"slug": "usage"
},
"depth": 3
}
]
}
]
},
"title": " Toggle Support"
},
"depth": 1,
"outline": [
{
"type": "heading",
"data": {
"level": 2,
"title": "Toggle Up In Your Grill",
"slug": "toggle-up-in-your-grill"
},
"depth": 2,
"children": [
{
"type": "heading",
"data": {
"level": 3,
"title": "Usage",
"slug": "usage"
},
"depth": 3
}
]
}
]
}
];
nav$ = null;
toc$ = null;
setTableOfContentsActive = function(active) {
var html$;
html$ = $('html');
if (active) {
nav$.addClass('active');
return html$.addClass('popped');
} else {
nav$.removeClass('active');
return html$.removeClass('popped');
}
};
toggleTableOfContents = function() {
return setTableOfContentsActive(!nav$.hasClass('active'));
};
currentNode$ = null;
focusCurrentNode = function() {
var currentNodeBottom, currentNodeTop;
currentNodeTop = currentNode$.offset().top - toc$.children(':visible').first().offset().top;
currentNodeBottom = currentNodeTop + currentNode$.children('.label').height();
if (currentNodeTop < toc$.scrollTop()) {
toc$.scrollTop(currentNodeTop);
}
if (currentNodeBottom > toc$.scrollTop() + toc$.height()) {
return toc$.scrollTop(currentNodeBottom - toc$.height());
}
};
setCurrentNodeExpanded = function(expanded) {
var parents$;
if (expanded) {
currentNode$.addClass('expanded');
} else {
if (currentNode$.hasClass('expanded')) {
currentNode$.removeClass('expanded');
} else {
parents$ = currentNode$.parents('li');
if (parents$.length > 0) {
selectNode(parents$.first());
}
}
}
return focusCurrentNode();
};
selectNode = function(newNode$) {
currentNode$.removeClass('selected');
newNode$.addClass('selected');
currentNode$ = newNode$;
return focusCurrentNode();
};
selectNodeByDocumentPath = function(documentPath, headerSlug) {
var link, urlChunks, _i, _len, _ref;
if (headerSlug == null) {
headerSlug = null;
}
currentNode$ = fileMap[documentPath];
if (headerSlug) {
_ref = currentNode$.find('.outline a');
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
urlChunks = $(link).attr('href').split('#');
if (urlChunks[1] === headerSlug) {
currentNode$ = $(link).parents('li').first();
break;
}
}
}
currentNode$.addClass('selected expanded');
currentNode$.parents('li').addClass('expanded');
return focusCurrentNode();
};
moveCurrentNode = function(up) {
var i, newIndex, node, visibleNodes$, _i, _len;
visibleNodes$ = toc$.find('li:visible:not(.filtered)');
newIndex = 0;
for (i = _i = 0, _len = visibleNodes$.length; _i < _len; i = ++_i) {
node = visibleNodes$[i];
if (node === currentNode$[0]) {
newIndex = up ? i - 1 : i + 1;
if (newIndex < 0) {
newIndex = 0;
}
if (newIndex > visibleNodes$.length - 1) {
newIndex = visibleNodes$.length - 1;
}
break;
}
}
return selectNode($(visibleNodes$[newIndex]));
};
visitCurrentNode = function() {
var labelLink$;
labelLink$ = currentNode$.children('a.label');
if (labelLink$.length > 0) {
return window.location = labelLink$.attr('href');
}
};
MAX_FILTER_SIZE = 10;
searchableNodes = [];
appendSearchNode = function(node$) {
var text$;
text$ = node$.find('> .label .text');
return searchableNodes.push([text$.text().toLowerCase(), node$, text$]);
};
currentQuery = '';
searchNodes = function(queryString) {
var c, filtered, matched, matcher, nodeInfo, p, _i, _j, _k, _len, _len1, _len2, _results;
queryString = queryString.toLowerCase().replace(/\s+/, '');
if (queryString === currentQuery) {
return;
}
currentQuery = queryString;
if (queryString === '') {
return clearFilter();
}
matcher = new RegExp(((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = queryString.length; _i < _len; _i++) {
c = queryString[_i];
_results.push(c.replace(/[-[\]{}()*+?.,\\^$|#\s]/, "\\$&"));
}
return _results;
})()).join('.*'));
matched = [];
filtered = [];
for (_i = 0, _len = searchableNodes.length; _i < _len; _i++) {
nodeInfo = searchableNodes[_i];
if (matcher.test(nodeInfo[0])) {
matched.push(nodeInfo);
} else {
filtered.push(nodeInfo);
}
}
if (matched.length > MAX_FILTER_SIZE) {
return clearFilter();
}
nav$.addClass('searching');
for (_j = 0, _len1 = filtered.length; _j < _len1; _j++) {
nodeInfo = filtered[_j];
nodeInfo[1].removeClass('matched-child');
nodeInfo[1].addClass('filtered');
clearHighlight(nodeInfo[2]);
}
_results = [];
for (_k = 0, _len2 = matched.length; _k < _len2; _k++) {
nodeInfo = matched[_k];
nodeInfo[1].removeClass('filtered matched-child');
nodeInfo[1].addClass('matched');
highlightMatch(nodeInfo[2], queryString);
_results.push((function() {
var _l, _len3, _ref, _results1;
_ref = nodeInfo[1].parents('li');
_results1 = [];
for (_l = 0, _len3 = _ref.length; _l < _len3; _l++) {
p = _ref[_l];
_results1.push($(p).addClass('matched-child'));
}
return _results1;
})());
}
return _results;
};
clearFilter = function() {
var nodeInfo, _i, _len, _results;
nav$.removeClass('searching');
currentQuery = '';
_results = [];
for (_i = 0, _len = searchableNodes.length; _i < _len; _i++) {
nodeInfo = searchableNodes[_i];
nodeInfo[1].removeClass('filtered matched-child');
_results.push(clearHighlight(nodeInfo[2]));
}
return _results;
};
highlightMatch = function(text$, queryString) {
var char, foundIndex, furthestIndex, lowerText, markedText, nodeText, _i, _len;
nodeText = text$.text();
lowerText = nodeText.toLowerCase();
markedText = '';
furthestIndex = 0;
for (_i = 0, _len = queryString.length; _i < _len; _i++) {
char = queryString[_i];
foundIndex = lowerText.indexOf(char, furthestIndex);
markedText += nodeText.slice(furthestIndex, foundIndex) + ("<em>" + nodeText[foundIndex] + "</em>");
furthestIndex = foundIndex + 1;
}
return text$.html(markedText + nodeText.slice(furthestIndex));
};
clearHighlight = function(text$) {
return text$.text(text$.text());
};
fileMap = {};
buildNav = function(metaInfo) {
var node, sourceURL, _i, _len;
nav$ = $("<nav>\n <ul class=\"tools\">\n <li class=\"toggle\">Table of Contents</li>\n <li class=\"search\">\n <input id=\"search\" type=\"search\" autocomplete=\"off\"/>\n </li>\n </ul>\n <ol class=\"toc\"/>\n </div>\n</nav>").appendTo($('body'));
toc$ = nav$.find('.toc');
if (metaInfo.githubURL) {
if (metaInfo.documentPath === 'index') {
sourceURL = metaInfo.githubURL;
} else {
sourceURL = "" + metaInfo.githubURL + "/blob/master/" + metaInfo.projectPath;
}
nav$.find('.tools').prepend("<li class=\"github\">\n <a href=\"" + sourceURL + "\" title=\"View source on GitHub\">\n View source on GitHub\n </a>\n</li>");
}
for (_i = 0, _len = tableOfContents.length; _i < _len; _i++) {
node = tableOfContents[_i];
toc$.append(buildTOCNode(node, metaInfo));
}
return nav$;
};
buildTOCNode = function(node, metaInfo) {
var c, children$, discloser$, label$, node$, _i, _len, _ref, _ref1, _ref2;
node$ = $("<li class=\"" + node.type + "\"/>");
switch (node.type) {
case 'file':
node$.append("<a class=\"label\" href=\"" + metaInfo.relativeRoot + node.data.targetPath + ".html\" title=\"" + node.data.projectPath + "\"><span class=\"text\">" + node.data.title + "</span></a>");
break;
case 'folder':
node$.append("<span class=\"label\"><span class=\"text\">" + node.data.title + "</span></span>");
}
if (((_ref = node.children) != null ? _ref.length : void 0) > 0) {
children$ = $('<ol class="children"/>');
_ref1 = node.children;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
c = _ref1[_i];
children$.append(buildTOCNode(c, metaInfo));
}
node$.append(children$);
}
label$ = node$.find('> .label');
label$.click(function() {
return selectNode(node$);
});
discloser$ = $('<span class="discloser"/>').prependTo(label$);
if (!(((_ref2 = node.children) != null ? _ref2.length : void 0) > 0)) {
discloser$.addClass('placeholder');
}
discloser$.click(function(evt) {
node$.toggleClass('expanded');
return evt.preventDefault();
});
if (node.type === 'file') {
fileMap[node.data.targetPath] = node$;
}
appendSearchNode(node$);
return node$;
};
$(function() {
var lastMousedownTimestamp, metaInfo, search$, toggle$;
metaInfo = {
relativeRoot: $('meta[name="groc-relative-root"]').attr('content'),
githubURL: $('meta[name="groc-github-url"]').attr('content'),
documentPath: $('meta[name="groc-document-path"]').attr('content'),
projectPath: $('meta[name="groc-project-path"]').attr('content')
};
nav$ = buildNav(metaInfo);
toc$ = nav$.find('.toc');
search$ = $('#search');
selectNodeByDocumentPath(metaInfo.documentPath, window.location.hash.replace('#', ''));
search$.focus(function() {
return setTableOfContentsActive(true);
});
lastMousedownTimestamp = null;
nav$.mousedown(function(evt) {
if (evt.target !== toggle$[0]) {
return lastMousedownTimestamp = evt.timeStamp;
}
});
search$.blur(function(evt) {
if (evt.timeStamp - lastMousedownTimestamp < 10) {
return search$.focus();
} else {
return setTableOfContentsActive(false);
}
});
toggle$ = nav$.find('.toggle');
toggle$.click(function(evt) {
if (search$.is(':focus')) {
search$.blur();
} else {
search$.focus();
}
return evt.preventDefault();
});
toggle$.mousedown(function(evt) {
return evt.preventDefault();
});
$('body').keydown(function(evt) {
if (nav$.hasClass('active')) {
switch (evt.keyCode) {
case 13:
visitCurrentNode();
break;
case 37:
setCurrentNodeExpanded(false);
break;
case 38:
moveCurrentNode(true);
break;
case 39:
setCurrentNodeExpanded(true);
break;
case 40:
moveCurrentNode(false);
break;
default:
return;
}
return evt.preventDefault();
}
});
search$.bind('keyup search', function(evt) {
return searchNodes(search$.val());
});
return search$.keydown(function(evt) {
if (evt.keyCode === 27) {
if (search$.val().trim() === '') {
return search$.blur();
} else {
return search$.val('');
}
}
});
});
}).call(this);