X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.4.x%2Fjavascripts%2Fwork.js;h=25d3256be66037fcd59030588f7c7aa64487d3ad;hb=080ecdb578eb49a116464aefc6b86bd5b6f6da38;hp=1dffaecc95b69acda91b8ecc0bd9b077c4513f9d;hpb=f6bfe2fe616d66b85cc65750e0701bf178c53b8b;p=pettanr%2FclientJs.git diff --git a/0.4.x/javascripts/work.js b/0.4.x/javascripts/work.js index 1dffaec..25d3256 100644 --- a/0.4.x/javascripts/work.js +++ b/0.4.x/javascripts/work.js @@ -1,6 +1,6 @@ /* * pettanR work.js - * version 0.4.2 + * version 0.4.12 * * author: * itozyun @@ -35,7 +35,7 @@ /* ---------------------------------------- * pettanr.editor * - MENU_BAR_CONTROL - * - HISTORY + * - HISTORY_CONTROL * - SAVE_CONTROL * - TEXT_EDITOR_CONTROL * - IMAGE_GROUP_EXPROLER @@ -87,6 +87,9 @@ pettanr.editor = ( function(){ /* ---------------------------------------- * MENU BAR + * - mouseEventListener + * - controler + * * div * div.title * ul @@ -180,15 +183,7 @@ pettanr.editor = ( function(){ function onClick( e){ var that = this, - i = ( function(){ - var parent = that.parentNode, - children = parent.getElementsByTagName( 'li'), - l = children.length; - for(var i=0; i 0){ // 先頭のクリックでない場合 // Array を前に WINDOW_ARRAY.splice( currentWindowIndex, 1); WINDOW_ARRAY.unshift( currentWindow); @@ -1279,14 +1273,14 @@ pettanr.editor = ( function(){ return false; }, onMouseUp: function( _mouseX, _mouseY){ - if( getCurrentWindow( _mouseX, _mouseY) === 0){ + if( getCurrentIndex( _mouseX, _mouseY) === 0){ currentWindow.onMouseUp( _mouseX, _mouseY); return true; } return false; }, onMouseDown: function( _mouseX, _mouseY){ - if( getCurrentWindow( _mouseX, _mouseY) === 0){ + if( getCurrentIndex( _mouseX, _mouseY) === 0){ currentWindow.onMouseDown( _mouseX, _mouseY); return true; } @@ -1300,7 +1294,7 @@ pettanr.editor = ( function(){ * 画面外に出るwindowの移動 */ }, - createWindow: function( scope, EXTENDS, bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH){ + createWindow: function( EXTENDS, bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH){ opt_visible = opt_visible !== false; opt_closeButtonEnabled = opt_closeButtonEnabled === true; opt_resizeButtonEnabled = opt_resizeButtonEnabled === true; @@ -1308,7 +1302,9 @@ pettanr.editor = ( function(){ opt_minWindowH = opt_minWindowH || ( h < DEFAULT_MIN_WINDOW_HEIGHT) ? h : DEFAULT_MIN_WINDOW_HEIGHT; var _window = pettanr.util.extend( - WindowClass.apply( scope, [ bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH]), + new WindowClass( + bodyTempleteID, title, x, y, w, h, opt_visible, opt_closeButtonEnabled, opt_resizeButtonEnabled, opt_minWindowW, opt_minWindowH + ), EXTENDS ); WINDOW_ARRAY.unshift( _window); @@ -1321,6 +1317,7 @@ pettanr.editor = ( function(){ /* ---------------------------------------- * TOOL_BOX_WINDOW + * - window */ var TOOL_BOX_WINDOW = ( function(){ var addImageButton, addTextButton, editBgButton, switchGridButton, popupHelpButton, postButton, @@ -1337,34 +1334,33 @@ pettanr.editor = ( function(){ function addImage( e){ setTimeout( COMIC_ELEMENT_CONTROL.createImageElement, 0); - e && e.preventDefault(); + e && e.preventDefault && e.preventDefault(); return false; } function addText( e){ setTimeout( COMIC_ELEMENT_CONTROL.createTextElement, 0); - e && e.preventDefault(); + e && e.preventDefault && e.preventDefault(); return false; } function switchGrid( e){ setTimeout( GRID_CONTROL.update, 0); - e && e.preventDefault(); + e && e.preventDefault && e.preventDefault(); return false; } function popupHelp( e){ instance.bodyBackOrForward( true); setTimeout( HELP_DOCUMENTS_WINDOW.open, 0); - e && e.preventDefault(); + e && e.preventDefault && e.preventDefault(); return false; } function editBG( e){ instance.bodyBackOrForward( true); setTimeout( INFOMATION_WINDOW.open, 0); - e && e.preventDefault(); + e && e.preventDefault && e.preventDefault(); return false; } return WINDOWS_CONTROL.createWindow( - this, { onInit: function(){ instance = this; @@ -1389,19 +1385,19 @@ pettanr.editor = ( function(){ /* ---------------------------------------- * IMAGE_EXPROLER + * - window */ var IMAGE_EXPLORER_WINDOW = ( function(){ var instance, finder; return WINDOWS_CONTROL.createWindow( - this, { onInit: function(){ instance = this; delete this.onInit; }, onFirstOpen: function( _w, _h){ - finder = pettanr.finder.createFinder( document.getElementById( 'image-exproler-container'), pettanr.file.TREE_TYPE_IS_IMAGE); + finder = pettanr.finder.createFinder( document.getElementById( 'image-exproler-container'), pettanr.driver.createPictureTree()); delete this.onFirstOpen; }, onOpen: function( _w, _h){ @@ -1418,6 +1414,7 @@ pettanr.editor = ( function(){ /* ---------------------------------------- * INFOMATION_WINDOW + * - window */ var INFOMATION_WINDOW = ( function(){ var FADE_EFFECT_ENABLED = true, //pettanr.ua.isIE === false || pettanr.ua.ieVersion >= 8, @@ -1432,7 +1429,6 @@ pettanr.editor = ( function(){ currentLock = false; return WINDOWS_CONTROL.createWindow( - this, { onFirstOpen: function( _w, _h){ backgroundInfomationElm = $( '#panel-background-information'); @@ -1501,14 +1497,14 @@ pettanr.editor = ( function(){ currentElementType = _elementType; } if( currentElementType !== -1){ - inputX.update( x); - inputY.update( y); - inputZ.update( z); - _elementType === 1 && inputA.update( a); - inputW.update( w); - inputH.update( h); - _elementType === 0 && inputPercentW.update( wPercent); - _elementType === 0 && inputPercentH.update( hPercent); + inputX.value( x); + inputY.value( y); + inputZ.value( z); + _elementType === 1 && inputA.value( a); + inputW.value( w); + inputH.value( h); + _elementType === 0 && inputPercentW.value( wPercent); + _elementType === 0 && inputPercentH.value( hPercent); } else { } @@ -1524,6 +1520,7 @@ pettanr.editor = ( function(){ /* ---------------------------------------- * HELP_WINDOW + * - window */ var HELP_DOCUMENTS_WINDOW = ( function(){ var visible = true, @@ -1531,22 +1528,12 @@ pettanr.editor = ( function(){ jqNaviItems, jqPages, currentPageIndex = 0, + numPage = 0, HELP = MENU_BAR_CONTROL.HELP, - onLoadFunction = HELP.createAjaxSelection( onFirstOpen), + onLoadFunction = HELP.createAjaxSelection( onAjaxStart), instance; - function jumpPage( _index){ - - } - function onSelectionClick( _pageIndex){ - currentPageIndex = _pageIndex || currentPageIndex; - HELP_DOCUMENTS_WINDOW.open(); - onOpen(); - } - function onOpen(){ - jqNaviItems.removeClass( 'current').eq( currentPageIndex).addClass( 'current'); - jqPages.hide().eq( currentPageIndex).show(); - } - function onFirstOpen( _pageIndex){ + + function onAjaxStart( _pageIndex){ currentPageIndex = _pageIndex || currentPageIndex; if( onHelpLoad !== null){ $.ajax({ @@ -1556,6 +1543,7 @@ pettanr.editor = ( function(){ }); onHelpLoad = null; } + onAjaxStart = new Function; } var onHelpLoad = function( _xml){ var jqXML = $( _xml), @@ -1565,8 +1553,7 @@ pettanr.editor = ( function(){ elmPages = document.createElement( 'div'), elmPageOrigin = document.createElement( 'div'), elmTitleOrigin = document.createElement( 'h2'), - elmPage, - numPage = 0; + elmPage; elmNavi.className = 'sidenavi'; elmItemOrigin.className = 'sidenavi-item'; elmItemOrigin.href = '#'; @@ -1574,7 +1561,7 @@ pettanr.editor = ( function(){ elmPageOrigin.className = 'page-content main'; elmPageOrigin.appendChild( elmTitleOrigin); - // helpTitle && instance.title( helpTitle); + //helpTitle && instance.title( helpTitle); jqXML.find( 'page').each( function(){ var xmlPage = $( this), @@ -1585,6 +1572,7 @@ pettanr.editor = ( function(){ elmNavi.appendChild( elmItemOrigin.cloneNode( true)); elmTitleOrigin.innerHTML = title; + elmPage = elmPageOrigin.cloneNode( true); elmPage.innerHTML = content; @@ -1606,51 +1594,50 @@ pettanr.editor = ( function(){ jqAjaxContents.removeClass( 'loading').append( elmNavi, elmPages); jqNaviItems = jqAjaxContents.find( 'a.' +elmItemOrigin.className).click( onNaviClick); - jqAjaxContents.find( '.' +elmPageOrigin.className).find( 'a').click( onInnerLinkClick); jqPages = jqAjaxContents.find( '.page-content'); - setTimeout( onOpen, 0); + jqPages.find( 'a').click( onInnerLinkClick); + + setTimeout( jumpPage, 0); + } + function onSelectionClick( _pageIndex){ + HELP_DOCUMENTS_WINDOW.open(); + jumpPage( _pageIndex); + } + function jumpPage( _index){ + if( typeof _index === 'number' && 0 <= _index && _index < numPage && currentPageIndex !== _index){ + currentPageIndex = _index; + } + jqNaviItems.removeClass( 'current').eq( currentPageIndex).addClass( 'current'); + jqPages.hide().eq( currentPageIndex).show(); } function onNaviClick( e){ // this は - var children = this.parentNode.getElementsByTagName( 'a'), - l = children.length; - for( var i=0; i 0){ + COMIC_ELEMENT_ARRAY.shift().destroy(); + } + }, remove: removeComicElement, restore: restoreComicElement, replace: replaceComicElement, @@ -3372,37 +3389,21 @@ pettanr.editor = ( function(){ return { init: function( _option){ option = _option; + }, firstOpen: function(){ - var jqWindow = pettanr.jqWindow(); - windowW = jqWindow.width(); - windowH = jqWindow.height(); - - jqEditor = $( '#editor'); - /* * MOUSE_LISTENER_ARRAY は、表示順に格納.手前の要素が最初 * MENU_BAR_CONTROL, * WINDOW_CONTROL, * COMIC_ELEMENT_CONTROL, * PANEL_CONTROL - * .busy() === true なら、そのままonMouseMove()にイベントを流す.これはArrayの後ろから、奥の表示要素から + * .busy() === true なら、そのままonMouseMove()にイベントを流す. * onMouseMove()に流してみて、false が帰れば、次にリスナーにも流す. */ MOUSE_LISTENER_ARRAY.push( MENU_BAR_CONTROL, WINDOWS_CONTROL, PANEL_RESIZER_TOP, PANEL_RESIZER_BOTTOM, COMIC_ELEMENT_CONTROL, PANEL_CONTROL); - - HISTORY.init(); - - WINDOWS_CONTROL.init(); - GRID_CONTROL.init(); - PANEL_CONTROL.init(); CONSOLE_CONTROLER.init(); - COMIC_ELEMENT_OPERATION_MANAGER.init(); - COMIC_ELEMENT_CONTROL.init(); - - // last - MENU_BAR_CONTROL.init(); OUTPUT_CONSOLE.init(); TEXT_EDITOR_CONTROL.init(); @@ -3427,17 +3428,41 @@ pettanr.editor = ( function(){ delete pettanr.editor.firstOpen; }, - onOpen: function( _option){ + onOpen: function( _file){ + if( pettanr.file.isFileInstance( _file) === true){ + // pettanr.file.isPettanFileInstance( _file) === true + // + } + jqEditor = jqEditor || $( '#editor'); + + HISTORY_CONTROL.open(); + + WINDOWS_CONTROL.open(); + + GRID_CONTROL.open(); + PANEL_CONTROL.open(); + + COMIC_ELEMENT_OPERATION_MANAGER.open(); + COMIC_ELEMENT_CONTROL.open(); + + // last + MENU_BAR_CONTROL.open(); + pettanr.editor.firstOpen !== undefined && pettanr.editor.firstOpen(); - - // HISTORY.onOpen(); - // WINDOWS_CONTROL.onOpen(); - // COMIC_ELEMENT_CONTROL.onOpen(); - // MENU_BAR_CONTROL.onOpen(); - // TEXT_EDITOR_CONTROL.onOpen(); - // IMAGE_GROUP_EXPROLER.onOpen(); }, onClose: function(){ + HISTORY_CONTROL.close(); + + WINDOWS_CONTROL.close(); + + GRID_CONTROL.close(); + PANEL_CONTROL.close(); + + COMIC_ELEMENT_OPERATION_MANAGER.close(); + COMIC_ELEMENT_CONTROL.close(); + + // last + MENU_BAR_CONTROL.open(); }, onWindowResize: function( _windowW, _windowH){ windowW = _windowW; @@ -3457,3 +3482,767 @@ pettanr.editor = ( function(){ MIN_HEIGHT: 320 } })(); + +// create hidden iframe +// write script +// setInterval +pettanr.proxy = ( function(){ + + function FormProxy( formJsUrl, callback){ + var timer = null, + iWin, idoc; + + pettanr.util.createIframe( 'id00000', onCreateIframe); + + function onCreateIframe( _iframe){ + iWin = _iframe.contentWindow; + idoc = _iframe.contentWindow.document; + + idoc.open(); + idoc.write( ''); + idoc.writeln( '