/*
* pettanR peta.apps.js
- * version 0.5.28
+ * version 0.5.29
*
* author:
* itozyun
_data.state = Const.FILE.STATE.OK;
if( Type.isArray( _json ) === true ){
- for( var i=0, l = _json.length; i<l; ++i ){
+ for( var i = 0, l = _json.length; i < l; ++i ){
buildFileData( _json[ i ], _data );
};
} else
var onHelpLoad = function( _xml ){
var jqXML = $( _xml ),
helpTitle = jqXML.find( 'pages' ).eq( 0 ).attr( 'title' ),
+ elmRoot = document.createElement( 'div' ),
elmNavi = document.createElement( 'div' ),
elmItemOrigin = document.createElement( 'a' ),
elmPages = document.createElement( 'div' ),
elmPageOrigin = document.createElement( 'div' ),
elmTitleOrigin = document.createElement( 'h2' ),
elmPage;
+ elmRoot.className = 'multi-page-container clearfix';
elmNavi.className = 'sidenavi';
elmItemOrigin.className = 'sidenavi-item';
elmItemOrigin.href = '#';
MENU_BAR_CONTROL.HELP.createOption( title, null, onSelectionClick, true );
++numPage;
});
-
- jqAjaxContents.removeClass( 'loading' ).append( elmNavi, elmPages );
+ elmRoot.appendChild( elmNavi );
+ elmRoot.appendChild( elmPages );
+ jqAjaxContents.removeClass( 'loading' ).append( elmRoot );
jqNaviItems = jqAjaxContents.find( 'a.' + elmItemOrigin.className ).click( onNaviClick );
jqPages = jqAjaxContents.find( '.page-content' );
baseW = _w;
baseH = _h = _memoryY -_y;
flip( false, true);
- flipH = currentElement.flipH();
+ flipH = currentElement.flipH;
} else {
// flipVH
_memoryX = _x;
this.resize( this.x + shiftX, this.y + shiftY );
},
mouseover : function( e ){
- console.log( 'w:' + this.node.width() + ' h:' + this.node.height() + ' x:' + this.node.x() + ' y:' + this.node.y() )
PanelElementOperatorManager.show( this );
}
};
this.$.stop().remove();
this.balloon.destroy();
this.node.remove();
+
+ this.destroy = null;
}
}
);
'</div>',
'<div class="window-body"></div>',
'<div class="window-footer">',
- '<div class="window-resize-button">/</div>',
+ '<div class="window-resize-button"></div>',
'</div>',
'</div>',
_optionList = _select.getElementsByTagName( 'option' )
if( _name === 'comic[visible]' ){
_select.selectedIndex = comboboxVisible.selectIndex();
- } else
+ }/* else
if( _name === 'comic[editable]' ){
- // _select.selectedIndex = comboboxEditable.selectIndex();
- };
+ _select.selectedIndex = comboboxEditable.selectIndex();
+ } */;
};
app.submit();
};
option = optionList[ j ];
if( select.name === 'comic[visible]' ){
comboboxVisible.createOption( option.innerHTML, option.value, option.selected );
- } else
+ }/* else
if( select.name === 'comic[editable]' ){
- // comboboxEditable.createOption( option.innerHTML, option.value, option.selected );
- };
+ comboboxEditable.createOption( option.innerHTML, option.value, option.selected );
+ }*/;
};
};
inputTitle.focus();
//node.mesure();
app.onPaneResize( windowW, windowH );
-
delete app.onFoemReady;
};
this.submitError = function(){
var UploadConsole = gOS.registerApplication( function(){
var windowW, windowH,
+ eventRoot, node,
buttonSubmit, buttonCancel,
elmFile,
app = this;
app.fetchCSS( pettanr.CONST.URL_PETA_APPS_CSS );
+ eventRoot = app.getPointingDeviceEventTreeRoot();
+
delete app.onInit;
};
this.elmProgressID = 'upload-console-progress';
this.hideUploader = false;
FormApplicationHelper( this );
this.onFormReady = function(){
- app.onPaneResize( windowW, windowH );
-
var _inputList = app.elmForm.getElementsByTagName( 'input' ),
_input;
for( var i = _inputList.length; i; ){
_input.style.display = 'none';
};
};
+ node.mesure();
+ app.onPaneResize( windowW, windowH );
+ node.mesureChildren();
delete app.onFoemReady;
};
this.submitError = function(){
app.addTimer( clickCancel , 5000, true );
};
this.onOpen = function( w, h ){
- var ui = app.createUIGroup();
- buttonSubmit = ui.createButton( document.getElementById( 'upload-console-post-button'), clickOK );
- buttonCancel = ui.createButton( document.getElementById( 'upload-console-cancel-button'), clickCancel );
+ node = eventRoot.createNode( app.rootElement, true, true );
+ var ui = app.createUIGroup( node );
+
+ buttonSubmit = ui.createButton( document.getElementById( 'upload-console-post-button' ), clickOK );
+ buttonCancel = ui.createButton( document.getElementById( 'upload-console-cancel-button' ), clickCancel );
app.onPaneResize( w, h );
app.fetchScript();
};
- this.onPaneResize = function( _windowW, _windowH){
- windowW = _windowW;
- windowH = _windowH;
- app.rootElement.style.cssText = [
- 'left:', Math.floor( ( _windowW - app.rootElement.offsetWidth ) /2 ), 'px;',
- 'top:', Math.floor( ( _windowH - app.rootElement.offsetHeight ) /2 ), 'px;'
- ].join( '' );
+ this.onPaneResize = function( w, h ){
+ windowW = w;
+ windowH = h;
+ //app.rootElement.style.cssText = [
+ // 'left:', Math.floor( ( _w - app.rootElement.offsetWidth ) /2 ), 'px;',
+ // 'top:', Math.floor( ( _h- app.rootElement.offsetHeight ) /2 ), 'px;'
+ //].join( '' );
+ node.update( w / 2 - node.width() / 2, h / 2 - node.height() / 2 );
};
this.onClose = function(){
app.destroyHelper();
var ArtistConsole = gOS.registerApplication( function(){
var windowW, windowH,
+ eventRoot, node,
+ elmName, elmLicense,
+ inputName, inputLicense,
buttonSubmit, buttonCancel,
app = this;
function clickOK(){
if( !app.elmForm || !app.elmIframe || app.isUploading === true ) return false;
+ inputUpdate();
app.submit();
return false;
};
ArtistConsole.shutdown();
return false;
};
+ function inputUpdate( v ){
+ elmName.value = inputName.value();
+ elmLicense.value = inputLicense.value();
+ };
/* grobal method */
this.MIN_WIDTH = 320;
app.rootElement.innerHTML = [
'<div id="artist-console-header" class="console-header">Register Artist</div>',
'<div id="artist-console" class="console-inner">',
- '<div id="register"></div>',
+ '<div id="artist-console-name" class="field">',
+ '<span class="field-label">Name:</span>',
+ '<span id="artist-console-name-value" class="comic-console-value editable-value">artist name here.</span>',
+ '</div>',
+ '<div id="artist-console-license" class="field">',
+ '<span class="field-label">License:</span>',
+ '<span id="artist-console-license-value" class="comic-console-value editable-value">license here.</span>',
+ '</div>',
'<div class="console-button-container">',
'<div id="artist-console-post-button" class="button console-submit-button">register</div>',
'<div id="artist-console-cancel-button" class="button console-cancel-button">cancel</div>',
'</div>',
'<div id="artist-console-progress" class="console-progress"> </div>',
+ '<div id="register" style="display:none;"></div>',
'</div>'
].join( '' );
app.fetchCSS( pettanr.CONST.URL_PETA_APPS_CSS );
+ eventRoot = app.getPointingDeviceEventTreeRoot();
delete app.onInit;
};
this.hideUploader = false;
FormApplicationHelper( this );
this.onFormReady = function(){
- app.onPaneResize( windowW, windowH );
-
var _inputList = app.elmForm.getElementsByTagName( 'input' ),
_input;
for( var i = _inputList.length; i; ){
if( _input.type === 'submit' ){
_input.style.display = 'none';
};
+ if( _input.name === 'artist[name]' ){
+ elmName = _input;
+ };
+ if( _input.name === 'artist[default_license_id]' ){
+ elmLicense = _input;
+ };
};
+
+ node.mesure();
+ app.onPaneResize( windowW, windowH );
+ node.mesureChildren();
+
delete app.onFoemReady;
};
this.submitError = function(){
app.addTimer( clickCancel , 5000, true );
};
this.onOpen = function( w, h ){
- var ui = app.createUIGroup();
- buttonSubmit = ui.createButton( document.getElementById( 'artist-console-post-button'), clickOK );
- buttonCancel = ui.createButton( document.getElementById( 'artist-console-cancel-button'), clickCancel );
+ node = eventRoot.createNode( app.rootElement, true, true );
+ var ui = app.createUIGroup( node );
+
+ inputName = ui.createInputText( document.getElementById( 'artist-console-name' ), inputUpdate );
+ inputLicense = ui.createInputText( document.getElementById( 'artist-console-license' ), inputUpdate );
+ buttonSubmit = ui.createButton( document.getElementById( 'artist-console-post-button' ), clickOK );
+ buttonCancel = ui.createButton( document.getElementById( 'artist-console-cancel-button' ), clickCancel );
app.onPaneResize( w, h );
app.fetchScript();
};
- this.onPaneResize = function( _windowW, _windowH ){
- windowW = _windowW;
- windowH = _windowH;
- app.rootElement.style.cssText = [
- 'left:', Math.floor( ( _windowW - app.rootElement.offsetWidth ) /2 ), 'px;',
- 'top:', Math.floor( ( _windowH - app.rootElement.offsetHeight ) /2 ), 'px;'
- ].join( '' );
+ this.onPaneResize = function( w, h ){
+ windowW = w;
+ windowH = h;
+ //app.rootElement.style.cssText = [
+ // 'left:', Math.floor( ( _w - app.rootElement.offsetWidth ) /2 ), 'px;',
+ // 'top:', Math.floor( ( _h- app.rootElement.offsetHeight ) /2 ), 'px;'
+ //].join( '' );
+ node.update( w / 2 - node.width() / 2, h / 2 - node.height() / 2 );
};
this.onClose = function(){
app.destroyHelper();
};
}, true, true, 'Artist Console', 'artistConsole', null, '#FFC40D' );
+var PanelConsole = gOS.registerApplication( function(){
+ var windowW, windowH,
+ eventRoot, node, inputData,
+ comboboxPublish, buttonPost, buttonClose,
+ elmInput,
+ app = this,
+ model = null;
+
+ /*
+ * upload ボタンが押されたらまず iframe をつくる.
+ */
+ function clickOK(){
+ if( !app.elmForm || !app.elmIframe || app.isUploading === true ) return false;
+ inputData.value();
+ app.submit();
+ return false;
+ }
+
+ function clickCancel(){
+ if( app.isUploading === true ) return false;
+ PanelConsole.shutdown();
+ return false;
+ };
+ function publishUpdate(){
+ if( model ){
+ model.publish( comboboxPublish.selectIndex() === 1 );
+ elmInput.value = model.getJsonPostString().replace( /\n/g, '' );
+ inputData.value( elmInput.value );
+ } else {
+ elmInput.value = inputData.value();
+ };
+ };
+
+ /* grobal method */
+ this.MIN_WIDTH = 320;
+ this.MIN_HEIGHT = 320;
+ this.onInit = function(){
+ app.rootElement.id = 'panel-console-wrapper';
+ app.rootElement.className = 'console-wrapper';
+ app.rootElement.innerHTML = [
+ '<div id="panel-console-header" class="console-header">Create New Panel (dev)</div>',
+ '<div id="panel-console" class="console-inner">',
+ '<div id="panel-console-data" class="field">',
+ '<span class="field-label">POST DATA:</span>',
+ '<span id="panel-console-data-value" class="comic-console-value editable-value">panel json here.</span>',
+ '</div>',
+ '<div id="panel-console-publish" class="field">',
+ '<span class="field-label">Publish:</span>',
+ '<span id="panel-console-publish-value" class="combobox"></span>',
+ '</div>',
+ '<div class="console-button-container">',
+ '<div id="panel-console-post-button" class="button console-submit-button">post</div>',
+ '<div id="panel-console-cancel-button" class="button console-cancel-button">cancel</div>',
+ '</div>',
+ '<div id="panel-console-progress" class="console-progress"> </div>',
+ '<div id="newpanel" style="display:none;"></div>',
+ '</div>'
+ ].join( '' );
+
+ app.fetchCSS( pettanr.CONST.URL_PETA_APPS_CSS );
+ eventRoot = app.getPointingDeviceEventTreeRoot();
+
+ delete app.onInit;
+ };
+ this.elmProgressID = 'panel-console-progress';
+ this.elmUploaderID = 'newpanel';
+ this.elmIframeName = 'targetFrameNewPanel'
+ this.scriptSrc = pettanr.CONST.CREATE_PANEL_JS;
+ this.hideUploader = false;
+ FormApplicationHelper( this );
+ this.onFormReady = function(){
+ var _inputList = app.elmForm.getElementsByTagName( 'input' ),
+ _input;
+ for( var i = _inputList.length; i; ){
+ _input = _inputList[ --i ];
+ if( _input.type === 'submit' ){
+ _input.style.display = 'none';
+ };
+ if( _input.name === 'json' ){
+ elmInput = _input;
+ publishUpdate();
+ };
+ };
+
+ node.mesure();
+ app.onPaneResize( windowW, windowH );
+ node.mesureChildren();
+
+ delete app.onFoemReady;
+ };
+ this.submitError = function(){
+ app.addTimer( clickCancel , 5000, true );
+ };
+ this.submitSuccess = function(){
+ app.addTimer( clickCancel , 5000, true );
+ };
+ this.onOpen = function( w, h, _model ){
+ node = eventRoot.createNode( app.rootElement, true, true );
+ var ui = app.createUIGroup( node ),
+ elm = document.getElementById( 'panel-console-publish' );
+
+ inputData = ui.createInputText( document.getElementById( 'panel-console-data' ), publishUpdate );
+
+ if( _model ){
+ comboboxPublish = ui.createCombobox( elm, publishUpdate );
+ comboboxPublish.createOption( 'only me', '0', _model.publish() === false );
+ comboboxPublish.createOption( 'publish', '1', _model.publish() === true );
+ model = _model;
+ } else {
+ elm.parentNode.removeChild( elm );
+ };
+
+ buttonPost = ui.createButton( document.getElementById( 'panel-console-post-button' ), clickOK );
+ buttonClose = ui.createButton( document.getElementById( 'panel-console-cancel-button' ), clickCancel );
+
+ app.onPaneResize( w, h );
+ app.fetchScript();
+ };
+ this.onPaneResize = function( w, h ){
+ windowW = w;
+ windowH = h;
+ //app.rootElement.style.cssText = [
+ // 'left:', Math.floor( ( _w - app.rootElement.offsetWidth ) /2 ), 'px;',
+ // 'top:', Math.floor( ( _h- app.rootElement.offsetHeight ) /2 ), 'px;'
+ //].join( '' );
+ node.update( w / 2 - node.width() / 2, h / 2 - node.height() / 2 );
+ };
+ this.onClose = function(){
+ app.destroyHelper();
+ model && model.destroy();
+ app = model = comboboxPublish = buttonPost = buttonClose = elmInput = null;
+ };
+}, true, true, 'Panel Console', 'panelConsole', null, '#603CBA' );
var Model = ( function(){
};
}, true, false, 'Output Console', 'outputConsole', null, '#2D89F0' );
-
-var PanelConsole = gOS.registerApplication( function(){
- var windowW, windowH,
- comboboxPublish, buttonPost, buttonClose,
- elmInput,
- app = this,
- model = null;
-
- /*
- * upload ボタンが押されたらまず iframe をつくる.
- */
- function clickOK(){
- if( !app.elmForm || !app.elmIframe || app.isUploading === true ) return false;
- app.submit();
- return false;
- }
-
- function clickCancel(){
- if( app.isUploading === true ) return false;
- PanelConsole.shutdown();
- return false;
- };
- function publishUpdate(){
- if( model ){
- model.publish( comboboxPublish.selectIndex() === 1 );
- elmInput.value = model.getJsonPostString().replace( /\n/g, '' );
- };
- };
-
- /* grobal method */
- this.MIN_WIDTH = 320;
- this.MIN_HEIGHT = 320;
- this.onInit = function(){
- app.rootElement.id = 'panel-console-wrapper';
- app.rootElement.className = 'console-wrapper';
- app.rootElement.innerHTML = [
- '<div id="panel-console-header" class="console-header">Create New Panel (dev)</div>',
- '<div id="panel-console" class="console-inner">',
- '<div id="newpanel"></div>',
- '<div id="panel-console-publish" class="field">',
- '<span class="field-label">Publish:</span>',
- '<span id="panel-console-publish-value" class="combobox"></span>',
- '</div>',
- '<div class="console-button-container">',
- '<div id="panel-console-post-button" class="button console-submit-button">post</div>',
- '<div id="panel-console-cancel-button" class="button console-cancel-button">cancel</div>',
- '</div>',
- '<div id="panel-console-progress" class="console-progress"> </div>',
- '</div>'
- ].join( '' );
-
- app.fetchCSS( pettanr.CONST.URL_PETA_APPS_CSS );
-
- delete app.onInit;
- };
- this.elmProgressID = 'panel-console-progress';
- this.elmUploaderID = 'newpanel';
- this.elmIframeName = 'targetFrameNewPanel'
- this.scriptSrc = pettanr.CONST.CREATE_PANEL_JS;
- this.hideUploader = false;
- FormApplicationHelper( this );
- this.onFormReady = function(){
- app.onPaneResize( windowW, windowH );
-
- var _inputList = app.elmForm.getElementsByTagName( 'input' ),
- _input;
- for( var i = _inputList.length; i; ){
- _input = _inputList[ --i ];
- if( _input.type === 'submit' ){
- _input.style.display = 'none';
- };
- if( _input.name === 'json' ){
- elmInput = _input;
- publishUpdate();
- };
- };
-
- delete app.onFoemReady;
- };
- this.submitError = function(){
- app.addTimer( clickCancel , 5000, true );
- };
- this.submitSuccess = function(){
- app.addTimer( clickCancel , 5000, true );
- };
- this.onOpen = function( w, h, _model ){
- var ui = app.createUIGroup(),
- elm = document.getElementById( 'panel-console-publish' );
- if( _model ){
- comboboxPublish = ui.createCombobox( elm, publishUpdate );
- comboboxPublish.createOption( 'only me', '0', _model.publish() === false );
- comboboxPublish.createOption( 'publish', '1', _model.publish() === true );
- model = _model;
- } else {
- elm.parentNode.removeChild( elm );
- };
-
- buttonPost = ui.createButton( document.getElementById( 'panel-console-post-button' ), clickOK );
- buttonClose = ui.createButton( document.getElementById( 'panel-console-cancel-button' ), clickCancel );
-
- app.onPaneResize( w, h );
- app.fetchScript();
- };
- this.onPaneResize = function( _windowW, _windowH ){
- windowW = _windowW;
- windowH = _windowH;
- app.rootElement.style.cssText = [
- 'left:', Math.floor( ( _windowW - app.rootElement.offsetWidth ) /2 ), 'px;',
- 'top:', Math.floor( ( _windowH - app.rootElement.offsetHeight ) /2 ), 'px;'
- ].join( '' );
- };
- this.onClose = function(){
- app.destroyHelper();
- model && model.destroy();
- app = model = comboboxPublish = buttonPost = buttonClose = elmInput = null;
- };
-}, true, true, 'Panel Console', 'panelConsole', null, '#603CBA' );
-
-
})( pettanr, gOS, window, document );
/*
* pettanR system.js
- * version 0.5.28
+ * version 0.5.29
*
* gadgetOS
* author:
}
};
-var EX = ( function(){
- var F = new Function();
-
+var Class = ( function(){
function clone( src ){
var ret;
if( Type.isArray(src) === true ){
return ret;
};
+ function extend(){
+
+ };
+
+ var f = true;
+ var c = Util.copyArray;
+
+ function I(){
+ var klass = this;
+ f = false;
+ var instance = klass.pool.shift() || new klass();
+ f = true;
+ instance.init.apply( instance, c( arguments ) );
+ klass.live.push( instance );
+ return instance;
+ };
+
return {
- extend: function( base, extend ){
- F.prototype = base;
- var ret = new F;
- for( var p in extend ){
- ret[ p ] = extend[ p ];
+ create : function( def, final, pool, abstract ){
+ var klass = function(){
+ var a = arguments;
+ if( f ) return I.apply( a.collee, c( a ) );
};
- return ret;
- },
- clone: function( obj ){
- return clone( obj );
- },
- kill: function(){
- var self = this, v;
- for( var p in s ){
- if( self.hasOwnProperty && !self.hasOwnProperty( p ) ) continue;
- v = self[ p ];
- v && v instanceof TicketBase && self.kill();
- delete self[ p ];
- }
+ klass.prototype = def;
+ if( pool === true ){
+ klass.pool = [];
+ klass.live = [];
+ };
+ return klass;
}
}
})();
this.hoverClass = hover;
this.scroll = clip && scroll;
this.mesure();
- this.scroll === true && this.addEventListener( 'mouseover', this.onScrollReady, this );
+ this.scroll === true && ScrollBarManager.register( this );
} else {
this.update( rangeOrElm.x, rangeOrElm.y, rangeOrElm.w, rangeOrElm.h );
};
this.y = y;
this.w = w;
this.h = h;
- console.log( ' ---- mesure' + this.elm.id + ' x:' + this.x + ' y:' + this.y + ' w:' + w + ' h:' + h )
parent = this.parentData;
parent && this._updateAbsoluteXY( parent.absoluteX, parent.absoluteY, parent.scrollingX, parent.scrollingY );
this._updateRectangle();
// this.w = r - x;
// this.h = b - y;
this.parentData && this.parentData.clip === false && this.parentData._updateRectangle();
+ return true;
};
},
setPosition : function( x, y ){
};
forceNodeData = null;
},
- onScrollReady : function( e ){
- ScrollBarManager.show( this );
- },
- onMouseWheelScroll : function( e ){
- this._scrollY += e.wheelDelta;
- ScrollBarManager.update( this );
- //return true;
- },
- onMouseDragScroll : function( e ){
- //e.dragOffsetY;
- this._scrollY = this.scrollStartY + e.dragOffsetY;
- ScrollBarManager.update( this );
- this.scrollStartY = this._scrollY;
- return true;
- },
- onScrollComplete : function( e ){
- ScrollBarManager.hide( this );
- },
scrollTo : function( x, y ){
this._scrollX = x;
this._scrollY = y;
this.node = node;
this.type = eventType;
this.handler = handler;
- this.thisObj = opt_thisObject;
+ this.thisObj = opt_thisObject || node;
};
EventTicketClass.prototype = {
match : function( eventType, handler ){
fire : ( function(){
if( Function.prototype.call ){
return function( e ){
- return this.handler.call( this.thisObj || this.node, e );
+ return this.handler.call( this.thisObj, e );
};
};
return function( e ){
- var thisObj = this.thisObj || this.node,
- ret;
- thisObj._currentHandler = this.handler;
- ret = thisObj._currentHandler( e );
- delete thisObj._currentHandler;
+ var ret;
+ this.thisObj._currentHandler = this.handler;
+ ret = this.thisObj._currentHandler( e );
+ delete this.thisObj._currentHandler;
return ret;
};
})()
};
var ScrollBarManager = ( function(){
- var elmBar = document.createElement( 'div' ),
+ var elmScroller = document.createElement( 'div' ),
+ elmBar = document.createElement( 'div' ),
smoothList = [],
currentNodeData = null;
} else {
y = data._scrollY < y ? data._scrollY : y;
};
- data.scrollingY = y;
- data.elmScroller.style.top = y + 'px';
+ data.scrollingY = y;
+ data.elm.scrollTop = -y;
};
if( data.scrollingY === data._scrollY ){
list.splice( i, 1 );
list.length === 0 && SystemTimer.remove( SUPER_USER_KEY, tick );
};
+ function onScrollStart( e ){
+ var data = this;
+ if( data === currentNodeData ) return;
+ currentNodeData && onScrollComplete();
+
+ data.elm.parentNode.appendChild( elmScroller );
+ elmScroller.appendChild( data.elm );
+
+ elmScroller.style.cssText = 'position:absolute;left:0;top:0;';
+ elmScroller.appendChild( elmBar );
+
+ data.scrollStartX = data.scrollingX;
+ data.scrollStartY = data.scrollingY;
+ data.elm.scrollTop = -data.scrollingY;
+ data.addEventListener( 'mousewheel', onMouseWheelScroll, data );
+ data.addEventListener( 'mousedrag', onMouseDragScroll, data );
+ data.addEventListener( 'mouseout', onScrollComplete, data );
+ currentNodeData = data;
+ ScrollBarManager.update( data );
+ };
+ function onScrollComplete( e ){
+ if( currentNodeData === null ) return;
+
+ var data = currentNodeData;
+ var parent = elmScroller.parentNode;
+ parent.appendChild( currentNodeData.elm );
+ parent.removeChild( elmScroller );
+ currentNodeData.elm.scrollTop = -data.scrollingY;
+
+ data.removeEventListener( 'mousewheel', onMouseWheelScroll, data );
+ data.removeEventListener( 'mousedrag', onMouseDragScroll, data );
+ data.removeEventListener( 'mouseout', onScrollComplete, data );
+ currentNodeData = null;
+ };
+ function onMouseWheelScroll( e ){
+ var data = this;
+ this._scrollY += e.wheelDelta;
+ ScrollBarManager.update( this );
+ return true;
+ };
+ function onMouseDragScroll( e ){
+ var data = this;
+ //e.dragOffsetY;
+ this._scrollY = this.scrollStartY + e.dragOffsetY;
+ ScrollBarManager.update( this );
+ this.scrollStartY = this._scrollY;
+ return true;
+ };
+
return {
- show : function( data ){
- console.log( '############ show ' + ( currentNodeData === null ) )
- if( data === currentNodeData ) return;
- currentNodeData && ScrollBarManager.hide( currentNodeData );
- if( !data.elmScroller ){
- data.elmScroll = data.elm.firstChild;
- data.elmScroller = document.createElement( 'div' );
- data.elm.appendChild( data.elmScroller );
- data.elmScroller.style.cssText = 'position:absolute;top:0;left:0;width:100%;';
- data.elmScroller.appendChild( data.elmScroll );
- };
- data.scrollStartX = data.scrollingX;
- data.scrollStartY = data.scrollingY;
- //data._scrollX = data.elmScroll.offsetLeft;
- //data._scrollY = data.elmScroll.offsetTop;
- data.addEventListener( 'mousewheel', data.onMouseWheelScroll, data );
- data.addEventListener( 'mousedrag', data.onMouseDragScroll, data );
- data.addEventListener( 'mouseout', data.onScrollComplete, data );
- currentNodeData = data;
- data.elm.appendChild( elmBar );
- ScrollBarManager.update( data );
+ register : function( data ){
+ data.addEventListener( 'mouseover', onScrollStart, data );
},
update : function( data ){
- //if( data !== currentNodeData ) return;
- if( data.elmScroll === null ) return;
- var contentH = data._scrollH = data.elmScroll.offsetHeight,
- scrollY = data._scrollY,
+ if( data !== currentNodeData ) return;
+
+ var contentH = data._scrollH = data.elm.scrollHeight,
clipH = data.h,
- barH = Math.floor( clipH * ( clipH / contentH ) ),
offsetH = contentH - clipH,
- barY;
- if( 0 < scrollY ) scrollY = data._scrollY = 0;
- if( scrollY < -offsetH ) scrollY = data._scrollY = -offsetH;
- barY = Math.floor( ( clipH - barH ) * -scrollY / ( contentH - clipH ) );
- if( contentH <= clipH ) data._scrollY = barY = barH = scrollY = 0;
- data.smoothY = ( data._scrollY - data.scrollingY ) / 10;
- elmBar.style.cssText = [
- 'position:absolute;',
- 'width:10px;',
- 'background-color:#333;',
- 'right:2px;',
- 'height:', barH, 'px;',
- 'top:', barY, 'px;'
- ].join( '' );
- if( data.scrollingY !== data._scrollY && Util.getIndex( smoothList, data ) === -1 ){
+ scrollY = data._scrollY = 0 < data._scrollY ? 0 : ( data._scrollY < -offsetH ? -offsetH : data._scrollY ),
+ barH, barY;
+ elmScroller.style.width = data.w + 'px';
+ elmScroller.style.height = clipH + 'px';
+ if( offsetH < 1 ){
+ data._scrollY = scrollY = 0;
+ elmBar.style.display = 'none';
+ } else {
+ barH = Math.floor( clipH * ( clipH / contentH ) );
+ barY = Math.floor( ( clipH - barH ) * - scrollY / offsetH );
+ elmBar.style.cssText = [
+ 'position:absolute;',
+ 'width:10px;',
+ 'background-color:#333;',
+ 'right:2px;',
+ 'font-size:0;line-height:0;',
+ 'height:', barH, 'px;',
+ 'top:', data.y + barY, 'px;'
+ ].join( '' );
+ };
+ data.smoothY = ( scrollY - data.scrollingY ) / 10;
+ if( data.scrollingY !== scrollY && Util.getIndex( smoothList, data ) === -1 ){
smoothList.length === 0 && SystemTimer.add( SUPER_USER_KEY, tick, 16 );
smoothList.push( data );
};
- },
- hide : function( data ){
- console.log( '############ hide ' + ( currentNodeData === null ) )
- if( data !== currentNodeData ) return;
- data.removeEventListener( 'mousewheel', data.onMouseWheelScroll, data );
- data.removeEventListener( 'mousedrag', data.onMouseDragScroll, data );
- data.removeEventListener( 'mouseout', data.onScrollComplete, data );
- data.elm.removeChild( elmBar );
- currentNodeData = null;
}
};
})();
return {
create : function( apiuser ){
- var root = new NodeClass( apiuser, null, null, apiuser.rootElement ),
- data = NodePrivateData.get( root ),
- elm = document.createElement( 'div' );
+ var elm = document.createElement( 'div' ),
+ root, data;
body.appendChild( elm );
+
+ root = new NodeClass( apiuser, null, null, elm );
+ data = NodePrivateData.get( root );
+
// elm.style.cssText = 'position:absolute;top:0;left:0;height:100%;';
elm.className = 'mouse-operation-catcher';
elm.unselectable = 'on';
this.displayName = displayName;
this.thumbnailUrl = thumbnailUrl;
this.tailColor = tailColor;
+
+ function asyncBoot(){
+ application = Application.boot( appClass, displayName, self.getUID(), isOverlay, Util.copyArray( arguments ) );
+ };
+
this.getUID = function(){
return Util.getIndex( API_USER_LIST, appClass );
};
this.boot = function( /* _option */ ){
- application = Application.boot( appClass, displayName, self.getUID(), isOverlay, Util.copyArray( arguments ) );
+ AsyncCall.add( this, asyncBoot, Util.copyArray( arguments ) );
};
this.shutdown = function(){
if( !application ) return false;
if( document.attachEvent ){
wrappedHandlerClass = function( ticket ){
this.handler = function(){
+ if( ticket === null ) alert( window.event.type )
if( ticket.fire( new wrappedEventClass( window.event, ticket.element ) ) !== false ) return;
// e.preventDefault();
// e.stopPropagation();
key = e.keyCode, // || e.which,
shift = Type.isBoolean( e.shiftKey ) === true ? e.shiftKey : ( e.modifiers & Event.SHIFT_MASK ),
ctrl = Type.isBoolean( e.ctrlKey ) === true ? e.ctrlKey : ( e.modifiers & Event.CONTROL_MASK ),
- lock = type === 'keyup' ? LOCK_UP : LOCK_DOWN;
+ lock = type === 'keyup' ? LOCK_UP : LOCK_DOWN,
+ i, t;
// block chattering
if( Util.getIndex( lock, key ) !== -1 ) return;
if( key === 17 || ctrl === true ){
KeyEvent.ctrlEnabled = type !== 'keyup';
};
- for( var i=currentList.length, t; t = currentList[ --i ]; ){
+ for( i = currentList.length; i; ){
+ t = currentList[ --i ];
if( Type.isFunction( t[ type ] ) === true && t.keyCode === key && ( t.shift === undefined || t.shift === shift ) && ( t.ctrl === undefined || t.ctrl === ctrl )){
- AsyncCall.add( t.apiuser, t[ type ], e );
- cancel = true;
+ if( t[ type ].call( t.apiuser, e ) === false ){
+ cancel = true;
+ break;
+ };
};
};
if( cancel === true || key === 18 || key === 9 || key === 27 || e.altKey === true ){ // 13.enter 18.esc 9.tab 27.esc || ( key === 13 && overlayEnabled === false)
ret.id = 'ui-textinput';
return ret;
})();
+ var currentData;
+
+ function updateWrapperPosition(){
+ var p = Position.cumulativeOffset( currentData.elmValue ),
+ w = currentData.elmValue.offsetWidth - 2,
+ _w;
+ elmInput.style.cssText = [
+ 'left:', p[ 0 ], 'px;',
+ 'top:', p[ 1 ], 'px;',//,
+ 'width:', w, 'px;'//,
+ //'height:', data.elmValue.offsetHeight, 'px;',
+ //'position:absolute;'
+ ].join( '' );
+
+ //_w = elmInput.offsetWidth;
+ //if( w !== _w ) elmInput.style.width = ( w - ( _w - w ) ) + 'px;';
+ };
return {
show: function( data ){
// this.groupData.node.addEventListener( 'mouseout' );
- var p = Position.cumulativeOffset( data.elmValue ),
- w = data.elmValue.offsetWidth - 2,
- _w;
- elmInput.style.cssText = [
- 'left:', p[ 0 ], 'px;',
- 'top:', p[ 1 ], 'px;',//,
- 'width:', w, 'px;'//,
- //'height:', data.elmValue.offsetHeight, 'px;',
- //'position:absolute;'
- ].join( '' );
- elmInput.value = data.value;
+ currentData = data;
+
body.appendChild( elmInput );
- _w = elmInput.offsetWidth;
- if( w !== _w ) elmInput.style.width = ( w - ( _w - w ) ) + 'px;';
+ elmInput.value = data.value;
+ updateWrapperPosition();
elmInput.focus();
elmInput.select();
+
+ SystemTimer.add( SUPER_USER_KEY, updateWrapperPosition, 500 );
},
hide : function( data ){
+ if( currentData !== data ) return;
+ currentData = null;
body.removeChild( elmInput );
var ret = elmInput.value;
elmInput.value = '';
+ SystemTimer.remove( SUPER_USER_KEY, updateWrapperPosition );
return ret;
},
update : function( data ){
elmInput.value = data.value;
+ },
+ onWindowResize: function( _w, _h ){
+ AsyncCall.add( currentData.apiuser, updateWrapperPosition );
}
};
})();
- var InputTextClass = function( groupData, elmWrapper, elmValue, onUpdate, validater ){
+ var TextInputClass = function( groupData, elmWrapper, elmValue, onUpdate, validater ){
var data = new UIItemPrivateData();
data.init( groupData, this, elmWrapper, elmValue.innerHTML, onUpdate, validater, false, true, true );
Util.addClass( elmValue, 'editable-text' );
data.node.addEventListener( 'click', this.focus, this );
//MouseEvent.add( groupData.apiuser, elmWrapper, 'click', instance.focus );
};
- InputTextClass.prototype = {
+ TextInputClass.prototype = {
value : function( value ){
var data = UIItemPrivateData.get( this );
if( Type.isString( value ) === true || Type.isNumber( value ) === true ){
var data = UIItemPrivateData.get( this ),
newValue;
if( data.focus === false ) return;
- newValue = TextInputManager.hide( data );
- newValue = keep !== 27 ? ( data.validater ? '' + data.validater( newValue ) : newValue ) : value; // 27:ESC
+ newValue = TextInputManager.hide( data );
+ newValue = keep !== 27 ? ( data.validater ? '' + data.validater( newValue ) : newValue ) : data.value; // 27:ESC
data.elmValue.innerHTML = newValue;
data.focus = false;
finish( data );
},
- enabled : function(){
+ enabled : function( v ){
var data = UIItemPrivateData.get( this );
+ if( Type.isBoolean( v ) === true && data.enabled !== v ){
+ Util.toggleClass( data.elm, 'ui-textinput-disabled', !v );
+ if( data.focus === true && v === false ) this.blur();
+ data.enabled = v;
+ data.node.disabled( !( data.visible && v ) );
+ };
return data.enabled;
},
- visible : function( _visible ){
+ visible : function( v ){
var data = UIItemPrivateData.get( this );
- if( Type.isBoolean( _visible ) === true ){
- data.elm.style.display = _visible ? '' : 'none';
- data.visible = _visible;
+ if( Type.isBoolean( v ) === true && data.visible !== v ){
+ data.elm.style.display = v ? '' : 'none';
+ if( data.focus === true && v === false ) this.blur();
+ data.visible = v;
+ data.node.disabled( !( data.enabled && v ) );
};
return data.visible;
},
data.destroy();
}
};
+
+/* --------------------------------
+ * TextInputManager
+ */
+ var FileInputManager = ( function(){
+ var currentData,
+ elmForm,
+ elmInput;
+
+ function updateWrapperPosition(){
+ var p = Position.cumulativeOffset( currentData.elmValue ),
+ w = currentData.elmValue.offsetWidth - 2,
+ _w;
+ elmInput.style.cssText = [
+ 'left:', p[ 0 ], 'px;',
+ 'top:', p[ 1 ], 'px;',//,
+ 'width:', w, 'px;'//,
+ //'height:', data.elmValue.offsetHeight, 'px;',
+ //'position:absolute;'
+ ].join( '' );
+
+ _w = elmInput.offsetWidth;
+ if( w !== _w ) elmInput.style.width = ( w - ( _w - w ) ) + 'px;';
+ };
+
+ function change( e ){
+ var data = currentData,
+ file = data.elmFileInputReal.value;
+ if( data.value !== file ){
+ data.onUpdate && AsyncCall.add( data.groupData.apiuser, data.onUpdate, [ file, data.value ], this );
+ data.elmValue.innerHTML = data.value = value;
+ currentData.blur();
+ };
+ };
+
+ return {
+ show : function( data ){
+ currentData = data;
+ updateWrapperPosition();
+
+ elmInput = data.elmFileInputReal;
+ elmInput.focus();
+ data.node.addEventListener( 'change', change, data );
+
+ SystemTimer.add( SUPER_USER_KEY, updateWrapperPosition, 500 );
+ },
+ hide : function( data ){
+ if( currentData !== data ) return;
+ data.node.removeEventListener( 'change', change );
+ currentData = null;
+ SystemTimer.remove( SUPER_USER_KEY, updateWrapperPosition );
+ },
+ onWindowResize: function( _w, _h ){
+ AsyncCall.add( currentData.apiuser, updateWrapperPosition );
+ }
+ };
+ })();
+
+ var FileInputClass = function( groupData, elmWrapper, onUpdate, elmFileInputReal, elmValue ){
+ var data = new UIItemPrivateData();
+ data.init( groupData, this, elmWrapper, null, onUpdate, null, false, true, true );
+ data.node = groupData.node.createNode( elmWrapper, false, true, 'ui-fileinput-hover', 'pointer' );
+ data.elmValue = elmValue;
+ data.elmFileInputReal = elmFileInputReal;
+ data.node.addEventListener( 'mouseover', this.focus, this );
+ };
+ FileInputClass.prototype = {
+ value : function(){
+ return data.value;
+ },
+ focus : function(){
+ var data = UIItemPrivateData.get( this );
+ data.focus = true;
+ Util.addClass( data.elm, 'fileinput-has-focus' );
+ start( data );
+ FileInputManager.show( data );
+ },
+ blur : function( keyCode ){
+ var data = UIItemPrivateData.get( this );
+ Util.removeClass( data.elm, 'fileinput-has-focus' );
+ data.focus = false;
+ FileInputManager.hide( data );
+ finish( data );
+ },
+ enabled : function( v ){
+ var data = UIItemPrivateData.get( this );
+ if( Type.isBoolean( v ) === true && data.enabled !== v ){
+ if( data.focus === true && v === false ) this.blur();
+ Util.toggleClass( data.elm, 'fileinput-disabled', !v );
+ data.enabled = v;
+ data.node.disabled( !( data.visible && v ) );
+ };
+ return data.enabled;
+ },
+ visible : function( v ){
+ var data = UIItemPrivateData.get( this );
+ if( Type.isBoolean( v ) === true && data.visible !== v ){
+ if( data.focus === true && v === false ) this.blur();
+ data.elm.style.display = v ? '' : 'none';
+ data.visible = v;
+ data.node.disabled( !( data.enabled && v ) );
+ };
+ return data.visible;
+ },
+ destroy : function(){
+ var data = UIItemPrivateData.get( this );
+ data.focus === true && FileInputManager.hide( data );
+ data.destroy();
+ }
+ };
var ButtonClass = function( groupData, elmWrapper, onUpdate ){
var data = new UIItemPrivateData();
data.init( groupData, this, elmWrapper, null, onUpdate, null, false, true, true );
- data.node = groupData.node.createNode( elmWrapper, false, true, 'ui-inpittext-hover', 'pointer' );
+ data.node = groupData.node.createNode( elmWrapper, false, true, 'ui-button-hover', 'pointer' );
data.node.addEventListener( 'click', onUpdate );
//MouseEvent.add( groupData.apiuser, elmWrapper, 'click', onUpdate );
};
data.focus = false;
finish( data );
},
- enabled : function( _enabled ){
+ enabled : function( v ){
var data = UIItemPrivateData.get( this );
- if( Type.isBoolean( _enabled ) === true && data.enabled !== _enabled ){
- _enabled === true ? Util.removeClass( data.elm, 'button-disabled' ) : Util.addClass( data.elm, 'button-disabled' );
- data.enabled = _enabled;
+ if( Type.isBoolean( v ) === true && data.enabled !== v ){
+ Util.toggleClass( data.elm, 'button-disabled', !v );
+ data.enabled = v;
+ data.node.disabled( !( data.visible && v ) );
};
return data.enabled;
},
- visible : function( _visible ){
+ visible : function( v ){
var data = UIItemPrivateData.get( this );
- if( Type.isBoolean( _visible ) === true ){
- data.elm.style.display = _visible ? '' : 'none';
- data.visible = _visible;
+ if( Type.isBoolean( v ) === true && data.visible !== v ){
+ data.elm.style.display = v ? '' : 'none';
+ data.visible = v;
+ data.node.disabled( !( data.enabled && v ) );
};
return data.visible;
},
data.selectIndex = 0;
data.optionList = [];
- data.node = groupData.node.createNode( elmWrapper, false, true, 'ui-inpittext-hover', 'pointer' );
+ data.node = groupData.node.createNode( elmWrapper, false, true, 'ui-combobox-hover', 'pointer' );
data.node.addEventListener( 'click', this.focus, this );
- // MouseEvent.add( groupData.apiuser, data.elm, 'click', this.focus );
};
ComboBoxClass.prototype = {
focus : function( e ){
var data = UIItemPrivateData.get( this );
- // MouseEvent.remove( data.groupData.apiuser, data.elm, 'click', this.focus );
data.node.removeEventListener( 'click', this.focus );
data.focus = true;
data.elmA.className = 'combobox-has-focus';
data.elmA.className = '';
finish( data );
data.node.addEventListener( 'click', this.focus, this );
- // MouseEvent.add( data.groupData.apiuser, data.elm, 'click', this.focus );
},
- enabled : function(){
+ enabled : function( v ){
var data = UIItemPrivateData.get( this );
+ if( Type.isBoolean( v ) === true && data.enabled !== v ){
+ Util.toggleClass( data.elm, 'ui-combobox-disabled', !v );
+ if( data.focus === true && v === false ) this.blur();
+ data.enabled = v;
+ data.node.disabled( !( data.visible && v ) );
+ };
return data.enabled;
},
- visible : function( _visible ){
+ visible : function( v ){
var data = UIItemPrivateData.get( this );
- if( Type.isBoolean( _visible ) === true ){
- data.elm.style.display = _visible ? '' : 'none';
- data.visible = _visible;
+ if( Type.isBoolean( v ) === true && data.visible !== v ){
+ data.elm.style.display = v ? '' : 'none';
+ if( data.focus === true && v === false ) this.blur();
+ data.visible = v;
+ data.node.disabled( !( data.enabled && v ) );
};
return data.visible;
},
elmValue = Util.getElementsByClassName( elmWrapper, 'editable-value' )[ 0 ],
ret;
if( elmValue ){
- ret = new InputTextClass( data, elmWrapper, elmValue, onUpdate, validater );
+ ret = new TextInputClass( data, elmWrapper, elmValue, onUpdate, validater );
data.itemList.push( ret );
return ret;
};
data.itemList.push( ret );
return ret;
},
- createFileInput : function( elm, onUpdate, validater, elmFileInput ){
- var data = UIGroupPrivateData.get( this ),
- ret = new FileInputClass( data, elm, onUpdate, validater, elmFileInput );
- data.itemList.push( ret );
+ createFileInput : function( elm, onUpdate, validater, elmFileInputReal ){
+ var data = UIGroupPrivateData.get( this ),
+ elmValue = Util.getElementsByClassName( elmWrapper, 'fileinput-value' )[ 0 ],
+ ret;
+ if( elmValue ){
+ ret = new FileInputClass( data, elm, onUpdate, validater, elmFileInputReal, elmValue );
+ data.itemList.push( ret );
+ return ret;
+ };
return ret;
},
createCombobox : function( elm, onUpdate, optionList ){
visible : function( v ){
var data = UIGroupPrivateData.get( this );
if( Type.isBoolean( v ) === true && data.visible !== v ){
- data.node.disabled( !v );
- data.visible = v;
- if( v === false && currentUi === this ){
- currentItem.blur();
- // finish( UIItemPrivateData.get( currentItem ) );
+ for( var i = data.itemList.length; i; ){
+ data.itemList[ --i ].visible( v );
};
+ data.visible = v;
+ data.node.disabled( !( data.enabled && v ) );
};
return data.visible;
},
enabled : function( v ){
-
+ var data = UIGroupPrivateData.get( this );
+ if( Type.isBoolean( v ) === true && data.enabled !== v ){
+ for( var i = data.itemList.length; i; ){
+ data.itemList[ --i ].enabled( v );
+ };
+ data.enabled = v;
+ data.node.disabled( !( data.visible && v ) );
+ };
+ return data.enabled;
},
destroy : function(){
var data = UIGroupPrivateData.get( this ),
keyCode === 13 && currentItem instanceof ComboBoxClass && OptionControl.onEnter();
keyCode === 13 && tabShift( index, 1 );
currentItem && currentItem.blur( keyCode );
+ return false;
};
- return false;
};
function tabShift( index, way ){
windowW = w;
windowH = h;
currentItem instanceof ComboBoxClass && OptionControl.onWindowResize( w, h );
+ currentItem instanceof TextInputClass && TextInputManager.onWindowResize( w, h );
+ currentItem instanceof FileInputClass && FileInputManager.onWindowResize( w, h );
},
onCurrentApplicationChange: function( _apiuser ){
currentList = UI_LIST[ _apiuser.getUID() ];