/*
- * pettanR system.js
- * version 0.4.37
+ * pettanR peta.apps.js
+ * version 0.5.5
*
* author:
* itozyun
_rule,
_Math_pow = Math.pow,
_bits = 0;
- if( typeof _license === 'object'){
+ if( typeof _license === 'object' ){
for( i=0, l=BASIC_LICENSES.length; i<l; ++i ){
_rule = _license[ BASIC_LICENSES[ i]];
if( typeof _rule === 'number' && _rule === 1 ){
} else
// Comic + Panels
if( _parent.type === FILE_TYPE.COMIC || _parent === FILE_DATA_COMICS_ROOT ){
- var _panels = _data.panels,
+ var _panels = _data.stories,
_panel;
if( _panels && Type.isArray( _panels ) === true ){
- for( i=0, l=_panels.length; i<l; ++i){
+ for( i=0, l=_panels.length; i<l; ++i ){
_panel = buildFileData( _panels[ i ], FILE_DATA_PANELS_ROOT );
/*
* 間違い! t 順に格納
*/
addChildData( _data, _panel );
};
- delete _data.panels;
+ delete _data.stories;
} else {
if( _data.json !== null ){
_data.json = 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( '' );
- }
- }
+ _json = [ pettanr.CONST.PETTANR_ROOT_PATH, 'comics\/', _data.id, '.json' ].join( '' );
+ };
+ };
if( typeof _json === 'string' ){
FileAPI.getJson( _file, _json, onLoadJson, onErrorJson );
_data.state = Const.FILE.STATE.LOADING;
_data.json = null;
return;
- }
+ };
};
this.getName = function( _file ){
var _data = FileAPI.getFileData( _file ),
for( var key in _data ){
ret[ key ] = _data[ key ]
}
- ret.panels = _data.children;
+ ret.stories = _data.children;
return ret;
}
if( _type === FILE_TYPE.PANEL ){
var Cabinet = gOS.registerApplication( function(){
var self = this,
finder = null,
- tree = null;
+ tree = null,
+ headerH = 0;
this.bgColor = '#FFFFFF';
this.MIN_WIDTH = 500;
this.MIN_HEIGHT = 300;
this.onInit = function(){
self.rootElement.id = 'cabinet-root';
- self.rootElement.innerHTML = '<div id="cabinet-container" class="finder-container"></div>';
+ self.rootElement.innerHTML = [
+ '<div id="cabinet-header">Cabinet<div id="cabinet-close-button">x</div></div>',
+ '<div id="cabinet-container" class="finder-container"></div>'
+ ].join( '' );
self.fetchCSS( '/assets/peta.apps.css' );
delete self.onInit;
};
this.onOpen = function( _w, _h ){
+ headerH = Util.getElementSize( document.getElementById( 'cabinet-header' ) ).height;
+
+ self.addMouseEventListener( document.getElementById( 'cabinet-close-button' ), 'click', Cabinet.shutdown );
+
finder = self.createFinder( self.rootElement, tree );
self.onPaneResize( _w, _h );
};
finder = tree = null;
};
this.onPaneResize = function( _w, _h ){
- finder.resize( _w, _h );
+ finder.resize( _w, _h - headerH );
};
}, false, true, 'Cabinet', 'cabinet', null, '#1C1C1C' );
var Gallery = gOS.registerApplication( function(){
var self = this,
finder = null,
- tree = null;
+ tree = null,
+ headerH = 0;
this.bgColor = '#FFFFFF';
this.MIN_WIDTH = 500;
this.MIN_HEIGHT = 300;
this.onInit = function(){
self.rootElement.id = 'gallery-root';
- self.rootElement.innerHTML = '<div id="gallery-container" class="finder-container"></div>';
+ self.rootElement.innerHTML = [
+ '<div id="gallery-header">Cabinet<div id="gallery-close-button">x</div></div>',
+ '<div id="gallery-container" class="finder-container"></div>'
+ ].join( '' );
self.fetchCSS( '/assets/peta.apps.css' );
_pic.destroy();
};
this.onOpen = function( _w, _h ){
+ headerH = Util.getElementSize( document.getElementById( 'gallery-header' ) ).height;
+
+ self.addMouseEventListener( document.getElementById( 'gallery-close-button' ), 'click', Gallery.shutdown );
+
finder = self.createFinder( self.rootElement, tree );
self.onPaneResize( _w, _h );
};
finder = tree = null;
};
this.onPaneResize = function( _w, _h ){
- finder.resize( _w, _h );
+ finder.resize( _w, _h - headerH );
};
}, false, true, 'Gallery', 'gallery', null, '#01A31C' );
} else {
};
-
if( comicData !== null ){
elmTitle.data = title;
elmAuthor.data = author;
y = _y;
w = _w;
h = _h;
- }
+ };
function bodyBackOrForward( isBack ){
- if( !self) return;
- if( bodyIsTachable === !isBack) return;
+ if( !self ) return;
+ if( bodyIsTachable === !isBack ) return;
elmBodyStyle.position = isBack === true ? 'relative' : 'absolute';
elmBodyStyle.left = isBack === true ? 0 : x +'px';
- elmBodyStyle.top = isBack === true ? 0 : y +headerH +'px';
- elmBodyStyle.width = isBack === true ? '' : ( w -WINDOW_BODY_BODER_SIZE *2) +'px';
+ elmBodyStyle.top = isBack === true ? 0 : y + headerH + 'px';
+ elmBodyStyle.width = isBack === true ? '' : ( w - WINDOW_BODY_BODER_SIZE * 2 ) + 'px';
bodyIsTachable === isBack && isBack === true ? elmHeader.parentNode.insertBefore( elmBody, elmHeader.nextSibling ) : app.rootElement.appendChild( elmBody );
bodyIsTachable = !isBack;
- }
+ };
this.init = function(){
self.elm = elmWindowOrigin.cloneNode( true );
};
this.onFadeOut = function(){
self.elm.parentNode.removeChild( self.elm );
- self.onClose && setTimeout( self.onClose, 0 );
+ self.onClose && app.addAsyncCall( self.onClose );
};
this.close = function(){
if( visible === false) return;
function addImage(){
IMAGE_EXPLORER_WINDOW.open();// setTimeout( IMAGE_EXPLORER_WINDOW.open, 0);
TOOL_BOX_WINDOW.bodyBackOrForward( true );
- }
+ };
function addText(){
- setTimeout( PANEL_ELEMENT_CONTROL.createTextElement, 0 );
- }
+ app.addAsyncCall( PANEL_ELEMENT_CONTROL.createTextElement );
+ };
function switchGrid(){
- setTimeout( GRID_CONTROL.update, 0 );
- }
+ app.addAsyncCall( GRID_CONTROL.update );
+ };
function popupHelp(){
TOOL_BOX_WINDOW.bodyBackOrForward( true );
- setTimeout( HELP_DOCUMENTS_WINDOW.open, 0 );
- }
+ app.addAsyncCall( HELP_DOCUMENTS_WINDOW.open );
+ };
function editBG( e ){
TOOL_BOX_WINDOW.bodyBackOrForward( true );
- setTimeout( INFOMATION_WINDOW.open, 0 );
- }
+ app.addAsyncCall( INFOMATION_WINDOW.open );
+ };
return WINDOWS_CONTROL.createWindow(
{
jqAjaxContents.removeClass( 'loading' ).append( elmNavi, elmPages );
jqNaviItems = jqAjaxContents.find( 'a.' + elmItemOrigin.className ).click( onNaviClick );
- jqPages = jqAjaxContents.find( '.page-content' );
+ jqPages = jqAjaxContents.find( '.page-content' );
jqPages.find( 'a' ).click( onInnerLinkClick );
- setTimeout( jumpPage, 0 );
+ app.addAsyncCall( jumpPage );
}
function onSelectionClick( _pageIndex ){
HELP_DOCUMENTS_WINDOW.open();
jumpPage( _pageIndex );
}
function jumpPage( _index ){
- if( typeof _index === 'number' && 0 <= _index && _index < numPage && currentPageIndex !== _index ){
+ if( Type.isNumber( _index ) === true && 0 <= _index && _index < numPage && currentPageIndex !== _index ){
currentPageIndex = _index;
}
jqNaviItems.removeClass( 'current' ).eq( currentPageIndex).addClass( 'current' );
onInit: function(){
help = MENU_BAR_CONTROL.HELP;
onLoadFunction = help.createAjaxSelection( onAjaxStart );
- jqAjaxContents = $( HELP_DOCUMENTS_WINDOW.elm ).find( '.window-body' ).addClass( 'loading' );
+ jqAjaxContents = $( HELP_DOCUMENTS_WINDOW.elm ).find( '.window-body' ).addClass( 'loading' ).css( { overflow: 'auto' } );
delete HELP_DOCUMENTS_WINDOW.onInit;
},
onFirstOpen: function( _w, _h ){
var elmHeader, elmProgress,
winW, winH,
inputTitle, inputW, inputH,
- comboboxVisible, comboboxEditable,
+ comboboxVisible, // comboboxEditable,
buttonSubmit, buttonCancel,
elmUploader = null,
elmScript = null,
_select.selectedIndex = comboboxVisible.selectIndex();
} else
if( _name === 'comic[editable]'){
- _select.selectedIndex = comboboxEditable.selectIndex();
+ // _select.selectedIndex = comboboxEditable.selectIndex();
};
};
try {
};
function onIframeUpdate(){
elmIframe.onload = null;
+ try {
+ console.log( ( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow ).document.body.innerHTML );
+ } catch(e){
+
+ }
+
( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow ).close();
elmIframe = null;
elmProgress.innerHTML = 'success!';
comboboxVisible.createOption( option.innerHTML, option.value, option.selected );
} else
if( select.name === 'comic[editable]' ){
- comboboxEditable.createOption( option.innerHTML, option.value, option.selected );
+ // comboboxEditable.createOption( option.innerHTML, option.value, option.selected );
};
};
};
'<span class="field-label">Visible:</span>',
'<span id="comic-console-visible-value" class="comic-console-value combobox"></span>',
'</div>',
- '<div id="comic-console-editable" class="field">',
- '<span class="field-label">Editable:</span>',
- '<span id="comic-console-editable-value" class="comic-console-value combobox"></span>',
- '</div>',
+ //'<div id="comic-console-editable" class="field">',
+ // '<span class="field-label">Editable:</span>',
+ // '<span id="comic-console-editable-value" class="comic-console-value combobox"></span>',
+ //'</div>',
'<div class="console-button-container">',
'<div id="comic-console-post-button" class="button console-submit-button">create</div>',
'<div id="comic-console-cancel-button" class="button console-cancel-button">cancel</div>',
inputW = ui.createInputText( document.getElementById( 'comic-console-width') );
inputH = ui.createInputText( document.getElementById( 'comic-console-height') );
comboboxVisible = ui.createCombobox( document.getElementById( 'comic-console-visible') );
- comboboxEditable = ui.createCombobox( document.getElementById( 'comic-console-editable') );
+ // comboboxEditable = ui.createCombobox( document.getElementById( 'comic-console-editable') );
buttonSubmit = ui.createButton( document.getElementById( 'comic-console-post-button'), clickOK );
buttonCancel = ui.createButton( document.getElementById( 'comic-console-cancel-button'), clickCancel );
};
};
function onLoad(){
+ try {
+ console.log( ( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow ).document.body.innerHTML );
+ } catch(e){
+
+ }
elmIframe.onload = null;
( elmIframe.contentWindow || elmIframe.contentDocument.parentWindow ).close();
elmProgress.innerHTML = 'success!';
elmOutputArea = document.getElementById( 'output-area' );
var ui = instance.createUIGroup();
- comboboxFormat = ui.createCombobox( document.getElementById( 'output-console-format' ) );
+ comboboxFormat = ui.createCombobox( document.getElementById( 'output-console-format' ), clickGenerate );
for( var i=0; FORMAT_LIST[ 0 ]; ++i ){
- comboboxFormat.createOption( FORMAT_LIST.pop(), null, i === 0 );
+ comboboxFormat.createOption( FORMAT_LIST.shift(), null, i === 0 );
};
inputOption = ui.createInputText( document.getElementById( 'output-console-option' ), null );
buttonGenerate = ui.createButton( document.getElementById( 'output-console-generate-button' ), clickGenerate );