From: itozyun Date: Tue, 15 May 2012 13:39:44 +0000 (+0900) Subject: client is version0.4.30, bugfix around path. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=ab2e06eaeeed36ec55610803cb49f749b02d346b;p=pettanr%2Fpettanr.git client is version0.4.30, bugfix around path. --- diff --git a/public/assets/common.js b/public/assets/common.js index 3711638a..41b7c911 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -1,6 +1,6 @@ /* * pettanR common.js - * version 0.4.29 + * version 0.4.30 * * author: itozyun */ @@ -75,7 +75,7 @@ var pettanr = ( function(){ var FUNCTION_ARRAY = [], - URL = document.location.href.split( '#')[ 0], + URL = document.location.href.split( '#')[ 0 ], IS_LOCAL = URL.indexOf( 'file:') === 0, URL_PARAMS = ( function(){ var search = document.location.search, @@ -110,9 +110,9 @@ var pettanr = ( function(){ return { version: '0.4.28', init: function(){ - jqWindow = $( window); - jqDocument = $( document); - jqBody = $( document.body); + jqWindow = $( window ); + jqDocument = $( document ); + jqBody = $( document.body ); var l = FUNCTION_ARRAY.length, _fn; @@ -161,8 +161,7 @@ var pettanr = ( function(){ var pre = document.createElement('pre'); pre.appendChild( document.createTextNode('\n')); return pre.firstChild.data; - })(), - IS_IFRAME: !!window.parent + })() } })(); @@ -663,61 +662,41 @@ pettanr.ua = ( function(){ pettanr.CONST = ( function(){ - var isLocal = pettanr.LOCAL === true || pettanr.URL_PARAMS.exjson === false, - isLocalhost = document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0, - PETTANR_ROOT_PATH = isLocalhost === true ? 'http:\/\/localhost:3000\/' : 'http:\/\/pettanr.heroku.com\/', - location = document.location.pathname, - deep = location.indexOf( '\/diary\/' ) !== -1 || - location.indexOf( '\/test\/' ) !== -1 || - location.indexOf( '\/help\/' ) !== -1 || - location.indexOf( '\/sitemap\/' ) !== -1 || - location.indexOf( '\/wiki\/' ) !== -1; - + var SERVER_SUPPORT = !( 'has_server_support' in window && has_server_support === false ), + PETTANR_ROOT_PATH = ( function(){ + if( SERVER_SUPPORT === false ){ + var h1 = document.getElementsByTagName( 'h1' )[ 0 ]; + if( h1 ){ + var a = h1.getElementsByTagName( 'a' )[ 0 ]; + return a ? a.href : ''; + } + return ''; + } + var loc = document.location; + return [ loc.protocol, '\/\/', loc.host, '\/' ].join( '' ); + })(), + DEPTH = document.location.pathname.split( '\/' ).length; return { PETTANR_ROOT_PATH: PETTANR_ROOT_PATH, - URL_ORIGINAL_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'original_pictures.json', - URL_RESOURCE_PICTURES_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'resource_pictures.json', - URL_COMICS_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'comics.json', - URL_PANELS_JSON: ( isLocal === true ? 'json\/' : PETTANR_ROOT_PATH) + 'panels.json', + URL_ORIGINAL_PICTURES_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'original_pictures.json', + URL_RESOURCE_PICTURES_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'resource_pictures.json', + URL_COMICS_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'comics.json', + URL_PANELS_JSON: ( SERVER_SUPPORT === false ? 'json\/' : PETTANR_ROOT_PATH ) + 'panels.json', NS_PETTANR_COMIC: 'pettanr-comic', - RESOURCE_PICTURE_PATH: ( isLocal === true ? ( deep === true ? '..\/' : '' ) : PETTANR_ROOT_PATH ) + 'resource_pictures\/', - CREATE_COMIC_JS: isLocal === true ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js', - CREATE_PANEL_JS: isLocal === true ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js', - UPLOAD_PICTURE_JS: isLocal === true ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js', - REGISTER_ARTIST_JS: isLocal === true ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js', - JQUERY_URL: isLocal === true ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js' + RESOURCE_PICTURE_PATH: ( SERVER_SUPPORT === false ? ( DEPTH === 1 ? '..\/' : '' ) : PETTANR_ROOT_PATH ) + 'resource_pictures\/', + CREATE_COMIC_JS: SERVER_SUPPORT === false ? 'js\/create_new_comic.js' : PETTANR_ROOT_PATH + 'comics\/new.js', + CREATE_PANEL_JS: SERVER_SUPPORT === false ? 'js\/create_new_panel.js' : PETTANR_ROOT_PATH + 'panels\/new.js', + UPLOAD_PICTURE_JS: SERVER_SUPPORT === false ? 'js\/upload_picture.js' : PETTANR_ROOT_PATH + 'original_pictures\/new.js', + REGISTER_ARTIST_JS: SERVER_SUPPORT === false ? 'js\/register_artist.js' : PETTANR_ROOT_PATH + 'artists\/new.js', + JQUERY_URL: SERVER_SUPPORT === false ? 'javascripts\/jquery-1.6.2.min.js' : PETTANR_ROOT_PATH + 'assets\/jquery-162_min.js', + SERVER_SUPPORT: SERVER_SUPPORT, + DEPTH: DEPTH } })(); pettanr.view = ( function(){ /* create iframe overlay for user console */ - var location = document.location.pathname, - isWorkPage = document.location.href.indexOf( 'http:\/\/localhost:3000\/' ) === 0 || - document.location.href.indexOf( pettanr.CONST.PETTANR_ROOT_PATH ) === 0 || - location.indexOf( '\/work.html') !== -1 || - location.indexOf( '\work.html') !== -1, // for ie6 - deep = location.indexOf( '\/diary\/') !== -1 || - location.indexOf( '\/test\/') !== -1 || - location.indexOf( '\/help\/') !== -1 || - location.indexOf( '\/sitemap\/') !== -1 || - location.indexOf( '\/wiki\/') !== -1, - LoginUserNavi; - - if( isWorkPage === false){ - LoginUserNavi = { - show: function(){ - var i = pettanr.util.getChildIndex( this.parentNode, this ); - document.location.href = [ - deep === true ? '../' : '', - 'work.html', - typeof i === 'number' ? '?view=' + i : '' - ].join( ''); - return false; - }, - hide: function(){} - } - } else { - LoginUserNavi = { + var LoginUserNavi = { show: function(){ var i = pettanr.util.getChildIndex( this.parentNode, this ); i !== -1 && bootApplication( i ); @@ -725,7 +704,6 @@ pettanr.view = ( function(){ }, hide: function(){} } - } /* debug info */ // ua version, lang, os, plugin ( vml, svg), standerdmode, balloon, rimg @@ -835,8 +813,6 @@ pettanr.view = ( function(){ } function bootApplication( APPLICATIONorINDEX, _arguments ){ - if( isWorkPage === false ) return; - var _application, i, j, l, nodesA = document.getElementById('global-navi').getElementsByTagName( 'a') || [], diff --git a/public/assets/system.js b/public/assets/system.js index 23913d2f..cba80f31 100644 --- a/public/assets/system.js +++ b/public/assets/system.js @@ -1,6 +1,6 @@ /* * pettanR system.js - * version 0.4.29 + * version 0.4.30 * * author: * itozyun @@ -1160,7 +1160,7 @@ pettanr.driver = ( function(){ var _data = FileAPI.getFileData( _file), _json = _data !== null ? _data.json : null; if( _json === true && _data.type === pettanr.driver.FILE_TYPE.COMIC ){ - if( pettanr.LOCAL === 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( '' ); @@ -1778,7 +1778,7 @@ pettanr.premiumSatge = pettanr.view.registerApplication( function(){ elmButton.onclick = clickOK; - var BASE_PATH = pettanr.LOCAL === true ? 'resource_pictures\/' : pettanr.CONST.RESOURCE_PICTURE_PATH, + var BASE_PATH = pettanr.CONST.RESOURCE_PICTURE_PATH, THUMB_PATH = BASE_PATH, // + 'thumbnail/', LIMIT_FILESIZE = 1024 * 10; // 10KB diff --git a/public/assets/work.js b/public/assets/work.js index e9495ec1..3109892a 100644 --- a/public/assets/work.js +++ b/public/assets/work.js @@ -1,6 +1,6 @@ /* * pettanR work.js - * version 0.4.29 + * version 0.4.30 * * author: * itozyun