X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F06_net%2F02_XNetJSONP.js;h=69252c7d9217b5e10916d0cf86b441448d760344;hb=7911fddcbb190b99ad11412d283776ddbf77b479;hp=45cfec51048ebd332fcf0f4fb2bbded8c504a975;hpb=57e35f063b4a70fcec59db6ec7366b43f41f0ba4;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 45cfec5..69252c7 100644 --- a/0.6.x/js/06_net/02_XNetJSONP.js +++ b/0.6.x/js/06_net/02_XNetJSONP.js @@ -35,12 +35,19 @@ X.Net.JSONP = { } }; +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,6 +58,9 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ // TODO ' 化 恐らくアンチウイルスソフトが反応しないための対策 // TODO postMessage の利用 + // 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 = [ @@ -78,6 +88,7 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ 'onunload=function(){clearTimeout(id)};', 'nw=0;', // なぜか必要,,, 'function cb(o){nw-=+new Date;parent.X.Net.JSONP.cb(' + X_NET_JSONP_ACCESS_KEY + ',parent.JSON.stringify(o).replace(/\\\\u([a-fA-F0-9]{4})/g,function(a,b){return String.fromCharCode(parseInt(b,16))}),-nw)}', + //'function cb(o){if(nw){nw-=+new Date;postMessage("', X_NET_JSONP_SEND_MSG_KEY,' "+nw+"|"+parent.JSON.stringify(o).replace(/\\\\u([a-fA-F0-9]{4})/g,function(a,b){return String.fromCharCode(parseInt(b,16))}),"*");nw=0}}', 'function tm(){jp.src="', url ,'";nw=+new Date}', 'id=setTimeout(tm,16);', '' @@ -107,6 +118,7 @@ function X_NET_JSONP_loadScriptInNinjaIframe( url ){ '', '' ];