X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F06_net%2F02_XNetJSONP.js;h=69252c7d9217b5e10916d0cf86b441448d760344;hb=db13457fcd6dcd4a6a55043426d78f898e16db0a;hp=806396c92ab96bc3faef6b98bec501a94975ab63;hpb=dd02887497fa95f13d112b7fc2e5e7aefd0ffb08;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/06_net/02_XNetJSONP.js b/0.6.x/js/06_net/02_XNetJSONP.js index 806396c..69252c7 100644 --- a/0.6.x/js/06_net/02_XNetJSONP.js +++ b/0.6.x/js/06_net/02_XNetJSONP.js @@ -26,21 +26,28 @@ X.Net.JSONP = { X_NET_JSONPWrapper._busy = false; X_NET_JSONPWrapper - .asyncDispatch( 0, { + .asyncDispatch( { type : jsonString ? X.Event.SUCCESS : X.Event.ERROR, - data : jsonString //eval( jsonString ) + data : jsonString //window.JSON ? JSON.parse( jsonString ) : eval( jsonString ) } ); console.log( 'ms : ' + time + ' speed : ' + ( ( jsonString.length + ( opt_json2FileSize || 0 ) ) / time * 1000 ) + ' バイト/秒.' ); } }; +function X_Net_JSONP_reciveMessage( data ){ + console.log( data ); +}; + var X_NET_JSONP_ACCESS_KEY = Math.random(), + X_NET_JSONP_SEND_MSG_KEY = X_System.message( 'X.Net.JSONP', X_Net_JSONP_reciveMessage ), + X_NET_JSONP_NinjaIframe, X_Net_JSONP_onloadCount; + function X_NET_JSONP_loadScriptInNinjaIframe( url ){ var json2Path = 'js/libs/json2.js', @@ -51,8 +58,9 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ // TODO ' 化 恐らくアンチウイルスソフトが反応しないための対策 // TODO postMessage の利用 - - // numonLoad + // document.postMessage()→window.postMessage() (Opera 9.50 build 9841 -) + // http://d.hatena.ne.jp/cnrd/20080518/1211099169 + // 最近の仕様変更(引数のtargetOriginとかMessageEventのoriginとか)にはまだ対応してないみたい if( X_UA.Opera ){ html = [ @@ -60,7 +68,7 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ '', '', '' @@ -69,6 +77,9 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ } else if( X_UA.IE8 ){ html = [ + // JavaScriptでunicode文字列をunescapeする + // http://perutago.seesaa.net/article/202801583.html + // http://blog.livedoor.jp/dankogai/archives/51503830.html // Ajax - IE8にもJSON入ってます。使えるとは限らないけど // Compatibility mode (別名Quirks mode) では、JSONオブジェクトは無効になります。iframeもだめです @@ -76,7 +87,8 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ '' @@ -106,6 +118,7 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ '', '' ];