From cb0fdc92f7c9fba15907f13c4c4d31ac99525fda Mon Sep 17 00:00:00 2001 From: itozyun Date: Fri, 6 Apr 2012 05:43:50 +0900 Subject: [PATCH] client is version0.4.14, display file-loading --- app/assets/stylesheets/work.css | 4 +- public/assets/common.js | 53 +++++++++------ public/assets/system.js | 146 +++++++++++++++++++++++++++------------- public/assets/work.js | 28 ++++---- 4 files changed, 150 insertions(+), 81 deletions(-) diff --git a/app/assets/stylesheets/work.css b/app/assets/stylesheets/work.css index e51e1aca..90899533 100644 --- a/app/assets/stylesheets/work.css +++ b/app/assets/stylesheets/work.css @@ -1073,7 +1073,9 @@ .finder-body { position: relative; } - + .finder-container .loading { + background-position: 50% bottom; + } .finder-header { height: 40px; position: relative; diff --git a/public/assets/common.js b/public/assets/common.js index b9a73d31..3b78f0f8 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -1,6 +1,6 @@ /* * pettanR common.js - * version 0.4.13 + * version 0.4.14 * * author: itozyun */ @@ -771,7 +771,7 @@ pettanr.CONST = ( function(){ CREATE_COMIC_JS: isLocal === true ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js', CREATE_PANEL_JS: isLocal === true ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js', UPLOAD_PICTURE_JS: isLocal === true ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js', - RESISTER_ARTIST_JS: isLocal === true ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js', + REGISTER_ARTIST_JS: isLocal === true ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js', JQUERY_URL: isLocal === true ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js' } })(); @@ -930,7 +930,7 @@ pettanr.view = ( function(){ pettanr.DEBUG === true && VIEW_ID_ARRAY.push( 'debug'); - show(); + open(); function onWindowResize(){ var _fn, @@ -944,7 +944,7 @@ pettanr.view = ( function(){ currentView && currentView.onWindowResize && currentView.onWindowResize( w, h); pettanr.overlay.currentID !== null && pettanr.overlay.onWindowResize( w, h); } - function show(){ + function open( _option ){ if( isWorkPage === false) return; var _elm = document.getElementById( currentID); @@ -964,17 +964,27 @@ pettanr.view = ( function(){ if( !pettanr.view || pettanr.view.init !== undefined) return; currentView = pettanr[ currentID]; if( !currentView) return; - typeof currentView.onOpen === 'function' && currentView.onOpen(); - setTimeout( onWindowResize, 0); + typeof currentView.onOpen === 'function' && currentView.onOpen( jqWindow.width(), jqWindow.height(), _option ); + // setTimeout( onWindowResize, 0); } var AbstractBasicPane = function(){ this.UID = '', // element の ID と一致 - this.onOpen = function(){}; - this.onClose = function(){}; - this.onPaneResize = function( _w, _h){}; - this.MIN_WIDTH = 0; - this.MIN_HEIGHT = 0; + this.elm = null, + this.onOpen = function( _w, _h, _option ){} + this.onClose = function(){ return true; } // false の場合、close の拒否 + this.onPaneResize = function( _w, _h ){} + this.resize = function( _w, _h ){ + if( this.MIN_WIDTH > _w || this.MIN_HEIGHT > _h ){ + if( Type.isHTMLElement( this.elm ) === true ){ + // 小さすぎる!、と表示 + } + return; + } + this.onPaneResize( _w, _h ); + } + this.MIN_WIDTH = 240; + this.MIN_HEIGHT = 240; } return { @@ -983,10 +993,11 @@ pettanr.view = ( function(){ jqWindow = pettanr.jqWindow(); jqWindow.resize( onWindowResize); - currentView = currentView || pettanr[ currentID]; - currentView && typeof currentView.onOpen === 'function' && currentView.onOpen(); + currentView = currentView || pettanr[ currentID ]; + var _option = {}; // urlパラメータ + currentView && typeof currentView.onOpen === 'function' && currentView.onOpen( jqWindow.width(), jqWindow.height(), _option ); - setTimeout( onWindowResize, 100); + // setTimeout( onWindowResize, 100); delete pettanr.view.init; }, @@ -1003,18 +1014,18 @@ pettanr.view = ( function(){ if( pettanr.view[ key] === _viewID){ if( currentID !== _viewID && document.getElementById( _viewID)){ this.currentID = currentID = _viewID; - show(); + open(); } return; } } alert( _viewID); }, - resisterAsBasicPane: function( _basicPane){ + registerAsBasicPane: function( _basicPane ){ if( pettanr.view.isBasicPaneInstance( _basicPane ) === true ) return; _basicPane.prototype = new AbstractBasicPane(); }, - isBasicPaneInstance: function( _basicPane){ + isBasicPaneInstance: function( _basicPane ){ return _basicPane instanceof AbstractBasicPane; }, currentID: currentID, @@ -1095,8 +1106,8 @@ pettanr.overlay = ( function(){ // 先にeditorのcanvasを確定する。 currentOverlay && currentOverlay.onWindowResize && setTimeout( asyncResize, 0); }, - resisterOverlay: function( _basicPane){ - var _api = pettanr.view.resisterAsBasicPane( _basicPane); + registerOverlay: function( _basicPane){ + var _api = pettanr.view.registerAsBasicPane( _basicPane); // OverlayAPI return { show: function( _basicPane ){ @@ -2270,7 +2281,7 @@ var VisualEffect = ( function(){ var VisualEffectClass = function( ELM){ var isHtmlElement; - function resisterAnime( _cssObject, _onComplete, _onEnterFrame, _time){ + function registerAnime( _cssObject, _onComplete, _onEnterFrame, _time){ var _numFrames = Math.floor( _time / fpms); startAnimation( ELM, _cssObject, _onComplete, _onEnterFrame, _numFrames); } @@ -2285,7 +2296,7 @@ var VisualEffect = ( function(){ } - this.anime = resisterAnime; + this.anime = registerAnime; this.fadeIn = startFadeIn; this.fadeOut = startFadeOut; this.update = update; diff --git a/public/assets/system.js b/public/assets/system.js index f9d121b1..35ab2271 100644 --- a/public/assets/system.js +++ b/public/assets/system.js @@ -1,6 +1,6 @@ /* * pettanR system.js - * version 0.4.13 + * version 0.4.14 * * author: * itozyun @@ -40,7 +40,7 @@ pettanr.file = ( function(){ FILEDATA_RESITER = [], // store all of fileData( json object ) FILEDATA_ACCESS = [], // file operations for Kernel only ! hide from Out of pettanr.file FILE_OBJECT_POOL = [], - EVENT_LISTENER_RESISTER = [], + EVENT_LISTENER_REGISTER = [], TREE_ARRAY = [], TREE_ACCESS_ARRAY = []; @@ -156,15 +156,15 @@ pettanr.file = ( function(){ }, addEventListener: function( FILEorNULL, _eventType, _callback){ var _uid = FILEorNULL instanceof FileClass ? FILEorNULL.getUID() : FILEorNULL; - EVENT_LISTENER_RESISTER.push( new FileEventTicketClass( _uid, _eventType, _callback)); + EVENT_LISTENER_REGISTER.push( new FileEventTicketClass( _uid, _eventType, _callback)); }, removeEventListener: function( FILEorNULL, _eventType, _callback){ var _uid = FILEorNULL instanceof FileClass ? FILEorNULL.getUID() : FILEorNULL, _ticket; - for(var i=0, l = EVENT_LISTENER_RESISTER.length; i 0){ @@ -873,19 +909,24 @@ pettanr.finder = ( function(){ init: function(){ }, - createFinder: function( _elmTarget, _tree, detailSwitchEnabled, styleSwitchEnabled, actionSwitchEnabled){ - var _finder = new FinderClass( _elmTarget, _tree, detailSwitchEnabled, styleSwitchEnabled, actionSwitchEnabled); + createFinder: function( _elmTarget, _tree, _header, _footer ){ + var _finder = new FinderClass( _elmTarget, _tree, _header, _footer ); FINDER_ARRAY.push( _finder); return _finder; }, - createFinderHead: function(){ + registerFinderHead: function(){ }, - resisterFinderPane: function( _finderPane){ + registerFinderPane: function( _finderPane){ }, isFinderInstance: function( _finder){ return _finder instanceof FinderClass; + }, + isFinderPaneInstance: function(){ + + }, + isFinderHeadInstance: function(){ } } })(); @@ -926,10 +967,10 @@ pettanr.driver = ( function(){ if( _type === pettanr.driver.FILE_TYPE.AUTHOR ){ return [ _data.id , ':', _data.name, '先生' ].join( ''); } - return _data.name; + return _data.name + _data.type; }, getThumbnail: function( _file){ - var _data = FileAPI.getFileData( _file); + var _data = FileAPI.getFileData( _file), _type = _data !== null ? _data.type : null; if( _type === pettanr.driver.FILE_TYPE.PICTURE){ return { image: [ pettanr.CONST.RESOURCE_PICTURE_PATH, 'thumbnail/', _data.id, '.', _data.ext ].join( '')}; @@ -949,13 +990,23 @@ pettanr.driver = ( function(){ if( _type === pettanr.driver.FILE_TYPE.ARTIST){ return { className: 'file-type-artist'}; } - if( _type === pettanr.driver.FILE_TYPE.FOLDEER){ + if( _type === pettanr.file.FILE_TYPE.FOLDER){ return { className: 'file-type-folder'}; } - return { className: 'file-type-folder'}; + return { className: 'file-type-broken'}; + }, + viwerApplicationList: function( _file ){ + var _data = FileAPI.getFileData( _file ), + _type = _data !== null ? _data.type : null; + return []; + }, + editorApplicationList: function( _file ){ + var _data = FileAPI.getFileData( _file ), + _type = _data !== null ? _data.type : null; + return []; } }, - FileAPI = pettanr.file.resisterDriver( Driver), + FileAPI = pettanr.file.registerDriver( Driver), FILE_DATA_SERVICE_ROOT = { name: 'PettanR root', type: pettanr.file.FILE_TYPE.FOLDER, @@ -984,7 +1035,7 @@ pettanr.driver = ( function(){ }, FILE_DATA_MY_COMICS_ROOT = { name: 'My Comics', - type: pettanr.file.FILE_TYPE.AUTHOR, + type: pettanr.file.FILE_TYPE.FOLDER, children: [], driver: Driver }, @@ -995,7 +1046,7 @@ pettanr.driver = ( function(){ }, FILE_DATA_MY_PICTURES_ROOT = { name: 'My Pictures', - type: pettanr.file.FILE_TYPE.ARTIST, + type: pettanr.file.FILE_TYPE.FOLDER, children: [], driver: Driver, json: pettanr.CONST.URL_ORIGINAL_PICTURES_JSON @@ -1250,8 +1301,8 @@ pettanr.driver = ( function(){ pettanr.gallery = ( function(){ var finder, elmContainer = document.getElementById( 'gallery'), - option; - + option, + pageHeaderH = pettanr.util.getElementSize( document.getElementById('header') ).height; return { init: function( _option){ option = _option; @@ -1261,16 +1312,16 @@ pettanr.gallery = ( function(){ finder = pettanr.finder.createFinder( elmContainer, pettanr.driver.createPictureTree()); delete pettanr.gallery.firstOpen; }, - onOpen: function(){ + onOpen: function( _w, _h, _option ){ pettanr.gallery.firstOpen !== undefined && pettanr.gallery.firstOpen(); - finder.onOpen(); + finder.onOpen( _w, _h - pageHeaderH, _option ); }, onClose: function(){ finder.onClose(); }, onWindowResize: function( _w, _h){ - finder.onWindowResize( _w, _h); + finder.resize( _w, _h - pageHeaderH ); } } })(); @@ -1278,7 +1329,8 @@ pettanr.gallery = ( function(){ pettanr.cabinet = ( function(){ var finder, elmContainer = document.getElementById( 'cabinet'), - option; + option, + pageHeaderH = pettanr.util.getElementSize( document.getElementById('header') ).height; return { init: function( _option){ @@ -1289,16 +1341,16 @@ pettanr.cabinet = ( function(){ finder = pettanr.finder.createFinder( elmContainer, pettanr.driver.createComicTree()); delete pettanr.cabinet.firstOpen; }, - onOpen: function(){ + onOpen: function( _w, _h, _option ){ pettanr.cabinet.firstOpen !== undefined && pettanr.cabinet.firstOpen(); - finder.onOpen(); + finder.onOpen( _w, _h - pageHeaderH, _option ); }, onClose: function(){ finder.onClose(); }, onWindowResize: function( _w, _h){ - finder.onWindowResize( _w, _h); + finder.resize( _w, _h - pageHeaderH); } } })(); diff --git a/public/assets/work.js b/public/assets/work.js index dba2c2cf..bb435059 100644 --- a/public/assets/work.js +++ b/public/assets/work.js @@ -1,6 +1,6 @@ /* * pettanR work.js - * version 0.4.13 + * version 0.4.14 * * author: * itozyun @@ -1404,7 +1404,7 @@ pettanr.editor = ( function(){ finder.onOpen( _w, _h); }, onResize: function( _w, _h){ - finder.onWindowResize( _w, _h); + finder.resize( _w, _h); } }, 'image-exproler', 'Album', 0, 215, 400, 350, false, true, true, 300, 300 @@ -3428,7 +3428,7 @@ pettanr.editor = ( function(){ delete pettanr.editor.firstOpen; }, - onOpen: function( _file){ + onOpen: function( _w, _h, _file){ if( pettanr.file.isFileInstance( _file) === true){ // pettanr.file.isPettanFileInstance( _file) === true // @@ -3449,6 +3449,10 @@ pettanr.editor = ( function(){ MENU_BAR_CONTROL.open(); pettanr.editor.firstOpen !== undefined && pettanr.editor.firstOpen(); + + windowW = _w; + windowH = _h; + pettanr.editor.onWindowResize( _w, _h ); }, onClose: function(){ HISTORY_CONTROL.close(); @@ -3465,8 +3469,8 @@ pettanr.editor = ( function(){ MENU_BAR_CONTROL.open(); }, onWindowResize: function( _windowW, _windowH){ - windowW = _windowW; - windowH = _windowH; + windowW = _windowW || windowW; + windowH = _windowH || windowH; if( pettanr.editor.firstOpen) return; /* * ieは +'px'が不要みたい @@ -3708,7 +3712,7 @@ pettanr.comicConsole = ( function(){ COMIC_CONSOLE.init(); delete pettanr.comicConsole.init; }, - onOpen: function( _file){ + onOpen: function( _w, _h, _file){ if( pettanr.driver.isPettanrFileInstance( _file ) === true && _file.getType() === pettanr.driver.FILE_TYPE.COMIC){ // _data = _file.read(); } @@ -3889,7 +3893,7 @@ pettanr.uploadConsole = ( function(){ UPLOAD_CONSOLE.init(); delete pettanr.comicConsole.init; }, - onOpen: function( _file){ + onOpen: function( _w, _h, _file){ if( pettanr.driver.isPettanrFileInstance( _file ) === true && _file.getType() === pettanr.driver.FILE_TYPE.COMIC){ // _data = _file.read(); } @@ -4065,7 +4069,7 @@ pettanr.panelConsole = ( function(){ PANEL_CONSOLE.init(); delete pettanr.comicConsole.init; }, - onOpen: function(){ + onOpen: function( _w, _h, _file ){ }, onClose: function(){ @@ -4086,7 +4090,7 @@ pettanr.artistConsole = ( function(){ var ARTIST_CONSOLE = ( function(){ var jqWrap, windowW, windowH, ID = 'artistConsole', - TARGET_FRAME_NAME = 'targetFrameResisterArtist', + TARGET_FRAME_NAME = 'targetFrameRegisterArtist', elmContainer = document.getElementById( 'register'), elmProgress = document.getElementById( 'artist-console-progress'), timer = null, @@ -4191,7 +4195,7 @@ pettanr.artistConsole = ( function(){ */ elmScript = document.createElement( 'script'); elmScript.type = 'text\/javascript'; - elmScript.src = pettanr.CONST.RESISTER_ARTIST_JS; + elmScript.src = pettanr.CONST.REGISTER_ARTIST_JS; document.body.appendChild( elmScript); jqWrap.show(); @@ -4205,7 +4209,7 @@ pettanr.artistConsole = ( function(){ ARTIST_CONSOLE.onWindowResize( w, h ); }, - onWindowResize: function( _windowW, _windowH){ + onWindowResize: function( _windowW, _windowH ){ windowW = _windowW; windowH = _windowH; jqWrap.css( @@ -4239,7 +4243,7 @@ pettanr.artistConsole = ( function(){ ARTIST_CONSOLE.init(); delete pettanr.comicConsole.init; }, - onOpen: function(){ + onOpen: function( _w, _h, _option ){ }, onClose: function(){ -- 2.11.0