OSDN Git Service

client is version0.4.25, added combobox to pettanr.form.
[pettanr/pettanr.git] / public / assets / work.js
index 69d4469..04106ea 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * pettanR work.js\r
- *   version 0.4.24\r
+ *   version 0.4.25\r
  *   \r
  * author:\r
  *   itozyun\r
@@ -130,7 +130,7 @@ pettanr.editor = pettanr.view.registerApplication( function(){
                        jqStage, jqBar;\r
                ELM_BAR.style.top = ( -barH) +'px';\r
 \r
-               var MenubarSelectionClass = function( container, title, shortcut, visible, separateAfter){\r
+               var MenubarSelectionClass = function( container, title, shortcut, visible, separateAfter ){\r
                        var ELM_WRAPPER = ELM_SELECTION_ORIGN.cloneNode( true),\r
                                ELM_TITLE = ELM_WRAPPER.getElementsByTagName( 'span')[ 0],\r
                                elmShortcut = ELM_WRAPPER.getElementsByTagName( 'kbd')[ 0];\r
@@ -2896,7 +2896,9 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
                elmWrap = document.getElementById( 'comic-console-wrapper' ),\r
                elmHeader = document.getElementById( 'comic-console-header' ),\r
                elmProgress = document.getElementById( 'comic-console-progress' ),\r
-               inputTitle, inputW, inputH, inputVisible, inputEditable,\r
+               inputTitle, inputW, inputH,\r
+               comboboxVisible, comboboxEditable,\r
+               buttonSubmit, buttonCancel,\r
                elmUploader = null,\r
                elmScript = null,\r
                elmIframe = null,\r
@@ -2937,10 +2939,10 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
                                _name = _select.name;\r
                                _optionList = _select.getElementsByTagName( 'option' )\r
                                if( _name === 'comic[visible]'){\r
-                                       _select.selectedIndex = 1;\r
+                                       _select.selectedIndex = comboboxVisible.selectIndex;\r
                                } else\r
                                if( _name === 'comic[editable]'){\r
-                                       _select.selectedIndex = 0;\r
+                                       _select.selectedIndex = comboboxEditable.selectIndex;\r
                                }\r
                        }\r
                        try {\r
@@ -2983,7 +2985,25 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
        }\r
        function detectForm(){\r
                elmForm = elmUploader.getElementsByTagName( 'form' )[ 0 ];\r
-               if( elmForm){\r
+               if( elmForm ){\r
+                       var selectList = elmForm.getElementsByTagName( 'select' ),\r
+                               select,\r
+                               j, m,\r
+                               optionList, option;\r
+                       for( var i=0, l=selectList.length; i<l; ++i ){\r
+                               select = selectList[ i ];\r
+                               optionList = select.getElementsByTagName( 'option' );\r
+                               for( j=0, m=optionList.length; j<m; ++j ){\r
+                                       option = optionList[ j ];\r
+                                       if( select.name === 'comic[visible]' ){\r
+                                               comboboxVisible.createOption( option.innerHTML, option.value, option.selected );\r
+                                       } else\r
+                                       if( select.name === 'comic[editable]' ){\r
+                                               comboboxEditable.createOption( option.innerHTML, option.value, option.selected );\r
+                                       }\r
+                               }\r
+                       }\r
+                       \r
                        window.clearInterval( timer);\r
                        timer = null;\r
                        pettanr.util.createIframe( 'targetFrameCreateComic', onCreateIframe );\r
@@ -3005,15 +3025,14 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
        this.MIN_HEIGHT  = 320;\r
        this.init = function(){\r
                jqWrap = $( '#comic-console-wrapper').hide();\r
-               $( '#comic-console-post-button').click( clickOK );\r
-               $( '#comic-console-cancel-button').click( clickCancel );\r
                \r
-               var CREATER = pettanr.form.createInputText;//pettanr.key.createEditableText;\r
-               inputTitle    = CREATER( document.getElementById( 'comic-console-title'), null, ID);\r
-               inputW        = CREATER( document.getElementById( 'comic-console-width'), null, ID);\r
-               inputH        = CREATER( document.getElementById( 'comic-console-height'), null, ID);\r
-               inputVisible  = CREATER( document.getElementById( 'comic-console-visible'), null, ID);\r
-               inputEditable = CREATER( document.getElementById( 'comic-console-editable'), null, ID);\r
+               inputTitle    = pettanr.form.createInputText( document.getElementById( 'comic-console-title'), null, ID);\r
+               inputW        = pettanr.form.createInputText( document.getElementById( 'comic-console-width'), null, ID);\r
+               inputH        = pettanr.form.createInputText( document.getElementById( 'comic-console-height'), null, ID);\r
+               comboboxVisible  = pettanr.form.createCombobox( document.getElementById( 'comic-console-visible'), null, ID);\r
+               comboboxEditable = pettanr.form.createCombobox( document.getElementById( 'comic-console-editable'), null, ID);\r
+               buttonSubmit  = pettanr.form.createButton( document.getElementById( 'comic-console-post-button'), clickOK, ID);\r
+               buttonCancel  = pettanr.form.createButton( document.getElementById( 'comic-console-cancel-button'), clickCancel, ID);\r
                \r
                delete instance.init;\r
        }\r
@@ -3022,7 +3041,7 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
                \r
                jqWrap.show();\r
                \r
-               inputTitle.start();\r
+               inputTitle.focus();\r
                \r
                elmUploader = document.createElement( 'div' );\r
                elmUploader.id = 'newcomic';\r
@@ -3032,7 +3051,7 @@ pettanr.comicConsole = pettanr.view.registerApplication( function(){
                var elmScript = document.createElement( 'script');\r
                elmScript.type = 'text\/javascript';\r
                elmScript.src = pettanr.CONST.CREATE_COMIC_JS;\r
-               elmWrap.appendChild( elmScript);\r
+               elmWrap.appendChild( elmScript );\r
                \r
                elmProgress.innerHTML = 'loading form.';\r
                \r
@@ -3082,7 +3101,7 @@ pettanr.uploadConsole = pettanr.view.registerApplication( function(){
                isUploading = false,\r
                instance = this;\r
        /*\r
-        * upload ボタンが押されたらまず iframe をつくる.
+        * upload ボタンが押されたらまず iframe をつくる.\r
         */\r
        function clickOK(){\r
                if( !elmForm || !elmIframe || isUploading === true ) return false;\r
@@ -3093,7 +3112,7 @@ pettanr.uploadConsole = pettanr.view.registerApplication( function(){
                return false;\r
        }\r
        /*\r
-        * form の target に iframe を指定したのち submit();
+        * form の target に iframe を指定したのち submit();\r
         */\r
                function submit(){\r
                        try {\r
@@ -3113,7 +3132,7 @@ pettanr.uploadConsole = pettanr.view.registerApplication( function(){
                        elmProgress.innerHTML = 'uploading..';\r
                }\r
        /*\r
-        * ie の 場合、readyState をチェック.
+        * ie の 場合、readyState をチェック.\r
         */\r
                        function detectIframe(){\r
                    if ( elmIframe.readyState === 'complete') {\r
@@ -3158,7 +3177,7 @@ pettanr.uploadConsole = pettanr.view.registerApplication( function(){
                instance.onPaneResize( windowW, windowH );\r
        }\r
        /*\r
-        * 
+        * \r
         */\r
        function clickCancel(){\r
                if( isUploading === true) return false;\r
@@ -3182,7 +3201,7 @@ pettanr.uploadConsole = pettanr.view.registerApplication( function(){
        this.onOpen = function( w, h){\r
                instance.init && instance.init();\r
                /*\r
-                * ie 6, 7 で fadeIn 中の要素に appendChild すると クラッシュするので、document.body に追加.
+                * ie 6, 7 で fadeIn 中の要素に appendChild すると クラッシュするので、document.body に追加.\r
                 */                             \r
                elmScript = document.createElement( 'script');\r
                elmScript.type = 'text\/javascript';\r