diff --git a/client/src/ui/widgets/BackgroundPicker.coffee b/client/src/ui/widgets/BackgroundPicker.coffee index bd4a02eae..544bfcbd5 100644 --- a/client/src/ui/widgets/BackgroundPicker.coffee +++ b/client/src/ui/widgets/BackgroundPicker.coffee @@ -49,6 +49,10 @@ define(["vendor/backbone", @$gradientPicker = @$el.find(".gradientPicker") @$gradientPreview = @$el.find(".gradientPreview") + # TODO: this is a temp hack until we get the CSS plugin + # building correctly. + @$gradientPicker.css("width", 250) + bgOpts = @options.bgOpts or {} bgOpts.change = (points, styles) => @_updateGradientPreview(styles) diff --git a/client/web/scripts/main-built.js b/client/web/scripts/main-built.js index e3235a02e..e23d878a7 100644 --- a/client/web/scripts/main-built.js +++ b/client/web/scripts/main-built.js @@ -1 +1 @@ -define("vendor/backbone",[],function(){var a={};return a._=window._,a.jQuery=window.jQuery,function(){var a=this,b=a.Backbone,c=Array.prototype.slice,d=Array.prototype.splice,e;typeof exports!="undefined"?e=exports:e=a.Backbone={},e.VERSION="0.9.2";var f=a._,g=a.jQuery||a.Zepto||a.ender;e.setDomLibrary=function(a){g=a},e.noConflict=function(){return a.Backbone=b,this},e.emulateHTTP=!1,e.emulateJSON=!1;var h=/\s+/,i=e.Events={on:function(a,b,c){var d,e,f,g,i;if(!b)return this;a=a.split(h),d=this._callbacks||(this._callbacks={});while(e=a.shift())i=d[e],f=i?i.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:i?i.next:f};return this},off:function(a,b,c){var d,e,g,i,j,k;if(!(e=this._callbacks))return;if(!(a||b||c))return delete this._callbacks,this;a=a?a.split(h):f.keys(e);while(d=a.shift()){g=e[d],delete e[d];if(!g||!b&&!c)continue;i=g.tail;while((g=g.next)!==i)j=g.callback,k=g.context,(b&&j!==b||c&&k!==c)&&this.on(d,j,k)}return this},trigger:function(a){var b,d,e,f,g,i,j;if(!(e=this._callbacks))return this;i=e.all,a=a.split(h),j=c.call(arguments,1);while(b=a.shift()){if(d=e[b]){f=d.tail;while((d=d.next)!==f)d.callback.apply(d.context||this,j)}if(d=i){f=d.tail,g=[b].concat(j);while((d=d.next)!==f)d.callback.apply(d.context||this,g)}}return this}};i.bind=i.on,i.unbind=i.off;var j=e.Model=function(a,b){var c;a||(a={}),b&&b.parse&&(a=this.parse(a));if(c=A(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection),this.attributes={},this._escapedAttributes={},this.cid=f.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(a,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=f.clone(this.attributes),this.initialize.apply(this,arguments)};f.extend(j.prototype,i,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(a){return f.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.get(a);return this._escapedAttributes[a]=f.escape(c==null?"":""+c)},has:function(a){return this.get(a)!=null},set:function(a,b,c){var d,e,g;f.isObject(a)||a==null?(d=a,c=b):(d={},d[a]=b),c||(c={});if(!d)return this;d instanceof j&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var h=c.changes={},i=this.attributes,k=this._escapedAttributes,l=this._previousAttributes||{};for(e in d){g=d[e];if(!f.isEqual(i[e],g)||c.unset&&f.has(i,e))delete k[e],(c.silent?this._silent:h)[e]=!0;c.unset?delete i[e]:i[e]=g,!f.isEqual(l[e],g)||f.has(i,e)!=f.has(l,e)?(this.changed[e]=g,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}return c.silent||this.change(c),this},unset:function(a,b){return(b||(b={})).unset=!0,this.set(a,null,b)},clear:function(a){return(a||(a={})).unset=!0,this.set(f.clone(this.attributes),a)},fetch:function(a){a=a?f.clone(a):{};var b=this,c=a.success;return a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b,c){var d,g;f.isObject(a)||a==null?(d=a,c=b):(d={},d[a]=b),c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;g=f.clone(this.attributes)}var h=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?h:c))return!1;var i=this,j=c.success;c.success=function(a,b,e){var g=i.parse(a,e);c.wait&&(delete c.wait,g=f.extend(d||{},g));if(!i.set(g,c))return!1;j?j(i,a):i.trigger("sync",i,a,c)},c.error=e.wrapError(c.error,i,c);var k=this.isNew()?"create":"update",l=(this.sync||e.sync).call(this,k,this,c);return c.wait&&this.set(g,h),l},destroy:function(a){a=a?f.clone(a):{};var b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d(),c?c(b,e):b.trigger("sync",b,e,a)},a.error=e.wrapError(a.error,b,a);var g=(this.sync||e.sync).call(this,"delete",this,a);return a.wait||d(),g},url:function(){var a=A(this,"urlRoot")||A(this.collection,"url")||B();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.attributes)},isNew:function(){return this.id==null},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(var c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;while(!f.isEmpty(this._pending)){this._pending={},this.trigger("change",this,a);for(var c in this.changed){if(this._pending[c]||this._silent[c])continue;delete this.changed[c]}this._previousAttributes=f.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(a){return arguments.length?f.has(this.changed,a):!f.isEmpty(this.changed)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes;for(var e in a){if(f.isEqual(d[e],b=a[e]))continue;(c||(c={}))[e]=b}return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;a=f.extend({},this.attributes,a);var c=this.validate(a,b);return c?(b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}});var k=e.Collection=function(a,b){b||(b={}),b.model&&(this.model=b.model),b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(k.prototype,i,{model:j,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,e,g,h,i,j,k={},l={},m=[];b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,g=a.length;c').hide().appendTo("body")[0].contentWindow,this.navigate(b)),this._hasPushState?g(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!d?g(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=b;var e=window.location,h=e.pathname==this.options.root;if(this._wantsHashChange&&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&&e.hash&&(this.fragment=this.getHash().replace(r,""),window.history.replaceState({},document.title,e.protocol+"//"+e.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){g(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),q.started=!1},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.getHash(this.iframe)));if(b==this.fragment)return!1;this.iframe&&this.navigate(b),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(a){var b=this.fragment=this.getFragment(a),c=f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0});return c},navigate:function(a,b){if(!q.started)return!1;if(!b||b===!0)b={trigger:b};var c=(a||"").replace(r,"");if(this.fragment==c)return;this._hasPushState?(c.indexOf(this.options.root)!=0&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.getHash(this.iframe))&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a)},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}});var t=e.View=function(a){this.cid=f.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},u=/^(\S+)\s*(.*)$/,v=["model","collection","el","id","attributes","className","tagName"];f.extend(t.prototype,i,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(a,b,c){var d=document.createElement(a);return b&&g(d).attr(b),c&&g(d).html(c),d},setElement:function(a,b){return this.$el&&this.undelegateEvents(),this.$el=a instanceof g?a:g(a),this.el=this.$el[0],b!==!1&&this.delegateEvents(),this},delegateEvents:function(a){if(!a&&!(a=A(this,"events")))return;this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw new Error('Method "'+a[b]+'" does not exist');var d=b.match(u),e=d[1],g=d[2];c=f.bind(c,this),e+=".delegateEvents"+this.cid,g===""?this.$el.bind(e,c):this.$el.delegate(g,e,c)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=v.length;b]+>|<\/[^>]+>/,b=function(a){function b(a){this.g2d=a}return __extends(b,a),b.name="TextBoxDrawer",b.prototype.paint=function(a){var b,c,d,e,f,g=this;return this.g2d.fillStyle="#"+a.get("color"),d=a.get("size")*this.scale,this.g2d.font=d+"px "+a.get("family"),e=this._extractLines(a.get("text")),f=this._findWidestWidth(e)*this.scale,b={x:a.get("x")*this.scale,y:a.get("y")*this.scale,width:f+f,height:a.get("size")*this.scale},this.applyTransforms(a,b),c=0,e.forEach(function(a){if(a!=="")return g.g2d.fillText(a,b.x,b.y+b.height+c*d),++c})},b.prototype._extractLines=function(a){return a.split(c)},b.prototype._findWidestWidth=function(a){var b,c=this;return b=0,a.forEach(function(a){var d;d=c.g2d.measureText(a).width;if(d>b)return b=d}),b},b}(a)});var __hasProp={}.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};define("ui/editor/raster/ImageModelDrawer",["./AbstractDrawer"],function(a){var b;return b=function(a){function b(a){this.g2d=a}return __extends(b,a),b.name="ImageModelDrawer",b.prototype.paint=function(a){return this._imageLoaded(a.cachedImage,a)},b.prototype._imageLoaded=function(a,b){var c;return c={x:b.get("x")*this.scale,y:b.get("y")*this.scale,width:a.naturalWidth*this.scale,height:a.naturalHeight*this.scale},this.applyTransforms(b,c),this.g2d.drawImage(a,c.x,c.y,c.width,c.height)},b}(a)}),define("ui/editor/raster/SlideDrawer",["common/Throttler","./TextBoxDrawer","./ImageModelDrawer"],function(a,b,c){var d;return d=function(){function d(d,e){var f,g,h;this.model=d,this.g2d=e,this.model.on("contentsChanged",this.repaint,this),this.size={width:this.g2d.canvas.width,height:this.g2d.canvas.height},this.throttler=new a(600,this),this.scale=this.size.width/slideConfig.size.width,this.drawers={TextBox:new b(this.g2d),ImageModel:new c(this.g2d)},h=this.drawers;for(f in h)g=h[f],g.scale=this.scale}return d.name="SlideDrawer",d.prototype.resized=function(a){var b,c,d;this.size=a,this.scale=this.size.width/slideConfig.size.width,d=this.drawers;for(b in d)c=d[b],c.scale=this.scale;return this.repaint()},d.prototype.repaint=function(){return this.throttler.submit(this.paint,{rejectionPolicy:"runLast"})},d.prototype.paint=function(){var a,b=this;return this.g2d.clearRect(0,0,this.size.width,this.size.height),a=this.model.get("components"),a.forEach(function(a){var c;return c=a.get("type"),b.g2d.save(),b.drawers[c].paint(a),b.g2d.restore()})},d.prototype.dispose=function(){return this.model.off(null,null,this)},d}()}),define("model/system/Clipboard",["vendor/backbone"],function(a){return a.Model.extend()}),define("ui/editor/SlideCopyPaste",[],function(){var a;return a={cut:function(){var a;a=this.model.get("activeSlide");if(a!=null)return this._clipboard.set("item",a),this.model.removeSlide(a),a.set("selected",!1),!1},copy:function(){var a;a=this.model.get("activeSlide");if(a!=null)return this._clipboard.set("item",a.clone()),!1},paste:function(){var a,b;a=this._clipboard.get("item");if(a!=null)return b=a.clone(),b.set("x",null),b.set("y",null),this.model.addSlide(b)}}}),define("ui/widgets/DeltaDragControl",[],function(){var a,b;return b=["mousedown","mousemove","mouseup"],a=function(){function a(a,b){this.$el=a,this.stopProp=b,this.dragging=!1,this._mousemove=this.mousemove.bind(this),this._mouseup=this.mouseup.bind(this),this._mouseout=this._mouseup,$(document).bind("mousemove",this._mousemove),$(document).bind("mouseup",this._mouseup),this.$el.bind("mousedown",this.mousedown.bind(this)),this.$el.bind("mouseup",this._mouseup)}return a.name="DragControl",a.prototype.dispose=function(){return $(document).unbind("mousemove",this._mousemove),$(document).unbind("mouseup",this._mouseup)},a.prototype.mousedown=function(a){this.dragging=!0,this._startPos={x:a.pageX,y:a.pageY},this.$el.trigger("deltadragStart",{x:a.pageX,y:a.pageY});if(this.stopProp)return a.stopPropagation()},a.prototype.mousemove=function(a){var b,c;if(this.dragging){b=a.pageX-this._startPos.x,c=a.pageY-this._startPos.y,this.$el.trigger("deltadrag",[{dx:b,dy:c,x:a.pageX,y:a.pageY}]);if(this.stopProp)return a.stopPropagation()}},a.prototype.mouseup=function(a){return this.dragging=!1,!0},a}()}),define("ui/editor/components/TableView",function(){}),define("common/EventEmitter",[],function(){function a(){if(!(this instanceof a))return new a;this._events=null,typeof process!="undefined"&&typeof process.nextTick!="undefined"?this._deferer=function(a,b,c){process.nextTick(function(){a(b,c)})}:this._deferer=function(a,b,c){setTimeout(function(){a(b,c)},0)}}return a.prototype={_listeners:function(b){var c=this._events||(this._events={});return c[b]||(c[b]=[])},_emit:function(a,b){a instanceof Array&&(a=JSON.stringify(a));if(!this._events)return;var c=this._events[a];if(!c)return;var d=c.length;while(d--){var e=c[d];e&&e.cb.apply(e.context,b)}},_splice:function(a,b,c){return a=Array.prototype.slice.call(a),a.splice(b,c)},_indexOfSub:function(a,b,c){for(var d=0;d1?this._splice(arguments,1,arguments.length):[];this._emit(a,b)},trigger:function(){this.emit.apply(this,arguments)},emitDeferred:function(a){var b=arguments.length>1?this._splice(arguments,1,arguments.length):[];this._deferer(emit,a,b)},on:function(a,b,c){if(!b)throw"Undefined callback provided";a instanceof Array&&(a=JSON.stringify(a));var d=this._listeners(a),e=this._indexOfSub(d,b,c);e<0&&(d.push({cb:b,context:c}),e=d.length-1);var f=this;return{dispose:function(){f.removeListener(a,b,c)}}},once:function(a,b,c){var d={sub:null};return d.sub=this.on(a,function(){d.sub.dispose(),b.apply(c,arguments)}),d.sub},removeListener:function(a,b,c){var d=this._listeners(a),e=this._indexOfSub(d,b,c);0<=e&&d.splice(e,1),d.length==0&&delete this._events[a]},getNumListeners:function(a){var b=0;return this._events[a]&&(b=this._events[a].length),b},off:function(a,b,c){this.removeListener(a,b,c)},removeAllListeners:function(){this._events=null}},a}),define("ui/editor/button_bar/AbstractButtonBarView",["vendor/backbone"],function(a){return a.View.extend({initialize:function(a){return this.buttonBarOptions=a},optionChosen:function(a){var b;return b=$(a.currentTarget).attr("data-option"),this.buttonBarOptions[b].call(this,a)}})}),define("model/editor/button_bar/ButtonBarModel",["vendor/backbone"],function(a){var b,c,d,e,f,g,h;c=["size","family","color","style","weight","decoration"],f=function(a){return c.indexOf(a)>2},b={};for(g=0,h=c.length;g0)for(var i=0,j=a.length;i0)for(var f=0,g=a.length;f2&&A.push("'"+this.terminals_[x]+"'");var B="";this.lexer.showPosition?B="Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+this.terminals_[q]+"'":B="Parse error on line "+(i+1)+": Unexpected "+(q==1?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:n,expected:A})}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:y=this.productions_[t[1]][1],w.$=e[e.length-y],w._$={first_line:f[f.length-(y||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(y||1)].first_column,last_column:f[f.length-1].last_column},v=this.performAction.call(w,h,j,i,this.yy,t[1],e,f);if(typeof v!="undefined")return v;y&&(d=d.slice(0,-1*y*2),e=e.slice(0,-1*y),f=f.slice(0,-1*y)),d.push(this.productions_[t[1]][0]),e.push(w.$),f.push(w._$),z=g[d[d.length-2]][d[d.length-1]],d.push(z);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseError:function(b,c){if(!this.yy.parseError)throw new Error(b);this.yy.parseError(b,c)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.match+=a,this.matched+=a;var b=a.match(/\n/);return b&&this.yylineno++,this._input=this._input.slice(1),a},unput:function(a){return this._input=a+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=(new Array(a.length+1)).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");var e=this._currentRules();for(var f=0;f/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/],a.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,26],inclusive:!0}},a}();return a.lexer=b,a}();return a.Parser=d,a.parse=function(b){return a.Parser.yy=a.AST,a.Parser.parse(b)},a.print=function(b){return(new a.PrintVisitor).accept(b)},a.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){}},a.log=function(b,c){a.logger.log(b,c)},function(){a.AST={},a.AST.ProgramNode=function(b,c){this.type="program",this.statements=b,c&&(this.inverse=new a.AST.ProgramNode(c))},a.AST.MustacheNode=function(a,b,c){this.type="mustache",this.id=a[0],this.params=a.slice(1),this.hash=b,this.escaped=!c},a.AST.PartialNode=function(a,b){this.type="partial",this.id=a,this.context=b};var b=function(b,c){if(b.original!==c.original)throw new a.Exception(b.original+" doesn't match "+c.original)};a.AST.BlockNode=function(a,c,d){b(a.id,d),this.type="block",this.mustache=a,this.program=c},a.AST.InverseNode=function(a,c,d){b(a.id,d),this.type="inverse",this.mustache=a,this.program=c},a.AST.ContentNode=function(a){this.type="content",this.string=a},a.AST.HashNode=function(a){this.type="hash",this.pairs=a},a.AST.IdNode=function(a){this.type="ID",this.original=a.join(".");var b=[],c=0;for(var d=0,e=a.length;d":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[<>"'`]/g,d=/[&<>"'`]/,e=function(a){return b[a]||"&"};a.Utils={escapeExpression:function(b){return b instanceof a.SafeString?b.toString():b==null||b===!1?"":d.test(b)?b.replace(c,e):b},isEmpty:function(a){return typeof a=="undefined"?!0:a===null?!0:a===!1?!0:a instanceof Array?!0:!1}}}(),a.Compiler=function(){},a.JavaScriptCompiler=function(){},function(b,c){b.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16},b.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1},b.DISASSEMBLE_MAP={};for(var d in b.OPCODE_MAP){var e=b.OPCODE_MAP[d];b.DISASSEMBLE_MAP[e]=d}b.multiParamSize=function(a){return b.MULTI_PARAM_OPCODES[b.DISASSEMBLE_MAP[a]]},b.prototype={compiler:b,disassemble:function(){var a=this.opcodes,c,d,e=[],f,g,h;for(var i=0,j=a.length;ithis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var f="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),g=c.RESERVED_WORDS={};for(var h=0,i=f.length;h ',c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='',f}),PictureGrabber:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),RawTextImporter:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),SaveAsDialog:a.template(function(a,b,c,d,e){function p(a,b){var c="",d;return c+='
  • ',d=a,typeof d===l?d=d.call(a,{hash:{}}):d===n&&(d=m.call(a,".",{hash:{}})),c+=o(d)+'
  • ',c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='',f})}}),define("ui/widgets/PictureGrabber",["vendor/backbone","./Templates","common/Throttler"],function(a,b,c){return a.View.extend({className:"pictureGrabber modal",events:{"click .ok":"okClicked","keyup input[name='imageUrl']":"urlChanged","paste input[name='imageUrl']":"urlChanged"},initialize:function(){return this.throttler=new c(200,this)},show:function(a){return this.cb=a,this.$el.modal("show")},okClicked:function(){return this.cb(this.src),this.$el.modal("hide")},urlChanged:function(){return this.throttler.submit(this.loadImage,{rejectionPolicy:"runLast"})},loadImage:function(){return this.img.src=this.$input.val(),this.src=this.img.src},render:function(){return this.$el.html(b.PictureGrabber()),this.$el.modal(),this.$el.modal("hide"),this.img=this.$el.find("img")[0],this.$input=this.$el.find("input[name='imageUrl']"),this.$el},constructor:function(){a.View.prototype.constructor.apply(this,arguments)}})}),define("vendor/keymaster",[],function(){var a={};return function(a){function h(a,b){var c=a.length;while(c--)if(a[c]===b)return c;return-1}function i(a){var b,g,i,j,k;b=a.keyCode;if(b==93||b==224)b=91;if(b in d){d[b]=!0;for(i in f)f[i]==b&&(l[i]=!0);return}if(!l.filter.call(this,a))return;if(!(b in c))return;for(j=0;j0;for(i in d)if(!d[i]&&h(g.mods,+i)>-1||d[i]&&h(g.mods,+i)==-1)k=!1;(g.mods.length==0&&!d[16]&&!d[18]&&!d[17]&&!d[91]||k)&&g.method(a,g)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}}function j(a){var b=a.keyCode,c;if(b==93||b==224)b=91;if(b in d){d[b]=!1;for(c in f)f[c]==b&&(l[c]=!1)}}function k(){for(b in d)d[b]=!1;for(b in f)l[b]=!1}function l(a,b,d){var e,h,i,j;d===undefined&&(d=b,b="all"),a=a.replace(/\s/g,""),e=a.split(","),e[e.length-1]==""&&(e[e.length-2]+=",");for(i=0;i1){h=a.slice(0,a.length-1);for(j=0;jSkew XSkew YRotateScale'}),Editor:a.template(function(a,b,c,d,e){function p(a,b){var d="",e;return d+='
  • ',h=c.name,e=h||a.name,typeof e===k?e=e.call(a,{hash:{}}):e===m&&(e=l.call(a,"name",{hash:{}})),d+=n(e)+"
  • ",d}c=c||a.helpers;var f="",g,h,i,j=this,k="function",l=c.helperMissing,m=void 0,n=this.escapeExpression,o=c.blockHelperMissing;f+='
    ',f}),SlideEditor:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    '}),SlideSnapshot:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),TransitionEditor:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    '}),TransitionSlideSnapshot:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    Rotate YRotate XRotate Z
    '})}}),define("ui/impress_renderer/Templates",["vendor/Handlebars"],function(a){return{ComponentContainer:a.template(function(a,b,c,d,e){function p(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function q(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function r(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function s(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}function t(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function u(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function v(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function w(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}function x(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function y(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function z(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function A(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='
    ',f}),ImpressTemplate:a.template(function(a,b,c,d,e){function p(a,b){var d="",e;d+="",h=c.attributes,e=h||a.attributes,i=j.program(2,q,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof e===k?e=e.call(a,i):e=l.call(a,e,i);if(e||e===0)d+=e;return d+="",d}function q(a,b){var d="",e,f;d+='
    ',h=c.components,e=h||a.components,i=j.program(20,B,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof e===k?e=e.call(a,i):e=l.call(a,e,i);if(e||e===0)d+=e;return d+="
    ",d}function r(a,b){var c="";return c}function s(a,b){var c="";return c}function t(a,b){var d="",e,f;d+='data-rotate-x="',h=c.rotateX,e=h||a.rotateX,h=c.toDeg,f=h||a.toDeg,i=j.program(8,u,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof f===k?e=f.call(a,e,i):e=l.call(a,f,e,i);if(e||e===0)d+=e;return d+='"',d}function u(a,b){var c="";return c}function v(a,b){var d="",e,f;d+='data-rotate-y="',h=c.rotateY,e=h||a.rotateY,h=c.toDeg,f=h||a.toDeg,i=j.program(11,w,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof f===k?e=f.call(a,e,i):e=l.call(a,f,e,i);if(e||e===0)d+=e;return d+='"',d}function w(a,b){var c="";return c}function x(a,b){var d="",e,f;d+='data-rotate-z="',h=c.rotateZ,e=h||a.rotateZ,h=c.toDeg,f=h||a.toDeg,i=j.program(14,y,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof f===k?e=f.call(a,e,i):e=l.call(a,f,e,i);if(e||e===0)d+=e;return d+='"',d}function y(a,b){var c="";return c}function z(a,b){var d="",e;return d+='data-z="',h=c.z,e=h||a.z,typeof e===k?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"z",{hash:{}})),d+=o(e)+'"',d}function A(a,b){var d="",e;return d+='data-scale="',h=c.impScale,e=h||a.impScale,typeof e===k?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"impScale",{hash:{}})),d+=o(e)+'"',d}function B(a,b){var d="",e,f;d+="",e=a,h=c.renderComponent,f=h||a.renderComponent,i=j.program(21,C,b),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof f===k?e=f.call(a,e,i):e=l.call(a,f,e,i);if(e||e===0)d+=e;return d+="",d}function C(a,b){var c="";return c}c=c||a.helpers;var f="",g,h,i,j=this,k="function",l=c.blockHelperMissing,m=c.helperMissing,n=void 0,o=this.escapeExpression;f+=' Deck Title

    Your browser doesn\'t support the features required by impress.js, so you are presented with a simplified version of this presentation.

    For the best experience please use the latest Chrome, Safari or Firefox browser.

    ',h=c.slides,g=h||b.slides,g=g===null||g===undefined||g===!1?g:g.models,i=j.program(1,p,e),i.hash={},i.fn=i,i.inverse=j.noop,h&&typeof g===k?g=g.call(b,i):g=l.call(b,g,i);if(g||g===0)f+=g;return f+='

    Use a spacebar or arrow keys to navigate

    ',f}),TextBox:a.template(function(a,b,c,d,e){c=c||a.helpers,d=d||a.partials;var f="",g,h,i=this,j="function",k=c.helperMissing,l=void 0,m=this.escapeExpression;g=b,g=i.invokePartial(d.ComponentContainer,"ComponentContainer",g,c,d);if(g||g===0)f+=g;return f+='
    ',h=c.text,g=h||b.text,typeof g===j?g=g.call(b,{hash:{}}):g===l&&(g=k.call(b,"text",{hash:{}})),f+=m(g)+"
    ",f})}}),define("ui/impress_renderer/ImpressRenderer",["vendor/Handlebars","./Templates"],function(a,b){var c;return c=function(){function c(){var c=this;a.registerHelper("renderComponent",function(d){var e;e="";switch(d.get("type")){case"ImageModel":e=b.Image(d.attributes);break;case"TextBox":e=b.TextBox(c.convertTextBoxData(d.attributes))}return new a.SafeString(e)}),a.registerHelper("scaleX",function(a){return a*slideConfig.size.width/150}),a.registerHelper("scaleY",function(a){return a*slideConfig.size.width/150}),a.registerHelper("toDeg",function(a){return a*180/Math.PI}),a.registerPartial("ComponentContainer",b.ComponentContainer)}return c.name="ImpressRenderer",c.prototype.render=function(a){var c,d,e,f,g=this;return f=a.slides,d=6,c=0,f.each(function(a){var b;return b=a.get("x"),b==null&&(a.set("x",c*160+30),a.set("y",(c/d|0)*160+80)),++c}),e=b.ImpressTemplate(a),e},c.prototype.convertTextBoxData=function(b){var c;return c=_.extend({},b),c.text=new a.SafeString(b.text),c},c}(),new c}),define("ui/widgets/RawTextImporter",["vendor/backbone","./Templates"],function(a,b){return a.View.extend({className:"rawTextImporter modal",events:{"click .ok":"okClicked"},initialize:function(){},show:function(a,b){return this.cb=a,b!=null&&this.$txtArea.val(b),this.$el.modal("show")},okClicked:function(){return this.cb!=null&&this.cb(this.$txtArea.val()),this.$el.modal("hide")},render:function(){return this.$el.html(b.RawTextImporter()),this.$el.modal(),this.$el.modal("hide"),this.$txtArea=this.$el.find("textarea"),this.$el}})}),define("storage/FileStorage",[],function(){var a;return a=function(){function a(){this.storageImpl=localStorage}return a.name="FileStorage",a.prototype.fileNames=function(){var a,b,c;c=this.storageImpl.length,b=0,a=[];while(b"),b.bind("dragstart",function(a){return a.preventDefault(),!1}),this.$el.find(".content").append(b),this.$el.css({top:this.model.get("y"),left:this.model.get("x")}),this.$el}})}),define("ui/editor/components/TextBoxView",["./ComponentView","../Templates"],function(a,b){var c;return c=["family","size","weight","style","color","decoration","align"],a.extend({className:"component textBox",tagName:"div",events:function(){var b,c;return c=a.prototype.events.call(this),b={dblclick:"dblclicked",editComplete:"editCompleted"},_.extend(c,b)},initialize:function(){var b,d,e,f;a.prototype.initialize.apply(this,arguments),f=[];for(d=0,e=c.length;d a > span":"fileClicked","click li > a > button":"deleteClicked"}},initialize:function(){},show:function(a,b){return this._renderPartial(),this.cb=a,this.$el.modal("show")},okClicked:function(){return this.cb!=null&&this.cb(this.$el.find(".active span").text()),this.$el.modal("hide")},fileClicked:function(a){return this.$el.find(".active").removeClass("active"),$(a.currentTarget).parent().parent().addClass("active")},deleteClicked:function(a){var b,d;return b=$(a.currentTarget),d=b.siblings("span").text(),c.remove(d),b.parent().parent().remove()},_renderPartial:function(){return this.$el.html(this.__template()({fileNames:c.fileNames()}))},__template:function(){return b.OpenDialog},render:function(){return this._renderPartial(),this.$el.modal(),this.$el.modal("hide"),this.$el}})}),define("ui/widgets/SaveAsDialog",["vendor/backbone","./Templates","./OpenDialog"],function(a,b,c){return c.extend({initialize:function(){return c.prototype.initialize.apply(this,arguments)},fileClicked:function(a){return c.prototype.fileClicked.call(this,a),this.$nameInput.val($(a.currentTarget).text())},okClicked:function(){return console.log(this.$nameInput.val()),this.cb!=null&&this.cb(this.$nameInput.val()),this.$el.modal("hide")},__template:function(){return b.SaveAsDialog},_renderPartial:function(){return c.prototype._renderPartial.call(this),this.$nameInput=this.$el.find("input")},render:function(){return this._renderPartial(),this.$el.modal(),this.$el.modal("hide"),this.$el}})}),define("ui/editor/Editor",["vendor/backbone","./SlideEditor","./transition_editor/TransitionEditor","./Templates","ui/impress_renderer/ImpressRenderer","ui/widgets/RawTextImporter","ui/widgets/OpenDialog","ui/widgets/SaveAsDialog","storage/FileStorage","css!./res/css/Editor.css"],function(a,b,c,d,e,f,g,h,i,j){var k,l;return k=0,l={"new":function(a){},open:function(a){var b=this;return this.openDialog.show(function(a){var c;console.log("Attempting to open "+a),c=i.open(a),console.log(c);if(c!=null)return b.model["import"](c)})},openRecent:function(a){},save:function(a){var b;return b=this.model.get("fileName"),b==null?l.saveAs.call(this,a):i.save(b,this.model.toJSON(!1,!0))},saveAs:function(a){var b=this;return this.saveAsDialog.show(function(a){if(a!=null&&a!=="")return console.log("Attempting to save "+a),b.model.set("fileName",a),i.save(a,b.model.toJSON(!1,!0))})},undo:function(a){return this.model.undo()},redo:function(a){return this.model.redo()},cut:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.cut()},copy:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.copy()},paste:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.paste()},transitionEditor:function(a){return this.changePerspective(a,{perspective:"transitionEditor"})},slideEditor:function(a){return this.changePerspective(a,{perspective:"slideEditor"})},preview:function(a){return this.$el.trigger("preview")},exportJSON:function(a){return this.rawTextModal.show(null,JSON.stringify(this.model.toJSON(!1,!0)))},importJSON:function(a){var b=this;return this.rawTextModal.show(function(a){return b.model["import"](JSON.parse(a))})}},a.View.extend({className:"editor",events:{"click .menuBar .dropdown-menu > li":"menuItemSelected",changePerspective:"changePerspective",preview:"renderPreview"},initialize:function(){return this.id=k++,this.perspectives={slideEditor:new b({model:this.model}),transitionEditor:new c({model:this.model})},this.activePerspective="slideEditor",this.model.undoHistory.on("updated",this.undoHistoryChanged,this)},undoHistoryChanged:function(){var a,b,c;return c=this.model.undoHistory.undoName(),b=this.model.undoHistory.redoName(),c!==""?(a=this.$el.find(".undoName"),a.text(c),a.removeClass("disp-none")):this.$el.find(".undoName").addClass("disp-none"),b!==""?(a=this.$el.find(".redoName"),a.text(b),a.removeClass("disp-none")):this.$el.find(".redoName").addClass("disp-none")},renderPreview:function(){var a,b;return b=e.render(this.model.attributes),a=window.open("data:text/html;charset=utf-8,"+escape(b))},changePerspective:function(a,b){var c=this;return this.activePerspective=b.perspective,_.each(this.perspectives,function(a,b){return b===c.activePerspective?a.show():a.hide()})},menuItemSelected:function(a){var b,c;return b=$(a.currentTarget),c=b.attr("data-option"),l[c].call(this,a)},render:function(){var a,b,c=this;return b=_.map(this.perspectives,function(a,b){return{perspective:b,name:a.name}}),this.$el.html(d.Editor({id:this.id,perspectives:b})),this.$el.find(".dropdown-toggle").dropdown(),a=this.$el.find(".perspectives-container"),_.each(this.perspectives,function(b,d){return a.append(b.render()),d===c.activePerspective?b.show():b.$el.addClass("disp-none")}),this.undoHistoryChanged(),this.rawTextModal=new f,this.$el.append(this.rawTextModal.render()),this.openDialog=new g,this.saveAsDialog=new h,this.$el.append(this.openDialog.render()),this.$el.append(this.saveAsDialog.render()),this.$el}})}),define("model/presentation/Slide",["vendor/backbone","model/geom/SpatialObject","./components/ComponentFactory"],function(a,b,c){return b.extend({initialize:function(){var b,d,e=this;return b=this.get("components"),b==null?this.set("components",[]):(d=[],this.set("components",d),b.forEach(function(b){var f;if(b instanceof a.Model)f=b.clone(),d.push(f);else switch(b.type){case"ImageModel":f=c.createImage(b),d.push(f);break;case"TextBox":f=c.createTextBox(b),d.push(f)}return e._registerWithComponent(f)})),this.on("unrender",this._unrendered,this)},_unrendered:function(){return this.get("components").forEach(function(a){return a.trigger("unrender",!0)})},_registerWithComponent:function(a){return a.on("dispose",this.remove,this),a.on("change:selected",this.selectionChanged,this),a.on("change",this.componentChanged,this)},getPositionData:function(){return{x:this.attributes.x,y:this.attributes.y,z:this.attributes.z,impScale:this.attributes.impScale,rotateX:this.attributes.rotateX,rotateY:this.attributes.rotateY,rotateZ:this.attributes.rotateZ}},add:function(a){return this.attributes.components.push(a),this._registerWithComponent(a),this.trigger("contentsChanged"),this.trigger("change:components.add",this,a)},dispose:function(){return this.set({active:!1,selected:!1}),this.trigger("dispose",this),this.off("dispose")},remove:function(a){var b;b=this.attributes.components.indexOf(a);if(b!==-1)return this.attributes.components.splice(b,1),this.trigger("contentsChanged"),this.trigger("change:components.remove",this,a),a.trigger("unrender"),a.off(null,null,this)},componentChanged:function(){return this.trigger("contentsChanged")},unselectComponents:function(){if(this.lastSelection)return this.lastSelection.set("selected",!1)},selectionChanged:function(a,b){return b?(this.lastSelection!==a&&(this.attributes.components.forEach(function(b){if(b!==a)return b.set("selected",!1)}),this.lastSelection=a),this.trigger("change:activeComponent",this,a,b)):(this.trigger("change:activeComponent",this,null),this.lastSelection=null)},constructor:function(){b.prototype.constructor.apply(this,arguments)}})}),define("model/presentation/SlideCollection",["common/Calcium","./Slide"],function(a,b){var c;return c=function(a,b){return a.get("num")-b.get("num")},a.Collection.extend({model:b,initialize:function(){return this.on("add",this._updateNumbers,this),this.on("remove",this._updateNumbers,this)},_updateNumbers:function(){return this.models.forEach(function(a,b){return a.set("num",b)})},sort:function(a){var b,d=this;return a||(a={}),b={},this.models.forEach(function(a,c){var e;e=a.get("num");if(e!==c&&!b[e])return b[e]=!0,b[c]=!0,d._swapTransitionPositions(a,d.models[e])}),this.models.sort(c)},_swapTransitionPositions:function(a,b){var c,d;return d=a.getPositionData(),c={silent:!0},a.set(b.getPositionData(),c),b.set(d,c)}})}),define("common/collections/LinkedList",[],function(){var a;return a=function(){function a(){this.head=this.tail=null,this.length=0}return a.name="LinkedList",a.prototype.push=function(a){var b;return b={prev:null,next:null,value:a},this.tail!=null?(this.tail.next=b,b.prev=this.tail,this.tail=b):this.head=this.tail=b,++this.length,this},a.prototype.pop=function(){var a;if(this.tail==null)throw"List is empty";return a=this.tail.value,this.tail===this.head?this.tail=this.head=null:(this.tail=this.tail.prev,this.tail.next=null),--this.length,a},a.prototype.shift=function(){var a;if(this.head==null)throw"List is empty";return a=this.head.value,this.tail===this.head?this.tail=this.head=null:(this.head=this.head.next,this.head.prev=null),--this.length,a},a.prototype.unshift=function(a){var b;return b={prev:null,next:null,value:a},this.head!=null?(this.head.prev=b,b.next=this.head,this.head=b):this.head=this.tail=b,++this.length,this},a.prototype.first=function(){return this.head.value},a.prototype.last=function(){return this.tail.value},a.prototype.forEach=function(a){var b,c,d;b=this.head,c=0,d=[];while(b!==null)a(b.value,c++,this),d.push(b=b.next);return d},a}()}),define("model/common_application/UndoHistory",["common/EventEmitter","common/collections/LinkedList"],function(a,b){var c;return c=function(){function c(c){this.size=c,this.actions=new b,this.cursor=null,this.undoCount=0,_.extend(this,new a)}return c.name="UndoHistory",c.prototype.push=function(a){var b;return this.actions.length-this.undoCount0?(b={prev:null,next:null,value:a},this.cursor?(b.prev=this.cursor,this.cursor.next.prev=null,this.cursor.next=b,this.actions.length+=1,this.actions.length=this.actions.length-this.undoCount):(this.actions.head=b,this.actions.tail=b,this.actions.length=1),this.undoCount=0,this.cursor=null):this.actions.push(a):(this.actions.shift(),this.actions.push(a)),this.emit("updated"),this},c.prototype.undoName=function(){var a;return this.undoCount0?(this.cursor==null?a=this.actions.head:a=this.cursor.next,a!=null?a.value.name:""):""},c.prototype.undo=function(){return this.undoCount0&&(this.cursor==null?this.cursor=this.actions.head:this.cursor=this.cursor.next,this.cursor.value["do"](),--this.undoCount,this.emit("updated")),this},c}()}),define("model/presentation/Deck",["common/Calcium","./SlideCollection","./Slide","model/common_application/UndoHistory"],function(a,b,c,d){var e,f;return e=function(a){return this.deck=a,this},e.prototype={"do":function(){var a;return a=this.deck.get("slides"),this.slide==null&&(this.slide=new c({num:a.length})),a.add(this.slide),this.slide},undo:function(){return this.deck.get("slides").remove(this.slide),this.slide},name:"Create Slide"},f=function(a,b){return this.deck=a,this.slide=b,this},f.prototype={"do":function(){var a;return a=this.deck.get("slides"),a.remove(this.slide),this.slide},undo:function(){return this.deck.get("slides").add(this.slide)},name:"Remove Slide"},a.Model.extend({initialize:function(){var a;return this.undoHistory=new d(20),this.set("slides",new b),a=this.get("slides"),a.on("add",this._slideAdded,this),a.on("remove",this._slideRemoved,this),a.on("reset",this._slidesReset,this),this._lastSelected=null},newSlide:function(){var a,b;return a=new e(this),b=a["do"](),this.undoHistory.push(a),b},set:function(b,c){return b==="activeSlide"&&this._activeSlideChanging(c),a.Model.prototype.set.apply(this,arguments)},"import":function(a){var b,c;return c=this.get("slides"),b=this.get("activeSlide"),b!=null&&b.unselectComponents(),this.set("activeSlide",null),c.reset(a.slides)},_activeSlideChanging:function(a){var b;b=this.get("activeSlide");if(a===b)return null;b!=null&&(b.unselectComponents(),b.set({active:!1,selected:!1}));if(a!=null)return a.set({selected:!0,active:!0})},_slideAdded:function(a,b){return this.set("activeSlide",a),this._registerWithSlide(a)},_slideDisposed:function(a){return a.off(null,null,this)},_slideRemoved:function(a,b,c){return console.log("Slide removed"),this.get("activeSlide")===a&&(c.index0?this.set("activeSlide",b.at(c.index-1)):this.set("activeSlide",null)),a.dispose()},_slidesReset:function(a,b,c){var d=this;return c.forEach(function(a){return a.dispose()}),a.forEach(function(a){d._registerWithSlide(a);if(a.get("active"))return a.trigger("change:active",a,!0);if(a.get("selected"))return a.set("selected",!1)})},_slideActivated:function(a,b){if(b)return this.set("activeSlide",a)},_slideSelected:function(a,b){return this._lastSelected!=null&&b&&this._lastSelected!==a&&this._lastSelected.set("selected",!1),this._lastSelected=a},_registerWithSlide:function(a){return a.on("change:active",this._slideActivated,this),a.on("change:selected",this._slideSelected,this),a.on("dispose",this._slideDisposed,this)},removeSlide:function(a){var b;return b=new f(this,a),a=b["do"](),this.undoHistory.push(b),a},addSlide:function(a){return this.get("slides").add(a)},undo:function(){return this.undoHistory.undo()},redo:function(){return this.undoHistory.redo()}})});var continuation;requirejs.config({paths:{css:"vendor/amd_plugins/css",text:"vendor/amd_plugins/text"}}),window.browserPrefix="",$.browser.mozilla?window.browserPrefix="-moz-":$.browser.msie?window.browserPrefix="-ms-":$.browser.opera?window.browserPrefix="-o-":$.browser.webkit&&(window.browserPrefix="-webkit-"),window.localStorage==null&&(window.localStorage={setItem:function(){},getItem:function(){},length:0}),requirejs(["vendor/backbone","state/DefaultState"],function(a,b){return a.sync=function(a,c,d){if(d.keyTrail!=null)return d.success(b.get(d.keyTrail))},window.slideConfig={size:{width:1024,height:768}},continuation()}),continuation=function(){return requirejs(["ui/editor/Editor","model/presentation/Deck"],function(a,b){var c,d;return c=new b,d=new a({model:c}),window.zTracker={z:0,next:function(){return++this.z}},$("body").append(d.render()),c.newSlide()})},define("main",function(){}) \ No newline at end of file +define("vendor/backbone",[],function(){var a={};return a._=window._,a.jQuery=window.jQuery,function(){var a=this,b=a.Backbone,c=Array.prototype.slice,d=Array.prototype.splice,e;typeof exports!="undefined"?e=exports:e=a.Backbone={},e.VERSION="0.9.2";var f=a._,g=a.jQuery||a.Zepto||a.ender;e.setDomLibrary=function(a){g=a},e.noConflict=function(){return a.Backbone=b,this},e.emulateHTTP=!1,e.emulateJSON=!1;var h=/\s+/,i=e.Events={on:function(a,b,c){var d,e,f,g,i;if(!b)return this;a=a.split(h),d=this._callbacks||(this._callbacks={});while(e=a.shift())i=d[e],f=i?i.tail:{},f.next=g={},f.context=c,f.callback=b,d[e]={tail:g,next:i?i.next:f};return this},off:function(a,b,c){var d,e,g,i,j,k;if(!(e=this._callbacks))return;if(!(a||b||c))return delete this._callbacks,this;a=a?a.split(h):f.keys(e);while(d=a.shift()){g=e[d],delete e[d];if(!g||!b&&!c)continue;i=g.tail;while((g=g.next)!==i)j=g.callback,k=g.context,(b&&j!==b||c&&k!==c)&&this.on(d,j,k)}return this},trigger:function(a){var b,d,e,f,g,i,j;if(!(e=this._callbacks))return this;i=e.all,a=a.split(h),j=c.call(arguments,1);while(b=a.shift()){if(d=e[b]){f=d.tail;while((d=d.next)!==f)d.callback.apply(d.context||this,j)}if(d=i){f=d.tail,g=[b].concat(j);while((d=d.next)!==f)d.callback.apply(d.context||this,g)}}return this}};i.bind=i.on,i.unbind=i.off;var j=e.Model=function(a,b){var c;a||(a={}),b&&b.parse&&(a=this.parse(a));if(c=A(this,"defaults"))a=f.extend({},c,a);b&&b.collection&&(this.collection=b.collection),this.attributes={},this._escapedAttributes={},this.cid=f.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(a,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=f.clone(this.attributes),this.initialize.apply(this,arguments)};f.extend(j.prototype,i,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(a){return f.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.get(a);return this._escapedAttributes[a]=f.escape(c==null?"":""+c)},has:function(a){return this.get(a)!=null},set:function(a,b,c){var d,e,g;f.isObject(a)||a==null?(d=a,c=b):(d={},d[a]=b),c||(c={});if(!d)return this;d instanceof j&&(d=d.attributes);if(c.unset)for(e in d)d[e]=void 0;if(!this._validate(d,c))return!1;this.idAttribute in d&&(this.id=d[this.idAttribute]);var h=c.changes={},i=this.attributes,k=this._escapedAttributes,l=this._previousAttributes||{};for(e in d){g=d[e];if(!f.isEqual(i[e],g)||c.unset&&f.has(i,e))delete k[e],(c.silent?this._silent:h)[e]=!0;c.unset?delete i[e]:i[e]=g,!f.isEqual(l[e],g)||f.has(i,e)!=f.has(l,e)?(this.changed[e]=g,c.silent||(this._pending[e]=!0)):(delete this.changed[e],delete this._pending[e])}return c.silent||this.change(c),this},unset:function(a,b){return(b||(b={})).unset=!0,this.set(a,null,b)},clear:function(a){return(a||(a={})).unset=!0,this.set(f.clone(this.attributes),a)},fetch:function(a){a=a?f.clone(a):{};var b=this,c=a.success;return a.success=function(d,e,f){if(!b.set(b.parse(d,f),a))return!1;c&&c(b,d)},a.error=e.wrapError(a.error,b,a),(this.sync||e.sync).call(this,"read",this,a)},save:function(a,b,c){var d,g;f.isObject(a)||a==null?(d=a,c=b):(d={},d[a]=b),c=c?f.clone(c):{};if(c.wait){if(!this._validate(d,c))return!1;g=f.clone(this.attributes)}var h=f.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?h:c))return!1;var i=this,j=c.success;c.success=function(a,b,e){var g=i.parse(a,e);c.wait&&(delete c.wait,g=f.extend(d||{},g));if(!i.set(g,c))return!1;j?j(i,a):i.trigger("sync",i,a,c)},c.error=e.wrapError(c.error,i,c);var k=this.isNew()?"create":"update",l=(this.sync||e.sync).call(this,k,this,c);return c.wait&&this.set(g,h),l},destroy:function(a){a=a?f.clone(a):{};var b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};if(this.isNew())return d(),!1;a.success=function(e){a.wait&&d(),c?c(b,e):b.trigger("sync",b,e,a)},a.error=e.wrapError(a.error,b,a);var g=(this.sync||e.sync).call(this,"delete",this,a);return a.wait||d(),g},url:function(){var a=A(this,"urlRoot")||A(this.collection,"url")||B();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.attributes)},isNew:function(){return this.id==null},change:function(a){a||(a={});var b=this._changing;this._changing=!0;for(var c in this._silent)this._pending[c]=!0;var d=f.extend({},a.changes,this._silent);this._silent={};for(var c in d)this.trigger("change:"+c,this,this.get(c),a);if(b)return this;while(!f.isEmpty(this._pending)){this._pending={},this.trigger("change",this,a);for(var c in this.changed){if(this._pending[c]||this._silent[c])continue;delete this.changed[c]}this._previousAttributes=f.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(a){return arguments.length?f.has(this.changed,a):!f.isEmpty(this.changed)},changedAttributes:function(a){if(!a)return this.hasChanged()?f.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes;for(var e in a){if(f.isEqual(d[e],b=a[e]))continue;(c||(c={}))[e]=b}return c},previous:function(a){return!arguments.length||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return f.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(a,b){if(b.silent||!this.validate)return!0;a=f.extend({},this.attributes,a);var c=this.validate(a,b);return c?(b&&b.error?b.error(this,c,b):this.trigger("error",this,c,b),!1):!0}});var k=e.Collection=function(a,b){b||(b={}),b.model&&(this.model=b.model),b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,{silent:!0,parse:b.parse})};f.extend(k.prototype,i,{model:j,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},add:function(a,b){var c,e,g,h,i,j,k={},l={},m=[];b||(b={}),a=f.isArray(a)?a.slice():[a];for(c=0,g=a.length;c').hide().appendTo("body")[0].contentWindow,this.navigate(b)),this._hasPushState?g(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!d?g(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=b;var e=window.location,h=e.pathname==this.options.root;if(this._wantsHashChange&&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&&e.hash&&(this.fragment=this.getHash().replace(r,""),window.history.replaceState({},document.title,e.protocol+"//"+e.host+this.options.root+this.fragment));if(!this.options.silent)return this.loadUrl()},stop:function(){g(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),q.started=!1},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.getHash(this.iframe)));if(b==this.fragment)return!1;this.iframe&&this.navigate(b),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(a){var b=this.fragment=this.getFragment(a),c=f.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0});return c},navigate:function(a,b){if(!q.started)return!1;if(!b||b===!0)b={trigger:b};var c=(a||"").replace(r,"");if(this.fragment==c)return;this._hasPushState?(c.indexOf(this.options.root)!=0&&(c=this.options.root+c),this.fragment=c,window.history[b.replace?"replaceState":"pushState"]({},document.title,c)):this._wantsHashChange?(this.fragment=c,this._updateHash(window.location,c,b.replace),this.iframe&&c!=this.getFragment(this.getHash(this.iframe))&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,c,b.replace))):window.location.assign(this.options.root+a),b.trigger&&this.loadUrl(a)},_updateHash:function(a,b,c){c?a.replace(a.toString().replace(/(javascript:|#).*$/,"")+"#"+b):a.hash=b}});var t=e.View=function(a){this.cid=f.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},u=/^(\S+)\s*(.*)$/,v=["model","collection","el","id","attributes","className","tagName"];f.extend(t.prototype,i,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(a,b,c){var d=document.createElement(a);return b&&g(d).attr(b),c&&g(d).html(c),d},setElement:function(a,b){return this.$el&&this.undelegateEvents(),this.$el=a instanceof g?a:g(a),this.el=this.$el[0],b!==!1&&this.delegateEvents(),this},delegateEvents:function(a){if(!a&&!(a=A(this,"events")))return;this.undelegateEvents();for(var b in a){var c=a[b];f.isFunction(c)||(c=this[a[b]]);if(!c)throw new Error('Method "'+a[b]+'" does not exist');var d=b.match(u),e=d[1],g=d[2];c=f.bind(c,this),e+=".delegateEvents"+this.cid,g===""?this.$el.bind(e,c):this.$el.delegate(g,e,c)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=f.extend({},this.options,a));for(var b=0,c=v.length;b]+>|<\/[^>]+>/,b=function(a){function b(a){this.g2d=a}return __extends(b,a),b.name="TextBoxDrawer",b.prototype.paint=function(a){var b,c,d,e,f,g=this;return this.g2d.fillStyle="#"+a.get("color"),d=a.get("size")*this.scale,this.g2d.font=d+"px "+a.get("family"),e=this._extractLines(a.get("text")),f=this._findWidestWidth(e)*this.scale,b={x:a.get("x")*this.scale,y:a.get("y")*this.scale,width:f+f,height:a.get("size")*this.scale},this.applyTransforms(a,b),c=0,e.forEach(function(a){if(a!=="")return g.g2d.fillText(a,b.x,b.y+b.height+c*d),++c})},b.prototype._extractLines=function(a){return a.split(c)},b.prototype._findWidestWidth=function(a){var b,c=this;return b=0,a.forEach(function(a){var d;d=c.g2d.measureText(a).width;if(d>b)return b=d}),b},b}(a)});var __hasProp={}.hasOwnProperty,__extends=function(a,b){function d(){this.constructor=a}for(var c in b)__hasProp.call(b,c)&&(a[c]=b[c]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};define("ui/editor/raster/ImageModelDrawer",["./AbstractDrawer"],function(a){var b;return b=function(a){function b(a){this.g2d=a}return __extends(b,a),b.name="ImageModelDrawer",b.prototype.paint=function(a){return this._imageLoaded(a.cachedImage,a)},b.prototype._imageLoaded=function(a,b){var c;return c={x:b.get("x")*this.scale,y:b.get("y")*this.scale,width:a.naturalWidth*this.scale,height:a.naturalHeight*this.scale},this.applyTransforms(b,c),this.g2d.drawImage(a,c.x,c.y,c.width,c.height)},b}(a)}),define("ui/editor/raster/SlideDrawer",["common/Throttler","./TextBoxDrawer","./ImageModelDrawer"],function(a,b,c){var d;return d=function(){function d(d,e){var f,g,h;this.model=d,this.g2d=e,this.model.on("contentsChanged",this.repaint,this),this.size={width:this.g2d.canvas.width,height:this.g2d.canvas.height},this.throttler=new a(600,this),this.scale=this.size.width/slideConfig.size.width,this.drawers={TextBox:new b(this.g2d),ImageModel:new c(this.g2d)},h=this.drawers;for(f in h)g=h[f],g.scale=this.scale}return d.name="SlideDrawer",d.prototype.resized=function(a){var b,c,d;this.size=a,this.scale=this.size.width/slideConfig.size.width,d=this.drawers;for(b in d)c=d[b],c.scale=this.scale;return this.repaint()},d.prototype.repaint=function(){return this.throttler.submit(this.paint,{rejectionPolicy:"runLast"})},d.prototype.paint=function(){var a,b=this;return this.g2d.clearRect(0,0,this.size.width,this.size.height),a=this.model.get("components"),a.forEach(function(a){var c;return c=a.get("type"),b.g2d.save(),b.drawers[c].paint(a),b.g2d.restore()})},d.prototype.dispose=function(){return this.model.off(null,null,this)},d}()}),define("model/system/Clipboard",["vendor/backbone"],function(a){return a.Model.extend()}),define("ui/editor/SlideCopyPaste",[],function(){var a;return a={cut:function(){var a;a=this.model.get("activeSlide");if(a!=null)return this._clipboard.set("item",a),this.model.removeSlide(a),a.set("selected",!1),!1},copy:function(){var a;a=this.model.get("activeSlide");if(a!=null)return this._clipboard.set("item",a.clone()),!1},paste:function(){var a,b;a=this._clipboard.get("item");if(a!=null)return b=a.clone(),b.set("x",null),b.set("y",null),this.model.addSlide(b)}}}),define("ui/widgets/DeltaDragControl",[],function(){var a,b;return b=["mousedown","mousemove","mouseup"],a=function(){function a(a,b){this.$el=a,this.stopProp=b,this.dragging=!1,this._mousemove=this.mousemove.bind(this),this._mouseup=this.mouseup.bind(this),this._mouseout=this._mouseup,$(document).bind("mousemove",this._mousemove),$(document).bind("mouseup",this._mouseup),this.$el.bind("mousedown",this.mousedown.bind(this)),this.$el.bind("mouseup",this._mouseup)}return a.name="DragControl",a.prototype.dispose=function(){return $(document).unbind("mousemove",this._mousemove),$(document).unbind("mouseup",this._mouseup)},a.prototype.mousedown=function(a){this.dragging=!0,this._startPos={x:a.pageX,y:a.pageY},this.$el.trigger("deltadragStart",{x:a.pageX,y:a.pageY});if(this.stopProp)return a.stopPropagation()},a.prototype.mousemove=function(a){var b,c;if(this.dragging){b=a.pageX-this._startPos.x,c=a.pageY-this._startPos.y,this.$el.trigger("deltadrag",[{dx:b,dy:c,x:a.pageX,y:a.pageY}]);if(this.stopProp)return a.stopPropagation()}},a.prototype.mouseup=function(a){return this.dragging=!1,!0},a}()}),define("ui/editor/components/TableView",function(){}),define("common/EventEmitter",[],function(){function a(){if(!(this instanceof a))return new a;this._events=null,typeof process!="undefined"&&typeof process.nextTick!="undefined"?this._deferer=function(a,b,c){process.nextTick(function(){a(b,c)})}:this._deferer=function(a,b,c){setTimeout(function(){a(b,c)},0)}}return a.prototype={_listeners:function(b){var c=this._events||(this._events={});return c[b]||(c[b]=[])},_emit:function(a,b){a instanceof Array&&(a=JSON.stringify(a));if(!this._events)return;var c=this._events[a];if(!c)return;var d=c.length;while(d--){var e=c[d];e&&e.cb.apply(e.context,b)}},_splice:function(a,b,c){return a=Array.prototype.slice.call(a),a.splice(b,c)},_indexOfSub:function(a,b,c){for(var d=0;d1?this._splice(arguments,1,arguments.length):[];this._emit(a,b)},trigger:function(){this.emit.apply(this,arguments)},emitDeferred:function(a){var b=arguments.length>1?this._splice(arguments,1,arguments.length):[];this._deferer(emit,a,b)},on:function(a,b,c){if(!b)throw"Undefined callback provided";a instanceof Array&&(a=JSON.stringify(a));var d=this._listeners(a),e=this._indexOfSub(d,b,c);e<0&&(d.push({cb:b,context:c}),e=d.length-1);var f=this;return{dispose:function(){f.removeListener(a,b,c)}}},once:function(a,b,c){var d={sub:null};return d.sub=this.on(a,function(){d.sub.dispose(),b.apply(c,arguments)}),d.sub},removeListener:function(a,b,c){var d=this._listeners(a),e=this._indexOfSub(d,b,c);0<=e&&d.splice(e,1),d.length==0&&delete this._events[a]},getNumListeners:function(a){var b=0;return this._events[a]&&(b=this._events[a].length),b},off:function(a,b,c){this.removeListener(a,b,c)},removeAllListeners:function(){this._events=null}},a}),define("ui/editor/button_bar/AbstractButtonBarView",["vendor/backbone"],function(a){return a.View.extend({initialize:function(a){return this.buttonBarOptions=a},optionChosen:function(a){var b;return b=$(a.currentTarget).attr("data-option"),this.buttonBarOptions[b].call(this,a)}})}),define("model/editor/button_bar/ButtonBarModel",["vendor/backbone"],function(a){var b,c,d,e,f,g,h;c=["size","family","color","style","weight","decoration"],f=function(a){return c.indexOf(a)>2},b={};for(g=0,h=c.length;g0)for(var i=0,j=a.length;i0)for(var f=0,g=a.length;f2&&A.push("'"+this.terminals_[x]+"'");var B="";this.lexer.showPosition?B="Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+this.terminals_[q]+"'":B="Parse error on line "+(i+1)+": Unexpected "+(q==1?"end of input":"'"+(this.terminals_[q]||q)+"'"),this.parseError(B,{text:this.lexer.match,token:this.terminals_[q]||q,line:this.lexer.yylineno,loc:n,expected:A})}if(t[0]instanceof Array&&t.length>1)throw new Error("Parse Error: multiple actions possible at state: "+s+", token: "+q);switch(t[0]){case 1:d.push(q),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(t[1]),q=null,r?(q=r,r=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,n=this.lexer.yylloc,k>0&&k--);break;case 2:y=this.productions_[t[1]][1],w.$=e[e.length-y],w._$={first_line:f[f.length-(y||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(y||1)].first_column,last_column:f[f.length-1].last_column},v=this.performAction.call(w,h,j,i,this.yy,t[1],e,f);if(typeof v!="undefined")return v;y&&(d=d.slice(0,-1*y*2),e=e.slice(0,-1*y),f=f.slice(0,-1*y)),d.push(this.productions_[t[1]][0]),e.push(w.$),f.push(w._$),z=g[d[d.length-2]][d[d.length-1]],d.push(z);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseError:function(b,c){if(!this.yy.parseError)throw new Error(b);this.yy.parseError(b,c)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.match+=a,this.matched+=a;var b=a.match(/\n/);return b&&this.yylineno++,this._input=this._input.slice(1),a},unput:function(a){return this._input=a+this._input,this},more:function(){return this._more=!0,this},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=(new Array(a.length+1)).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");var e=this._currentRules();for(var f=0;f/,/^\{\{#/,/^\{\{\//,/^\{\{\^/,/^\{\{\s*else\b/,/^\{\{\{/,/^\{\{&/,/^\{\{![\s\S]*?\}\}/,/^\{\{/,/^=/,/^\.(?=[} ])/,/^\.\./,/^[\/.]/,/^\s+/,/^\}\}\}/,/^\}\}/,/^"(\\["]|[^"])*"/,/^true(?=[}\s])/,/^false(?=[}\s])/,/^[0-9]+(?=[}\s])/,/^[a-zA-Z0-9_$-]+(?=[=}\s\/.])/,/^\[[^\]]*\]/,/^./,/^$/],a.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,26],inclusive:!0}},a}();return a.lexer=b,a}();return a.Parser=d,a.parse=function(b){return a.Parser.yy=a.AST,a.Parser.parse(b)},a.print=function(b){return(new a.PrintVisitor).accept(b)},a.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){}},a.log=function(b,c){a.logger.log(b,c)},function(){a.AST={},a.AST.ProgramNode=function(b,c){this.type="program",this.statements=b,c&&(this.inverse=new a.AST.ProgramNode(c))},a.AST.MustacheNode=function(a,b,c){this.type="mustache",this.id=a[0],this.params=a.slice(1),this.hash=b,this.escaped=!c},a.AST.PartialNode=function(a,b){this.type="partial",this.id=a,this.context=b};var b=function(b,c){if(b.original!==c.original)throw new a.Exception(b.original+" doesn't match "+c.original)};a.AST.BlockNode=function(a,c,d){b(a.id,d),this.type="block",this.mustache=a,this.program=c},a.AST.InverseNode=function(a,c,d){b(a.id,d),this.type="inverse",this.mustache=a,this.program=c},a.AST.ContentNode=function(a){this.type="content",this.string=a},a.AST.HashNode=function(a){this.type="hash",this.pairs=a},a.AST.IdNode=function(a){this.type="ID",this.original=a.join(".");var b=[],c=0;for(var d=0,e=a.length;d":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[<>"'`]/g,d=/[&<>"'`]/,e=function(a){return b[a]||"&"};a.Utils={escapeExpression:function(b){return b instanceof a.SafeString?b.toString():b==null||b===!1?"":d.test(b)?b.replace(c,e):b},isEmpty:function(a){return typeof a=="undefined"?!0:a===null?!0:a===!1?!0:a instanceof Array?!0:!1}}}(),a.Compiler=function(){},a.JavaScriptCompiler=function(){},function(b,c){b.OPCODE_MAP={appendContent:1,getContext:2,lookupWithHelpers:3,lookup:4,append:5,invokeMustache:6,appendEscaped:7,pushString:8,truthyOrFallback:9,functionOrFallback:10,invokeProgram:11,invokePartial:12,push:13,assignToHash:15,pushStringParam:16},b.MULTI_PARAM_OPCODES={appendContent:1,getContext:1,lookupWithHelpers:2,lookup:1,invokeMustache:3,pushString:1,truthyOrFallback:1,functionOrFallback:1,invokeProgram:3,invokePartial:1,push:1,assignToHash:1,pushStringParam:1},b.DISASSEMBLE_MAP={};for(var d in b.OPCODE_MAP){var e=b.OPCODE_MAP[d];b.DISASSEMBLE_MAP[e]=d}b.multiParamSize=function(a){return b.MULTI_PARAM_OPCODES[b.DISASSEMBLE_MAP[a]]},b.prototype={compiler:b,disassemble:function(){var a=this.opcodes,c,d,e=[],f,g,h;for(var i=0,j=a.length;ithis.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){return"stack"+this.stackSlot--},topStack:function(){return"stack"+this.stackSlot},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'}};var f="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),g=c.RESERVED_WORDS={};for(var h=0,i=f.length;h

    Change Background

    '}),OpenDialog:a.template(function(a,b,c,d,e){function p(a,b){var c="",d;return c+='
  • ',d=a,typeof d===l?d=d.call(a,{hash:{}}):d===n&&(d=m.call(a,".",{hash:{}})),c+=o(d)+'
  • ',c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='',f}),PictureGrabber:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),RawTextImporter:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),SaveAsDialog:a.template(function(a,b,c,d,e){function p(a,b){var c="",d;return c+='
  • ',d=a,typeof d===l?d=d.call(a,{hash:{}}):d===n&&(d=m.call(a,".",{hash:{}})),c+=o(d)+'
  • ',c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='',f})}}),define("ui/widgets/PictureGrabber",["vendor/backbone","./Templates","common/Throttler"],function(a,b,c){return a.View.extend({className:"pictureGrabber modal",events:{"click .ok":"okClicked","keyup input[name='imageUrl']":"urlChanged","paste input[name='imageUrl']":"urlChanged"},initialize:function(){return this.throttler=new c(200,this)},show:function(a){return this.cb=a,this.$el.modal("show")},okClicked:function(){return this.cb(this.src),this.$el.modal("hide")},urlChanged:function(){return this.throttler.submit(this.loadImage,{rejectionPolicy:"runLast"})},loadImage:function(){return this.img.src=this.$input.val(),this.src=this.img.src},render:function(){return this.$el.html(b.PictureGrabber()),this.$el.modal(),this.$el.modal("hide"),this.img=this.$el.find("img")[0],this.$input=this.$el.find("input[name='imageUrl']"),this.$el},constructor:function(){a.View.prototype.constructor.apply(this,arguments)}})}),define("vendor/keymaster",[],function(){var a={};return function(a){function h(a,b){var c=a.length;while(c--)if(a[c]===b)return c;return-1}function i(a){var b,g,i,j,k;b=a.keyCode;if(b==93||b==224)b=91;if(b in d){d[b]=!0;for(i in f)f[i]==b&&(l[i]=!0);return}if(!l.filter.call(this,a))return;if(!(b in c))return;for(j=0;j0;for(i in d)if(!d[i]&&h(g.mods,+i)>-1||d[i]&&h(g.mods,+i)==-1)k=!1;(g.mods.length==0&&!d[16]&&!d[18]&&!d[17]&&!d[91]||k)&&g.method(a,g)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}}function j(a){var b=a.keyCode,c;if(b==93||b==224)b=91;if(b in d){d[b]=!1;for(c in f)f[c]==b&&(l[c]=!1)}}function k(){for(b in d)d[b]=!1;for(b in f)l[b]=!1}function l(a,b,d){var e,h,i,j;d===undefined&&(d=b,b="all"),a=a.replace(/\s/g,""),e=a.split(","),e[e.length-1]==""&&(e[e.length-2]+=",");for(i=0;i1){h=a.slice(0,a.length-1);for(j=0;jSkew XSkew YRotateScale'}),Editor:a.template(function(a,b,c,d,e){function p(a,b){var d="",e;return d+='
  • ',h=c.name,e=h||a.name,typeof e===k?e=e.call(a,{hash:{}}):e===m&&(e=l.call(a,"name",{hash:{}})),d+=n(e)+"
  • ",d}c=c||a.helpers;var f="",g,h,i,j=this,k="function",l=c.helperMissing,m=void 0,n=this.escapeExpression,o=c.blockHelperMissing;f+='
    ',f}),SlideEditor:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    '}),SlideSnapshot:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return''}),TransitionEditor:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    '}),TransitionSlideSnapshot:a.template(function(a,b,c,d,e){c=c||a.helpers;var f,g=this;return'
    Rotate YRotate XRotate Z
    '})}}),define("ui/impress_renderer/Templates",["vendor/Handlebars"],function(a){return{ComponentContainer:a.template(function(a,b,c,d,e){function p(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function q(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function r(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function s(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}function t(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function u(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function v(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function w(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}function x(a,b){var d="",e;return d+="rotate(",i=c.rotate,e=i||a.rotate,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"rotate",{hash:{}})),d+=o(e)+"rad)",d}function y(a,b){var d="",e;return d+="skewX(",i=c.skewX,e=i||a.skewX,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewX",{hash:{}})),d+=o(e)+"rad)",d}function z(a,b){var d="",e;return d+="skewY(",i=c.skewY,e=i||a.skewY,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"skewY",{hash:{}})),d+=o(e)+"rad)",d}function A(a,b){var d="",e;return d+="scale(",i=c.scale,e=i||a.scale,typeof e===l?e=e.call(a,{hash:{}}):e===n&&(e=m.call(a,"scale",{hash:{}})),d+=o(e)+")",d}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.helperMissing,n=void 0,o=this.escapeExpression;f+='
    ',f}),ImpressTemplate:a.template(function(a,b,c,d,e){function q(a,b){var c="";return c}function r(a,b){var d="",e;d+="",i=c.attributes,e=i||a.attributes,j=k.program(4,s,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof e===l?e=e.call(a,j):e=m.call(a,e,j);if(e||e===0)d+=e;return d+="",d}function s(a,b){var d="",e,f;d+='
    ',i=c.components,e=i||a.components,j=k.program(22,D,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof e===l?e=e.call(a,j):e=m.call(a,e,j);if(e||e===0)d+=e;return d+="
    ",d}function t(a,b){var c="";return c}function u(a,b){var c="";return c}function v(a,b){var d="",e,f;d+='data-rotate-x="',i=c.rotateX,e=i||a.rotateX,i=c.toDeg,f=i||a.toDeg,j=k.program(10,w,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof f===l?e=f.call(a,e,j):e=m.call(a,f,e,j);if(e||e===0)d+=e;return d+='"',d}function w(a,b){var c="";return c}function x(a,b){var d="",e,f;d+='data-rotate-y="',i=c.rotateY,e=i||a.rotateY,i=c.toDeg,f=i||a.toDeg,j=k.program(13,y,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof f===l?e=f.call(a,e,j):e=m.call(a,f,e,j);if(e||e===0)d+=e;return d+='"',d}function y(a,b){var c="";return c}function z(a,b){var d="",e,f;d+='data-rotate-z="',i=c.rotateZ,e=i||a.rotateZ,i=c.toDeg,f=i||a.toDeg,j=k.program(16,A,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof f===l?e=f.call(a,e,j):e=m.call(a,f,e,j);if(e||e===0)d+=e;return d+='"',d}function A(a,b){var c="";return c}function B(a,b){var d="",e;return d+='data-z="',i=c.z,e=i||a.z,typeof e===l?e=e.call(a,{hash:{}}):e===o&&(e=n.call(a,"z",{hash:{}})),d+=p(e)+'"',d}function C(a,b){var d="",e;return d+='data-scale="',i=c.impScale,e=i||a.impScale,typeof e===l?e=e.call(a,{hash:{}}):e===o&&(e=n.call(a,"impScale",{hash:{}})),d+=p(e)+'"',d}function D(a,b){var d="",e,f;d+="",e=a,i=c.renderComponent,f=i||a.renderComponent,j=k.program(23,E,b),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof f===l?e=f.call(a,e,j):e=m.call(a,f,e,j);if(e||e===0)d+=e;return d+="",d}function E(a,b){var c="";return c}c=c||a.helpers;var f="",g,h,i,j,k=this,l="function",m=c.blockHelperMissing,n=c.helperMissing,o=void 0,p=this.escapeExpression;f+=' Deck Title

    Your browser doesn\'t support the features required by impress.js, so you are presented with a simplified version of this presentation.

    For the best experience please use the latest Chrome, Safari or Firefox browser.

    ',i=c.slides,g=i||b.slides,g=g===null||g===undefined||g===!1?g:g.models,j=k.program(3,r,e),j.hash={},j.fn=j,j.inverse=k.noop,i&&typeof g===l?g=g.call(b,j):g=m.call(b,g,j);if(g||g===0)f+=g;return f+='

    Use a spacebar or arrow keys to navigate

    ',f}),TextBox:a.template(function(a,b,c,d,e){c=c||a.helpers,d=d||a.partials;var f="",g,h,i=this,j="function",k=c.helperMissing,l=void 0,m=this.escapeExpression;g=b,g=i.invokePartial(d.ComponentContainer,"ComponentContainer",g,c,d);if(g||g===0)f+=g;return f+='
    ',h=c.text,g=h||b.text,typeof g===j?g=g.call(b,{hash:{}}):g===l&&(g=k.call(b,"text",{hash:{}})),f+=m(g)+"
    ",f})}}),define("ui/impress_renderer/ImpressRenderer",["vendor/Handlebars","./Templates"],function(a,b){var c;return c=function(){function c(){var c=this;a.registerHelper("renderComponent",function(d){var e;e="";switch(d.get("type")){case"ImageModel":e=b.Image(d.attributes);break;case"TextBox":e=b.TextBox(c.convertTextBoxData(d.attributes))}return new a.SafeString(e)}),a.registerHelper("scaleX",function(a){return a*slideConfig.size.width/150}),a.registerHelper("scaleY",function(a){return a*slideConfig.size.width/150}),a.registerHelper("toDeg",function(a){return a*180/Math.PI}),a.registerHelper("extractBG",function(a){var b,c,d,e,f,g;d="",e=a[0],b=["-moz-","-webkit-","-o-","-ms-",""];for(f=0,g=b.length;f"),b.bind("dragstart",function(a){return a.preventDefault(),!1}),this.$el.find(".content").append(b),this.$el.css({top:this.model.get("y"),left:this.model.get("x")}),this.$el}})}),define("ui/editor/components/TextBoxView",["./ComponentView","../Templates"],function(a,b){var c;return c=["family","size","weight","style","color","decoration","align"],a.extend({className:"component textBox",tagName:"div",events:function(){var b,c;return c=a.prototype.events.call(this),b={dblclick:"dblclicked",editComplete:"editCompleted"},_.extend(c,b)},initialize:function(){var b,d,e,f;a.prototype.initialize.apply(this,arguments),f=[];for(d=0,e=c.length;d a > span":"fileClicked","click li > a > button":"deleteClicked"}},initialize:function(){},show:function(a,b){return this._renderPartial(),this.cb=a,this.$el.modal("show")},okClicked:function(){return this.cb!=null&&this.cb(this.$el.find(".active span").text()),this.$el.modal("hide")},fileClicked:function(a){return this.$el.find(".active").removeClass("active"),$(a.currentTarget).parent().parent().addClass("active")},deleteClicked:function(a){var b,d;return b=$(a.currentTarget),d=b.siblings("span").text(),c.remove(d),b.parent().parent().remove()},_renderPartial:function(){return this.$el.html(this.__template()({fileNames:c.fileNames()}))},__template:function(){return b.OpenDialog},render:function(){return this._renderPartial(),this.$el.modal(),this.$el.modal("hide"),this.$el}})}),define("ui/widgets/SaveAsDialog",["vendor/backbone","./Templates","./OpenDialog"],function(a,b,c){return c.extend({initialize:function(){return c.prototype.initialize.apply(this,arguments)},fileClicked:function(a){return c.prototype.fileClicked.call(this,a),this.$nameInput.val($(a.currentTarget).text())},okClicked:function(){return console.log(this.$nameInput.val()),this.cb!=null&&this.cb(this.$nameInput.val()),this.$el.modal("hide")},__template:function(){return b.SaveAsDialog},_renderPartial:function(){return c.prototype._renderPartial.call(this),this.$nameInput=this.$el.find("input")},render:function(){return this._renderPartial(),this.$el.modal(),this.$el.modal("hide"),this.$el}})}),define("ui/widgets/BackgroundPicker",["vendor/backbone","./Templates","css!./res/css/BackgroundPicker.css"],function(a,b,c){var d;return d={type:function(a){return this._updatePicker({type:a})},direction:function(a){return this._updatePicker({fillDirection:a})}},a.View.extend({className:"backgroundPicker modal",events:{"click .ok":"okClicked","click [data-option]":"optionChosen"},initialize:function(){},show:function(a,b){return this.$el.modal("show"),b!=null&&this._updatePicker(b),this.cb=a},_updatePicker:function(a){return this.$gradientPicker.gradientPicker("update",a)},_updateGradientPreview:function(a){return this.$gradientPreview.css("background-image",a[0]),this.$gradientPreview.css("background-image",a[1])},okClicked:function(){return this.$el.modal("hide"),this.cb(this.$gradientPicker.gradientPicker("currentState"))},optionChosen:function(a){var b,c;return b=a.currentTarget.dataset.option,c=a.target.dataset.value,d[b].call(this,c)},render:function(){var a,c=this;return this.$el.html(b.BackgroundPicker()),this.$el.modal(),this.$gradientPicker=this.$el.find(".gradientPicker"),this.$gradientPreview=this.$el.find(".gradientPreview"),this.$gradientPicker.css("width",250),a=this.options.bgOpts||{},a.change=function(a,b){return c._updateGradientPreview(b)},this.$gradientPicker.gradientPicker(a),this.$el.modal("hide"),this.$el.find(".dropdown-toggle").dropdown(),this.$el}})}),define("ui/editor/Editor",["vendor/backbone","./SlideEditor","./transition_editor/TransitionEditor","./Templates","ui/impress_renderer/ImpressRenderer","ui/widgets/RawTextImporter","ui/widgets/OpenDialog","ui/widgets/SaveAsDialog","storage/FileStorage","ui/widgets/BackgroundPicker","css!./res/css/Editor.css"],function(a,b,c,d,e,f,g,h,i,j,k){var l,m;return l=0,m={"new":function(a){},open:function(a){var b=this;return this.openDialog.show(function(a){var c;console.log("Attempting to open "+a),c=i.open(a),console.log(c);if(c!=null)return b.model["import"](c)})},openRecent:function(a){},save:function(a){var b;return b=this.model.get("fileName"),b==null?m.saveAs.call(this,a):i.save(b,this.model.toJSON(!1,!0))},saveAs:function(a){var b=this;return this.saveAsDialog.show(function(a){if(a!=null&&a!=="")return console.log("Attempting to save "+a),b.model.set("fileName",a),i.save(a,b.model.toJSON(!1,!0))})},undo:function(a){return this.model.undo()},redo:function(a){return this.model.redo()},cut:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.cut()},copy:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.copy()},paste:function(a){var b;b=this.perspectives[this.activePerspective];if(b!=null)return b.paste()},transitionEditor:function(a){return this.changePerspective(a,{perspective:"transitionEditor"})},slideEditor:function(a){return this.changePerspective(a,{perspective:"slideEditor"})},preview:function(a){return this.$el.trigger("preview")},exportJSON:function(a){return this.rawTextModal.show(null,JSON.stringify(this.model.toJSON(!1,!0)))},importJSON:function(a){var b=this;return this.rawTextModal.show(function(a){return b.model["import"](JSON.parse(a))})},changeBackground:function(){var a=this;return this.backgroundPickerModal.show(function(b){return a.model.set("background",b)})}},a.View.extend({className:"editor",events:{"click .menuBar .dropdown-menu > li":"menuItemSelected",changePerspective:"changePerspective",preview:"renderPreview"},initialize:function(){return this.id=l++,this.perspectives={slideEditor:new b({model:this.model}),transitionEditor:new c({model:this.model})},this.activePerspective="slideEditor",this.model.undoHistory.on("updated",this.undoHistoryChanged,this),this.model.on("change:background",this._backgroundChanged,this)},undoHistoryChanged:function(){var a,b,c;return c=this.model.undoHistory.undoName(),b=this.model.undoHistory.redoName(),c!==""?(a=this.$el.find(".undoName"),a.text(c),a.removeClass("disp-none")):this.$el.find(".undoName").addClass("disp-none"),b!==""?(a=this.$el.find(".redoName"),a.text(b),a.removeClass("disp-none")):this.$el.find(".redoName").addClass("disp-none")},renderPreview:function(){var a,b;return b=e.render(this.model.attributes),a=window.open("data:text/html;charset=utf-8,"+escape(b))},changePerspective:function(a,b){var c=this;return this.activePerspective=b.perspective,_.each(this.perspectives,function(a,b){return b===c.activePerspective?a.show():a.hide()})},_backgroundChanged:function(a,b){var c,d,e,f;e=this.perspectives,f=[];for(c in e)d=e[c],f.push(d.backgroundChanged(b));return f},menuItemSelected:function(a){var b,c;return b=$(a.currentTarget),c=b.attr("data-option"),m[c].call(this,a)},render:function(){var a,b,c=this;return b=_.map(this.perspectives,function(a,b){return{perspective:b,name:a.name}}),this.$el.html(d.Editor({id:this.id,perspectives:b})),this.$el.find(".dropdown-toggle").dropdown(),a=this.$el.find(".perspectives-container"),_.each(this.perspectives,function(b,d){return a.append(b.render()),d===c.activePerspective?b.show():b.$el.addClass("disp-none")}),this.undoHistoryChanged(),this.rawTextModal=new f,this.$el.append(this.rawTextModal.render()),this.openDialog=new g,this.saveAsDialog=new h,this.$el.append(this.openDialog.render()),this.$el.append(this.saveAsDialog.render()),this.backgroundPickerModal=new j({bgOpts:{type:"radial",controlPoints:["#F0F0F0 0%","#BEBEBE 100%"]}}),this.$el.append(this.backgroundPickerModal.render()),this.$el}})}),define("model/presentation/Slide",["vendor/backbone","model/geom/SpatialObject","./components/ComponentFactory"],function(a,b,c){return b.extend({initialize:function(){var b,d,e=this;return b=this.get("components"),b==null?this.set("components",[]):(d=[],this.set("components",d),b.forEach(function(b){var f;if(b instanceof a.Model)f=b.clone(),d.push(f);else switch(b.type){case"ImageModel":f=c.createImage(b),d.push(f);break;case"TextBox":f=c.createTextBox(b),d.push(f)}return e._registerWithComponent(f)})),this.on("unrender",this._unrendered,this)},_unrendered:function(){return this.get("components").forEach(function(a){return a.trigger("unrender",!0)})},_registerWithComponent:function(a){return a.on("dispose",this.remove,this),a.on("change:selected",this.selectionChanged,this),a.on("change",this.componentChanged,this)},getPositionData:function(){return{x:this.attributes.x,y:this.attributes.y,z:this.attributes.z,impScale:this.attributes.impScale,rotateX:this.attributes.rotateX,rotateY:this.attributes.rotateY,rotateZ:this.attributes.rotateZ}},add:function(a){return this.attributes.components.push(a),this._registerWithComponent(a),this.trigger("contentsChanged"),this.trigger("change:components.add",this,a)},dispose:function(){return this.set({active:!1,selected:!1}),this.trigger("dispose",this),this.off("dispose")},remove:function(a){var b;b=this.attributes.components.indexOf(a);if(b!==-1)return this.attributes.components.splice(b,1),this.trigger("contentsChanged"),this.trigger("change:components.remove",this,a),a.trigger("unrender"),a.off(null,null,this)},componentChanged:function(){return this.trigger("contentsChanged")},unselectComponents:function(){if(this.lastSelection)return this.lastSelection.set("selected",!1)},selectionChanged:function(a,b){return b?(this.lastSelection!==a&&(this.attributes.components.forEach(function(b){if(b!==a)return b.set("selected",!1)}),this.lastSelection=a),this.trigger("change:activeComponent",this,a,b)):(this.trigger("change:activeComponent",this,null),this.lastSelection=null)},constructor:function(){b.prototype.constructor.apply(this,arguments)}})}),define("model/presentation/SlideCollection",["common/Calcium","./Slide"],function(a,b){var c;return c=function(a,b){return a.get("num")-b.get("num")},a.Collection.extend({model:b,initialize:function(){return this.on("add",this._updateNumbers,this),this.on("remove",this._updateNumbers,this)},_updateNumbers:function(){return this.models.forEach(function(a,b){return a.set("num",b)})},sort:function(a){var b,d=this;return a||(a={}),b={},this.models.forEach(function(a,c){var e;e=a.get("num");if(e!==c&&!b[e])return b[e]=!0,b[c]=!0,d._swapTransitionPositions(a,d.models[e])}),this.models.sort(c)},_swapTransitionPositions:function(a,b){var c,d;return d=a.getPositionData(),c={silent:!0},a.set(b.getPositionData(),c),b.set(d,c)}})}),define("common/collections/LinkedList",[],function(){var a;return a=function(){function a(){this.head=this.tail=null,this.length=0}return a.name="LinkedList",a.prototype.push=function(a){var b;return b={prev:null,next:null,value:a},this.tail!=null?(this.tail.next=b,b.prev=this.tail,this.tail=b):this.head=this.tail=b,++this.length,this},a.prototype.pop=function(){var a;if(this.tail==null)throw"List is empty";return a=this.tail.value,this.tail===this.head?this.tail=this.head=null:(this.tail=this.tail.prev,this.tail.next=null),--this.length,a},a.prototype.shift=function(){var a;if(this.head==null)throw"List is empty";return a=this.head.value,this.tail===this.head?this.tail=this.head=null:(this.head=this.head.next,this.head.prev=null),--this.length,a},a.prototype.unshift=function(a){var b;return b={prev:null,next:null,value:a},this.head!=null?(this.head.prev=b,b.next=this.head,this.head=b):this.head=this.tail=b,++this.length,this},a.prototype.first=function(){return this.head.value},a.prototype.last=function(){return this.tail.value},a.prototype.forEach=function(a){var b,c,d;b=this.head,c=0,d=[];while(b!==null)a(b.value,c++,this),d.push(b=b.next);return d},a}()}),define("model/common_application/UndoHistory",["common/EventEmitter","common/collections/LinkedList"],function(a,b){var c;return c=function(){function c(c){this.size=c,this.actions=new b,this.cursor=null,this.undoCount=0,_.extend(this,new a)}return c.name="UndoHistory",c.prototype.push=function(a){var b;return this.actions.length-this.undoCount0?(b={prev:null,next:null,value:a},this.cursor?(b.prev=this.cursor,this.cursor.next.prev=null,this.cursor.next=b,this.actions.length+=1,this.actions.length=this.actions.length-this.undoCount):(this.actions.head=b,this.actions.tail=b,this.actions.length=1),this.undoCount=0,this.cursor=null):this.actions.push(a):(this.actions.shift(),this.actions.push(a)),this.emit("updated"),this},c.prototype.undoName=function(){var a;return this.undoCount0?(this.cursor==null?a=this.actions.head:a=this.cursor.next,a!=null?a.value.name:""):""},c.prototype.undo=function(){return this.undoCount0&&(this.cursor==null?this.cursor=this.actions.head:this.cursor=this.cursor.next,this.cursor.value["do"](),--this.undoCount,this.emit("updated")),this},c}()}),define("model/presentation/Deck",["common/Calcium","./SlideCollection","./Slide","model/common_application/UndoHistory"],function(a,b,c,d){var e,f;return e=function(a){return this.deck=a,this},e.prototype={"do":function(){var a;return a=this.deck.get("slides"),this.slide==null&&(this.slide=new c({num:a.length})),a.add(this.slide),this.slide},undo:function(){return this.deck.get("slides").remove(this.slide),this.slide},name:"Create Slide"},f=function(a,b){return this.deck=a,this.slide=b,this},f.prototype={"do":function(){var a;return a=this.deck.get("slides"),a.remove(this.slide),this.slide},undo:function(){return this.deck.get("slides").add(this.slide)},name:"Remove Slide"},a.Model.extend({initialize:function(){var a;return this.undoHistory=new d(20),this.set("slides",new b),a=this.get("slides"),a.on("add",this._slideAdded,this),a.on("remove",this._slideRemoved,this),a.on("reset",this._slidesReset,this),this._lastSelected=null},newSlide:function(){var a,b;return a=new e(this),b=a["do"](),this.undoHistory.push(a),b},set:function(b,c){return b==="activeSlide"&&this._activeSlideChanging(c),a.Model.prototype.set.apply(this,arguments)},"import":function(a){var b,c;return c=this.get("slides"),b=this.get("activeSlide"),b!=null&&b.unselectComponents(),this.set("activeSlide",null),c.reset(a.slides)},_activeSlideChanging:function(a){var b;b=this.get("activeSlide");if(a===b)return null;b!=null&&(b.unselectComponents(),b.set({active:!1,selected:!1}));if(a!=null)return a.set({selected:!0,active:!0})},_slideAdded:function(a,b){return this.set("activeSlide",a),this._registerWithSlide(a)},_slideDisposed:function(a){return a.off(null,null,this)},_slideRemoved:function(a,b,c){return console.log("Slide removed"),this.get("activeSlide")===a&&(c.index0?this.set("activeSlide",b.at(c.index-1)):this.set("activeSlide",null)),a.dispose()},_slidesReset:function(a,b,c){var d=this;return c.forEach(function(a){return a.dispose()}),a.forEach(function(a){d._registerWithSlide(a);if(a.get("active"))return a.trigger("change:active",a,!0);if(a.get("selected"))return a.set("selected",!1)})},_slideActivated:function(a,b){if(b)return this.set("activeSlide",a)},_slideSelected:function(a,b){return this._lastSelected!=null&&b&&this._lastSelected!==a&&this._lastSelected.set("selected",!1),this._lastSelected=a},_registerWithSlide:function(a){return a.on("change:active",this._slideActivated,this),a.on("change:selected",this._slideSelected,this),a.on("dispose",this._slideDisposed,this)},removeSlide:function(a){var b;return b=new f(this,a),a=b["do"](),this.undoHistory.push(b),a},addSlide:function(a){return this.get("slides").add(a)},undo:function(){return this.undoHistory.undo()},redo:function(){return this.undoHistory.redo()}})});var continuation;requirejs.config({paths:{css:"vendor/amd_plugins/css",text:"vendor/amd_plugins/text"}}),window.browserPrefix="",$.browser.mozilla?window.browserPrefix="-moz-":$.browser.msie?window.browserPrefix="-ms-":$.browser.opera?window.browserPrefix="-o-":$.browser.webkit&&(window.browserPrefix="-webkit-"),window.localStorage==null&&(window.localStorage={setItem:function(){},getItem:function(){},length:0}),requirejs(["vendor/backbone","state/DefaultState"],function(a,b){return a.sync=function(a,c,d){if(d.keyTrail!=null)return d.success(b.get(d.keyTrail))},window.slideConfig={size:{width:1024,height:768}},continuation()}),continuation=function(){return requirejs(["ui/editor/Editor","model/presentation/Deck"],function(a,b){var c,d;return c=new b,d=new a({model:c}),window.zTracker={z:0,next:function(){return++this.z}},$("body").append(d.render()),c.newSlide()})},define("main",function(){}) \ No newline at end of file diff --git a/client/web/scripts/ui/widgets/BackgroundPicker.js b/client/web/scripts/ui/widgets/BackgroundPicker.js index a063a48a3..308a1b89d 100644 --- a/client/web/scripts/ui/widgets/BackgroundPicker.js +++ b/client/web/scripts/ui/widgets/BackgroundPicker.js @@ -50,6 +50,7 @@ define(["vendor/backbone", "./Templates", "css!./res/css/BackgroundPicker.css"], this.$el.modal(); this.$gradientPicker = this.$el.find(".gradientPicker"); this.$gradientPreview = this.$el.find(".gradientPreview"); + this.$gradientPicker.css("width", 250); bgOpts = this.options.bgOpts || {}; bgOpts.change = function(points, styles) { return _this._updateGradientPreview(styles);