/*\r
* pettanR common.js\r
- * version 0.4.19\r
+ * version 0.4.21\r
* \r
* author: itozyun\r
*/\r
IS_DEBUG = Type.isBoolean( URL_PARAMS.debug ) ? URL_PARAMS.debug : IS_LOCAL === true,\r
jqWindow , jqDocument , jqBody;\r
return {\r
- version: '0.4.19',\r
+ version: '0.4.21',\r
init: function(){\r
jqWindow = $( window);\r
jqDocument = $( document);\r
currentApplication = null;\r
\r
var AbstractBasicPane = function(){\r
+ this.onPaneResize = function( _w, _h ){}\r
+ this.resize = function( _w, _h ){\r
+ if( this.MIN_WIDTH > _w || this.MIN_HEIGHT > _h ){\r
+ if( Type.isHTMLElement( this.rootElement ) === true ){\r
+ // 小さすぎる!、と表示\r
+ }\r
+ return;\r
+ }\r
+ this.onPaneResize( _w, _h );\r
+ }\r
+ this.MIN_WIDTH = 240;\r
+ this.MIN_HEIGHT = 240;\r
+ }\r
+ \r
+ var AbstractApplication = function(){\r
+ this.displayName = 'app name';\r
+ this.ID = 'app id';\r
this.rootElement = null;\r
this.parentElement = null;\r
this.nextSibling = null;\r
- this.onOpen = function( _w, _h /*, _option */ ){\r
- // overrride\r
- };\r
- this.onClose = function(){\r
- // overrride\r
- return true;\r
- } // false の場合、close の拒否 \r
- this.onPaneResize = function( _w, _h ){}\r
this.open = function( _w, _h /*, _option */ ){\r
- if( this.nextSibling && this.nextSibling.parentNode === this.parentElement ){\r
- this.parentElement.insertBefore( this.rootElement, this.nextSibling );\r
- } else\r
- if( this.parentElement ){\r
- this.parentElement.appendChild( this.rootElement );\r
- } else {\r
- this.rootElement && document.body.appendChild( this.rootElement );\r
- }\r
if( this.MIN_WIDTH > _w || this.MIN_HEIGHT > _h ){\r
if( Type.isHTMLElement( this.rootElement ) === true ){\r
// 小さすぎる!、と表示\r
}\r
this.close = function(){\r
if( this.onClose() === false ){\r
- \r
+ return;\r
}\r
if( this.rootElement && this.rootElement.parentNode ){\r
this.rootElement.parentNode.removeChild( this.rootElement );\r
}\r
}\r
- this.resize = function( _w, _h ){\r
- if( this.MIN_WIDTH > _w || this.MIN_HEIGHT > _h ){\r
- if( Type.isHTMLElement( this.rootElement ) === true ){\r
- // 小さすぎる!、と表示\r
- }\r
- return;\r
- }\r
- this.onPaneResize( _w, _h );\r
- }\r
- this.MIN_WIDTH = 240;\r
- this.MIN_HEIGHT = 240;\r
- }\r
- \r
- var AbstractApplication = function(){\r
- this.displayName = 'app name';\r
- this.ID = 'app id';\r
+ this.onOpen = function( _w, _h /*, _option */ ){\r
+ // overrride\r
+ };\r
+ this.onClose = function(){\r
+ // overrride\r
+ return true;\r
+ } // false の場合、close の拒否 \r
}\r
AbstractApplication.prototype = new AbstractBasicPane();\r
\r
- var ApplicationReference = function( _application ){\r
+ var ApplicationReference = function( application ){\r
this.inOverlay = false;\r
+ this.getUID = function(){\r
+ return pettanr.util.getIndex( APPLICATION_LIST, application );\r
+ }\r
this.boot = function( /* _option */ ){\r
if( arguments.length > 0 ){\r
- bootApplication( _application, pettanr.util.copyArray( arguments ) );\r
+ bootApplication( application, pettanr.util.copyArray( arguments ) );\r
} else {\r
- bootApplication( _application );\r
+ bootApplication( application );\r
}\r
}\r
this.bootInOverlay = function( /* _option */ ){\r
this.inOverlay = true;\r
- pettanr.overlay.show( _application );\r
- \r
- if( arguments.length > 0 ){\r
- var _arguments = pettanr.util.copyArray( arguments );\r
- _arguments.unshift( jqWindow.width(), jqWindow.height() )\r
- // argumentsRellay( _application.open, _arguments );\r
- _application.open.apply( _application, _arguments );\r
- } else {\r
- _application.open( jqWindow.width(), jqWindow.height() );\r
- }\r
+ pettanr.overlay.show( application, pettanr.util.copyArray( arguments ) );\r
}\r
this.shutdown = function(){\r
if( this.inOverlay === true ){\r
pettanr.overlay.hide();\r
- _application.close();\r
+ application.close();\r
this.inOverlay = false;\r
} else {\r
bootApplication( 0 );\r
}\r
}\r
this.addToLancher = function(){\r
- if( pettanr.util.getIndex( LUNCHER_APPLICATION_LIST, _application ) !== -1 ) return;\r
- LUNCHER_APPLICATION_LIST.push( _application );\r
+ if( pettanr.util.getIndex( LUNCHER_APPLICATION_LIST, application ) !== -1 ) return;\r
+ LUNCHER_APPLICATION_LIST.push( application );\r
\r
var navi = document.getElementById('global-navi'),\r
item = document.createElement('a');\r
navi.appendChild( item );\r
navi.style.width = ( ( item.offsetWidth || 80 ) * LUNCHER_APPLICATION_LIST.length ) + 'px';\r
item.href = '#';\r
- item.appendChild( document.createTextNode( _application.displayName ));\r
+ item.appendChild( document.createTextNode( application.displayName ));\r
item.onclick = LoginUserNavi.show;\r
}\r
}\r
}\r
\r
if( currentApplication === _application ) return;\r
- \r
currentApplication && currentApplication.close();\r
-\r
currentApplication = _application;\r
\r
+ if( _application.nextSibling && _application.nextSibling.parentNode === _application.parentElement ){\r
+ _application.parentElement.insertBefore( _application.rootElement, _application.nextSibling );\r
+ } else\r
+ if( _application.parentElement ){\r
+ _application.parentElement.appendChild( _application.rootElement );\r
+ } else {\r
+ _application.rootElement && document.body.appendChild( _application.rootElement );\r
+ }\r
+ \r
if( _arguments ){\r
_arguments.unshift( jqWindow.width(), jqWindow.height() );\r
_application.open.apply( _application, _arguments );\r
function onWindowResize(){\r
var w = jqWindow.width(),\r
h = jqWindow.height();\r
- currentApplication && currentApplication.resize && currentApplication.resize( w, h );\r
- pettanr.overlay.currentID !== null && pettanr.overlay.onWindowResize( w, h );\r
+ currentApplication && currentApplication.resize( w, h );\r
+ pettanr.overlay.onWindowResize( w, h );\r
}\r
\r
return {\r
jqWindow.resize( onWindowResize );\r
\r
var _option = {}; // urlパラメータ\r
-\r
+ \r
+ onWindowResize();\r
+ \r
bootApplication( pettanr.URL_PARAMS.view || 0 );\r
\r
delete pettanr.view.init;\r
ELM_CONTAINER = document.getElementById( 'overlay-container' ),\r
jqConteiner, jqShadow, jqCloseButton,// jqBody, \r
currentOverlay = null,\r
+ bootParams = null,\r
visible = false,\r
windowW, windowH;\r
\r
function close(){\r
currentOverlay && currentOverlay.close();\r
- pettanr.overlay.hide(); \r
+ pettanr.overlay.hide();\r
}\r
function asyncResize(){\r
currentOverlay.resize( windowW, windowH);\r
return false; \r
}\r
function onFadeInComplete(){\r
- \r
+\r
}\r
function onFadeOutComplete(){\r
if( currentOverlay.rootElement && currentOverlay.rootElement.parentNode === ELM_CONTAINER ){\r
\r
delete pettanr.overlay.init;\r
},\r
- show: function( _overlay ){\r
+ show: function( _overlay, _bootParams ){\r
if( visible === true && currentOverlay === _overlay ) return;\r
if( pettanr.view.isApplicationInstance( _overlay ) === false ) return;\r
\r
document.body.style.overflow = 'hidden';\r
- ELM_CONTAINER.insertBefore( _overlay.rootElement, document.getElementById( 'overlay-close-button' ));\r
\r
+ this.visible = visible = true;\r
+ this.currentID = _overlay.ID;\r
+ currentOverlay = _overlay;\r
+ bootParams = _bootParams;\r
+\r
jqConteiner.stop().css( {\r
filter: '',\r
opacity: '',\r
top: document.documentElement.scrollTop || document.body.scrollTop\r
}).fadeIn( onFadeInComplete );\r
- \r
- this.visible = visible = true;\r
- currentOverlay = _overlay;\r
- this.currentID = _overlay.ID;\r
- // jqCloseButton.toggle( !!_overlay.onClose );\r
+\r
+ ELM_CONTAINER.insertBefore( currentOverlay.rootElement, document.getElementById( 'overlay-close-button' ));\r
+ \r
+ if( Type.isArray( bootParams ) === true ){\r
+ bootParams.unshift( windowW, windowH )\r
+ currentOverlay.open.apply( currentOverlay, bootParams );\r
+ } else {\r
+ currentOverlay.open( windowW, windowH, bootParams );\r
+ }\r
},\r
hide: function(){\r
if( visible === false) return;\r
visible: visible,\r
currentID: null,\r
onWindowResize: function( _windowW, _windowH ){\r
+ windowW = _windowW;\r
+ windowH = _windowH; \r
+ \r
+ if( currentOverlay === null ) return;\r
+ \r
jqConteiner.css({\r
height: _windowH,\r
top: document.documentElement.scrollTop || document.body.scrollTop\r
});\r
- jqShadow.css( { height: _windowH});\r
- windowW = _windowW;\r
- windowH = _windowH;\r
+ jqShadow.css( { height: _windowH });\r
// 先にeditorのcanvasを確定する。\r
- currentOverlay && setTimeout( asyncResize, 0);\r
- },\r
- registerOverlay: function( _basicPane){\r
- var _api = pettanr.view.createBasicPane( _basicPane );\r
- // OverlayAPI\r
- return {\r
- show: function( _basicPane ){\r
- \r
- },\r
- hide: function( _basciPane ){\r
- \r
- },\r
- isCurrent: function( _basicPane ){\r
- \r
- }\r
- }\r
- },\r
- isOverlay: function( _basicPane ){\r
- \r
+ setTimeout( asyncResize, 0);\r
}\r
}\r
})();\r
/*
* pettanR system.js
- * version 0.4.20
+ * version 0.4.21
*
* author:
* itozyun
}
return -1;
},
+ getChildFileByIndex: function( _index ){
+ var _access = FILE_CONTROLER.getFileDataAccess( this ),
+ _children = FILE_CONTROLER.getChildren( this );
+ if( typeof _index !== 'number' || _index < 0 || Type.isArray( _children ) === false || _index >= _children.length) return null;
+ var _file = new FileClass( _access.TREE, _access.DATA, _children[ _index ]);
+ // _file.init();
+ return _file;
+ },
getName: function(){
var driver = FILE_CONTROLER.getDriver( this );
if( typeof driver.getName === 'function'){
onDelete: function(){
},
- getChildFileByIndex: function( _index ){
- var _access = FILE_CONTROLER.getFileDataAccess( this ),
- _children = FILE_CONTROLER.getChildren( this );
- if( typeof _index !== 'number' || _index < 0 || Type.isArray( _children ) === false || _index >= _children.length) return null;
- var _file = new FileClass( _access.TREE, _access.data, _children[ _index ]);
- // _file.init();
- return _file;
- },
move: function( _newFolder, _newIndex, opt_callback ){
var _access = FILE_CONTROLER.getFileDataAccess( this );
_access.TREE.move( _access.parentData, this.getUID(), _newFolder, _newIndex, opt_callback );
},
destroy: function(){
- elmContainer.removeChild( ELM_WRAPPER);
+ elmContainer.removeChild( ELM_WRAPPER );
file && file.destroy();
file = elmContainer = onDownCallback = onEditorCallback = onViewerCallback = onActionCallback = viewerList = editorList = null;
FINDER_ICON_POOL.push( instansce);
instance = this;
tree.addTreeEventListener( pettanr.file.TREE_EVENT.UPDATE, draw );
+ ELM_CONTAINER.appendChild( elmContainer );
function draw( _w, _h ){
w = Type.isFinite( _w ) === true ? _w : w;
this.init = function(){
//$( elmLocation).click( onHeadClick);
//$( elmContainer).click( onBodyClick);
- var position = pettanr.util.getAbsolutePosition( elmLocation);
+ var position = pettanr.util.getAbsolutePosition( elmLocation );
headX = position.x;
headY = position.y;
bodyY = pettanr.util.getAbsolutePosition( elmBody ).y;
delete instance.init;
}
- this.onOpen = function( _w, _h, _option ){
- instance.init && instance.init();
- draw( _w, _h );
- }
- this.onClose = function(){
- return true;
- }
this.onPaneResize = function( _w, _h ){
+ instance.init && instance.init();
+ draw( _w, _h );
+
w = _w;
h = _h;
elmBody.style.height = ( _h - headH ) + 'px';
init: function(){
},
- createFinder: function( _elmTarget, _tree, _header, _footer ){
+ createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer ){
+ if( pettanr.view.isApplicationReference( _applicationReference ) === false ) return;
+
var _finder = new FinderClass( _elmTarget, _tree, _header, _footer );
FINDER_ARRAY.push( _finder );
return _finder;
name: 'My Comics',
type: pettanr.file.FILE_TYPE.FOLDER,
children: [],
- driver: Driver
+ driver: Driver,
+ id: MyAuthorID
},
FILE_DATA_LATEST_COMICS = {
name: 'Latest Comics',
type: pettanr.file.FILE_TYPE.FOLDER,
children: [],
driver: Driver,
- json: pettanr.CONST.URL_ORIGINAL_PICTURES_JSON
+ json: pettanr.CONST.URL_ORIGINAL_PICTURES_JSON,
+ id: MyArtistID
},
FILE_DATA_AUTHOR_ROOT = {
name: 'Authors',
if( _artist){
_data.artist = _artist = buildFileData( _artist, FILE_DATA_ARTIST_ROOT );
addChildData( _artist, _data );
- _artist.id === MyArtistID && addChildData( FILE_DATA_MY_PICTURES_ROOT, _data );
+ if( _artist.id === MyArtistID ){
+ addChildData( FILE_DATA_MY_PICTURES_ROOT, _data );
+ //FILE_DATA_MY_PICTURES_ROOT.type = pettanr.driver.FILE_TYPE.ARTIST;
+ //FILE_DATA_MY_PICTURES_ROOT.id = MyArtistID;
+ }
}
}
return _data;
_getAPI: function(){
return FileAPI;
},
+ _getMyPicturesData: function(){
+ return FILE_DATA_MY_PICTURES_ROOT;
+ },
FILE_TYPE: {
COMIC: FileAPI.createFileTypeID(),
PANEL: FileAPI.createFileTypeID(),
this.displayName = 'Comic list';
this.ID = 'Comiclist';
this.rootElement = elmContainer;
- this.onOpen = function( _w, _h, _option ){
- finder = finder || pettanr.finder.createFinder( elmContainer, pettanr.driver.createComicTree() );
- finder.open( _w, _h - pageHeaderH, _option );
+ this.onOpen = function( _w, _h ){
+ finder = finder || pettanr.finder.createFinder( pettanr.cabinet, elmContainer, pettanr.driver.createComicTree() );
+ finder.resize( _w, _h - pageHeaderH );
}
this.onClose = function(){
- finder.close();
+ // finder.close();
}
this.onPaneResize = function( _w, _h){
finder.resize( _w, _h - pageHeaderH );
this.displayName = 'Pictures';
this.ID = 'pictures';
this.rootElement = elmContainer;
- this.onOpen = function( _w, _h, _option ){
- finder = finder || pettanr.finder.createFinder( elmContainer, pettanr.driver.createPictureTree() );
- finder.open( _w, _h - pageHeaderH, _option );
+ this.onOpen = function( _w, _h ){
+ finder = finder || pettanr.finder.createFinder( pettanr.gallery, elmContainer, pettanr.driver.createPictureTree() );
+ finder.resize( _w, _h - pageHeaderH );
}
this.onClose = function(){
- finder.close();
+ // finder.close();
}
this.onPaneResize = function( _w, _h){
finder.resize( _w, _h - pageHeaderH );
var _data, _artistID = -1;
if( pettanr.driver.isPettanrFileInstance( _ARTISTIDorFILE ) === true ){
- if( _ARTISTIDorFILE.getType() === pettanr.driver.FILE_TYPE.ARTIST ){
- _data = pettanr.driver._getAPI().getFileData( _ARTISTIDorFILE );
- _artistID = _data !== null ? _data.id || 0 : -1;
+ _data = pettanr.driver._getAPI().getFileData( _ARTISTIDorFILE );
+ if( _ARTISTIDorFILE.getType() === pettanr.driver.FILE_TYPE.ARTIST || pettanr.driver._getMyPicturesData() === _data ){
+ _artistID = _data.id || -1;
}
} else
if( Type.isNumber( _ARTISTIDorFILE ) === true ){
/*\r
* pettanR work.js\r
- * version 0.4.19\r
+ * version 0.4.21\r
* \r
* author:\r
* itozyun\r
delete this.onInit;\r
},\r
onOpen: function( _w, _h){\r
- finder = finder || pettanr.finder.createFinder( document.getElementById( 'image-exproler-container'), pettanr.driver.createPictureTree());\r
- finder.open( _w, _h );\r
+ finder = finder || pettanr.finder.createFinder( pettanr.editor, document.getElementById( 'image-exproler-container'), pettanr.driver.createPictureTree());\r
+ finder.resize( _w, _h );\r
},\r
onResize: function( _w, _h ){\r
finder.resize( _w, _h );\r
this.MIN_WIDTH = 320;\r
this.MIN_HEIGHT = 320;\r
this.init = function(){\r
- instance.jqWrap = jqWrap = $( '#comic-console-wrapper').hide();\r
+ jqWrap = $( '#comic-console-wrapper').hide();\r
$( '#comic-console-post-button').click( clickOK );\r
$( '#comic-console-cancel-button').click( clickCancel );\r
\r
\r
delete instance.init;\r
}\r
- this.jqWrap = null;\r
this.onOpen = function( w, h ){\r
instance.init && instance.init();\r
\r
this.onPaneResize = function( _windowW, _windowH){\r
jqWrap.css(\r
{\r
- left: Math.floor( ( _windowW -jqWrap.width()) /2),\r
- top: Math.floor( ( _windowH -jqWrap.height()) /2)\r
+ left: Math.floor( ( _windowW - jqWrap.width()) /2),\r
+ top: Math.floor( ( _windowH - jqWrap.height()) /2)\r
}\r
);\r
}\r
this.MIN_WIDTH = 320;\r
this.MIN_HEIGHT = 320;\r
this.init = function(){\r
- instance.jqWrap = jqWrap = $( '#upload-console-wrapper').hide();\r
+ jqWrap = $( '#upload-console-wrapper').hide();\r
$( '#upload-console-post-button').click( clickOK );\r
$( '#upload-console-cancel-button').click( clickCancel );\r
\r
delete instance.init;\r
}\r
- this.jqWrap = null;\r
this.onOpen = function( w, h){\r
instance.init && instance.init();\r
/*\r
this.MIN_WIDTH = 320;\r
this.MIN_HEIGHT = 320;\r
this.init = function(){\r
- instance.jqWrap = jqWrap = $( '#panel-console-wrapper').hide();\r
+ jqWrap = $( '#panel-console-wrapper').hide();\r
$( '#panel-console-post-button').click( clickOK );\r
$( '#panel-console-cancel-button').click( clickCancel );\r
\r
delete instance.init;\r
}\r
- this.jqWrap = null;\r
this.onOpen = function( w, h ){\r
instance.init && instance.init();\r
/*\r
this.MIN_WIDTH = 320;\r
this.MIN_HEIGHT = 320;\r
this.init = function(){\r
- instance.jqWrap = jqWrap = $( '#artist-console-wrapper').hide();\r
+ jqWrap = $( '#artist-console-wrapper').hide();\r
$( '#artist-console-post-button').click( clickOK );\r
$( '#artist-console-cancel-button').click( clickCancel );\r
\r
delete instance.init;\r
}\r
- this.jqWrap = null;\r
this.onOpen = function( w, h ){\r
instance.init && instance.init();\r
/*\r
this.MIN_WIDTH = 320;\r
this.MIN_HEIGHT = 320;\r
this.init = function(){\r
- instance.jqWrap = jqWrap = $( '#output-console-wrapper').hide();\r
+ jqWrap = $( '#output-console-wrapper').hide();\r
jqOutputArea = $( '#output-area');\r
delete instance.init;\r
}\r
- this.jqWrap = null;\r
this.onOpen = function( _w, _h, _text ){\r
instance.init && instance.init();\r
\r
jqWrap.show();\r
- instance.onWindowResize( _w, _h );\r
+ instance.onPaneResize( _w, _h );\r
jqOutputArea.val( _text).focus();\r
}\r
- this.onWindowResize = function( _w, _h){\r
+ this.onPaneResize = function( _w, _h){\r
jqWrap.css(\r
{\r
left: Math.floor( ( _w -jqWrap.width()) /2),\r