X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=public%2Fassets%2Fsystem.js;fp=public%2Fassets%2Fsystem.js;h=1b3ae388b9c15a6539c900a1be6f0a7d2140505b;hp=4d00da824bd813a7e55a6a1f1e0357a81503b0a5;hb=cd9653c66c4883c5e9a483fc47f0ddf77ed837be;hpb=1e409caa9b7da216bcfd202bb82e3463b3304983 diff --git a/public/assets/system.js b/public/assets/system.js index 4d00da82..1b3ae388 100644 --- a/public/assets/system.js +++ b/public/assets/system.js @@ -1,6 +1,6 @@ /* * pettanR system.js - * version 0.4.33 + * version 0.4.35 * * author: * itozyun @@ -118,7 +118,7 @@ pettanr.file = ( function(){ var _uid, _data, _access; if( typeof UIDorFILEorFILEDATA === 'number'){ - _data = FILEDATA_RESITER[ UIDorFILEorFILEDATA] || null; + _data = FILEDATA_RESITER[ UIDorFILEorFILEDATA ] || null; } else if( UIDorFILEorFILEDATA instanceof FileClass){ _uid = UIDorFILEorFILEDATA.getUID(); @@ -146,7 +146,7 @@ pettanr.file = ( function(){ var _data = FILE_CONTROLER.getFileData( _file); return _data !== null && _data.driver ? _data.driver : FileDriverBase; }, - getUpdateFlag: function( _file, _bit){ + getUpdateFlag: function( _file, _bit ){ var _driver = FILE_CONTROLER.getDriver( _file ), _policy; if( typeof _driver.getUpdatePolicy === 'function'){ @@ -174,10 +174,10 @@ pettanr.file = ( function(){ removeEventListener: function( FILEorNULL, _eventType, _callback ){ var _uid = FILEorNULL instanceof FileClass ? FILEorNULL.getUID() : FILEorNULL, _ticket; - for(var i=0, l = EVENT_LISTENER_REGISTER.length; i 0 ? 1 : 0 ); + slide(); + return false; + } + function onNextClick(){ + currentIndex += ( currentIndex < numPanel - 1 ? 1 : 0 ); + slide(); + return false; + } + function slide(){ + var elm = elmContainer.childNodes[ currentIndex ], + h = windowH - headerH - consoleH, + top = headerH; + if( elm ){ + top = headerH - elm.offsetTop + Math.floor( ( h - elm.offsetHeight ) / 2 ); + } + + jqPanelContainer.stop().animate( { + top: top + }); + } + function getCurrentTopPosition(){ + + } + function draw(){ + var fileData, title, author; + + if( pettanr.driver.isPettanrFileInstance( currentFile ) === true ){ + if( currentFile.getType() === pettanr.driver.FILE_TYPE.COMIC ){ + fileData = currentFile.read(); + title = fileData.title; + author = fileData.author.name; + comicData = fileData; + numPanel = currentFile.getChildFileLength(); + } else + if( currentFile.getType() === pettanr.driver.FILE_TYPE.PANEL ){ + fileData = currentFile.read(); + title = fileData.comic.title; + author = fileData.comic.author.name; + comicData = fileData; + numPanel = 1; + } + } else { + + } + + if( comicData !== null ){ + elmTitle.data = title; + elmAuthor.data = author; + bindWorker.json( comicData ); + window.setTimeout( asyncResize, 0 ); + } + } + function asyncResize(){ + instance.onPaneResize( windowW, windowH ); + } + + /* grobal method */ + // this.rootElement = elmWrap; + this.displayName = ID; + this.ID = ID; + this.rootElement = document.getElementById( 'comic-reader-wrapper' ); + this.MIN_WIDTH = 320; + this.MIN_HEIGHT = 320; + this.init = function(){ + jqWrap = $( instance.rootElement ); + jqPanelContainer = $( elmContainer ); + + elmBackButton.onclick = onBackClick; + elmNextButton.onclick = onNextClick; + + bindWorker = pettanr.bind.createBindWorker( elmContainer, null, false, false ); + + delete instance.init; + } + this.onOpen = function( _w, _h, _file ){ + instance.init && instance.init(); + numPanel = currentIndex = 0; + + jqWrap.show(); + jqPanelContainer.css({ + left: _w / 2, + top: _h + }); + windowW = _w; + windowH = _h; + if( pettanr.file.isFileInstance( _file ) === true ){ + currentFile = _file; + _file.addEventListener( pettanr.file.FILE_EVENT.GET_SEQENTIAL_FILES, draw ); + draw(); + } + } + this.onPaneResize = function( _windowW, _windowH ){ + windowW = _windowW; + windowH = _windowH; + var panelH = elmContainer.offsetHeight, + panelW = elmContainer.offsetWidth, + h = _windowH - headerH - consoleH; + jqPanelContainer.stop().animate( + { + left: Math.floor( ( _windowW - panelW ) / 2 ), + top: headerH + ( panelH < h ? Math.floor( ( h - panelH ) / 2 ) : 0 ) + } + ); + } + this.onClose = function(){ + jqWrap.hide(); + currentFile.addEventListener( pettanr.file.FILE_EVENT.GET_SEQENTIAL_FILES, draw ); + currentFile = comicData = currentPanel = null; + } +}); + // i18n // login // lib