-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
1 lines (1 loc) · 38.8 KB
/
app.js
1
(function(a){function b(){}for(var c="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d;d=c.pop();)a[d]=a[d]||b})(window.console=window.console||{}),function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.slice,h=d.unshift,i=e.toString,j=e.hasOwnProperty,k=d.forEach,l=d.map,m=d.reduce,n=d.reduceRight,o=d.filter,p=d.every,q=d.some,r=d.indexOf,s=d.lastIndexOf,t=Array.isArray,u=Object.keys,v=f.bind,w=function(a){return new B(a)};typeof module!="undefined"&&module.exports?(module.exports=w,w._=w):a._=w,w.VERSION="1.1.7";var x=w.each=w.forEach=function(a,b,d){if(a==null)return;if(k&&a.forEach===k)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;e<f;e++)if(e in a&&b.call(d,a[e],e,a)===c)return}else for(var g in a)if(j.call(a,g)&&b.call(d,a[g],g,a)===c)return};w.map=function(a,b,c){var d=[];return a==null?d:l&&a.map===l?a.map(b,c):(x(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)},w.reduce=w.foldl=w.inject=function(a,b,c,d){var e=c!==void 0;a==null&&(a=[]);if(m&&a.reduce===m)return d&&(b=w.bind(b,d)),e?a.reduce(b,c):a.reduce(b);x(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)});if(!e)throw new TypeError("Reduce of empty array with no initial value");return c},w.reduceRight=w.foldr=function(a,b,c,d){a==null&&(a=[]);if(n&&a.reduceRight===n)return d&&(b=w.bind(b,d)),c!==void 0?a.reduceRight(b,c):a.reduceRight(b);var e=(w.isArray(a)?a.slice():w.toArray(a)).reverse();return w.reduce(e,b,c,d)},w.find=w.detect=function(a,b,c){var d;return y(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},w.filter=w.select=function(a,b,c){var d=[];return a==null?d:o&&a.filter===o?a.filter(b,c):(x(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},w.reject=function(a,b,c){var d=[];return a==null?d:(x(a,function(a,e,f){b.call(c,a,e,f)||(d[d.length]=a)}),d)},w.every=w.all=function(a,b,d){var e=!0;return a==null?e:p&&a.every===p?a.every(b,d):(x(a,function(a,f,g){if(!(e=e&&b.call(d,a,f,g)))return c}),e)};var y=w.some=w.any=function(a,b,d){b=b||w.identity;var e=!1;return a==null?e:q&&a.some===q?a.some(b,d):(x(a,function(a,f,g){if(e|=b.call(d,a,f,g))return c}),!!e)};w.include=w.contains=function(a,b){var c=!1;return a==null?c:r&&a.indexOf===r?a.indexOf(b)!=-1:(y(a,function(a){if(c=a===b)return!0}),c)},w.invoke=function(a,b){var c=g.call(arguments,2);return w.map(a,function(a){return(b.call?b||a:a[b]).apply(a,c)})},w.pluck=function(a,b){return w.map(a,function(a){return a[b]})},w.max=function(a,b,c){if(!b&&w.isArray(a))return Math.max.apply(Math,a);var d={computed:-Infinity};return x(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},w.min=function(a,b,c){if(!b&&w.isArray(a))return Math.min.apply(Math,a);var d={computed:Infinity};return x(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g<d.computed&&(d={value:a,computed:g})}),d.value},w.sortBy=function(a,b,c){return w.pluck(w.map(a,function(a,d,e){return{value:a,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")},w.groupBy=function(a,b){var c={};return x(a,function(a,d){var e=b(a,d);(c[e]||(c[e]=[])).push(a)}),c},w.sortedIndex=function(a,b,c){c||(c=w.identity);var d=0,e=a.length;while(d<e){var f=d+e>>1;c(a[f])<c(b)?d=f+1:e=f}return d},w.toArray=function(a){return a?a.toArray?a.toArray():w.isArray(a)?g.call(a):w.isArguments(a)?g.call(a):w.values(a):[]},w.size=function(a){return w.toArray(a).length},w.first=w.head=function(a,b,c){return b!=null&&!c?g.call(a,0,b):a[0]},w.rest=w.tail=function(a,b,c){return g.call(a,b==null||c?1:b)},w.last=function(a){return a[a.length-1]},w.compact=function(a){return w.filter(a,function(a){return!!a})},w.flatten=function(a){return w.reduce(a,function(a,b){return w.isArray(b)?a.concat(w.flatten(b)):(a[a.length]=b,a)},[])},w.without=function(a){return w.difference(a,g.call(arguments,1))},w.uniq=w.unique=function(a,b){return w.reduce(a,function(a,c,d){if(0==d||(b===!0?w.last(a)!=c:!w.include(a,c)))a[a.length]=c;return a},[])},w.union=function(){return w.uniq(w.flatten(arguments))},w.intersection=w.intersect=function(a){var b=g.call(arguments,1);return w.filter(w.uniq(a),function(a){return w.every(b,function(b){return w.indexOf(b,a)>=0})})},w.difference=function(a,b){return w.filter(a,function(a){return!w.include(b,a)})},w.zip=function(){var a=g.call(arguments),b=w.max(w.pluck(a,"length")),c=new Array(b);for(var d=0;d<b;d++)c[d]=w.pluck(a,""+d);return c},w.indexOf=function(a,b,c){if(a==null)return-1;var d,e;if(c)return d=w.sortedIndex(a,b),a[d]===b?d:-1;if(r&&a.indexOf===r)return a.indexOf(b);for(d=0,e=a.length;d<e;d++)if(a[d]===b)return d;return-1},w.lastIndexOf=function(a,b){if(a==null)return-1;if(s&&a.lastIndexOf===s)return a.lastIndexOf(b);var c=a.length;while(c--)if(a[c]===b)return c;return-1},w.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);while(e<d)f[e++]=a,a+=c;return f},w.bind=function(a,b){if(a.bind===v&&v)return v.apply(a,g.call(arguments,1));var c=g.call(arguments,2);return function(){return a.apply(b,c.concat(g.call(arguments)))}},w.bindAll=function(a){var b=g.call(arguments,1);return b.length==0&&(b=w.functions(a)),x(b,function(b){a[b]=w.bind(a[b],a)}),a},w.memoize=function(a,b){var c={};return b||(b=w.identity),function(){var d=b.apply(this,arguments);return j.call(c,d)?c[d]:c[d]=a.apply(this,arguments)}},w.delay=function(a,b){var c=g.call(arguments,2);return setTimeout(function(){return a.apply(a,c)},b)},w.defer=function(a){return w.delay.apply(w,[a,1].concat(g.call(arguments,1)))};var z=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,a.apply(e,f)};c&&clearTimeout(d);if(c||!d)d=setTimeout(g,b)}};w.throttle=function(a,b){return z(a,b,!1)},w.debounce=function(a,b){return z(a,b,!0)},w.once=function(a){var b=!1,c;return function(){return b?c:(b=!0,c=a.apply(this,arguments))}},w.wrap=function(a,b){return function(){var c=[a].concat(g.call(arguments));return b.apply(this,c)}},w.compose=function(){var a=g.call(arguments);return function(){var b=g.call(arguments);for(var c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},w.after=function(a,b){return function(){if(--a<1)return b.apply(this,arguments)}},w.keys=u||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)j.call(a,c)&&(b[b.length]=c);return b},w.values=function(a){return w.map(a,w.identity)},w.functions=w.methods=function(a){var b=[];for(var c in a)w.isFunction(a[c])&&b.push(c);return b.sort()},w.extend=function(a){return x(g.call(arguments,1),function(b){for(var c in b)b[c]!==void 0&&(a[c]=b[c])}),a},w.defaults=function(a){return x(g.call(arguments,1),function(b){for(var c in b)a[c]==null&&(a[c]=b[c])}),a},w.clone=function(a){return w.isArray(a)?a.slice():w.extend({},a)},w.tap=function(a,b){return b(a),a},w.isEqual=function(a,b){if(a===b)return!0;var c=typeof a,d=typeof b;if(c!=d)return!1;if(a==b)return!0;if(!a&&b||a&&!b)return!1;a._chain&&(a=a._wrapped),b._chain&&(b=b._wrapped);if(a.isEqual)return a.isEqual(b);if(b.isEqual)return b.isEqual(a);if(w.isDate(a)&&w.isDate(b))return a.getTime()===b.getTime();if(w.isNaN(a)&&w.isNaN(b))return!1;if(w.isRegExp(a)&&w.isRegExp(b))return a.source===b.source&&a.global===b.global&&a.ignoreCase===b.ignoreCase&&a.multiline===b.multiline;if(c!=="object")return!1;if(a.length&&a.length!==b.length)return!1;var e=w.keys(a),f=w.keys(b);if(e.length!=f.length)return!1;for(var g in a)if(!(g in b)||!w.isEqual(a[g],b[g]))return!1;return!0},w.isEmpty=function(a){if(w.isArray(a)||w.isString(a))return a.length===0;for(var b in a)if(j.call(a,b))return!1;return!0},w.isElement=function(a){return!!a&&a.nodeType==1},w.isArray=t||function(a){return i.call(a)==="[object Array]"},w.isObject=function(a){return a===Object(a)},w.isArguments=function(a){return!!a&&!!j.call(a,"callee")},w.isFunction=function(a){return!!(a&&a.constructor&&a.call&&a.apply)},w.isString=function(a){return!!(a===""||a&&a.charCodeAt&&a.substr)},w.isNumber=function(a){return!!(a===0||a&&a.toExponential&&a.toFixed)},w.isNaN=function(a){return a!==a},w.isBoolean=function(a){return a===!0||a===!1},w.isDate=function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},w.isRegExp=function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},w.isNull=function(a){return a===null},w.isUndefined=function(a){return a===void 0},w.noConflict=function(){return a._=b,this},w.identity=function(a){return a},w.times=function(a,b,c){for(var d=0;d<a;d++)b.call(c,d)},w.mixin=function(a){x(w.functions(a),function(b){D(b,w[b]=a[b])})};var A=0;w.uniqueId=function(a){var b=A++;return a?a+b:b},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g},w.template=function(a,b){var c=w.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(c.interpolate,function(a,b){return"',"+b.replace(/\\'/g,"'")+",'"}).replace(c.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+"__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj",d);return b?e(b):e};var B=function(a){this._wrapped=a};w.prototype=B.prototype;var C=function(a,b){return b?w(a).chain():a},D=function(a,b){B.prototype[a]=function(){var a=g.call(arguments);return h.call(a,this._wrapped),C(b.apply(w,a),this._chain)}};w.mixin(w),x(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];B.prototype[a]=function(){return b.apply(this._wrapped,arguments),C(this._wrapped,this._chain)}}),x(["concat","join","slice"],function(a){var b=d[a];B.prototype[a]=function(){return C(b.apply(this._wrapped,arguments),this._chain)}}),B.prototype.chain=function(){return this._chain=!0,this},B.prototype.value=function(){return this._wrapped}}(),function(){var a=this,b=a.Backbone,c;typeof exports!="undefined"?c=exports:c=a.Backbone={},c.VERSION="0.5.3";var d=a._;!d&&typeof require!="undefined"&&(d=require("underscore")._);var e=a.jQuery||a.Zepto;c.noConflict=function(){return a.Backbone=b,this},c.emulateHTTP=!1,c.emulateJSON=!1,c.Events={bind:function(a,b,c){var d=this._callbacks||(this._callbacks={}),e=d[a]||(d[a]=[]);return e.push([b,c]),this},unbind:function(a,b){var c;if(!a)this._callbacks={};else if(c=this._callbacks)if(!b)c[a]=[];else{var d=c[a];if(!d)return this;for(var e=0,f=d.length;e<f;e++)if(d[e]&&b===d[e][0]){d[e]=null;break}}return this},trigger:function(a){var b,c,d,e,f,g=2;if(!(c=this._callbacks))return this;while(g--){d=g?a:"all";if(b=c[d])for(var h=0,i=b.length;h<i;h++)(e=b[h])?(f=g?Array.prototype.slice.call(arguments,1):arguments,e[0].apply(e[1]||this,f)):(b.splice(h,1),h--,i--)}return this}},c.Model=function(a,b){var c;a||(a={});if(c=this.defaults)d.isFunction(c)&&(c=c.call(this)),a=d.extend({},c,a);this.attributes={},this._escapedAttributes={},this.cid=d.uniqueId("c"),this.set(a,{silent:!0}),this._changed=!1,this._previousAttributes=d.clone(this.attributes),b&&b.collection&&(this.collection=b.collection),this.initialize(a,b)},d.extend(c.Model.prototype,c.Events,{_previousAttributes:null,_changed:!1,idAttribute:"id",initialize:function(){},toJSON:function(){return d.clone(this.attributes)},get:function(a){return this.attributes[a]},escape:function(a){var b;if(b=this._escapedAttributes[a])return b;var c=this.attributes[a];return this._escapedAttributes[a]=w(c==null?"":""+c)},has:function(a){return this.attributes[a]!=null},set:function(a,b){b||(b={});if(!a)return this;a.attributes&&(a=a.attributes);var c=this.attributes,e=this._escapedAttributes;if(!b.silent&&this.validate&&!this._performValidation(a,b))return!1;this.idAttribute in a&&(this.id=a[this.idAttribute]);var f=this._changing;this._changing=!0;for(var g in a){var h=a[g];d.isEqual(c[g],h)||(c[g]=h,delete e[g],this._changed=!0,b.silent||this.trigger("change:"+g,this,h,b))}return!f&&!b.silent&&this._changed&&this.change(b),this._changing=!1,this},unset:function(a,b){if(a in this.attributes){b||(b={});var c=this.attributes[a],d={};return d[a]=void 0,!b.silent&&this.validate&&!this._performValidation(d,b)?!1:(delete this.attributes[a],delete this._escapedAttributes[a],a==this.idAttribute&&delete this.id,this._changed=!0,b.silent||(this.trigger("change:"+a,this,void 0,b),this.change(b)),this)}return this},clear:function(a){a||(a={});var b,c=this.attributes,d={};for(b in c)d[b]=void 0;if(!a.silent&&this.validate&&!this._performValidation(d,a))return!1;this.attributes={},this._escapedAttributes={},this._changed=!0;if(!a.silent){for(b in c)this.trigger("change:"+b,this,void 0,a);this.change(a)}return this},fetch:function(a){a||(a={});var b=this,d=a.success;return a.success=function(c,e,f){if(!b.set(b.parse(c,f),a))return!1;d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"read",this,a)},save:function(a,b){b||(b={});if(a&&!this.set(a,b))return!1;var d=this,e=b.success;b.success=function(a,c,f){if(!d.set(d.parse(a,f),b))return!1;e&&e(d,a,f)},b.error=v(b.error,d,b);var f=this.isNew()?"create":"update";return(this.sync||c.sync).call(this,f,this,b)},destroy:function(a){a||(a={});if(this.isNew())return this.trigger("destroy",this,this.collection,a);var b=this,d=a.success;return a.success=function(c){b.trigger("destroy",b,b.collection,a),d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"delete",this,a)},url:function(){var a=t(this.collection)||this.urlRoot||u();return this.isNew()?a:a+(a.charAt(a.length-1)=="/"?"":"/")+encodeURIComponent(this.id)},parse:function(a,b){return a},clone:function(){return new this.constructor(this)},isNew:function(){return this.id==null},change:function(a){this.trigger("change",this,a),this._previousAttributes=d.clone(this.attributes),this._changed=!1},hasChanged:function(a){return a?this._previousAttributes[a]!=this.attributes[a]:this._changed},changedAttributes:function(a){a||(a=this.attributes);var b=this._previousAttributes,c=!1;for(var e in a)d.isEqual(b[e],a[e])||(c=c||{},c[e]=a[e]);return c},previous:function(a){return!a||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return d.clone(this._previousAttributes)},_performValidation:function(a,b){var c=this.validate(a);return c?(b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}}),c.Collection=function(a,b){b||(b={}),b.comparator&&(this.comparator=b.comparator),d.bindAll(this,"_onModelEvent","_removeReference"),this._reset(),a&&this.reset(a,{silent:!0}),this.initialize.apply(this,arguments)},d.extend(c.Collection.prototype,c.Events,{model:c.Model,initialize:function(){},toJSON:function(){return this.map(function(a){return a.toJSON()})},add:function(a,b){if(d.isArray(a))for(var c=0,e=a.length;c<e;c++)this._add(a[c],b);else this._add(a,b);return this},remove:function(a,b){if(d.isArray(a))for(var c=0,e=a.length;c<e;c++)this._remove(a[c],b);else this._remove(a,b);return this},get:function(a){return a==null?null:this._byId[a.id!=null?a.id:a]},getByCid:function(a){return a&&this._byCid[a.cid||a]},at:function(a){return this.models[a]},sort:function(a){a||(a={});if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return this.models=this.sortBy(this.comparator),a.silent||this.trigger("reset",this,a),this},pluck:function(a){return d.map(this.models,function(b){return b.get(a)})},reset:function(a,b){return a||(a=[]),b||(b={}),this.each(this._removeReference),this._reset(),this.add(a,{silent:!0}),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a||(a={});var b=this,d=a.success;return a.success=function(c,e,f){b[a.add?"add":"reset"](b.parse(c,f),a),d&&d(b,c)},a.error=v(a.error,b,a),(this.sync||c.sync).call(this,"read",this,a)},create:function(a,b){var c=this;b||(b={}),a=this._prepareModel(a,b);if(!a)return!1;var d=b.success;return b.success=function(a,e,f){c.add(a,b),d&&d(a,e,f)},a.save(null,b),a},parse:function(a,b){return a},chain:function(){return d(this.models).chain()},_reset:function(a){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){if(a instanceof c.Model)a.collection||(a.collection=this);else{var d=a;a=new this.model(d,{collection:this}),a.validate&&!a._performValidation(d,b)&&(a=!1)}return a},_add:function(a,b){b||(b={}),a=this._prepareModel(a,b);if(!a)return!1;var c=this.getByCid(a);if(c)throw new Error(["Can't add the same model to a set twice",c.id]);this._byId[a.id]=a,this._byCid[a.cid]=a;var d=b.at!=null?b.at:this.comparator?this.sortedIndex(a,this.comparator):this.length;return this.models.splice(d,0,a),a.bind("all",this._onModelEvent),this.length++,b.silent||a.trigger("add",a,this,b),a},_remove:function(a,b){return b||(b={}),a=this.getByCid(a)||this.get(a),a?(delete this._byId[a.id],delete this._byCid[a.cid],this.models.splice(this.indexOf(a),1),this.length--,b.silent||a.trigger("remove",a,this,b),this._removeReference(a),a):null},_removeReference:function(a){this==a.collection&&delete a.collection,a.unbind("all",this._onModelEvent)},_onModelEvent:function(a,b,c,d){if(a!="add"&&a!="remove"||c==this)a=="destroy"&&this._remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],this._byId[b.id]=b),this.trigger.apply(this,arguments);else return}});var f=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","rest","last","without","indexOf","lastIndexOf","isEmpty","groupBy"];d.each(f,function(a){c.Collection.prototype[a]=function(){return d[a].apply(d,[this.models].concat(d.toArray(arguments)))}}),c.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)};var g=/:([\w\d]+)/g,h=/\*([\w\d]+)/g,i=/[-[\]{}()+?.,\\^$|#\s]/g;d.extend(c.Router.prototype,c.Events,{initialize:function(){},route:function(a,b,e){c.history||(c.history=new c.History),d.isRegExp(a)||(a=this._routeToRegExp(a)),c.history.route(a,d.bind(function(c){var d=this._extractParameters(a,c);e.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d))},this))},navigate:function(a,b){c.history.navigate(a,b)},_bindRoutes:function(){if(!this.routes)return;var a=[];for(var b in this.routes)a.unshift([b,this.routes[b]]);for(var c=0,d=a.length;c<d;c++)this.route(a[c][0],a[c][1],this[a[c][1]])},_routeToRegExp:function(a){return a=a.replace(i,"\\$&").replace(g,"([^/]*)").replace(h,"(.*?)"),new RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}}),c.History=function(){this.handlers=[],d.bindAll(this,"checkUrl")};var j=/^#*/,k=/msie [\w.]+/,l=!1;d.extend(c.History.prototype,{interval:50,getFragment:function(a,b){if(a==null)if(this._hasPushState||b){a=window.location.pathname;var c=window.location.search;c&&(a+=c),a.indexOf(this.options.root)==0&&(a=a.substr(this.options.root.length))}else a=window.location.hash;return decodeURIComponent(a.replace(j,""))},start:function(a){if(l)throw new Error("Backbone.history has already been started");this.options=d.extend({},{root:"/"},this.options,a),this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var b=this.getFragment(),c=document.documentMode,f=k.exec(navigator.userAgent.toLowerCase())&&(!c||c<=7);f&&(this.iframe=e('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(b)),this._hasPushState?e(window).bind("popstate",this.checkUrl):"onhashchange"in window&&!f?e(window).bind("hashchange",this.checkUrl):setInterval(this.checkUrl,this.interval),this.fragment=b,l=!0;var g=window.location,h=g.pathname==this.options.root;if(this._wantsPushState&&!this._hasPushState&&!h)return this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&h&&g.hash&&(this.fragment=g.hash.replace(j,""),window.history.replaceState({},document.title,g.protocol+"//"+g.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(a){var b=this.getFragment();b==this.fragment&&this.iframe&&(b=this.getFragment(this.iframe.location.hash));if(b==this.fragment||b==decodeURIComponent(this.fragment))return!1;this.iframe&&this.navigate(b),this.loadUrl()||this.loadUrl(window.location.hash)},loadUrl:function(a){var b=this.fragment=this.getFragment(a),c=d.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0});return c},navigate:function(a,b){var c=(a||"").replace(j,"");if(this.fragment==c||this.fragment==decodeURIComponent(c))return;if(this._hasPushState){var d=window.location;c.indexOf(this.options.root)!=0&&(c=this.options.root+c),this.fragment=c,window.history.pushState({},document.title,d.protocol+"//"+d.host+c)}else window.location.hash=this.fragment=c,this.iframe&&c!=this.getFragment(this.iframe.location.hash)&&(this.iframe.document.open().close(),this.iframe.location.hash=c);b&&this.loadUrl(a)}}),c.View=function(a){this.cid=d.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.delegateEvents(),this.initialize.apply(this,arguments)};var m=function(a){return e(a,this.el)},n=/^(\S+)\s*(.*)$/,o=["model","collection","el","id","attributes","className","tagName"];d.extend(c.View.prototype,c.Events,{tagName:"div",$:m,initialize:function(){},render:function(){return this},remove:function(){return e(this.el).remove(),this},make:function(a,b,c){var d=document.createElement(a);return b&&e(d).attr(b),c&&e(d).html(c),d},delegateEvents:function(a){if(!a&&!(a=this.events))return;d.isFunction(a)&&(a=a.call(this)),e(this.el).unbind(".delegateEvents"+this.cid);for(var b in a){var c=this[a[b]];if(!c)throw new Error('Event "'+a[b]+'" does not exist');var f=b.match(n),g=f[1],h=f[2];c=d.bind(c,this),g+=".delegateEvents"+this.cid,h===""?e(this.el).bind(g,c):e(this.el).delegate(h,g,c)}},_configure:function(a){this.options&&(a=d.extend({},this.options,a));for(var b=0,c=o.length;b<c;b++){var e=o[b];a[e]&&(this[e]=a[e])}this.options=a},_ensureElement:function(){if(!this.el){var a=this.attributes||{};this.id&&(a.id=this.id),this.className&&(a["class"]=this.className),this.el=this.make(this.tagName,a)}else d.isString(this.el)&&(this.el=e(this.el).get(0))}});var p=function(a,b){var c=s(this,a,b);return c.extend=this.extend,c};c.Model.extend=c.Collection.extend=c.Router.extend=c.View.extend=p;var q={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};c.sync=function(a,b,f){var g=q[a],h=d.extend({type:g,dataType:"json"},f);return h.url||(h.url=t(b)||u()),!h.data&&b&&(a=="create"||a=="update")&&(h.contentType="application/json",h.data=JSON.stringify(b.toJSON())),c.emulateJSON&&(h.contentType="application/x-www-form-urlencoded",h.data=h.data?{model:h.data}:{}),c.emulateHTTP&&(g==="PUT"||g==="DELETE")&&(c.emulateJSON&&(h.data._method=g),h.type="POST",h.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",g)}),h.type!=="GET"&&!c.emulateJSON&&(h.processData=!1),e.ajax(h)};var r=function(){},s=function(a,b,c){var e;return b&&b.hasOwnProperty("constructor")?e=b.constructor:e=function(){return a.apply(this,arguments)},d.extend(e,a),r.prototype=a.prototype,e.prototype=new r,b&&d.extend(e.prototype,b),c&&d.extend(e,c),e.prototype.constructor=e,e.__super__=a.prototype,e},t=function(a){return!a||!a.url?null:d.isFunction(a.url)?a.url():a.url},u=function(){throw new Error('A "url" property or function must be specified')},v=function(a,b,c){return function(d){a?a(b,d,c):b.trigger("error",b,d,c)}},w=function(a){return a.replace(/&(?!\w+;|#\d+;|#x[\da-f]+;)/gi,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}}.call(this);var Markdown;typeof exports=="object"&&typeof require=="function"?Markdown=exports:Markdown={},function(){function a(a){return a}function b(a){return!1}function c(){}function d(){}c.prototype={chain:function(b,c){var d=this[b];if(!d)throw new Error("unknown hook "+b);d===a?this[b]=c:this[b]=function(a){return c(d(a))}},set:function(a,b){if(!this[a])throw new Error("unknown hook "+a);this[a]=b},addNoop:function(b){this[b]=a},addFalse:function(a){this[a]=b}},Markdown.HookCollection=c,d.prototype={set:function(a,b){this["s_"+a]=b},get:function(a){return this["s_"+a]}},Markdown.Converter=function(){function h(a){return a=a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(a,c,d,f,g,h){return c=c.toLowerCase(),b.set(c,C(d)),g?f:(h&&e.set(c,h.replace(/"/g,""")),"")}),a}function i(a){var b="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del",c="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math";return a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm,j),a=a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm,j),a=a.replace(/\n[ ]{0,3}((<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,j),a=a.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g,j),a=a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,j),a}function j(a,b){var c=b;return c=c.replace(/^\n+/,""),c=c.replace(/\n+$/g,""),c="\n\n~K"+(f.push(c)-1)+"K\n\n",c}function k(a,b){a=r(a);var c="<hr />\n";return a=a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm,c),a=a.replace(/^[ ]{0,2}([ ]?-[ ]?){3,}[ \t]*$/gm,c),a=a.replace(/^[ ]{0,2}([ ]?_[ ]?){3,}[ \t]*$/gm,c),a=s(a),a=v(a),a=A(a),a=i(a),a=B(a,b),a}function l(a){return a=x(a),a=m(a),a=D(a),a=p(a),a=n(a),a=E(a),a=a.replace(/~P/g,"://"),a=C(a),a=z(a),a=a.replace(/ +\n/g," <br>\n"),a}function m(a){var b=/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>)/gi;return a=a.replace(b,function(a){var b=a.replace(/(.)<\/?code>(?=.)/g,"$1`");return b=K(b,a.charAt(1)=="!"?"\\`*_/":"\\`*_"),b}),a}function n(a){return a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,o),a=a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?((?:\([^)]*\)|[^()])*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,o),a=a.replace(/(\[([^\[\]]+)\])()()()()()/g,o),a}function o(a,c,d,f,g,h,i,j){j==undefined&&(j="");var k=c,l=d.replace(/:\/\//g,"~P"),m=f.toLowerCase(),n=g,o=j;if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b.get(m)!=undefined)n=b.get(m),e.get(m)!=undefined&&(o=e.get(m));else if(k.search(/\(\s*\)$/m)>-1)n="";else return k}n=J(n),n=K(n,"*_");var p='<a href="'+n+'"';return o!=""&&(o=o.replace(/"/g,"""),o=K(o,"*_"),p+=' title="'+o+'"'),p+=">"+l+"</a>",p}function p(a){return a=a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g,q),a=a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,q),a}function q(a,c,d,f,g,h,i,j){var k=c,l=d,m=f.toLowerCase(),n=g,o=j;o||(o="");if(n==""){m==""&&(m=l.toLowerCase().replace(/ ?\n/g," ")),n="#"+m;if(b.get(m)!=undefined)n=b.get(m),e.get(m)!=undefined&&(o=e.get(m));else return k}l=l.replace(/"/g,"""),n=K(n,"*_");var p='<img src="'+n+'" alt="'+l+'"';return o=o.replace(/"/g,"""),o=K(o,"*_"),p+=' title="'+o+'"',p+=" />",p}function r(a){return a=a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm,function(a,b){return"<h1>"+l(b)+"</h1>\n\n"}),a=a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm,function(a,b){return"<h2>"+l(b)+"</h2>\n\n"}),a=a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm,function(a,b,c){var d=b.length;return"<h"+d+">"+l(c)+"</h"+d+">\n\n"}),a}function s(a){a+="~0";var b=/^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;return g?a=a.replace(b,function(a,b,c){var d=b,e=c.search(/[*+-]/g)>-1?"ul":"ol",f=u(d,e);return f=f.replace(/\s+$/,""),f="<"+e+">"+f+"</"+e+">\n",f}):(b=/(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g,a=a.replace(b,function(a,b,c,d){var e=b,f=c,g=d.search(/[*+-]/g)>-1?"ul":"ol",h=u(f,g);return h=e+"<"+g+">\n"+h+"</"+g+">\n",h})),a=a.replace(/~0/,""),a}function u(a,b){g++,a=a.replace(/\n{2,}$/,"\n"),a+="~0";var c=t[b],d=new RegExp("(^[ \\t]*)("+c+")[ \\t]+([^\\r]+?(\\n+))(?=(~0|\\1("+c+")[ \\t]+))","gm"),e=!1;return a=a.replace(d,function(a,b,c,d){var f=d,g=b,h=/\n\n$/.test(f),i=h||f.search(/\n{2,}/)>-1;return i||e?f=k(G(f),!0):(f=s(G(f)),f=f.replace(/\n$/,""),f=l(f)),e=h,"<li>"+f+"</li>\n"}),a=a.replace(/~0/g,""),g--,a}function v(a){return a+="~0",a=a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g,function(a,b,c){var d=b,e=c;return d=y(G(d)),d=H(d),d=d.replace(/^\n+/g,""),d=d.replace(/\n+$/g,""),d="<pre><code>"+d+"\n</code></pre>","\n\n"+d+"\n\n"+e}),a=a.replace(/~0/,""),a}function w(a){return a=a.replace(/(^\n+|\n+$)/g,""),"\n\n~K"+(f.push(a)-1)+"K\n\n"}function x(a){return a=a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(a,b,c,d,e){var f=d;return f=f.replace(/^([ \t]*)/g,""),f=f.replace(/[ \t]*$/g,""),f=y(f),b+"<code>"+f+"</code>"}),a}function y(a){return a=a.replace(/&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=K(a,"*_{}[]\\",!1),a}function z(a){return a=a.replace(/([\W_]|^)(\*\*|__)(?=\S)([^\r]*?\S[\*_]*)\2([\W_]|$)/g,"$1<strong>$3</strong>$4"),a=a.replace(/([\W_]|^)(\*|_)(?=\S)([^\r\*_]*?\S)\2([\W_]|$)/g,"$1<em>$3</em>$4"),a}function A(a){return a=a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm,function(a,b){var c=b;return c=c.replace(/^[ \t]*>[ \t]?/gm,"~0"),c=c.replace(/~0/g,""),c=c.replace(/^[ \t]+$/gm,""),c=k(c),c=c.replace(/(^|\n)/g,"$1 "),c=c.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm,function(a,b){var c=b;return c=c.replace(/^ /mg,"~0"),c=c.replace(/~0/g,""),c}),w("<blockquote>\n"+c+"\n</blockquote>")}),a}function B(a,b){a=a.replace(/^\n+/g,""),a=a.replace(/\n+$/g,"");var c=a.split(/\n{2,}/g),d=[],e=/~K(\d+)K/,g=c.length;for(var h=0;h<g;h++){var i=c[h];e.test(i)?d.push(i):/\S/.test(i)&&(i=l(i),i=i.replace(/^([ \t]*)/g,"<p>"),i+="</p>",d.push(i))}if(!b){g=d.length;for(var h=0;h<g;h++){var j=!0;while(j)j=!1,d[h]=d[h].replace(/~K(\d+)K/g,function(a,b){return j=!0,f[b]})}}return d.join("\n\n")}function C(a){return a=a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g,"&"),a=a.replace(/<(?![a-z\/?\$!])/gi,"<"),a}function D(a){return a=a.replace(/\\(\\)/g,L),a=a.replace(/\\([`*_{}\[\]()>#+-.!])/g,L),a}function E(b){b=b.replace(/(^|\s)(https?|ftp)(:\/\/[-A-Z0-9+&@#\/%?=~_|\[\]\(\)!:,\.;]*[-A-Z0-9+&@#\/%=~_|\[\]])($|\W)/gi,"$1<$2$3>$4");var c=function(b,c){return'<a href="'+c+'">'+a.plainLinkText(c)+"</a>"};return b=b.replace(/<((https?|ftp):[^'">\s]+)>/gi,c),b}function F(a){return a=a.replace(/~E(\d+)E/g,function(a,b){var c=parseInt(b);return String.fromCharCode(c)}),a}function G(a){return a=a.replace(/^(\t|[ ]{1,4})/gm,"~0"),a=a.replace(/~0/g,""),a}function H(a){if(!/\t/.test(a))return a;var b=[" "," "," "," "],c=0,d;return a.replace(/[\n\t]/g,function(a,e){return a==="\n"?(c=e+1,a):(d=(e-c)%4,c=e+1,b[d])})}function J(a){if(!a)return"";var b=a.length;return a.replace(I,function(c,d){if(c=="~D")return"%24";if(c==":")if(d==b-1||/[0-9\/]/.test(a.charAt(d+1)))return":";return"%"+c.charCodeAt(0).toString(16)})}function K(a,b,c){var d="(["+b.replace(/([\[\]\\])/g,"\\$1")+"])";c&&(d="\\\\"+d);var e=new RegExp(d,"g");return a=a.replace(e,L),a}function L(a,b){var c=b.charCodeAt(0);return"~E"+c+"E"}var a=this.hooks=new c;a.addNoop("plainLinkText"),a.addNoop("preConversion"),a.addNoop("postConversion");var b,e,f,g;this.makeHtml=function(c){if(b)throw new Error("Recursive call to converter.makeHtml");return b=new d,e=new d,f=[],g=0,c=a.preConversion(c),c=c.replace(/~/g,"~T"),c=c.replace(/\$/g,"~D"),c=c.replace(/\r\n/g,"\n"),c=c.replace(/\r/g,"\n"),c="\n\n"+c+"\n\n",c=H(c),c=c.replace(/^[ \t]+$/mg,""),c=i(c),c=h(c),c=k(c),c=F(c),c=c.replace(/~D/g,"$$"),c=c.replace(/~T/g,"~"),c=a.postConversion(c),f=e=b=null,c};var t={ol:"\\d+[.]",ul:"[*+-]"},I=/(?:["'*()[\]:]|~D)/g}}(),function(){if(!this.require){var a={},b={},c=function(f,g){var h=b[f],i=d(g,f),j;if(h)return h;if(!(j=a[i]||a[i=d(i,"./index")]))throw"module '"+f+"' not found";h={id:f,exports:{}};try{return b[f]=h.exports,j(h.exports,function(a){return c(a,e(i))},h),b[f]=h.exports}catch(k){throw delete b[f],k}},d=function(a,b){var c=[],d,e;/^\.\.?(\/|$)/.test(b)?d=[a,b].join("/").split("/"):d=b.split("/");for(var f=0,g=d.length;f<g;f++)e=d[f],e==".."?c.pop():e!="."&&e!=""&&c.push(e);return c.join("/")},e=function(a){return a.split("/").slice(0,-1).join("/")};this.require=function(a){return c(a,"")},this.require.define=function(b){for(var c in b)a[c]=b[c]}}return this.require.define}.call(this)({main:function(a,b,c){(function(){var a,c,d,e;window.app={},app.routers={},app.models={},app.collections={},app.views={},a=b("models/editing").Editing,e=b("models/stats").Stats,d=b("routers/main_router").MainRouter,c=b("views/home_view").HomeView,jQuery(document).ready(function(){return app.initialize=function(){app.models.editing=new a,app.models.stats=new e,app.routers.main=new d,app.views.home=new c;if(Backbone.history.getFragment()==="")return app.routers.main.navigate("home",!0)},app.initialize(),Backbone.history.start()}),window.converter=new Markdown.Converter,window.renderMarkdown=function(){return jQuery("#markdown").html(window.converter.makeHtml("# "+jQuery("#title").val()+"\n\n"+jQuery("#body").val())),app.models.editing.set({title:jQuery("#title").val()},{silent:!0}),app.models.editing.set({body:jQuery("#body").val()},{silent:!0})}}).call(this)},"models/editing":function(a,b,c){(function(){var b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};a.Editing=function(){function a(){a.__super__.constructor.apply(this,arguments)}return c(a,Backbone.Model),a.prototype.defaults={title:"title",body:"body",link:"http://google.com"},a}()}).call(this)},"models/stats":function(a,b,c){(function(){var b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};a.Stats=function(){function a(){a.__super__.constructor.apply(this,arguments)}return c(a,Backbone.Model),a.prototype.defaults={remaining:"n/a",completed:[]},a}()}).call(this)},"routers/main_router":function(a,b,c){(function(){var b=Object.prototype.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};a.MainRouter=function(){function a(){a.__super__.constructor.apply(this,arguments)}return c(a,Backbone.Router),a.prototype.routes={home:"home"},a.prototype.home=function(){return jQuery("body").html(app.views.home.render().el)},a}()}).call(this)},"templates/home":function(a,b,c){c.exports=function(a){a||(a={});var b=[],c=function(a){var c=b,d;return b=[],a.call(this),d=b.join(""),b=c,e(d)},d=function(a){return a&&a.ecoSafe?a:typeof a!="undefined"&&a!=null?g(a):""},e,f=a.safe,g=a.escape;return e=a.safe=function(a){if(a&&a.ecoSafe)return a;if(typeof a=="undefined"||a==null)a="";var b=new String(a);return b.ecoSafe=!0,b},g||(g=a.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){var a,c,e;b.push("<div id='stats'>\n <strong>Remaining: </strong>"),b.push(this.stats.get("remaining")),b.push("<br />\n <strong>You've completed ("),b.push(this.stats.get("completed_count")),b.push(")</strong>\n <ul>\n "),e=this.stats.get("completed");for(a in e)c=e[a],b.push("\n <li>"),b.push(c.link),b.push("</li>\n ");b.push('\n </ul>\n</div>\n\n<div id="edit">\n <div id="tools">\n <button id="new">Load new</button>\n <button id="clean">remove line endings</button>\n <button id="render">Render Markdown</button>\n <button id="save">save</button>\n </div>\n <br />Original link: <span id="original-link">'),b.push(this.editing.get("link")),b.push('</span>\n <input type="text" id="title" value="'),b.push(d(this.editing.get("title"))),b.push('" />\n\n<textarea id="body">\n'),b.push(this.editing.get("body")),b.push('\n</textarea>\n</div>\n\n<div id="markdown"></div>\n')}).call(this)}.call(a),a.safe=f,a.escape=g,b.join("")}},"views/home_view":function(a,b,c){(function(){var c,d,e=function(a,b){return function(){return a.apply(b,arguments)}},f=Object.prototype.hasOwnProperty,g=function(a,b){function d(){this.constructor=a}for(var c in b)f.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};d=b("templates/home"),c=b("models/editing").Editing,a.HomeView=function(){function a(){this.save=e(this.save,this),this.loadNew=e(this.loadNew,this),this.render=e(this.render,this),a.__super__.constructor.apply(this,arguments)}return g(a,Backbone.View),a.prototype.id="home-view",a.prototype.initialize=function(){return app.models.editing.bind("change",this.render)},a.prototype.render=function(){return jQuery(this.el).html(d({editing:app.models.editing,stats:app.models.stats})),this},a.prototype.events={"click #new":"loadNew","click #clean":"removeEndLines","click #render":"renderText","click #save":"save"},a.prototype.loadNew=function(){return jQuery.getJSON("http://fhd-staging.eduglu.com/drupal-edit/next",e(function(a,b,c){var d;return d=/^#{1}\s/gm,a.markdown=a.markdown.replace(d,"## "),app.models.stats.set({remaining:a.remaining},{silent:!0}),app.models.stats.set({completed:a.completed}),app.models.stats.set({completed_count:a.completed_count}),app.models.editing.set({title:a.title},{silent:!0}),app.models.editing.set({nid:a.nid},{silent:!0}),app.models.editing.set({body:a.markdown},{silent:!0}),app.models.editing.set({link:a.link}),renderMarkdown(),console.log(a)},this))},a.prototype.removeEndLines=function(){var a,b,c;return c=jQuery("#body")[0],a=/(\S)\n/gm,window.selectedText=jQuery(c).val().substring(c.selectionStart,c.selectionEnd),b=window.selectedText.replace(/^\n/gm,"\n\n"),b=b.replace(a,"$1 "),jQuery(c).val(jQuery(c).val().substring(0,c.selectionStart)+b+jQuery(c).val().substring(c.selectionEnd)),renderMarkdown()},a.prototype.renderText=function(){return renderMarkdown()},a.prototype.save=function(){var a;return a={nid:app.models.editing.get("nid"),title:app.models.editing.get("title"),body:app.models.editing.get("body")},jQuery.post("http://fhd-staging.eduglu.com/drupal-edit/save",a),jQuery("#tools").append('<span class="success">Node saved</span>'),setTimeout(function(){return jQuery("#tools .success").fadeOut()},5e3)},a}()}).call(this)},"views/stats_view":function(a,b,c){(function(){var c,d=function(a,b){return function(){return a.apply(b,arguments)}},e=Object.prototype.hasOwnProperty,f=function(a,b){function d(){this.constructor=a}for(var c in b)e.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};c=b("templates/stats"),a.StatsView=function(){function a(){this.render=d(this.render,this),a.__super__.constructor.apply(this,arguments)}return f(a,Backbone.View),a.prototype.id="stats",a.prototype.initialize=function(){return app.models.stats.bind("change",this.render)},a.prototype.render=function(){return jQuery(this.el).html(c(app.models.stats)),console.log("rendering stats!"),this},a}()}).call(this)}})