From 4bb6bcb85b377876e31f4aef2a1a81cb6510fd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ramo=CC=81n=20Lamana?= Date: Tue, 14 May 2013 17:53:30 +0200 Subject: [PATCH] Fixes minimize restoration too --- build/ventus.js | 6 +++--- build/ventus.min.js | 2 +- src/ventus/wm/window.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/ventus.js b/build/ventus.js index c0374a2..e2833ee 100644 --- a/build/ventus.js +++ b/build/ventus.js @@ -965,11 +965,11 @@ function(Emitter, View, WindowTemplate) { set minimized(value) { if(value) { - this.stamp(); - this.signals.emit('minimize', this); + this._restoreMinimized = this.stamp(); + this.signals.emit('minimize', this, this._restoreMinimized); } else { - this.signals.emit('restore', this); + this.signals.emit('restore', this, this._restoreMinimized); } this._minimized = value; diff --git a/build/ventus.min.js b/build/ventus.min.js index de4858b..f7f3802 100644 --- a/build/ventus.min.js +++ b/build/ventus.min.js @@ -30,4 +30,4 @@ * https://github.com/rlamana */ -(function(e,t){typeof define=="function"&&define.amd?define(["$","handlebars"],t):e.Ventus=t(e.$,e.Handlebars)})(this,function(e,t){var n,r,i;return function(e){function c(e,t){var n=t&&t.split("/"),r=o.map,i=r&&r["*"]||{},s,u,a,f,l,c,h,p,d,v;if(e&&e.charAt(0)==="."&&t){n=n.slice(0,n.length-1),e=n.concat(e.split("/"));for(p=0;v=e[p];p++)if(v===".")e.splice(p,1),p-=1;else if(v===".."){if(p===1&&(e[2]===".."||e[0]===".."))return!0;p>0&&(e.splice(p-1,2),p-=2)}e=e.join("/")}if((n||i)&&r){s=e.split("/");for(p=s.length;p>0;p-=1){u=s.slice(0,p).join("/");if(n)for(d=n.length;d>0;d-=1){a=r[n.slice(0,d).join("/")];if(a){a=a[u];if(a){f=a,l=p;break}}}if(f)break;!c&&i&&i[u]&&(c=i[u],h=p)}!f&&c&&(f=c,l=h),f&&(s.splice(0,l,f),e=s.join("/"))}return e}function h(t,n){return function(){return l.apply(e,a.call(arguments,0).concat([t,n]))}}function p(e){return function(t){return c(t,e)}}function d(e){return function(n){t[e]=n}}function v(n){if(s.hasOwnProperty(n)){var r=s[n];delete s[n],u[n]=!0,f.apply(e,r)}if(!t.hasOwnProperty(n))throw new Error("No "+n);return t[n]}function m(e,t){var n,r,i=e.indexOf("!");return i!==-1?(n=c(e.slice(0,i),t),e=e.slice(i+1),r=v(n),r&&r.normalize?e=r.normalize(e,p(t)):e=c(e,t)):e=c(e,t),{f:n?n+"!"+e:e,n:e,p:r}}function g(e){return function(){return o&&o.config&&o.config[e]||{}}}var t={},s={},o={},u={},a=[].slice,f,l;f=function(n,r,i,o){var a=[],f,l,c,p,y,b;o=o||n;if(typeof i=="function"){r=!r.length&&i.length?["require","exports","module"]:r;for(b=0;b\n
\n
\n

',u=n.title,u?o=u.call(t,{hash:{}}):(o=t.title,o=typeof o===a?o():o),s+=f(o)+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n\n',s})}),i("less",[],function(){var e={options:{},load:function(t,n,r,i){var s;this.options=i.css;if(i.isBuild||!i.debug){r();return}r()},write:function(t,n,e){}};return e}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/view","tpl!ventus/tpl/window","less!ventus/css/window"],function(e,t,n){var r=function(r){this.signals=new e,r=r||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0},this.el=t(n({title:r.title,classname:r.classname||""})),this.el.listen(this.events.window,this),r.opacity&&this.el.css("opacity",r.opacity),this.$content=this.el.find(".wm-content"),r.content&&this.$content.append(r.content),this.$titlebar=this.el.find("header"),this.width=r.width||400,this.height=r.height||200,this.x=r.x||0,this.y=r.y||0,this.z=1e4,this.opened=!1,this.enabled=!0,this.active=!1,this.closed=!1,this.maximized=!1,this.minimized=!1,this.widget=!1,this.movable=!0,this.resizable=typeof r.resizable!="undefined"?r.resizable:!0,this.titlebar=!0};return r.prototype={_restore:null,_moving:null,_resizing:null,slots:{move:function(e){if(!this.enabled||!this.movable)return;this._moving=this.toLocal({x:e.originalEvent.pageX,y:e.originalEvent.pageY}),this.el.addClass("move"),e.preventDefault()}},events:{window:{click:function(e){this.signals.emit("select",this,e)},mousedown:function(e){this.focus(),this.widget&&this.slots.move.call(this,e)},".wm-content click":function(e){this.enabled&&this.signals.emit("click",this,e)},".wm-window-title mousedown":function(e){this.slots.move.call(this,e)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(e){this.focus(),e.stopPropagation(),e.preventDefault()},"button.wm-resize mousedown":function(e){if(!this.enabled||!this.resizable)return;this._resizing={width:this.width-e.originalEvent.pageX,height:this.height-e.originalEvent.pageY},this.el.addClass("resizing"),e.preventDefault()}},space:{mousemove:function(e){this._moving&&this.move(e.originalEvent.pageX-this._moving.x,e.originalEvent.pageY-this._moving.y),this._resizing&&this.resize(e.originalEvent.pageX+this._resizing.width,e.originalEvent.pageY+this._resizing.height)},mouseup:function(){this._moving&&(this.el.removeClass("move"),this._moving=null),this._resizing&&(this.el.removeClass("resizing"),this._restore=null,this._resizing=null)}}},set space(e){if(e&&!e.listen){console.error("The given space element is not a valid View");return}this._space=e,e.append(this.el),e.listen(this.events.space,this)},get space(){return this._space},get maximized(){return this._maximized},set maximized(e){e?(this._restoreMaximized=this.stamp(),this.signals.emit("maximize",this,this._restoreMaximized)):this.signals.emit("restore",this,this._restoreMaximized),this._maximized=e},get minimized(){return this._minimized},set minimized(e){e?(this.stamp(),this.signals.emit("minimize",this)):this.signals.emit("restore",this),this._minimized=e},set active(e){e?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=e},get active(){return this._active},set enabled(e){e?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=e},get enabled(){return this._enabled},set movable(e){this._movable=!!e},get movable(){return this._movable},set resizable(e){e?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!e},get resizable(){return this._resizable},set closed(e){e&&(this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.$content.html("")},this)),this._closed=e},get closed(){return this._closed},set opened(e){e&&(this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening")},this)),this._opened=e},get opened(){return this._opened},set widget(e){this._widget=e},get widget(){return this._widget},set titlebar(e){e?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=e},get titlebar(){return this._titlebar},set width(e){this.el.width(e)},get width(){return parseInt(this.el.width(),10)},set height(e){this.el.height(e)},get height(){return parseInt(this.el.height(),10)},set x(e){this.el.css("left",e)},set y(e){this.el.css("top",e)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(e){this.el.css("z-index",e)},get z(){return parseInt(this.el.css("z-index"),10)},open:function(){return this.opened=!0,this},resize:function(e,t){return this.width=e,this.height=t,this},move:function(e,t){return this.x=e,this.y=t,this},stamp:function(){return this.restore=function(){var e={width:this.width,height:this.height},t={x:this.x,y:this.y};return function(){return this.resize(e.width,e.height),this.move(t.x,t.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){return this.el.addClass("maximazing"),this.el.onTransitionEnd(function(){this.el.removeClass("maximazing")},this),this.maximized=!this.maximized,this},minimize:function(){return this.el.addClass("minimizing"),this.el.onTransitionEnd(function(){this.el.removeClass("minimizing")},this),this.minimized=!this.minimized,this},close:function(){return this.closed=!0,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(e){return{x:e.x-this.x,y:e.y-this.y}},toGlobal:function(e){return{x:e.x+this.x,y:e.y+this.y}},append:function(e){e.appendTo(this.$content)}},r}),i("ventus/wm/modes/default",["less!../../../css/windowmanager"],function(){var e={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(e){e.move(0,0),e.el.css("-webkit-transform","translate3d(0, 0, 0);"),e.resize(this.el.width(),this.el.height())},restore:function(e,t){t.call(e)},minimize:function(e){e.resize(0,0)}}};return e}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){return e instanceof x?e:this instanceof x?(this._wrapped=e,void 0):new x(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(null!=e)if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;s>i;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return null==e?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);if(T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)}),!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}if(T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)}),!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){return t.call(n,e,i,s)?(r=e,!0):void 0}),r},x.filter=x.select=function(e,t,n){var r=[];return null==e?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return null==e?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){return(i=i&&t.call(r,e,s,o))?void 0:n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return null==e?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){return i||(i=t.call(r,e,s,o))?n:void 0}),!!i)};x.contains=x.include=function(e,t){return null==e?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?null:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-1/0;var r={computed:-1/0,value:-1/0};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return 1/0;var r={computed:1/0,value:1/0};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;r.computed>o&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(r>n||r===void 0)return-1}return e.indexs;){var u=s+o>>>1;i>n.call(r,e[u])?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return null==e?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:u.call(e,0,t)},x.initial=function(e,t,n){return u.call(e,0,e.length-(null==t||n?1:t))},x.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:u.call(e,Math.max(e.length-t,0))},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,null==t||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){(t?r&&o[o.length-1]===n:x.contains(o,n))||(o.push(n),s.push(e[r]))}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){for(var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=Array(t),r=0;t>r;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(null==e)return{};for(var n={},r=0,i=e.length;i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(null==e)return-1;var r=0,i=e.length;if(n){if("number"!=typeof n)return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=0>n?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;i>r;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(null==e)return-1;var r=null!=n;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);for(var i=r?n:e.length;i--;)if(e[i]===t)return i;return-1},x.range=function(e,t,n){1>=arguments.length&&(t=e||0,e=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=Array(r);r>i;)s[i++]=e,e+=n;return s},x.bind=function(e,t){if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));var n=u.call(arguments,2);return function(){return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return 0===t.length&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,0>=f?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return 0>=e?t():function(){return 1>--e?t.apply(this,arguments):void 0}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)null==e[n]&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var O=function(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==t+"";case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var s=n.length;s--;)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if("[object Array]"==i){if(o=e.length,u=o==t.length)for(;o--&&(u=O(e[o],t[o],n,r)););}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)&&(o++,!(u=x.has(t,c)&&O(e[c],t[c],n,r))))break;if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return O(e,t,[],[])},x.isEmpty=function(e){if(null==e)return!0;if(x.isArray(e)||x.isString(e))return 0===e.length;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&1===e.nodeType},x.isArray=w||function(e){return"[object Array]"==f.call(e)},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),"function"!=typeof /./&&(x.isFunction=function(e){return"function"==typeof e}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==f.call(e)},x.isNull=function(e){return null===e},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){for(var r=Array(e),i=0;e>i;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var M={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};M.unescape=x.invert(M.escape);var _={escape:RegExp("["+x.keys(M.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(M.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return null==t?"":(""+t).replace(_[e],function(t){return M[e][t]})}}),x.result=function(e,t){if(null==e)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),j.call(this,n.apply(x,e))}})};var D=0;x.uniqueId=function(e){var t=++D+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(B,function(e){return"\\"+H[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var j=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],j.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return j.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("Underscore",function(e){return function(){var t,n;return t||e._}}(this)),i("ventus/wm/modes/expose",["Underscore","less!../../../css/expose"],function(e){var t={register:function(){var t=this;console.log("Expose mode registered."),this.el.on("contextmenu",e.throttle(function(){return t.mode!=="expose"?t.mode="expose":t.mode==="expose"&&(t.mode="default"),!1},1e3))},plug:function(){var e=Math.floor,t=Math.ceil,n=this,r=t(this.windows.length/2),i=e(this.el.width()/r),s=e(this.el.height()/2),o,u,a,f;this.el.addClass("expose");for(var l,c,h=0,p=this.windows.length;hc.width?o=c.height>s?s/c.height:1:o=c.width>i?i/c.width:1,o-=.15,f={x:h%r*i,y:(h
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(e){this[e]=function(e){return function(){this.currentMode.actions[e]&&this.currentMode.actions[e].apply(this,arguments)}}.call(this,e)},this);for(var e in this.modes)this.modes.hasOwnProperty(e)&&this.modes[e].register&&this.modes[e].register.apply(this);this.windows=[],this.active=null,this.mode="default",this.createWindow.fromQuery=this.createWindow.fromQuery.bind(this),this.createWindow.fromElement=this.createWindow.fromElement.bind(this)};return u.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:s,fullscreen:o},set mode(e){var t=this.modes[e];if(!t||this._mode===e)return;this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),t.plug&&t.plug.apply(this),this._mode=e},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(e){this.$overlay.css("opacity",e?.8:0),this._overlay=e},get overlay(){return this._overlay},createWindow:function(e){var t=new n(e);return this.mode="default",t.signals.on("focus",this._focus,this),t.signals.on("blur",this._blur,this),t.signals.on("close",this._close,this),this.actions.forEach(function(e){t.signals.on(e,this[e],this)},this),this.windows.push(t),t.space=this.el,t.focus(),t},_focus:function(e){var t,n=1e4,r=n+1e4,i;if(this.active&&this.active===e)return;this.active?(t=this.active.z,this.active.blur()):t=n,i=this.windows.indexOf(e),this.windows.splice(i,1),this.windows.push(e),e.z=t+1;if(t>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=n+(s-r);this.active=e},_blur:function(e){this.active===e&&(this.active=null)},_close:function(e){var t=this.windows.indexOf(e),n;if(t===-1){console.log("Trying to close a window that doesn't exist in this window manager");return}this.windows.splice(t,1),n=this.windows.length,this.active&&this.active===e&&(this.active=n!==0?this.windows[n-1]:null,this.active&&this.active.focus())}},u.prototype.createWindow.fromQuery=function(e,t){return t.content=r(e),this.createWindow(t)},u.prototype.createWindow.fromElement=function(e,t){return t.content=r(e),this.createWindow(t)},u}),i("ventus",["require","ventus/wm/windowmanager","ventus/wm/window"],function(e){return{version:"0.1",browser:{animationEventName:function(){var e=document.body.style,t=null;return e.animation===""?t="animationend":e.MozAnimation===""?t="mozAnimationEnd":e.webkitAnimation===""&&(t="webkitAnimationEnd"),t}},WindowManager:e("ventus/wm/windowmanager"),Window:e("ventus/wm/window")}}),i("$",function(){return e}),i("handlebars",function(){return t}),r("ventus")}); \ No newline at end of file +(function(e,t){typeof define=="function"&&define.amd?define(["$","handlebars"],t):e.Ventus=t(e.$,e.Handlebars)})(this,function(e,t){var n,r,i;return function(e){function c(e,t){var n=t&&t.split("/"),r=o.map,i=r&&r["*"]||{},s,u,a,f,l,c,h,p,d,v;if(e&&e.charAt(0)==="."&&t){n=n.slice(0,n.length-1),e=n.concat(e.split("/"));for(p=0;v=e[p];p++)if(v===".")e.splice(p,1),p-=1;else if(v===".."){if(p===1&&(e[2]===".."||e[0]===".."))return!0;p>0&&(e.splice(p-1,2),p-=2)}e=e.join("/")}if((n||i)&&r){s=e.split("/");for(p=s.length;p>0;p-=1){u=s.slice(0,p).join("/");if(n)for(d=n.length;d>0;d-=1){a=r[n.slice(0,d).join("/")];if(a){a=a[u];if(a){f=a,l=p;break}}}if(f)break;!c&&i&&i[u]&&(c=i[u],h=p)}!f&&c&&(f=c,l=h),f&&(s.splice(0,l,f),e=s.join("/"))}return e}function h(t,n){return function(){return l.apply(e,a.call(arguments,0).concat([t,n]))}}function p(e){return function(t){return c(t,e)}}function d(e){return function(n){t[e]=n}}function v(n){if(s.hasOwnProperty(n)){var r=s[n];delete s[n],u[n]=!0,f.apply(e,r)}if(!t.hasOwnProperty(n))throw new Error("No "+n);return t[n]}function m(e,t){var n,r,i=e.indexOf("!");return i!==-1?(n=c(e.slice(0,i),t),e=e.slice(i+1),r=v(n),r&&r.normalize?e=r.normalize(e,p(t)):e=c(e,t)):e=c(e,t),{f:n?n+"!"+e:e,n:e,p:r}}function g(e){return function(){return o&&o.config&&o.config[e]||{}}}var t={},s={},o={},u={},a=[].slice,f,l;f=function(n,r,i,o){var a=[],f,l,c,p,y,b;o=o||n;if(typeof i=="function"){r=!r.length&&i.length?["require","exports","module"]:r;for(b=0;b\n
\n
\n

',u=n.title,u?o=u.call(t,{hash:{}}):(o=t.title,o=typeof o===a?o():o),s+=f(o)+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n\n',s})}),i("less",[],function(){var e={options:{},load:function(t,n,r,i){var s;this.options=i.css;if(i.isBuild||!i.debug){r();return}r()},write:function(t,n,e){}};return e}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/view","tpl!ventus/tpl/window","less!ventus/css/window"],function(e,t,n){var r=function(r){this.signals=new e,r=r||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0},this.el=t(n({title:r.title,classname:r.classname||""})),this.el.listen(this.events.window,this),r.opacity&&this.el.css("opacity",r.opacity),this.$content=this.el.find(".wm-content"),r.content&&this.$content.append(r.content),this.$titlebar=this.el.find("header"),this.width=r.width||400,this.height=r.height||200,this.x=r.x||0,this.y=r.y||0,this.z=1e4,this.opened=!1,this.enabled=!0,this.active=!1,this.closed=!1,this.maximized=!1,this.minimized=!1,this.widget=!1,this.movable=!0,this.resizable=typeof r.resizable!="undefined"?r.resizable:!0,this.titlebar=!0};return r.prototype={_restore:null,_moving:null,_resizing:null,slots:{move:function(e){if(!this.enabled||!this.movable)return;this._moving=this.toLocal({x:e.originalEvent.pageX,y:e.originalEvent.pageY}),this.el.addClass("move"),e.preventDefault()}},events:{window:{click:function(e){this.signals.emit("select",this,e)},mousedown:function(e){this.focus(),this.widget&&this.slots.move.call(this,e)},".wm-content click":function(e){this.enabled&&this.signals.emit("click",this,e)},".wm-window-title mousedown":function(e){this.slots.move.call(this,e)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(e){e.stopPropagation(),e.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(e){this.focus(),e.stopPropagation(),e.preventDefault()},"button.wm-resize mousedown":function(e){if(!this.enabled||!this.resizable)return;this._resizing={width:this.width-e.originalEvent.pageX,height:this.height-e.originalEvent.pageY},this.el.addClass("resizing"),e.preventDefault()}},space:{mousemove:function(e){this._moving&&this.move(e.originalEvent.pageX-this._moving.x,e.originalEvent.pageY-this._moving.y),this._resizing&&this.resize(e.originalEvent.pageX+this._resizing.width,e.originalEvent.pageY+this._resizing.height)},mouseup:function(){this._moving&&(this.el.removeClass("move"),this._moving=null),this._resizing&&(this.el.removeClass("resizing"),this._restore=null,this._resizing=null)}}},set space(e){if(e&&!e.listen){console.error("The given space element is not a valid View");return}this._space=e,e.append(this.el),e.listen(this.events.space,this)},get space(){return this._space},get maximized(){return this._maximized},set maximized(e){e?(this._restoreMaximized=this.stamp(),this.signals.emit("maximize",this,this._restoreMaximized)):this.signals.emit("restore",this,this._restoreMaximized),this._maximized=e},get minimized(){return this._minimized},set minimized(e){e?(this._restoreMinimized=this.stamp(),this.signals.emit("minimize",this,this._restoreMinimized)):this.signals.emit("restore",this,this._restoreMinimized),this._minimized=e},set active(e){e?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=e},get active(){return this._active},set enabled(e){e?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=e},get enabled(){return this._enabled},set movable(e){this._movable=!!e},get movable(){return this._movable},set resizable(e){e?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!e},get resizable(){return this._resizable},set closed(e){e&&(this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.$content.html("")},this)),this._closed=e},get closed(){return this._closed},set opened(e){e&&(this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening")},this)),this._opened=e},get opened(){return this._opened},set widget(e){this._widget=e},get widget(){return this._widget},set titlebar(e){e?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=e},get titlebar(){return this._titlebar},set width(e){this.el.width(e)},get width(){return parseInt(this.el.width(),10)},set height(e){this.el.height(e)},get height(){return parseInt(this.el.height(),10)},set x(e){this.el.css("left",e)},set y(e){this.el.css("top",e)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(e){this.el.css("z-index",e)},get z(){return parseInt(this.el.css("z-index"),10)},open:function(){return this.opened=!0,this},resize:function(e,t){return this.width=e,this.height=t,this},move:function(e,t){return this.x=e,this.y=t,this},stamp:function(){return this.restore=function(){var e={width:this.width,height:this.height},t={x:this.x,y:this.y};return function(){return this.resize(e.width,e.height),this.move(t.x,t.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){return this.el.addClass("maximazing"),this.el.onTransitionEnd(function(){this.el.removeClass("maximazing")},this),this.maximized=!this.maximized,this},minimize:function(){return this.el.addClass("minimizing"),this.el.onTransitionEnd(function(){this.el.removeClass("minimizing")},this),this.minimized=!this.minimized,this},close:function(){return this.closed=!0,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(e){return{x:e.x-this.x,y:e.y-this.y}},toGlobal:function(e){return{x:e.x+this.x,y:e.y+this.y}},append:function(e){e.appendTo(this.$content)}},r}),i("ventus/wm/modes/default",["less!../../../css/windowmanager"],function(){var e={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(e){e.move(0,0),e.el.css("-webkit-transform","translate3d(0, 0, 0);"),e.resize(this.el.width(),this.el.height())},restore:function(e,t){t.call(e)},minimize:function(e){e.resize(0,0)}}};return e}),function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){return e instanceof x?e:this instanceof x?(this._wrapped=e,void 0):new x(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.4";var T=x.each=x.forEach=function(e,t,r){if(null!=e)if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;s>i;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return null==e?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);if(T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)}),!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;if(null==e&&(e=[]),d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}if(T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)}),!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){return t.call(n,e,i,s)?(r=e,!0):void 0}),r},x.filter=x.select=function(e,t,n){var r=[];return null==e?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return null==e?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){return(i=i&&t.call(r,e,s,o))?void 0:n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return null==e?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){return i||(i=t.call(r,e,s,o))?n:void 0}),!!i)};x.contains=x.include=function(e,t){return null==e?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?null:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-1/0;var r={computed:-1/0,value:-1/0};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return 1/0;var r={computed:1/0,value:1/0};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;r.computed>o&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(r>n||r===void 0)return-1}return e.indexs;){var u=s+o>>>1;i>n.call(r,e[u])?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return null==e?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:u.call(e,0,t)},x.initial=function(e,t,n){return u.call(e,0,e.length-(null==t||n?1:t))},x.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:u.call(e,Math.max(e.length-t,0))},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,null==t||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){(t?r&&o[o.length-1]===n:x.contains(o,n))||(o.push(n),s.push(e[r]))}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){for(var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=Array(t),r=0;t>r;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(null==e)return{};for(var n={},r=0,i=e.length;i>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(null==e)return-1;var r=0,i=e.length;if(n){if("number"!=typeof n)return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=0>n?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;i>r;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(null==e)return-1;var r=null!=n;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);for(var i=r?n:e.length;i--;)if(e[i]===t)return i;return-1},x.range=function(e,t,n){1>=arguments.length&&(t=e||0,e=0),n=arguments[2]||1;for(var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=Array(r);r>i;)s[i++]=e,e+=n;return s},x.bind=function(e,t){if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));var n=u.call(arguments,2);return function(){return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return 0===t.length&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,0>=f?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return 0>=e?t():function(){return 1>--e?t.apply(this,arguments):void 0}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)null==e[n]&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var O=function(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==t+"";case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var s=n.length;s--;)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if("[object Array]"==i){if(o=e.length,u=o==t.length)for(;o--&&(u=O(e[o],t[o],n,r)););}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)&&(o++,!(u=x.has(t,c)&&O(e[c],t[c],n,r))))break;if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return O(e,t,[],[])},x.isEmpty=function(e){if(null==e)return!0;if(x.isArray(e)||x.isString(e))return 0===e.length;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&1===e.nodeType},x.isArray=w||function(e){return"[object Array]"==f.call(e)},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),"function"!=typeof /./&&(x.isFunction=function(e){return"function"==typeof e}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==f.call(e)},x.isNull=function(e){return null===e},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){for(var r=Array(e),i=0;e>i;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var M={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};M.unescape=x.invert(M.escape);var _={escape:RegExp("["+x.keys(M.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(M.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return null==t?"":(""+t).replace(_[e],function(t){return M[e][t]})}}),x.result=function(e,t){if(null==e)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),j.call(this,n.apply(x,e))}})};var D=0;x.uniqueId=function(e){var t=++D+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},B=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(B,function(e){return"\\"+H[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var j=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],j.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return j.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("Underscore",function(e){return function(){var t,n;return t||e._}}(this)),i("ventus/wm/modes/expose",["Underscore","less!../../../css/expose"],function(e){var t={register:function(){var t=this;console.log("Expose mode registered."),this.el.on("contextmenu",e.throttle(function(){return t.mode!=="expose"?t.mode="expose":t.mode==="expose"&&(t.mode="default"),!1},1e3))},plug:function(){var e=Math.floor,t=Math.ceil,n=this,r=t(this.windows.length/2),i=e(this.el.width()/r),s=e(this.el.height()/2),o,u,a,f;this.el.addClass("expose");for(var l,c,h=0,p=this.windows.length;hc.width?o=c.height>s?s/c.height:1:o=c.width>i?i/c.width:1,o-=.15,f={x:h%r*i,y:(h
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(e){this[e]=function(e){return function(){this.currentMode.actions[e]&&this.currentMode.actions[e].apply(this,arguments)}}.call(this,e)},this);for(var e in this.modes)this.modes.hasOwnProperty(e)&&this.modes[e].register&&this.modes[e].register.apply(this);this.windows=[],this.active=null,this.mode="default",this.createWindow.fromQuery=this.createWindow.fromQuery.bind(this),this.createWindow.fromElement=this.createWindow.fromElement.bind(this)};return u.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:s,fullscreen:o},set mode(e){var t=this.modes[e];if(!t||this._mode===e)return;this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),t.plug&&t.plug.apply(this),this._mode=e},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(e){this.$overlay.css("opacity",e?.8:0),this._overlay=e},get overlay(){return this._overlay},createWindow:function(e){var t=new n(e);return this.mode="default",t.signals.on("focus",this._focus,this),t.signals.on("blur",this._blur,this),t.signals.on("close",this._close,this),this.actions.forEach(function(e){t.signals.on(e,this[e],this)},this),this.windows.push(t),t.space=this.el,t.focus(),t},_focus:function(e){var t,n=1e4,r=n+1e4,i;if(this.active&&this.active===e)return;this.active?(t=this.active.z,this.active.blur()):t=n,i=this.windows.indexOf(e),this.windows.splice(i,1),this.windows.push(e),e.z=t+1;if(t>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=n+(s-r);this.active=e},_blur:function(e){this.active===e&&(this.active=null)},_close:function(e){var t=this.windows.indexOf(e),n;if(t===-1){console.log("Trying to close a window that doesn't exist in this window manager");return}this.windows.splice(t,1),n=this.windows.length,this.active&&this.active===e&&(this.active=n!==0?this.windows[n-1]:null,this.active&&this.active.focus())}},u.prototype.createWindow.fromQuery=function(e,t){return t.content=r(e),this.createWindow(t)},u.prototype.createWindow.fromElement=function(e,t){return t.content=r(e),this.createWindow(t)},u}),i("ventus",["require","ventus/wm/windowmanager","ventus/wm/window"],function(e){return{version:"0.1",browser:{animationEventName:function(){var e=document.body.style,t=null;return e.animation===""?t="animationend":e.MozAnimation===""?t="mozAnimationEnd":e.webkitAnimation===""&&(t="webkitAnimationEnd"),t}},WindowManager:e("ventus/wm/windowmanager"),Window:e("ventus/wm/window")}}),i("$",function(){return e}),i("handlebars",function(){return t}),r("ventus")}); \ No newline at end of file diff --git a/src/ventus/wm/window.js b/src/ventus/wm/window.js index 3571486..638fcd5 100644 --- a/src/ventus/wm/window.js +++ b/src/ventus/wm/window.js @@ -231,11 +231,11 @@ function(Emitter, View, WindowTemplate) { set minimized(value) { if(value) { - this.stamp(); - this.signals.emit('minimize', this); + this._restoreMinimized = this.stamp(); + this.signals.emit('minimize', this, this._restoreMinimized); } else { - this.signals.emit('restore', this); + this.signals.emit('restore', this, this._restoreMinimized); } this._minimized = value;