Browse files

Added dialog system directly to butter (non functional).

  • Loading branch information...
1 parent 12898fe commit 696a6d9cbfb9f6257668cf043a570ff2889de8ba @secretrobotron committed Jan 24, 2012
View
5 butter/src/butter-main.js
@@ -36,8 +36,9 @@ THE SOFTWARE.
"previewer/module",
"trackeditor/module",
"pluginmanager/module",
- "timeline/module" ],
- function( require, Logger, EventManager, Track, TrackEvent, Target, Media ) {
+ "timeline/module",
+ "dialogs/module" ],
+ function( require, Logger, EventManager, Track, TrackEvent, Target, Media, Dialogs ) {
var Butter = function ( options ) {
View
73 butter/src/dialogs/base-dialog.js
@@ -0,0 +1,73 @@
+define( [], function(){
+
+ var BaseDialog = function( context, baseOptions, parentDialog ) {
+
+ var _this = this,
+ _type = baseOptions.type,
+ _modal = baseOptions.modal || false,
+ _template = baseOptions.template,
+ _open = false;
+
+ if( typeof _template === "string" ){
+ _template = context.getTemplate( _template );
+ } //if
+
+ this.open = function(){
+ if( _open ){
+ throw new Error( "Dialog already open!" );
+ } //if
+ _open = true;
+ }; //open
+
+ this.close = function(){
+ _open = false;
+ }; //close
+
+ this.prepareToShow = function( options ){
+ options = options || {};
+ var showOptions = {
+ modal: options.modal || _modal,
+ template: _template,
+ };
+ return showOptions;
+ }; //prepareToShow
+
+ this.applyProperties = function( object ){
+ Object.defineProperties( object, {
+ type: {
+ get: function() {
+ return _type;
+ }
+ },
+ template: {
+ get: function() {
+ return _template;
+ }
+ },
+ modal: {
+ get: function(){
+ return _modal;
+ }
+ },
+ isOpen: {
+ get: function(){
+ return _open;
+ }
+ },
+ canOpen: {
+ get: function(){
+ return !_open;
+ }
+ }
+ });
+ }; //applyProperties
+
+ _this.applyProperties( _this );
+ if( parentDialog ){
+ _this.applyProperties( parentDialog );
+ } //if
+
+ }; //BaseDialog
+
+ return BaseDialog;
+});
View
66 butter/src/dialogs/comm.js
@@ -0,0 +1,66 @@
+define( [ "./event-manager" ], function( EventManager ){
+
+ var __context = 1;
+
+ var Comm = function( clientWindow, readyCallback ) {
+ var _this = this,
+ _em = new EventManager( _this ),
+ _readyInterval,
+ _context = __context++
+ _destroyed = false,
+ _ponged = false;
+
+ clientWindow.addEventListener( "message", function( e ){
+ if( e.source === clientWindow && typeof e.data === "object" && e.data.context ){
+ if( e.data.type === "pong" ){
+ _ponged = true;
+ }
+ else {
+ _this.dispatch( e.data.type, e.data );
+ } //if
+ } //if
+ }, false );
+
+ function checkPing(){
+ if( !_destroyed ){
+ if( !_ponged ){
+ _this.dispatch( "error", {
+ type: "connectionclosed"
+ });
+ } //if
+ ping();
+ } //if
+ } //checkPing
+
+ function ping(){
+ _ponged = false;
+ _this.send( "ping" );
+ setTimeout( checkPing, 1000 );
+ } //ping
+
+ _em.listen( "ready", function( e ){
+ clearInterval( _readyInterval );
+ readyCallback();
+ ping();
+ });
+
+ _readyInterval = setInterval( function(){
+ _this.send( "ready", "ready" );
+ }, 100 );
+
+ this.send = function( type, data ){
+ clientWindow.postMessage({
+ type: type,
+ context: _context,
+ data: data
+ }, "*" );
+ }; //send
+
+ this.destroy = function(){
+ _destroyed = true;
+ clearInterval( _readyInterval );
+ }; //destroy
+ }; //Comm
+
+ return Comm;
+});
View
17 butter/src/dialogs/container.js
@@ -0,0 +1,17 @@
+define( [ "./util" ], function( util ){
+
+ var Container = function( element ) {
+ var _element = element,
+ _this = this;
+
+ util.addClass( _element, "dialog-container" );
+
+ Object.defineProperties( this, {
+ element: {
+ get: function(){ return _element; }
+ }
+ });
+ }; //Container
+
+ return Container;
+});
View
154 butter/src/dialogs/context.js
@@ -0,0 +1,154 @@
+define( [
+ "./util",
+ "./layer-manager",
+ "./template",
+ "./iframe-dialog",
+ "./window-dialog"
+ ], function( util, LayerManager, Template, IFRAMEDialog, WindowDialog ){
+
+ var Context = function() {
+
+ var _dialogs = {},
+ _this = this,
+ _layerManager = new LayerManager(),
+ _dialogTypes = {
+ "iframe": IFRAMEDialog,
+ "window": WindowDialog
+ },
+ _dialogTemplates = [];
+
+ var _body = document.body;
+
+ var innerUtil = {
+ getTemplate: function( name ){
+ if( typeof name === "string" ){
+ for( var i=0, l=_dialogTemplates.length; i<l; ++i ){
+ if( name === _dialogTemplates[ i ].name ){
+ return _dialogTemplates[ i ];
+ } //if
+ } //for
+ }
+ else if( typeof name === "object" ){
+ for( var i=0, l=_dialogTemplates.length; i<l; ++i ){
+ if( name === _dialogTemplates[ i ].element ){
+ return _dialogTemplates[ i ];
+ } //if
+ } //for
+ } //if
+ }
+ }; //innerUtil
+
+ this.add = function( name, options ){
+ if( !name || !options ){
+ throw new Error( "Name and options required to create a dialog." );
+ } //if
+ if( _dialogs[ name ] ){
+ throw new Error( "Dialog " + name + " already exists." );
+ } //if
+ var type = options.type || "dom";
+ if( type === "dom" ){
+ if( findExistingDOMDialog( options.element ) ){
+ throw new Error( "Dialog already exists!" );
+ } //if
+ } //if
+ _dialogs[ name ] = new _dialogTypes[ type ]( innerUtil, options );
+ }; //add
+
+ this.remove = function( name ){
+ var dialog = _dialogs[ name ];
+ if( dialog ){
+ dialog.hide();
+ delete _dialogs[ name ];
+ } //if
+ }; //remove
+
+ this.open = function( name, listeners ){
+ function onClose( e ){
+ dialog.unlisten( listeners );
+ dialog.unlisten( "close", onClose );
+ } //onClose
+ var dialog = _dialogs[ name ];
+ if( dialog && dialog.canOpen ){
+ dialog.listen( listeners );
+ dialog.listen( "close", onClose );
+ _layerManager.add( dialog );
+ } //if
+ }; //show
+
+ this.close = function( name ){
+ var dialog = _dialogs[ name ];
+ if( dialog ){
+ dialog.hide();
+ } //if
+ }; //hide
+
+ this.send = function( name, type, data ){
+ var dialog = _dialogs[ name ];
+ if( dialog ){
+ dialog.send( type, data );
+ } //if
+ }; //send
+
+ this.hideAll = function( name ){
+ for( var d in _dialogs ){
+ if( _dialogs.hasOwnProperty( d ) ){
+ _dialogs[ d ].hide();
+ } //if
+ } //for
+ }; //hideAll
+
+ function getDialogTemplates(){
+ var templates = document.querySelectorAll( "*[dialog-template]" );
+ for( var i=0; i<templates.length; ++i ){
+ var existingTemplate = undefined;
+ for( var j=0; i<_dialogTemplates.length; ++j ){
+ if( _dialogTemplates[ j ].element !== templates[ i ] ){
+ existingTemplate = _dialogTemplates[ j ];
+ break;
+ } //if
+ } //for
+ if( !existingTemplate ){
+ _dialogTemplates.push( new Template( templates[ i ] ) );
+ } //if
+ } //for
+ } //getDialogTemplates
+
+ function getDialogContents(){
+ var contents = document.querySelectorAll( "*[dialog-content]" );
+ for( var i=0; i<contents.length; ++i ){
+ var existingContent = findExistingDOMDialog( contents[ i ] );
+ if( !existingContent ){
+ _this.add( contents[ i ].id, {
+ type: "dom",
+ element: contents[ i ]
+ });
+ } //if
+ } //for
+ } //getDialogContents
+
+ function findExistingDOMDialog( element ){
+ if( typeof element === "string" ){
+ element = document.getElementById( element );
+ } //if
+ for( var d in _dialogs ){
+ if( _dialogs.hasOwnProperty( d ) ){
+ dialog = _dialogs[ d ];
+ if( dialog.type === "dom" && dialog.element === element ){
+ return dialog;
+ } //if
+ } //if
+ } //for
+ } //findExistingDOMDialog
+
+ document.addEventListener( "DOMContentLoaded", function( e ){
+ getDialogTemplates();
+ getDialogContents();
+ _body = document.body;
+ }, false );
+ getDialogTemplates();
+ getDialogContents();
+
+ }; //Context
+
+ return Context;
+});
View
64 butter/src/dialogs/dialog-comm.js
@@ -0,0 +1,64 @@
+(function( root ){
+var Comm = function(){
+ var _listeners = {},
+ _context,
+ _this = this;
+
+ root.addEventListener( "message", function( e ){
+ if( e.source !== root && typeof e.data === "object" ){
+ if( !_context || _context === e.data.context ){
+ if( e.data.type === "ping" ){
+ _this.send( "pong" );
+ }
+ else {
+ _this.dispatch( e.data.type, e.data );
+ } //if
+ } //if
+ } //if
+ }, false );
+
+ this.listen = function( type, listener ){
+ if( !_listeners[ type ] ){
+ _listeners[ type ] = [];
+ } //if
+ _listeners[ type ].push( listener );
+ return listener;
+ }; //listen
+
+ this.unlisten = function( type, listener ){
+ if( _listeners[ type ] ){
+ var idx = _listeners[ type ].indexOf( listener );
+ if( idx > -1 ){
+ _listeners[ type ].splice( idx, 1 );
+ } //if
+ } //if
+ return listener;
+ }; //unlisten
+
+ this.dispatch = function( type, data ){
+ var listeners = _listeners[ type ];
+ if( listeners ){
+ for( var i=0, l=listeners.length; i<l; ++i ){
+ listeners[ i ]( data );
+ } //for
+ } //if
+ }; //dispatch
+
+ this.send = function( type, data ){
+ window.postMessage({
+ type: type,
+ data: data,
+ context: _context
+ }, "*" );
+ }; //send
+
+ function onReady( e ){
+ _context = e.context;
+ _this.unlisten( "ready", onReady );
+ _this.send( "ready", "ready" );
+ } //onReady
+ _this.listen( "ready", onReady );
+
+}; //Comm
+root.Comm = Comm;
+})( window );
View
85 butter/src/dialogs/event-manager.js
@@ -0,0 +1,85 @@
+define( [], function(){
+
+ var EventManager = function( object ) {
+ var _listeners = [],
+ _target = this,
+ _this = this;
+
+ this.dispatch = function( eventName, eventData ) {
+ var e;
+ if( typeof( eventName ) !== "object" ){
+ e = {
+ type: eventName + "",
+ target: _target,
+ data: eventData,
+ };
+ }
+ else {
+ e = eventName;
+ eventName = e.type;
+ } //if
+ e.currentTarget = _target;
+ if( _listeners[ eventName ] ) {
+ var theseListeners = _listeners[ eventName ].slice();
+ for( var i=0, l=theseListeners.length; i<l; ++i ){
+ theseListeners[ i ]( e );
+ } //for
+ } //if
+ }; //dispatch
+
+ this.listen = function( eventName, listener ) {
+ if( typeof( eventName ) === "object" ){
+ for( var i in eventName ){
+ if( eventName.hasOwnProperty( i ) ){
+ _this.listen( i, eventName[ i ] );
+ } //if
+ } //for
+ }
+ else {
+ if ( !_listeners[ eventName ] ) {
+ _listeners[ eventName ] = [];
+ }
+ _listeners[ eventName ].push( listener );
+ } //if
+ }; //listen
+
+ this.unlisten = function( eventName, listener ) {
+ if( typeof( eventName ) === "object" ){
+ for( var i in eventName ){
+ if( eventName.hasOwnProperty( i ) ){
+ _this.unlisten( i, eventName[ i ] );
+ } //if
+ } //for
+ }
+ else {
+ var theseListeners = _listeners[ eventName ];
+ if ( theseListeners ) {
+ if ( listener ) {
+ var idx = theseListeners.indexOf( listener );
+ if ( idx > -1 ) {
+ theseListeners.splice( idx, 1 );
+ } //if
+ }
+ else {
+ _listeners[ eventName ] = [];
+ }
+ } //if
+ } //if
+ }; //unlisten
+
+ this.apply = function( object ) {
+ object.listen = _this.listen;
+ object.unlisten = _this.unlisten;
+ object.dispatch = _this.dispatch;
+ _target = object;
+ }; //apply
+
+ if( object ) {
+ this.apply( object );
+ } //if
+
+ }; //EventManager
+
+ return EventManager;
+
+});
View
79 butter/src/dialogs/iframe-dialog.js
@@ -0,0 +1,79 @@
+define( [ "./util", "./base-dialog", "./comm", "./event-manager" ], function( util, BaseDialog, Comm, EventManager ){
+
+ var IFRAMEDialog = function( context, dialogOptions ) {
+ dialogOptions = dialogOptions || {};
+
+ if( !dialogOptions.url ){
+ throw new Error( "IFRAME dialog requires a url." );
+ } //if
+
+ var _this = this,
+ _baseDialog = new BaseDialog( context, dialogOptions, _this ),
+ _url = dialogOptions.url,
+ _em = new EventManager( _this ),
+ _currentComm,
+ _currentTemplate;
+
+ if( !_this.template ){
+ throw new Error( "Template required to build iframe dialog." );
+ } //if
+
+ function onSubmit( e ){
+ _em.dispatch( e.type, e.data.data );
+ } //onSubmit
+
+ function onCancel( e ){
+ _em.dispatch( e.type, e.data );
+ close();
+ } //onCancel
+
+ function onClose( e ){
+ close();
+ } //onClose
+
+ function close(){
+ _currentComm.unlisten( "submit", onSubmit );
+ _currentComm.unlisten( "cancel", onCancel );
+ _currentComm.unlisten( "close", onClose );
+ _currentComm.destroy();
+ _currentTemplate.destroy();
+ _baseDialog.close();
+ _em.dispatch( "close" );
+ _currentComm = _currentTemplate = undefined;
+ } //close
+
+ this.open = function( background ){
+ var iframe = document.createElement( "iframe" );
+ _currentTemplate = _this.template.createInstance();
+ _currentTemplate.insertContent( iframe );
+ _currentTemplate.attach( background );
+ util.css( iframe, "width", util.css( _currentTemplate.element, "width" ) );
+ util.css( iframe, "height", util.css( _currentTemplate.element, "height" ) );
+ util.css( iframe, "border", "none" );
+ iframe.src = _url;
+ iframe.addEventListener( "load", function( e ){
+ _currentComm = new Comm( iframe.contentWindow, function(){
+ _currentTemplate.show();
+ _currentComm.listen( "submit", onSubmit );
+ _currentComm.listen( "cancel", onCancel );
+ _currentComm.listen( "close", onClose );
+ });
+ }, false );
+ _baseDialog.open();
+ _em.dispatch( "open" );
+ }; //open
+
+ this.close = function(){
+ close();
+ }; //close
+
+ this.send = function( type, data ){
+ if( _currentComm ){
+ _currentComm.send( type, data );
+ } //if
+ }; //send
+
+ }; //IFRAMEDialog
+
+ return IFRAMEDialog;
+});
View
70 butter/src/dialogs/layer-manager.js
@@ -0,0 +1,70 @@
+define( [ "./util", "./event-manager" ] , function( util, EventManager ){
+
+ const MAX_DIALOGS = 1000;
+ const MIN_Z_INDEX = 2147483647 - MAX_DIALOGS;
+
+ var Layer = function( dialog, zIndex ) {
+
+ var _body = document.body,
+ _background = document.createElement( "div" ),
+ _numDialogs = 0,
+ _zIndex = 0,
+ _em = new EventManager( this ),
+ _this = this;
+
+ _body.appendChild( _background );
+ util.css( _background, "position", "fixed" );
+ util.css( _background, "top", "0px" );
+ util.css( _background, "left", "0px" );
+
+ if( dialog.modal ){
+ util.css( _background, "background", "rgba( 0, 0, 0, 0.6 )" );
+ util.css( _background, "width", "100%" );
+ util.css( _background, "height", "100%" );
+ window.addEventListener( "resize", function( e ){
+ }, false );
+ } //if
+
+ Object.defineProperties( this, {
+ zIndex: {
+ set: function( val ){
+ _zIndex = val;
+ util.css( _background, "z-index", _zIndex );
+ },
+ get: function(){
+ return _zIndex;
+ }
+ }
+ });
+
+ dialog.open( _background );
+
+ function onDialogClose( e ){
+ _background.parentNode.removeChild( _background );
+ _em.dispatch( "close" );
+ dialog.unlisten( "close", onDialogClose );
+ } //onDialogClose
+
+ dialog.listen( "close", onDialogClose );
+
+ _this.zIndex = zIndex;
+
+ }; //Layer
+
+ var LayerManager = function(){
+
+ var _layers = [];
+
+ this.add = function( dialog ){
+ var layer = new Layer( dialog, MIN_Z_INDEX + _layers.length );
+ _layers.push( layer );
+ layer.listen( "close", function( e ){
+ _layers.splice( _layers.indexOf( layer ), 1 );
+ });
+ return layer;
+ }; //prepare
+
+ }; //LayerManager
+
+ return LayerManager;
+});
View
37 butter/src/dialogs/module.js
@@ -0,0 +1,37 @@
+/*********************************************************************************
+
+Copyright (C) 2011 by Mozilla Foundation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+**********************************************************************************/
+
+(function() {
+
+ define( [ "core/logger", "core/eventmanager", "./context" ], function( Logger, EventManager, Context ) {
+
+ return {
+ name: "eventeditor",
+ init: Context
+ };
+
+ }); //define
+
+})();
+
View
50 butter/src/dialogs/template-instance.js
@@ -0,0 +1,50 @@
+define( [ "./util" ], function( util ){
+
+ var TemplateInstance = function( originalElement ){
+
+ var _rootElement = originalElement.cloneNode( true ),
+ _contentElement;
+
+ var contents = _rootElement.querySelectorAll( "*[dialog-content]" );
+
+ if( contents.length > 0 ){
+ _contentElement = contents[ 0 ];
+ }
+ else {
+ _contentElement = _rootElement;
+ } //if
+
+ util.addClass( _contentElement, "dialog-content" );
+
+ this.insertContent = function( content ){
+ _contentElement.appendChild( content );
+ }; //insertContent
+
+ this.show = function(){
+ util.css( _rootElement, "visibility", "visible" );
+ }; //show
+
+ this.attach = function( parentNode ){
+ parentNode.appendChild( _rootElement );
+ }; //attach
+
+ this.destroy = function(){
+ _rootElement.parentNode.removeChild( _rootElement );
+ }; //destroy
+
+ Object.defineProperties( this, {
+ element: {
+ get: function(){
+ return _rootElement;
+ }
+ },
+ contentElement: {
+ get: function(){
+ return _contentElement;
+ }
+ }
+ });
+ }; //TemplateInstance
+
+ return TemplateInstance;
+});
View
33 butter/src/dialogs/template.js
@@ -0,0 +1,33 @@
+define( [ "./util", "./template-instance" ], function( util, TemplateInstance ){
+
+ var Template = function( element, options ) {
+ options = options || {};
+
+ var _element = element,
+ _contentElement,
+ _name = options.name || element.id,
+ _this = this;
+
+ util.addClass( _element, "dialog-template" );
+ util.css( _element, "position", "absolute" );
+ util.css( _element, "visibility", "hidden" );
+
+ _element.parentNode.removeChild( _element );
+
+ this.createInstance = function( content ){
+ return new TemplateInstance( _element );
+ }; //clone
+
+ Object.defineProperties( this, {
+ name: {
+ get: function(){ return _name; }
+ },
+ element: {
+ get: function(){ return _element; }
+ }
+ });
+
+ }; //Template
+
+ return Template;
+});
View
31 butter/src/dialogs/util.js
@@ -0,0 +1,31 @@
+define( [], function(){
+
+ var util = {
+ addClass: function( obj, className ){
+ var classes = obj.className.split( " " );
+ for( var i=0, l=classes.length; i<l; ++i ){
+ if( classes[ i ] === className ){
+ return;
+ } //if
+ } //for
+ obj.className += " " + className;
+ },
+ removeClass: function( obj, className ){
+ var classes = obj.className.split( " " );
+ for( var i=classes.length; i>-1; --i ){
+ if( classes[ i ] === className ){
+ classes.splice( i, 1 );
+ } //if
+ } //for
+ obj.className = classes.join( " " );
+ },
+ css: function( obj, key, value ){
+ if( value ){
+ obj.style[ key ] = value;
+ }
+ return obj.style[ key ];
+ }
+ }; //util
+
+ return util;
+});
View
96 butter/src/dialogs/window-dialog.js
@@ -0,0 +1,96 @@
+define( [ "./util", "./base-dialog", "./comm", "./event-manager" ], function( util, BaseDialog, Comm, EventManager ){
+
+ const DEFAULT_WINDOW_WIDTH = 640;
+ const DEFAULT_WINDOW_HEIGHT = 479;
+
+ var WindowDialog = function( context, dialogOptions ) {
+ dialogOptions = dialogOptions || {};
+
+ if( !dialogOptions.url ){
+ throw new Error( "IFRAME dialog requires a url." );
+ } //if
+
+ var _this = this,
+ _baseDialog = new BaseDialog( context, dialogOptions, _this ),
+ _url = dialogOptions.url,
+ _em = new EventManager( _this ),
+ _currentComm,
+ _currentWindow,
+ _windowStatusInterval,
+ _features = [
+ "width=" + ( dialogOptions.width || DEFAULT_WINDOW_WIDTH ),
+ "height=" + ( dialogOptions.height || DEFAULT_WINDOW_HEIGHT ),
+ "toolbar=no",
+ "menubar=no",
+ "titlebar=yes",
+ "location=no",
+ "resizable=yes"
+ ];
+
+ function onSubmit( e ){
+ _em.dispatch( e.type, e.data.data );
+ } //onSubmit
+
+ function onCancel( e ){
+ _em.dispatch( e.type, e.data );
+ close();
+ } //onCancel
+
+ function onClose( e ){
+ close();
+ } //onClose
+
+ function onError( e ){
+ if( e.data.type === "connectionclosed" ){
+ close();
+ } //if
+ _em.dispatch( e.type, e.data );
+ } //onError
+
+ function close(){
+ _currentComm.unlisten( "submit", onSubmit );
+ _currentComm.unlisten( "cancel", onCancel );
+ _currentComm.unlisten( "close", onClose );
+ _currentComm.destroy();
+ _baseDialog.close();
+ _em.dispatch( "close" );
+ if( _currentWindow.close ){
+ _currentWindow.close();
+ } //if
+ clearInterval( _windowStatusInterval );
+ _currentComm = _currentWindow = undefined;
+ } //close
+
+ function checkWindowStatus(){
+ if( _currentWindow && _currentWindow.closed === true ) {
+ close();
+ } //if
+ } //checkWindowStatus
+
+ this.open = function( background ){
+ _currentWindow = window.open( _url, "dialog-window:" + _url, _features.join( "," ) );
+ _currentComm = new Comm( _currentWindow, function(){
+ _currentComm.listen( "error", onError );
+ _currentComm.listen( "submit", onSubmit );
+ _currentComm.listen( "cancel", onCancel );
+ _currentComm.listen( "close", onClose );
+ _windowStatusInterval = setInterval( checkWindowStatus, 300 );
+ });
+ _baseDialog.open();
+ _em.dispatch( "open" );
+ }; //open
+
+ this.close = function(){
+ close();
+ }; //close
+
+ this.send = function( type, data ){
+ if( _currentComm ){
+ _currentComm.send( type, data );
+ } //if
+ }; //send
+
+ }; //WindowDialog
+
+ return WindowDialog;
+});
View
2 js/popcorn-maker.js
@@ -358,6 +358,8 @@
previewer: {
target: "main",
exportBaseUrl: "http://mozillapopcorn.org/maker"
+ },
+ dialogs: {
}
},
ready: init

0 comments on commit 696a6d9

Please sign in to comment.