OSDN Git Service

pettanR version0.4.15
[pettanr/clientJs.git] / 0.4.x / javascripts / common.js
index 2033f37..744cd38 100644 (file)
@@ -1,10 +1,78 @@
 /*\r
  * pettanR common.js\r
- *   version 0.4.4\r
+ *   version 0.4.15\r
  * \r
  * author: itozyun\r
  */\r
 \r
+/*\r
+ * http://pettanr.sourceforge.jp/test/type.html
+ */\r
+       var Type = {\r
+               isObject : function(v) {\r
+                       return typeof v === 'object';\r
+               },\r
+               isFunction : function(v) {\r
+                       return typeof v === 'function';\r
+               },\r
+               isArray : function(v) {\r
+                       return Object.prototype.toString.call(v) === "[object Array]";\r
+               },\r
+               isBoolean : function(v) {\r
+                       return typeof v === 'boolean';\r
+               },\r
+               isString : function(v) {\r
+                       return typeof v === 'string';\r
+               },\r
+               isNumber : function(v) {\r
+                       return typeof v === 'number';\r
+               },\r
+               isFinite : function(v){\r
+                       return Type.isNumber(v) === true && isFinite(v);\r
+               },\r
+               isHTMLElement : function(v){\r
+                       if( 'HTMLElement' in window ){\r
+                               Type.isHTMLElement = function(v){\r
+                                       return v instanceof HTMLElement;\r
+                               }\r
+                       } else {\r
+                               Type.isHTMLElement = function(v) {\r
+                                       if( Type.isObject(v) === false ){\r
+                                               return false;\r
+                                       }\r
+                                       var r;\r
+                                       if(v && v.nodeType === 1){\r
+                                               try{\r
+                                                       r = v.cloneNode(false);\r
+                                               } catch(n) {\r
+                                                       return false;\r
+                                               }\r
+                                               if(r === v) return false;\r
+                                               try{\r
+                                                       r.nodeType = 9;\r
+                                                       return r.nodeType === 1;\r
+                                               } catch(n) {}\r
+                                               return true;\r
+                                       }\r
+                                       return false;\r
+                               }\r
+                       }\r
+                       return Type.isHTMLElement(v);\r
+               },\r
+               /*\r
+               isElementCollection : function(v) {\r
+                       return (Object.prototype.toString.call(v) === "[object HTMLCollection]");\r
+               },\r
+               */\r
+               isNull : function(v) {\r
+                       return v === null;\r
+               },\r
+               isUndefined : function(v) {\r
+                       return typeof v === 'undefined';\r
+               }\r
+       };\r
+\r
+\r
 var pettanr = ( function(){\r
        var     FUNCTION_ARRAY = [],\r
                URL = document.location.href.split( '#')[ 0],\r
@@ -22,7 +90,7 @@ var pettanr = ( function(){
                                        if( elm.length === 2){\r
                                                v = decodeURIComponent( elm[ 1]);\r
                                                if( '' + parseFloat( v) === v) v = parseFloat( v);\r
-                                               if( '' + parseInt( v) === '0' + v) v = parseInt( v);\r
+                                               if( '' + parseInt( v, 10 ) === '0' + v) v = parseInt( v, 10 );\r
                                                if( v === 'true') v = true;\r
                                                if( v === 'false') v = false;\r
                                                if( v === 'null') v = null;\r
@@ -40,7 +108,7 @@ var pettanr = ( function(){
                IS_DEBUG = typeof URL_PARAMS.debug === 'boolean' ? URL_PARAMS.debug : IS_LOCAL === true,\r
                jqWindow , jqDocument , jqBody;\r
        return {\r
-               version: '0.4.4',\r
+               version: '0.4.13',\r
                init: function(){\r
                        jqWindow = $( window);\r
                        jqDocument = $( document);\r
@@ -143,16 +211,24 @@ pettanr.util = ( function(){
        nodeNoscript = noscript = null;\r
        \r
        function cleanCommnetNode( _targetElm){\r
-               _targetElm = _targetElm || document;\r
-               var _nodes = _targetElm.all || _targetElm.getElementsByTagName( '*'),\r
-                       _array = [],\r
-                       _elm;\r
-               for(var i=0, l = _nodes.length; i<l; ++i){\r
-                       _array.push( _nodes[ i]);\r
-               }\r
-               for( i=0; i<l; ++i){\r
-                       _elm = _array[ i];\r
-                       _elm.nodeType === 8 && _elm.parentNode && _elm.parentNode.removeChild( _elm);\r
+               search( _targetElm || document.body );\r
+               \r
+               function search( _elm){\r
+                       if( !_elm) return;\r
+                       if( _elm.nodeType === 8){\r
+                               _elm.parentNode.removeChild( _elm);\r
+                               return;\r
+                       }\r
+                       var i, l, _children = _elm.childNodes, _array = [];\r
+                       if( _children && typeof _children.length === 'number'){\r
+                               // liveNode > array\r
+                               for( i=0, l=_children.length; i<l; ++i){\r
+                                       _array.push( _children[ i ] );\r
+                               }\r
+                               while( _array.length !== 0 ){\r
+                                       search( _array.shift());\r
+                               }\r
+                       }\r
                }\r
        }\r
        return {\r
@@ -227,7 +303,9 @@ pettanr.util = ( function(){
                                displayNone = img.style.display === 'none';\r
                        if( displayNone === true) img.style.display = '';\r
                        IMG_SIZE_GETTER.appendChild( img);\r
+                       \r
                        var size = getActualDimension( img);\r
+                       \r
                        IMG_SIZE_GETTER.removeChild( img);\r
                        if( displayNone === true) img.style.display = 'none';\r
                        if( nextElm){\r
@@ -268,20 +346,6 @@ pettanr.util = ( function(){
                                                run.width  = mem.w; // restore\r
                                                run.height = mem.h;\r
                                        } else { // for Opera and Other\r
-                                       /*\r
-                                               function fn() {\r
-                                                       w = image.width;\r
-                                                       h = image.height;\r
-                                               }\r
-                                               mem = { w: image.width, h: image.height }; // keep current style\r
-                                               image.removeAttribute("width");\r
-                                               image.addEventListener("DOMAttrModified", fn, false);\r
-                                               image.removeAttribute("height");\r
-                                               // call fn\r
-                                               image.removeEventListener("DOMAttrModified", fn, false);\r
-                                               image.width  = mem.w; // restore\r
-                                               image.height = mem.h;\r
-                                       */\r
                                                mem = { w: image.width, h: image.height }; // keep current style\r
                                                image.removeAttribute("width");\r
                                                image.removeAttribute("height");\r
@@ -533,6 +597,43 @@ pettanr.util = ( function(){
                                }\r
                        }\r
                        return randomKey;\r
+               },\r
+               createIframe: function( id, callback){\r
+                       var ua = pettanr.ua;\r
+            var el = document.createElement( ua.isIE ? '<iframe name="' + id + '" frameborder="0" scrolling="no">' : 'iframe');\r
+\r
+            if( ua.isIE){\r
+                               el.onreadystatechange = detect;\r
+            } else {\r
+               // iron(chrome) の場合、append の前に onload を指定しないと onload が呼ばれない\r
+               el.onload = onLoad;\r
+               //setTimeout( asynkCallback, 0 );\r
+                       }\r
+\r
+                       document.body.appendChild( el);\r
+            el.id = el.name = id;\r
+            el.setAttribute( 'name', id);\r
+            el.style.cssText = 'width:1px;height:1px;visibility:hidden;position:absolute;top:1px;left:1px;';\r
+                       // http://d.hatena.ne.jp/onozaty/20070830/p1\r
+                       // [JavaScript]IE6ではJavaScriptで動的に作成したiframeに対してsubmitできない(IE7は未確認) ->解決\r
+                       el.contentWindow.name = id;                                     \r
+            \r
+            window[id] = el;\r
+\r
+            function detect(){\r
+                if ( this.readyState === "complete") {\r
+                    this.onreadystatechange = new Function();\r
+                    this.onreadystatechange = null;\r
+                    setTimeout( asynkCallback, 0 );\r
+                }\r
+            }\r
+                       function onLoad(){\r
+                               el.onload = null;\r
+                               setTimeout( asynkCallback, 0 );\r
+                       }\r
+                       function asynkCallback(){\r
+                               callback( el );\r
+                       }\r
                }\r
        }\r
 })();\r
@@ -586,7 +687,7 @@ pettanr.ua = ( function(){
                                if( pettanr.util.hasClassName( b, ns + disabled) === true) return false;\r
                                x = document.createElement('div');\r
                                b.appendChild(x);\r
-                               x.style.cssText = 'width:1px;height:1px;filter:progid:DXImageTransform.Microsoft.Shadow()';\r
+                               x.style.cssText = 'width:1px;height:1px;line-height:1px;filter:progid:DXImageTransform.Microsoft.Shadow()';\r
                                ret = x.offsetHeight > 1;\r
                                b.removeChild(x);\r
                        }\r
@@ -664,25 +765,30 @@ pettanr.ua = ( function(){
 pettanr.CONST = ( function(){\r
        var isLocal = pettanr.LOCAL === true || pettanr.URL_PARAMS.exjson === false,\r
                isLocalhost = document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0,\r
-               RETTANR_ROOT_PATH = isLocalhost === true ? 'http:\/\/localhost:3000\/' : 'http:\/\/pettanr.heroku.com\/';\r
+               PETTANR_ROOT_PATH = isLocalhost === true ? 'http:\/\/localhost:3000\/' : 'http:\/\/pettanr.heroku.com\/';\r
                \r
        return {\r
-               PETTANR_ROOT_PATH:                      RETTANR_ROOT_PATH,\r
-               URL_ORIGINAL_PICTURES_JSON: ( isLocal === true ? 'json\/' : RETTANR_ROOT_PATH) + 'original_pictures.json',\r
-               URL_PANELS_JSON:                        ( isLocal === true ? 'json\/' : RETTANR_ROOT_PATH) + 'panels.json',\r
+               PETTANR_ROOT_PATH:                      PETTANR_ROOT_PATH,\r
+               URL_ORIGINAL_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'original_pictures.json',\r
+               URL_RESOURCE_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'resource_pictures.json',\r
+               URL_COMICS_JSON:                        ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'comics.json',\r
+               URL_PANELS_JSON:                        ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'panels.json',\r
                NS_PETTANR_COMIC:                       'pettanr-comic',\r
-               RESOURCE_PICTURE_PATH:          ( isLocal === true ? pettanr.ROOT_PATH : RETTANR_ROOT_PATH) + 'resource_pictures\/'\r
+               RESOURCE_PICTURE_PATH:          ( isLocal === true ? pettanr.ROOT_PATH : PETTANR_ROOT_PATH) + 'resource_pictures\/',\r
+               CREATE_COMIC_JS:                        isLocal === true ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js',\r
+               CREATE_PANEL_JS:                        isLocal === true ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js',\r
+               UPLOAD_PICTURE_JS:                      isLocal === true ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js',\r
+               REGISTER_ARTIST_JS:                     isLocal === true ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js',\r
+               JQUERY_URL:                                     isLocal === true ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js'\r
        }\r
 })();\r
 \r
-\r
 pettanr.view = ( function(){\r
        /* create iframe overlay for user console */\r
        var location = document.location.pathname,\r
                isWorkPage =    document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0 ||\r
                                                location.indexOf( pettanr.CONST.PETTANR_ROOT_PATH ) === 0 ||\r
-                                               location.indexOf( '\/work.html') !== -1 ||\r
-                                               location.indexOf( '\work.html') !== -1,\r
+                                               location.indexOf( '\/work.html') !== -1,\r
                deep =  location.indexOf( '\/diary\/') !== -1 ||\r
                                location.indexOf( '\/test\/') !== -1 ||\r
                                location.indexOf( '\/help\/') !== -1 ||\r
@@ -691,42 +797,26 @@ pettanr.view = ( function(){
                LoginUserNavi;\r
        \r
        if( isWorkPage === false){\r
-               LoginUserNavi = ( function(){\r
-                       var _body = document.body,\r
-                               _root = document.getElementsByTagName( 'html' )[ 0 ],\r
-                               filter,\r
-                               iframe, visible = false;\r
-                       return {\r
-                               show: function(){\r
-                                       document.location.href = [\r
-                                                       deep === true ? '../' : '',\r
-                                                       'work.html',\r
-                                                       typeof viewIndex === 'number' ? '?view=' + viewIndex : ''\r
-                                               ].join( '');\r
-                               },\r
-                               hide: function(){}\r
-                       }\r
-               })();\r
+               LoginUserNavi = {\r
+                       show: function(){\r
+                               var i = pettanr.util.getChildIndex( this.parentNode, this );\r
+                               document.location.href = [\r
+                                               deep === true ? '../' : '',\r
+                                               'work.html',\r
+                                               typeof i === 'number' ? '?view=' + i : ''\r
+                                       ].join( '');\r
+                               return false;\r
+                       },\r
+                       hide: function(){}\r
+               }\r
        } else {\r
-               LoginUserNavi = ( function(){\r
-                       return {\r
-                               show: function(){\r
-                                       var i = pettanr.util.getChildIndex( this.parentNode, this );\r
-                                       i !== -1 && pettanr.view.show( i );\r
-                                       return false;\r
-                               },\r
-                               hide: function(){}\r
-                       }\r
-               })();\r
-\r
-               if( pettanr.IS_IFRAME === true){\r
-                       var _nodes = document.getElementsByTagName( 'a'),\r
-                               _a, _href;\r
-                       for(var i=0, l = _nodes.length; i<l; i++){\r
-                               _a = _nodes[ i];\r
-                               _href = _a.href.split('?')[0].split('#')[0];\r
-                               if( pettanr.util.getAbsolutePath( _href) !== location) _a.target = '_parent';\r
-                       }\r
+               LoginUserNavi = {\r
+                       show: function(){\r
+                               var i = pettanr.util.getChildIndex( this.parentNode, this );\r
+                               i !== -1 && pettanr.view.show( i );\r
+                               return false;\r
+                       },\r
+                       hide: function(){}\r
                }\r
                \r
                if( pettanr.DEBUG === true){\r
@@ -782,12 +872,11 @@ pettanr.view = ( function(){
                        pettanr.DEBUG === true && ret.push( 'debug');\r
                        return ret;\r
                })(),\r
-               l = items.length,\r
                item;\r
        origin.href = '#';\r
-       for(var i=0; i<l; ++i){\r
+       for(var i=0, l = items.length; i<l; ++i){\r
                item = origin.cloneNode( true);\r
-               item.innerHTML = items[ i];\r
+               item.appendChild( document.createTextNode( items[ i]) );\r
                item.onclick = LoginUserNavi.show;\r
                navi.appendChild( item);\r
        }\r
@@ -830,21 +919,17 @@ pettanr.view = ( function(){
        \r
        pettanr.DEBUG === true && VIEW_ID_ARRAY.push( 'debug');\r
        \r
-       show();\r
+       open();\r
        \r
        function onWindowResize(){\r
                var _fn,\r
                        l = funcArray.length,\r
                        w = jqWindow.width(),\r
                        h = jqWindow.height();\r
-               //for( var i=0; i<l; ++i){\r
-               //      _fn = funcArray[ i];\r
-               //      _fn.onWindowResize && _fn.onWindowResize( w, h);\r
-               //}\r
                currentView && currentView.onWindowResize && currentView.onWindowResize( w, h);\r
                pettanr.overlay.currentID !== null && pettanr.overlay.onWindowResize( w, h);\r
        }\r
-       function show(){\r
+       function open( _option ){\r
                if( isWorkPage === false) return;\r
                \r
                var _elm = document.getElementById( currentID);\r
@@ -862,25 +947,48 @@ pettanr.view = ( function(){
                }\r
                \r
                if( !pettanr.view || pettanr.view.init !== undefined) return;\r
-               currentView = pettanr[ currentID];\r
-               if( !currentView) return;\r
-               typeof currentView.onOpen === 'function' && currentView.onOpen();\r
-               setTimeout( onWindowResize, 0);\r
+               typeof currentView.onClose === 'function' && currentView.onClose();\r
+               currentView = pettanr[ currentID ];\r
+               typeof currentView.onOpen === 'function' && currentView.onOpen( jqWindow.width(), jqWindow.height(), _option );\r
+               // setTimeout( onWindowResize, 0);\r
+       }\r
+       \r
+       var AbstractBasicPane = function(){\r
+               this.rootElement = null;\r
+               this.onOpen = function( _w, _h, _option ){};\r
+               this.onClose = function(){ return true; } // false の場合、close の拒否 \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
+       var AbstractApplication = function(){\r
+               this.prototype = new AbstractBasicPane();\r
        }\r
+       \r
        return {\r
                init: function( _funcArray){\r
                        funcArray = _funcArray;\r
                        jqWindow = pettanr.jqWindow();\r
                        jqWindow.resize( onWindowResize);\r
                        \r
-                       currentView = currentView || pettanr[ currentID];\r
-                       currentView && typeof currentView.onOpen === 'function' && currentView.onOpen();\r
+                       currentView = currentView || pettanr[ currentID ];\r
+                       var _option = {}; // urlパラメータ\r
+                       currentView && typeof currentView.onOpen === 'function' && currentView.onOpen( jqWindow.width(), jqWindow.height(), _option );\r
                        \r
-                       setTimeout( onWindowResize, 100);\r
+                       // setTimeout( onWindowResize, 100);\r
                        \r
                        delete pettanr.view.init;\r
                },\r
-               show: function( _viewID){\r
+               show: function( _viewID ){\r
                        if( typeof _viewID === 'number' && _viewID < VIEW_ID_ARRAY.length){\r
                                _viewID = VIEW_ID_ARRAY[ _viewID];\r
                        } else\r
@@ -893,13 +1001,27 @@ pettanr.view = ( function(){
                                if( pettanr.view[ key] === _viewID){\r
                                        if( currentID !== _viewID && document.getElementById( _viewID)){\r
                                                this.currentID = currentID = _viewID;\r
-                                               show();\r
+                                               open();\r
                                        }\r
                                        return;\r
                                }\r
                        }\r
                        alert( _viewID);\r
                },\r
+               registerAsBasicPane: function( _basicPane ){\r
+                       if( pettanr.view.isBasicPaneInstance( _basicPane ) === true ) return;\r
+                       _basicPane.prototype = new AbstractBasicPane();\r
+               },\r
+               registerApplication: function( _application ){\r
+                       if( pettanr.view.isApplicationInstance( _application ) === true ) return;\r
+                       _application.prototype = new AbstractApplication();\r
+               },\r
+               isBasicPaneInstance: function( _basicPane ){\r
+                       return  _basicPane instanceof AbstractBasicPane;\r
+               },\r
+               isApplicationInstance: function( _application ){\r
+                       return _application instanceof AbstractApplication;\r
+               },\r
                currentID:      currentID,\r
                HOME:           HOME_ID,\r
                COMICS:         VIEW_ID_ARRAY[ 1],\r
@@ -918,221 +1040,6 @@ pettanr.overlay = ( function(){
                visible = false,\r
                windowW, windowH;\r
 \r
-\r
-       var IMAGE_GROUP_EXPROLER = ( function(){\r
-               var ICON_ARRAY = [],\r
-                       WHEEL_DELTA = 64,\r
-                       containerW, containerH, wrapX,\r
-                       jqWrap, jqContainer, jqItemOrigin,\r
-                       itemW, itemH,\r
-                       jqName, jqButton, buttonW,\r
-                       folder, onUpdateFunction,\r
-                       winW,\r
-                       onEnterInterval = null;\r
-               \r
-               var BASE_PATH = pettanr.LOCAL === false ? 'http://pettan.heroku.com/images/' : 'images/',\r
-                       THUMB_PATH = BASE_PATH, // + 'thumbnail/',\r
-                       LIMIT_FILESIZE = 1024 * 10; // 10KB\r
-               var IMAGE_DATA = 0;\r
-               \r
-               var ImageGroupIconClass = function( INDEX, data){\r
-                       var JQ_ICON_WRAP = jqItemOrigin.clone( true),\r
-                               SRC = [ BASE_PATH, data.id, '.', data.ext].join( ''),\r
-                               LOW_SRC = data.filesize && data.filesize > LIMIT_FILESIZE ? [ THUMB_PATH, data.id, '.', data.ext].join( '') : null,\r
-                               reversibleImage = null,\r
-                               actualW, actualH,\r
-                               onEnterFlag = false;\r
-                       JQ_ICON_WRAP.children( 'div').eq( 0).html( data.filesize + 'bytes');\r
-                       jqContainer.append( JQ_ICON_WRAP.css( { left: INDEX * itemW}));\r
-                       \r
-                       function onLoad( url, _imgW, _imgH){\r
-                               if( reversibleImage === null) {\r
-                                       alert( url);\r
-                                       return;\r
-                               }\r
-                               actualW = _imgW || 64;\r
-                               actualH = _imgH || 64;\r
-                               JQ_ICON_WRAP.children( 'div').eq( 1).html( actualW +'x' +actualH);\r
-                               var zoom = 128 /( actualW > actualH ? actualW : actualH),\r
-                                       _h = Math.floor( actualH *zoom),\r
-                                       _w = Math.floor( actualW *zoom);\r
-                               reversibleImage.elm.style.width = _w +'px';\r
-                               reversibleImage.elm.style.height = _h +'px';\r
-                               reversibleImage.elm.style.margin = Math.floor( itemH /2 -_h /2)+'px 0 0';\r
-                               reversibleImage.resize( _w, _h);\r
-                               JQ_ICON_WRAP.click( onClick);\r
-                       }\r
-                       \r
-                       function onClick( e){\r
-                               pettanr.overlay.hide();\r
-                               if (onUpdateFunction) {\r
-                                       if( LOW_SRC === null){\r
-                                               onUpdateFunction( SRC, actualW, actualH);\r
-                                       } else {\r
-                                               onCloseUpdate( onUpdateFunction); // close()で値が消えるので、クロージャに保持\r
-                                       }\r
-                               }\r
-                               close();                                \r
-                       }\r
-                       \r
-                       function onCloseUpdate( onUpdate){\r
-                               pettanr.util.loadImage( SRC,\r
-                                       function( _abspath, imgW, imgH){\r
-                                               onUpdate( SRC, imgW, imgH);\r
-                                               onUpdate = null;\r
-                                       },\r
-                                       function( _abspath){\r
-                                               onUpdate( SRC, data.width || 64, data.height || 64);\r
-                                               onUpdate = null;\r
-                                       }\r
-                               );\r
-                       }\r
-                       \r
-                       return {\r
-                               onEnter: function(){\r
-                                       if( onEnterFlag === true) return;\r
-                                       reversibleImage = pettanr.image.createReversibleImage( LOW_SRC || SRC, itemW, itemH, onLoad);\r
-                                       JQ_ICON_WRAP.children( 'img').replaceWith( reversibleImage.elm);\r
-                                       onEnterFlag = true;                             \r
-                               },\r
-                               destroy: function(){\r
-                                       reversibleImage && reversibleImage.destroy();\r
-                                       JQ_ICON_WRAP.remove();\r
-                                       reversibleImage = JQ_ICON_WRAP = null;\r
-                                       delete this.destroy;\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               function close(){\r
-                       jqContainer.stop().animate( {\r
-                                       height: 0,\r
-                                       top:    Math.floor( windowH /2)\r
-                               }, function(){\r
-                                       jqWrap.hide()\r
-                               });\r
-                       while( ICON_ARRAY.length > 0){\r
-                               ICON_ARRAY.shift().destroy();\r
-                       }\r
-                       onEnterInterval !== null && window.clearTimeout( onEnterInterval);\r
-                       onUpdateFunction = onEnterInterval = null;\r
-               }\r
-               function onEnterShowImage(){\r
-                       var l = ICON_ARRAY.length,\r
-                               _start = -wrapX /itemW -1,\r
-                               _end = _start + winW /itemW +1;\r
-                       for( var i=0; i<l; ++i){\r
-                               _start < i && i < _end && ICON_ARRAY[ i].onEnter();\r
-                       }\r
-                       onEnterInterval !== null && window.clearTimeout( onEnterInterval);\r
-                       onEnterInterval = null;\r
-               }\r
-               function onCloseClick(){\r
-                       pettanr.overlay.hide();\r
-                       // onUpdateFunction && onUpdateFunction( textElement);\r
-                       close();\r
-               }\r
-               function onMouseWheel( e, delta){\r
-                       if( winW < containerW){\r
-                               wrapX += delta *WHEEL_DELTA;\r
-                               wrapX = wrapX > 0 ? 0 : wrapX < winW -containerW ? winW -containerW : wrapX;\r
-                               jqContainer.css( { left: wrapX});\r
-                               \r
-                               onEnterInterval !== null && window.clearTimeout( onEnterInterval);\r
-                               onEnterInterval = window.setTimeout( onEnterShowImage, 500);\r
-                       }\r
-                       //e.stopPropagation();\r
-                       return false;                   \r
-               }\r
-               return {\r
-                       init: function(){\r
-                               this.jqWrap = jqWrap = $( '#image-gruop-wrapper').hide();\r
-                               jqContainer = $( '#image-icon-container').mousewheel( onMouseWheel);\r
-                               containerH = pettanr.util.getElementSize( jqContainer.get( 0)).height;\r
-                               jqItemOrigin = $( $( '#imageGruopItemTemplete').remove().html());\r
-                               var itemSize = pettanr.util.getElementSize( jqItemOrigin.get( 0));\r
-                               itemW = itemSize.width;\r
-                               itemH = itemSize.height;\r
-                               jqName = $( '#gruop-name-display');\r
-                               jqButton = $( '#image-gruop-button').click( onCloseClick);\r
-                               buttonW = pettanr.util.getElementSize( jqButton.get( 0)).width;\r
-                               \r
-                               delete IMAGE_GROUP_EXPROLER.init;\r
-                       },\r
-                       jqWrap: null,\r
-                       show: function( _folder, _onUpdateFunction){\r
-                               this.init !== undefined && this.init();\r
-                               \r
-                               folder = _folder;\r
-                               onUpdateFunction = _onUpdateFunction;\r
-                               pettanr.overlay.show( this);\r
-                               \r
-                               var l = _folder.getChildFileLength();\r
-                               for( var i=0; i<l; ++i){\r
-                                       ICON_ARRAY.push( new ImageGroupIconClass( i, _folder.getChildFileByIndex( i)));\r
-                               }\r
-                               wrapX = 0;\r
-                               containerW = l * itemW;\r
-                               \r
-                               winW = windowW;\r
-                               var w = winW > containerW ? winW : containerW,\r
-                                       h = windowH > containerH ? containerH : windowH;\r
-                               \r
-                               jqWrap.show();\r
-                               jqContainer.css( {\r
-                                       width:          w,\r
-                                       height:         0,\r
-                                       left:           0,\r
-                                       top:            Math.floor( windowH /2)\r
-                               }).stop().animate( {\r
-                                       height:         h,\r
-                                       top:            Math.floor( windowH /2 -h /2)\r
-                               });\r
-                               \r
-                               jqButton.css( {\r
-                                       left:           Math.floor( winW /2 -buttonW /2),\r
-                                       top:            Math.floor( windowH /2 +containerH /2 +10)\r
-                               });\r
-                               \r
-                               onEnterShowImage();\r
-                       },\r
-                       onWindowResize: function( _windowW, _windowH){\r
-                               var w = _windowW > containerW ? _windowW : containerW,\r
-                                       h = _windowH > containerH ? containerH : _windowH,\r
-                                       offsetW = Math.floor( _windowW /2 -winW /2);\r
-                               winW = _windowW;\r
-                               if( offsetW <= 0){ // smaller\r
-                                       jqContainer.css( {\r
-                                               left:                           offsetW,\r
-                                               width:                          w\r
-                                       }).animate( {\r
-                                               left:                           0,\r
-                                               top:                            Math.floor( _windowH /2 -h /2)\r
-                                       });                                     \r
-                               } else {\r
-                                       jqContainer.css( { // bigger\r
-                                               left:                           0,\r
-                                               width:                          w,\r
-                                               borderLeftWidth:        offsetW\r
-                                       }).animate( {\r
-                                               top:                            Math.floor( _windowH /2 -h /2),\r
-                                               borderLeftWidth:        0\r
-                                       });\r
-                               }\r
-                               jqButton.css( {\r
-                                       left:           Math.floor( _windowW /2 -buttonW /2),\r
-                                       top:            Math.floor( _windowH /2 +containerH /2 +10)\r
-                               });\r
-                               onEnterShowImage();\r
-                       },\r
-                       onClose: close,\r
-                       ID: 'imageGroupExproler'\r
-               }\r
-       })();\r
-       /*\r
-        * \r
-        */\r
-\r
        function close(){\r
                currentOverlay && currentOverlay.onClose && currentOverlay.onClose();\r
                pettanr.overlay.hide();         \r
@@ -1158,9 +1065,11 @@ pettanr.overlay = ( function(){
                },\r
                show: function( _currentOverlay){\r
                        if( visible === true && currentOverlay === _currentOverlay) return;\r
+                       document.body.style.overflow = 'hidden';\r
                        jqConteiner.stop().css( {\r
                                filter:         '',\r
-                               opacity:        ''\r
+                               opacity:        '',\r
+                               top:            document.documentElement.scrollTop || document.body.scrollTop\r
                        }).fadeIn();\r
                        this.visible = visible = true;\r
                        currentOverlay = _currentOverlay;\r
@@ -1170,6 +1079,7 @@ pettanr.overlay = ( function(){
                hide: function(){\r
                        currentOverlay = null;\r
                        if( visible === false) return;\r
+                       document.body.style.overflow = '';\r
                        jqConteiner.stop().css( {\r
                                filter:         '',\r
                                opacity:        ''\r
@@ -1180,12 +1090,33 @@ pettanr.overlay = ( function(){
                visible: visible,\r
                currentID: null,\r
                onWindowResize: function( _windowW, _windowH){\r
-                       jqConteiner.css( { height:      _windowH});\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
                        // 先にeditorのcanvasを確定する。\r
                        currentOverlay && currentOverlay.onWindowResize && setTimeout( asyncResize, 0);\r
+               },\r
+               registerOverlay: function( _basicPane){\r
+                       var _api = pettanr.view.registerAsBasicPane( _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
                }\r
        }\r
 })();\r
@@ -1386,7 +1317,7 @@ pettanr.form = ( function(){
                                instance = this;\r
                                delete this.init;\r
                        },\r
-                       update: function( _value){\r
+                       value: function( _value){\r
                                if( _value !== undefined){\r
                                        elmA.innerHTML = _value;\r
                                        value = _value;\r
@@ -1396,6 +1327,7 @@ pettanr.form = ( function(){
                                        }\r
                                }\r
                                currentItem === instance && this.finish();\r
+                               return value;\r
                        },\r
                        start: function(){\r
                                onClick();\r
@@ -1412,7 +1344,64 @@ pettanr.form = ( function(){
                                \r
                                ON_UPDATE_FUNCTION && _newValue !== value && ON_UPDATE_FUNCTION( _newValue, value);\r
                                finish( instance);\r
-                               \r
+                               value = _newValue;\r
+                               focus = false;\r
+                       },\r
+                       enabled: function(){\r
+                               return enabled;\r
+                       },\r
+                       visible: function( _visible){\r
+                               if( _visible === true){\r
+                                       WRAPPER_ELM.style.display = '';\r
+                                       visible = true;\r
+                               } else\r
+                               if( _visible === false){\r
+                                       WRAPPER_ELM.style.display = 'none';\r
+                                       visible = false;\r
+                               }\r
+                               return visible;\r
+                       },\r
+                       index : index,\r
+                       groupID: GROUP_ID\r
+               }\r
+       }\r
+\r
+       var FileInputClass = function( WRAPPER_ELM, ON_UPDATE_FUNCTION, GROUP_ID, validater, elmFileInput){\r
+               validater = typeof validater === 'function' ? validater : null;\r
+               \r
+               var elmFilePath = pettanr.util.getElementsByClassName( WRAPPER_ELM, 'file-path')[ 0],\r
+                       value,\r
+                       index = GROUP_ID ? FORM_GROUP_TABLE[ GROUP_ID].length : -1,\r
+                       instance,\r
+                       focus = false,\r
+                       visible = true,\r
+                       enabled = true,\r
+                       elmFileInput = WRAPPER_ELM.getElementsByTagName('input')[0] || elmFileInput || document.createElement( 'input');\r
+               elmFileInput.type = 'file';\r
+               elmFileInput.style.visivility = 'hidden';\r
+\r
+               WRAPPER_ELM.onclick = onClick;\r
+               elmFileInput.onchenge = onChange;\r
+               \r
+               function onClick( e){\r
+                       focus = true;\r
+                       start( instance);\r
+                       elmFileInput.click();\r
+                       return false;\r
+               }\r
+               \r
+               function onChange(){\r
+                       elmFilePath.innerHTML = elmFileInput.value;\r
+               }\r
+               return {\r
+                       init: function(){\r
+                               instance = this;\r
+                               delete this.init;\r
+                       },\r
+                       start: function(){\r
+                               onClick();\r
+                       },\r
+                       finish: function( keep){\r
                                focus = false;\r
                        },\r
                        enabled: function(){\r
@@ -1488,6 +1477,15 @@ pettanr.form = ( function(){
                        _groupID && FORM_GROUP_TABLE[ _groupID].push( ret);\r
                        return ret;\r
                },\r
+               createFileInput: function( _elm, _onUpdate, _groupID, _validater, _elmFileInput){\r
+                       if( typeof _groupID === 'string' && !FORM_GROUP_TABLE[ _groupID]){\r
+                               FORM_GROUP_TABLE[ _groupID] = [];\r
+                       }\r
+                       var ret = FileInputClass( _elm, _onUpdate, _groupID, _validater, _elmFileInput);\r
+                       ret.init();\r
+                       _groupID && FORM_GROUP_TABLE[ _groupID].push( ret);\r
+                       return ret;\r
+               },\r
                createCheckBox: function(){\r
                        \r
                },\r
@@ -2277,7 +2275,7 @@ var VisualEffect = ( function(){
        var VisualEffectClass = function( ELM){\r
                var isHtmlElement;\r
                \r
-               function resisterAnime( _cssObject, _onComplete, _onEnterFrame, _time){\r
+               function registerAnime( _cssObject, _onComplete, _onEnterFrame, _time){\r
                        var _numFrames = Math.floor( _time / fpms);\r
                        startAnimation( ELM, _cssObject, _onComplete, _onEnterFrame, _numFrames);\r
                }\r
@@ -2292,7 +2290,7 @@ var VisualEffect = ( function(){
                        \r
                }\r
                \r
-               this.anime = resisterAnime;\r
+               this.anime = registerAnime;\r
                this.fadeIn = startFadeIn;\r
                this.fadeOut = startFadeOut;\r
                this.update = update;\r