OSDN Git Service

client is version0.4.32, updated add image.
authoritozyun <itozyun@gmail.com>
Wed, 16 May 2012 21:47:09 +0000 (06:47 +0900)
committeritozyun <itozyun@gmail.com>
Wed, 16 May 2012 21:47:09 +0000 (06:47 +0900)
0.4.x/javascripts/system.js
0.4.x/javascripts/work.js
0.4.x/json/comics_1.json

index 23913d2..6162a6f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * pettanR system.js
- *   version 0.4.29
+ *   version 0.4.32
  *   
  * author:
  *   itozyun
@@ -974,7 +974,7 @@ pettanr.finder = ( function(){
                }
        }
        
-       var FinderClass = function( ELM_CONTAINER, tree, header, footer ){
+       var FinderClass = function( ELM_CONTAINER, tree, header, footer, onSelect, viewerOption, editorOption ){
                var ICON_ARRAY = [],
                        BREAD_ARRAY = [],
                        elmContainer = ELM_ORIGIN_CONTAINER.cloneNode( true ),
@@ -1059,24 +1059,26 @@ pettanr.finder = ( function(){
                                if( _file !== null && ( _file.getChildFileLength() !== -1 || _file.getType() === pettanr.file.FILE_TYPE.FOLDER)){
                                        tree.down( i );
                                        draw( w, h );
+                               } else {
+                                       Type.isFunction( onSelect ) === true && onSelect( _file  );
                                }
                        }
                }
-               function onEditor( _file, _app ){
-                       _app.boot( _file );
+               function onEditor( _file, _app, editorOption ){
+                       _app.boot( _file, editorOption );
                }
                function onViwer( _file, _app ){
-                       _app.bootInOverlay( _file );
+                       _app.bootInOverlay( _file, viewerOption );
                }
                function onAction( _file ){
 
                }
-               this.rootElement = elmContainer;
+               this.rootElement   = elmContainer;
                this.parentElement = ELM_CONTAINER;
-               this.displayName = 'finder';
-               this.ID = 'finder';
-               this.MIN_WIDTH = 240;
-               this.MIN_HEIGHT = 240;
+               this.displayName   = 'finder';
+               this.ID            = 'finder';
+               this.MIN_WIDTH     = 240;
+               this.MIN_HEIGHT    = 240;
                this.init = function(){
                        //$( elmLocation).click( onHeadClick);
                        //$( elmContainer).click( onBodyClick);
@@ -1127,10 +1129,10 @@ pettanr.finder = ( function(){
                init: function(){
                        
                },
-               createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer ){
+               createFinder: function( _applicationReference, _elmTarget, _tree, _header, _footer, _onSelect, _viewerOption, _editorOption ){
                        if( pettanr.view.isApplicationReference( _applicationReference ) === false ) return;
                        
-                       var _finder = new FinderClass( _elmTarget, _tree, _header, _footer );
+                       var _finder = new FinderClass( _elmTarget, _tree, _header, _footer, _onSelect, _viewerOption, _editorOption );
                        FINDER_ARRAY.push( _finder );
                        return _finder;
                },
@@ -1153,14 +1155,14 @@ pettanr.finder = ( function(){
 
 
 pettanr.driver = ( function(){
-       var MyAuthorID = 'current_author' in window ? current_author.id : ( pettanr.DEBUG ? 1 : -1 ),
-               MyArtistID = 'current_artist' in window ? current_artist.id : ( pettanr.DEBUG ? 1 : -1 ),
+       var MyAuthorID = 'current_author' in window ? current_author.id : ( pettanr.CONST.SERVER_SUPPORT === false ? 1 : -1 ),
+               MyArtistID = 'current_artist' in window ? current_artist.id : ( pettanr.CONST.SERVER_SUPPORT === false ? 1 : -1 ),
                Driver = {
                        getSeqentialFiles: function( _file){
                                var _data = FileAPI.getFileData( _file),
                                        _json = _data !== null ? _data.json : null;
                                if( _json === true && _data.type === pettanr.driver.FILE_TYPE.COMIC ){
-                                       if( pettanr.LOCAL === true ){
+                                       if( pettanr.CONST.SERVER_SUPPORT === false ){
                                                _json = [ 'json\/comics_', _data.id, '.json' ].join( '' );
                                        } else {
                                                _json = [ pettanr.CONST.PETTANR_ROOT_PATH, 'comics\/', _data.id, '.json\/play\/' ].join( '' );
@@ -1558,7 +1560,15 @@ pettanr.driver = ( function(){
                        return pettanr.file.createTree( FILE_DATA_SERVICE_ROOT ); //FILE_DATA_COMICS_ROOT);
                },
                createPictureTree: function(){
-                       return pettanr.file.createTree( FILE_DATA_PICTURE_ROOT );
+                       var _tree  = pettanr.file.createTree( FILE_DATA_PICTURE_ROOT );
+                               _root  = _tree.getRootFile();
+                               _myPic = _root.getChildFileByIndex( 0 );
+                               _pic   = _root.getChildFileByIndex( 1 );
+                       _myPic.getSeqentialFiles();
+                       _pic.getSeqentialFiles();
+                       _myPic.destroy();
+                       _pic.destroy();
+                       return _tree;
                },
                createArtistTree: function(){
                        return pettanr.file.createTree( FILE_DATA_ARTIST_ROOT );
@@ -1778,7 +1788,7 @@ pettanr.premiumSatge = pettanr.view.registerApplication( function(){
 
        elmButton.onclick = clickOK;
        
-       var BASE_PATH = pettanr.LOCAL === true ? 'resource_pictures\/' : pettanr.CONST.RESOURCE_PICTURE_PATH,
+       var BASE_PATH = pettanr.CONST.RESOURCE_PICTURE_PATH,
                THUMB_PATH = BASE_PATH, // + 'thumbnail/',
                LIMIT_FILESIZE = 1024 * 10; // 10KB
 
index e9495ec..901e9c7 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR work.js\r
- *   version 0.4.29\r
+ *   version 0.4.32\r
  *   \r
  * author:\r
  *   itozyun\r
@@ -819,7 +819,8 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                MENU_BAR_CONTROL.EDIT.createSelection( 'show Grid', 'ctrl + G', switchGrid, true, true, true);\r
 \r
                function addImage( e){\r
-                       setTimeout( COMIC_ELEMENT_CONTROL.createImageElement, 0);\r
+                       setTimeout( IMAGE_EXPLORER_WINDOW.open, 0);\r
+                       instance.bodyBackOrForward( true );\r
                        e && e.preventDefault && e.preventDefault();\r
                        return false;\r
                }\r
@@ -876,6 +877,15 @@ pettanr.editor = pettanr.view.registerApplication( function(){
        var IMAGE_EXPLORER_WINDOW = ( function(){\r
                var instance, finder;\r
                \r
+               function onFileSelect( _file ){\r
+                       // 他の image ファイルも許可する?\r
+                       if( pettanr.driver.isPettanrFileInstance( _file ) === true ){\r
+                               if( _file.getType() === pettanr.driver.FILE_TYPE.PICTURE ){\r
+                                       COMIC_ELEMENT_CONTROL.onImageSelect( pettanr.driver._getAPI().getFileData( _file ) );\r
+                               }\r
+                       }\r
+               }\r
+               \r
                return WINDOWS_CONTROL.createWindow(\r
                        {\r
                                onInit: function(){\r
@@ -883,14 +893,22 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                                        delete this.onInit;\r
                                },\r
                                onOpen: function( _w, _h){\r
-                                       finder = finder || pettanr.finder.createFinder( pettanr.editor, document.getElementById( 'image-exproler-container'), pettanr.driver.createPictureTree());\r
+                                       finder = finder || pettanr.finder.createFinder(\r
+                                               pettanr.editor,\r
+                                               document.getElementById( 'image-exproler-container'),\r
+                                               pettanr.driver.createPictureTree(),\r
+                                               null, null,\r
+                                               onFileSelect,\r
+                                               COMIC_ELEMENT_CONTROL.onImageSelect\r
+                                       );\r
+\r
                                        finder.resize( _w, _h );\r
                                },\r
                                onResize: function( _w, _h ){\r
                                        finder.resize( _w, _h );\r
                                }\r
                        },\r
-                       'image-exproler', 'Album', 0, 215, 400, 350, false, true, true, 300, 300\r
+                       'image-exproler', 'Album', 0, 215, 600, 350, false, true, true, 300, 300\r
                );\r
        })();\r
        \r
@@ -2545,25 +2563,6 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                function restoreReplaceElement( arg){\r
                        replaceComicElement( arg[ 0], arg[ 1]);\r
                }\r
-\r
-               function onImageSelect( data, isPanelPictureData ){\r
-                       if( isPanelPictureData !== true ){\r
-                               data = {\r
-                                       resource_picture:data,\r
-                                       x:               Math.floor( panelW /2 - data.width /2 ),\r
-                                       y:               Math.floor( panelH /2 - data.height /2 ),\r
-                                       z:               -1,\r
-                                       t:               PANEL_ELEMENT_ARRAY.length,\r
-                                       width:           data.width,\r
-                                       height:          data.height\r
-                               }\r
-                       }\r
-                       var _panelElement = new ImageElementClass( data );\r
-                       _panelElement.init && _panelElement.init();\r
-                       appendComicElement( _panelElement );\r
-                       _panelElement.animate( undefined, undefined, data.width, data.height );\r
-                       SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement], true );\r
-               }\r
                function onTextInput( _panelElement ){\r
                        appendComicElement( _panelElement );\r
                        SAVE( restoreComicElement, [ false, _panelElement ], [ true, _panelElement ], true );\r
@@ -2669,10 +2668,28 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        },\r
                        createImageElement: function( data ){\r
                                if( Type.isObject( data ) === false ){\r
-                                       pettanr.premiumSatge.bootInOverlay( 1, onImageSelect );\r
+                                       pettanr.premiumSatge.bootInOverlay( 1, COMIC_ELEMENT_CONTROL.onImageSelect );\r
                                } else {\r
-                                       onImageSelect( data, true );\r
+                                       COMIC_ELEMENT_CONTROL.onImageSelect( data, true );\r
+                               }\r
+                       },\r
+                       onImageSelect: function( data, isPanelPictureData ){\r
+                               if( isPanelPictureData !== true ){\r
+                                       data = {\r
+                                               resource_picture:data,\r
+                                               x:               Math.floor( panelW /2 - data.width /2 ),\r
+                                               y:               Math.floor( panelH /2 - data.height /2 ),\r
+                                               z:               -1,\r
+                                               t:               PANEL_ELEMENT_ARRAY.length,\r
+                                               width:           data.width,\r
+                                               height:          data.height\r
+                                       }\r
                                }\r
+                               var _panelElement = new ImageElementClass( data );\r
+                               _panelElement.init && _panelElement.init();\r
+                               appendComicElement( _panelElement );\r
+                               _panelElement.animate( undefined, undefined, data.width, data.height );\r
+                               SAVE( restoreComicElement, [ false, _panelElement], [ true, _panelElement], true );\r
                        },\r
                        createTextElement: function( data ){\r
                                var _panelElement;\r
index 43259de..0d6049a 100644 (file)
@@ -47,7 +47,7 @@
                            "height":151,\r
                            "speaches_attributes":{\r
                                "newf2":{\r
-                                   "content":"Hello",\r
+                                   "content":"Hello, world!",\r
                                    "x":-34,\r
                                    "y":35,\r
                                    "t":2,\r