/*\r
* pettanR common.js\r
- * version 0.4.16\r
+ * version 0.4.21\r
* \r
* author: itozyun\r
*/\r
*/\r
var Type = {\r
isObject : function(v) {\r
- return typeof v === 'object';\r
+ return v !== null && Type.isArray(v) === false && typeof v === 'object';\r
},\r
isFunction : function(v) {\r
return typeof v === 'function';\r
}\r
return {};\r
})(),\r
- IS_DEBUG = typeof URL_PARAMS.debug === 'boolean' ? URL_PARAMS.debug : IS_LOCAL === true,\r
+ IS_DEBUG = Type.isBoolean( URL_PARAMS.debug ) ? URL_PARAMS.debug : IS_LOCAL === true,\r
jqWindow , jqDocument , jqBody;\r
return {\r
- version: '0.4.13',\r
+ version: '0.4.21',\r
init: function(){\r
jqWindow = $( window);\r
jqDocument = $( document);\r
_fn;\r
for( var i=0; i<l; i++){\r
_fn = FUNCTION_ARRAY[ i];\r
- _fn.init && _fn.init( _fn === pettanr.view ? FUNCTION_ARRAY : undefined);\r
+ _fn.init && _fn.init( _fn === pettanr.view ? FUNCTION_ARRAY : undefined );\r
}\r
\r
delete pettanr.init;\r
} else {\r
parentElm && parentElm.appendChild( img);\r
}\r
- return size;\r
\r
/* LICENSE: MIT\r
* AUTHOR: uupaa.js@gmail.com\r
// HTMLCanvasElement\r
return { width: image.width, height: image.height };\r
}\r
+ \r
+ return size;\r
},\r
loadImage: function( URLorELM, onLoad, onError, delay, timeout){\r
delay = delay || 250;\r
return ret;\r
},\r
getChildIndex: function( _parent, _child){\r
- var _children = _parent.getElementsByTagName( _child.tagName),\r
+ var _children = _parent.getElementsByTagName( _child.tagName ),\r
l = _children.length;\r
for(var i=0; i<l; ++i){\r
if( _children[ i] === _child) return i;\r
}\r
},\r
getIndex: function( _array, _element){\r
- if( Array.prototype.indexof){\r
+ if( Array.prototype.indexof ){\r
pettanr.util.getIndex = function( _array, _element){\r
return _array.indexof( _element);\r
}\r
}\r
return pettanr.util.getIndex( _array, _element);\r
},\r
+ copyArray: function( _array ){\r
+ var ret = new Array( l );\r
+ for(var i=0, l = _array.length; i<l; ++i){\r
+ ret[ i ] = _array[ i ];\r
+ }\r
+ return ret;\r
+ },\r
/*\r
* \r
*/\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 : PETTANR_ROOT_PATH) + 'resource_pictures\/',\r
+ RESOURCE_PICTURE_PATH: ( isLocal === true ? '' : 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
/* 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
+ document.location.href.indexOf( pettanr.CONST.PETTANR_ROOT_PATH ) === 0 ||\r
+ location.indexOf( '\/work.html') !== -1 ||\r
+ location.indexOf( '\work.html') !== -1, // for ie6\r
deep = location.indexOf( '\/diary\/') !== -1 ||\r
location.indexOf( '\/test\/') !== -1 ||\r
location.indexOf( '\/help\/') !== -1 ||\r
location.indexOf( '\/sitemap\/') !== -1 ||\r
location.indexOf( '\/wiki\/') !== -1,\r
LoginUserNavi;\r
- \r
+\r
if( isWorkPage === false){\r
LoginUserNavi = {\r
show: function(){\r
LoginUserNavi = {\r
show: function(){\r
var i = pettanr.util.getChildIndex( this.parentNode, this );\r
- i !== -1 && pettanr.view.show( i );\r
+ i !== -1 && bootApplication( i );\r
return false;\r
},\r
hide: function(){}\r
var jqWindow,\r
APPLICATION_LIST = [],\r
LUNCHER_APPLICATION_LIST = [],\r
- navi = document.getElementById('global-navi'),\r
- currentApplication;\r
- \r
- function onWindowResize(){\r
- var w = jqWindow.width(),\r
- h = jqWindow.height();\r
- currentApplication && currentApplication.onWindowResize && currentApplication.onWindowResize( w, h);\r
- pettanr.overlay.currentID !== null && pettanr.overlay.onWindowResize( w, h);\r
- }\r
+ currentApplication = null;\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
this.MIN_WIDTH = 240;\r
this.MIN_HEIGHT = 240;\r
}\r
+ \r
var AbstractApplication = function(){\r
this.displayName = 'app name';\r
this.ID = 'app id';\r
+ this.rootElement = null;\r
+ this.parentElement = null;\r
+ this.nextSibling = null;\r
+ this.open = function( _w, _h /*, _option */ ){\r
+ if( this.MIN_WIDTH > _w || this.MIN_HEIGHT > _h ){\r
+ if( Type.isHTMLElement( this.rootElement ) === true ){\r
+ // 小さすぎる!、と表示\r
+ }\r
+ }\r
+ if( arguments.length > 2){\r
+ // argumentsRellay( this.onOpen, arguments );\r
+ this.onOpen.apply( this, arguments );\r
+ } else {\r
+ this.onOpen( _w, _h );\r
+ }\r
+ }\r
+ this.close = function(){\r
+ if( this.onClose() === false ){\r
+ return false;\r
+ }\r
+ }\r
+ this.onOpen = function( _w, _h /*, _option */ ){\r
+ // overrride\r
+ };\r
+ this.onClose = function(){\r
+ // overrride\r
+ return true;\r
+ } // false の場合、close の拒否 \r
}\r
AbstractApplication.prototype = new AbstractBasicPane();\r
\r
- return {\r
- init: function( _funcArray ){\r
- jqWindow = pettanr.jqWindow();\r
- jqWindow.resize( onWindowResize);\r
- \r
- var _option = {}; // urlパラメータ\r
- \r
- pettanr.view.show( pettanr.URL_PARAMS.view || 0, _option );\r
- \r
- delete pettanr.view.init;\r
- },\r
- show: function( APPLICATIONorINDEX, _option ){\r
- if( isWorkPage === false ) return;\r
- \r
- var _applicetion,\r
- _elm, i, l,\r
- nodesA = navi.getElementsByTagName( 'a') || [],\r
- _index = -1;\r
- if( typeof APPLICATIONorINDEX === 'number' && APPLICATIONorINDEX < LUNCHER_APPLICATION_LIST.length){\r
- _applicetion = LUNCHER_APPLICATION_LIST[ APPLICATIONorINDEX ];\r
- } else\r
- if( typeof APPLICATIONorINDEX === 'string' ){\r
- for( i=0, l=LUNCHER_APPLICATION_LIST.length; i<l; ++i ){\r
- if( APPLICATIONorINDEX === APPLICATION_LIST[ i ].ID ){\r
- _applicetion = APPLICATION_LIST[ i ];\r
- break;\r
- }\r
- }\r
- } else\r
- if( pettanr.view.isApplicationInstance( APPLICATIONorINDEX ) === true ){\r
- _applicetion = APPLICATIONorINDEX;\r
- } else\r
- if( !currentApplication ){\r
- _applicetion = LUNCHER_APPLICATION_LIST[ 0 ];\r
+ var ApplicationReference = function( application ){\r
+ this.inOverlay = false;\r
+ this.getUID = function(){\r
+ return pettanr.util.getIndex( APPLICATION_LIST, application );\r
+ }\r
+ this.boot = function( /* _option */ ){\r
+ if( arguments.length > 0 ){\r
+ bootApplication( application, pettanr.util.copyArray( arguments ) );\r
} else {\r
- return;\r
+ bootApplication( application );\r
}\r
- \r
- if( !_applicetion ) return;\r
+ }\r
+ this.bootInOverlay = function( /* _option */ ){\r
+ this.inOverlay = true;\r
+ pettanr.overlay.show( application, pettanr.util.copyArray( arguments ) );\r
+ }\r
+ this.shutdown = function(){\r
+ if( this.inOverlay === true ){\r
+ pettanr.overlay.hide();\r
+ this.inOverlay = false;\r
+ } else {\r
+ bootApplication( 0 );\r
+ }\r
+ }\r
+ this.addToLancher = function(){\r
+ if( pettanr.util.getIndex( LUNCHER_APPLICATION_LIST, application ) !== -1 ) return;\r
+ LUNCHER_APPLICATION_LIST.push( application );\r
+ \r
+ var navi = document.getElementById('global-navi'),\r
+ item = document.createElement('a');\r
+ navi.appendChild( item );\r
+ navi.style.width = ( ( item.offsetWidth || 80 ) * LUNCHER_APPLICATION_LIST.length ) + 'px';\r
+ item.href = '#';\r
+ item.appendChild( document.createTextNode( application.displayName ));\r
+ item.onclick = LoginUserNavi.show;\r
+ }\r
+ }\r
+\r
+ function bootApplication( APPLICATIONorINDEX, _arguments ){\r
+ if( isWorkPage === false ) return;\r
+\r
+ var _application,\r
+ i, j, l, \r
+ nodesA = document.getElementById('global-navi').getElementsByTagName( 'a') || [],\r
+ _index = -1;\r
+ if( typeof APPLICATIONorINDEX === 'number' && APPLICATIONorINDEX < LUNCHER_APPLICATION_LIST.length){\r
+ _application = LUNCHER_APPLICATION_LIST[ APPLICATIONorINDEX ];\r
+ } else\r
+ if( typeof APPLICATIONorINDEX === 'string' ){\r
for( i=0, l=LUNCHER_APPLICATION_LIST.length; i<l; ++i ){\r
- if( _applicetion === LUNCHER_APPLICATION_LIST[ i ] ){\r
- _index = i;\r
+ if( APPLICATIONorINDEX === APPLICATION_LIST[ i ].ID ){\r
+ _application = APPLICATION_LIST[ i ];\r
break;\r
}\r
}\r
- if( _index !== -1 ){\r
- for( i=0, l=nodesA.length; i<l; ++i ){\r
- nodesA[ i ].className = _index === i ? 'current' : '';\r
- }\r
+ } else\r
+ if( pettanr.view.isApplicationInstance( APPLICATIONorINDEX ) === true ){\r
+ _application = APPLICATIONorINDEX;\r
+ } else\r
+ if( !currentApplication ){\r
+ _application = LUNCHER_APPLICATION_LIST[ 0 ];\r
+ } else {\r
+ return;\r
+ }\r
+ \r
+ if( !_application ) return;\r
+ \r
+ for( i=0, l=LUNCHER_APPLICATION_LIST.length; i<l; ++i ){\r
+ if( _application === LUNCHER_APPLICATION_LIST[ i ] ){\r
+ for( j=0, l=nodesA.length; j<l; ++j ){\r
+ nodesA[ j ].className = i === j ? 'current' : '';\r
+ } \r
+ break;\r
}\r
+ }\r
+ \r
+ if( currentApplication === _application ) return;\r
+ if( currentApplication ){\r
+ currentApplication.close();\r
+ currentApplication.rootElement && currentApplication.rootElement.parentNode &&\r
+ currentApplication.rootElement.parentNode.removeChild( currentApplication.rootElement );\r
+ }\r
\r
- if( currentApplication === _applicetion ) return;\r
+ currentApplication = _application;\r
+ \r
+ if( _application.nextSibling && _application.nextSibling.parentNode === _application.parentElement ){\r
+ _application.parentElement.insertBefore( _application.rootElement, _application.nextSibling );\r
+ } else\r
+ if( _application.parentElement ){\r
+ _application.parentElement.appendChild( _application.rootElement );\r
+ } else {\r
+ _application.rootElement && document.body.appendChild( _application.rootElement );\r
+ }\r
\r
- if( currentApplication ){\r
- _elm = currentApplication.rootElement;\r
- if( _elm ){\r
- _elm.style.display = 'none';\r
- }\r
- typeof currentApplication.onClose === 'function' && currentApplication.onClose();\r
- }\r
- currentApplication = _applicetion;\r
+ if( _arguments ){\r
+ _arguments.unshift( jqWindow.width(), jqWindow.height() );\r
+ _application.open.apply( _application, _arguments );\r
+ // argumentsRellay( _application.open, _arguments );\r
+ } else {\r
+ _application.open( jqWindow.width(), jqWindow.height() );\r
+ }\r
+ pettanr.view.currentID = _application.ID;\r
+ }\r
+ \r
+ function argumentsRellay( _method, _arguments ){\r
+ alert( typeof _method )\r
+ l = _arguments.length;\r
+ if( l > 0 ){\r
+ var _arg = [];\r
+ for( i=0; i<l; ++i ){\r
+ _arg.push( 'a[' + i + ']' );\r
+ }\r
+ window['_method'] = _method;\r
+ //eval( '_method(' + _arg.join(',') + ')' );\r
+ var f = new Function( 'a', '_method(' + _arg.join(',') + ')' );\r
+ f( _arguments );\r
+ window['_method'] = undefined;\r
+ } else {\r
+ _method();\r
+ } \r
+ }\r
+ \r
+ function onWindowResize(){\r
+ var w = jqWindow.width(),\r
+ h = jqWindow.height();\r
+ currentApplication && currentApplication.resize( w, h );\r
+ pettanr.overlay.onWindowResize( w, h );\r
+ }\r
+\r
+ return {\r
+ init: function( _funcArray ){\r
+ jqWindow = pettanr.jqWindow();\r
+ jqWindow.resize( onWindowResize );\r
\r
- _elm = _applicetion.rootElement;\r
- if( _elm ){\r
- _elm.style.display = 'block';\r
- }\r
- typeof _applicetion.onOpen === 'function' && _applicetion.onOpen( jqWindow.width(), jqWindow.height(), _option );\r
+ var _option = {}; // urlパラメータ\r
\r
- this.currentID = _applicetion.ID;\r
+ onWindowResize();\r
+ \r
+ bootApplication( pettanr.URL_PARAMS.view || 0 );\r
+ \r
+ delete pettanr.view.init;\r
},\r
- registerAsBasicPane: function( _basicPane ){\r
- if( pettanr.view.isBasicPaneInstance( _basicPane ) === true ) return;\r
- _basicPane.prototype = new AbstractBasicPane();\r
+ createBasicPane: function( _class, _options ){\r
+ _class.prototype = new AbstractBasicPane();\r
+ return new _class( _options );\r
},\r
- registerApplication: function( _application, _addToLancher ){\r
- if( pettanr.view.isApplicationInstance( _application ) === true ) return;\r
- _application.prototype = new AbstractApplication();\r
- APPLICATION_LIST.push( _application );\r
- if( _addToLancher === true ){\r
- pettanr.view.addApplicationToLancher( _application );\r
- }\r
+ _getAbstractApplication: function(){\r
+ return new AbstractApplication();\r
},\r
- addApplicationToLancher: function( _application ){\r
- // if( pettanr.view.isApplicationInstance( _application ) === false ) return;\r
+ registerApplication: function( _class, _options ){\r
+ _class.prototype = new AbstractApplication();\r
+ _application = new _class( _options );\r
\r
- if( pettanr.util.getIndex( LUNCHER_APPLICATION_LIST, _application ) !== -1 ) return;\r
- LUNCHER_APPLICATION_LIST.push( _application );\r
-\r
- var item = document.createElement('a');\r
- navi.appendChild( item );\r
- navi.style.width = ( ( item.offsetWidth || 80 ) * LUNCHER_APPLICATION_LIST.length ) + 'px';\r
- item.href = '#';\r
- item.appendChild( document.createTextNode( _application.displayName ));\r
- item.onclick = LoginUserNavi.show;\r
+ var elm = _application.rootElement;\r
+ if( Type.isHTMLElement( elm ) === false ) return null;\r
+ \r
+ _application.parentElement = elm.parentNode;\r
+ _application.nextSibling = elm.nextSibling;\r
+ \r
+ if( elm.parentNode ){\r
+ elm.parentNode.removeChild( elm );\r
+ }\r
+ APPLICATION_LIST.push( _application );\r
+ return new ApplicationReference( _application );\r
},\r
isBasicPaneInstance: function( _basicPane ){\r
return _basicPane instanceof AbstractBasicPane;\r
},\r
isApplicationInstance: function( _application ){\r
- return pettanr.util.getIndex( APPLICATION_LIST, _application ) !== -1;\r
- // return _application instanceof AbstractApplication;\r
+ return _application instanceof AbstractApplication;\r
+ },\r
+ isApplicationReference: function( _reference ){\r
+ return _reference instanceof ApplicationReference;\r
},\r
currentID: null,\r
EDITOR: 'editor',\r
\r
pettanr.overlay = ( function(){\r
var SHADOW_OPACITY = 0.5,\r
+ ELM_CONTAINER = document.getElementById( 'overlay-container' ),\r
jqConteiner, jqShadow, jqCloseButton,// jqBody, \r
currentOverlay = null,\r
+ bootParams = null,\r
visible = false,\r
windowW, windowH;\r
\r
- function close(){\r
- currentOverlay && currentOverlay.onClose && currentOverlay.onClose();\r
- pettanr.overlay.hide(); \r
- }\r
function asyncResize(){\r
- currentOverlay.onWindowResize( windowW, windowH);\r
+ currentOverlay.resize( windowW, windowH);\r
}\r
function onCloseClick( e){\r
- close();\r
+ pettanr.overlay.hide();\r
e.preventDefault();\r
return false; \r
}\r
+ function onFadeInComplete(){\r
+\r
+ }\r
+ function onFadeOutComplete(){\r
+ if( currentOverlay.rootElement && currentOverlay.rootElement.parentNode === ELM_CONTAINER ){\r
+ ELM_CONTAINER.removeChild( currentOverlay.rootElement );\r
+ }\r
+ currentOverlay = null;\r
+ }\r
return {\r
init: function(){\r
//jqBody = pettanr.jqBody();\r
jqConteiner = $( '#overlay-container');\r
jqShadow = $( '#overlay-shadow');\r
- jqCloseButton = $( '#overlay-close-button').click( onCloseClick);\r
+ jqCloseButton = $( '#overlay-close-button').click( onCloseClick );\r
\r
- pettanr.key.addKeyDownEvent( pettanr.view.OVERLAY, 27, false, false, close); // 27.esc\r
+ pettanr.key.addKeyDownEvent( pettanr.view.OVERLAY, 27, false, false, pettanr.overlay.hide ); // 27.esc\r
\r
delete pettanr.overlay.init;\r
},\r
- show: function( _currentOverlay){\r
- if( visible === true && currentOverlay === _currentOverlay) return;\r
+ show: function( _overlay, _bootParams ){\r
+ if( visible === true && currentOverlay === _overlay ) return;\r
+ if( pettanr.view.isApplicationInstance( _overlay ) === false ) return;\r
+ \r
document.body.style.overflow = 'hidden';\r
+ \r
+ this.visible = visible = true;\r
+ this.currentID = _overlay.ID;\r
+ currentOverlay = _overlay;\r
+ bootParams = _bootParams;\r
+\r
jqConteiner.stop().css( {\r
filter: '',\r
opacity: '',\r
top: document.documentElement.scrollTop || document.body.scrollTop\r
- }).fadeIn();\r
- this.visible = visible = true;\r
- currentOverlay = _currentOverlay;\r
- this.currentID = _currentOverlay.ID;\r
- jqCloseButton.toggle( !!_currentOverlay.onClose);\r
+ }).fadeIn( onFadeInComplete );\r
+\r
+ ELM_CONTAINER.insertBefore( currentOverlay.rootElement, document.getElementById( 'overlay-close-button' ));\r
+ \r
+ if( Type.isArray( bootParams ) === true ){\r
+ bootParams.unshift( windowW, windowH )\r
+ currentOverlay.open.apply( currentOverlay, bootParams );\r
+ } else {\r
+ currentOverlay.open( windowW, windowH, bootParams );\r
+ }\r
},\r
hide: function(){\r
- currentOverlay = null;\r
if( visible === false) return;\r
document.body.style.overflow = '';\r
jqConteiner.stop().css( {\r
filter: '',\r
opacity: ''\r
- }).fadeOut();\r
+ }).fadeOut( onFadeOutComplete );\r
+ currentOverlay.close();\r
this.visible = visible = false;\r
this.currentID = null;\r
},\r
visible: visible,\r
currentID: null,\r
- onWindowResize: function( _windowW, _windowH){\r
+ onWindowResize: function( _windowW, _windowH ){\r
+ windowW = _windowW;\r
+ windowH = _windowH; \r
+ \r
+ if( currentOverlay === null ) return;\r
+ \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
+ jqShadow.css( { height: _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
+ setTimeout( asyncResize, 0);\r
}\r
}\r
})();\r
var InputTextClass = function( WRAPPER_ELM, ON_UPDATE_FUNCTION, GROUP_ID, validater){\r
validater = typeof validater === 'function' ? validater : null;\r
\r
- var elmValue = pettanr.util.getElementsByClassName( WRAPPER_ELM, 'editable-value')[ 0],\r
+ var elmValue = pettanr.util.getElementsByClassName( WRAPPER_ELM, 'editable-value' )[ 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
- elmA = ELM_A_ORIGIN.cloneNode( true);\r
+ elmA = ELM_A_ORIGIN.cloneNode( true );\r
\r
if( elmValue === undefined){\r
alert( 'error!');\r
value = elmValue.innerHTML;\r
elmValue.innerHTML = '';\r
elmValue.className += ' editable-text';\r
+ try {\r
+ elmA.innerHTML = value;\r
+ } catch(e){\r
+ alert( value + elmA)\r
+ }\r
\r
- elmA.innerHTML = value;\r
- elmValue.appendChild( elmA);\r
+ elmValue.appendChild( elmA );\r
WRAPPER_ELM.onclick = onClick;\r
\r
function onClick( e){\r
instance,\r
focus = false,\r
visible = true,\r
- enabled = true,\r
- elmFileInput = WRAPPER_ELM.getElementsByTagName('input')[0] || elmFileInput || document.createElement( 'input');\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
}\r
}\r
var activexImage = css3Image;\r
- var vmlImage = function( url, w, h, onLoadCallback){\r
+ var vmlImage = function( url, w, h, onLoadCallback ){\r
var elmWrap = document.createElement( 'div'),\r
vmlImg,\r
loaded = false,\r
vmlImg.style.width = w < 0 ? -w : w +'px';\r
vmlImg.style.height = h < 0 ? -h : h +'px';\r
//if( flipH !== _flipH || flipV !== _flipV){\r
- vmlImg.parentNode === elmWrap && elmWrap.removeChild( vmlImg);\r
+ vmlImg.parentNode === elmWrap && elmWrap.removeChild( vmlImg );\r
//}\r
vmlImg.className = w < 0 || h < 0 ? ( 'img-flip-' + ( w < 0 && h < 0 ? 'vh' : ( w < 0 ? 'h' : 'v'))) : '';\r
elmWrap.appendChild( vmlImg);\r
\r
}\r
\r
- return function( url, w, h, onLoadCallback){\r
+ return function( url, w, h, onLoadCallback ){\r
var flipH = w < 0,\r
flipV = h < 0,\r
onLoadCallbackAsync = onLoadCallback,// ? function(){ setTimeout( onLoadCallback, 0);} : undefined,// 一度読み込んだ画像は即座にonLoadになるため遅延\r
- xBackendImage = ( function( urlIsXDomain){\r
- if( BACKEND === IS_CSS3) return css3Image.apply( {}, [ url, w, h, onLoadCallbackAsync]);\r
- if( BACKEND === IS_VML) return vmlImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);\r
- if( BACKEND === IS_ACTIVEX) return activexImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);\r
- return serverImage.apply( {}, [ url, w, h, onLoadCallbackAsync]);\r
+ xBackendImage = ( function( urlIsXDomain ){\r
+ if( BACKEND === IS_CSS3) return new css3Image( url, w, h, onLoadCallbackAsync );\r
+ if( BACKEND === IS_VML) return new vmlImage( url, w, h, onLoadCallbackAsync );\r
+ if( BACKEND === IS_ACTIVEX) return new activexImage( url, w, h, onLoadCallbackAsync );\r
+ return new serverImage( url, w, h, onLoadCallbackAsync );\r
})();\r
return {\r
elm: xBackendImage.elm,\r
return {\r
elm: ELM,\r
onEnterFrame: function(){\r
- var _updateCss = {};\r
+ var _updateCss = {}, i;\r
if( numFrames === 1){\r
- for( var i=0; i<l; ++i){\r
+ for( i=0; i<l; ++i){\r
_updateCss[ targetAttributes[ i]] = endParameters[ i];\r
++i;\r
}\r
updateCss( ELM, currentParameters, targetAttributes, l);\r
onComplete !== null && onComplete();\r
} else {\r
- for( var i=0; i<l; ++i){\r
+ for( i=0; i<l; ++i){\r
_updateCss[ targetAttributes[ i]] = currentParameters[ i] = Math.floor( currentParameters[ i] + offsetParameters[ i]);\r
++i;\r
}\r