X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/bb42027c8fd9ed17234381d3c366c387a20592f0..8f2b5f13ac74ab18a0c2bac0e2d8209a40ce3c1c:/fnpjs/layout.js?ds=inline diff --git a/fnpjs/layout.js b/fnpjs/layout.js index d5fa098..05252fb 100644 --- a/fnpjs/layout.js +++ b/fnpjs/layout.js @@ -1,37 +1,37 @@ -define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) { - 'use strict'; - - var Layout = function(template) { - var layout = this; - this.dom = $(_.template(template)()); - this.views = {}; - - this.dom.onShow = function() { - _.values(layout.views).forEach(function(view) { - if(view.onShow) - view.onShow(); - }); - }; - this.dom.onHide = function() { - _.values(layout.views).forEach(function(view) { - if(view.onHide) - view.onHide(); - }); - }; - - }; - - Layout.prototype.setView = function(place, view) { - this.dom.find('[fnpjs-place=' + place + ']').append(view); - this.views[place] = view; - if(this.dom.is(':visible') && view.onShow) { - view.onShow(); - } - }; - - Layout.prototype.getAsView = function() { - return this.dom; - }; - - return {Layout: Layout}; +define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) { + 'use strict'; + + var Layout = function(template) { + var layout = this; + this.dom = $(_.template(template)()); + this.views = {}; + + this.dom.onShow = function() { + _.values(layout.views).forEach(function(view) { + if(view.onShow) + view.onShow(); + }); + }; + this.dom.onHide = function() { + _.values(layout.views).forEach(function(view) { + if(view.onHide) + view.onHide(); + }); + }; + + }; + + Layout.prototype.setView = function(place, view) { + this.dom.find('[fnpjs-place=' + place + ']').append(view); + this.views[place] = view; + if(this.dom.is(':visible') && view.onShow) { + view.onShow(); + } + }; + + Layout.prototype.getAsView = function() { + return this.dom; + }; + + return {Layout: Layout}; }); \ No newline at end of file