OSDN Git Service

IEでF12開発者ツールを開かないとうまく実行されない問題を修正。
authorhikarupsp <hikarupsp@users.sourceforge.jp>
Sun, 18 Aug 2013 12:28:57 +0000 (21:28 +0900)
committerhikarupsp <hikarupsp@users.sourceforge.jp>
Sun, 18 Aug 2013 12:28:57 +0000 (21:28 +0900)
ファイルの整理。
Mac Safari, Chrome
Win Chrome, IE
上記の環境で動作確認。

documents/classExample/index.html [moved from www/lab/index.html with 100% similarity]
documents/tips [new file with mode: 0644]
documents/tips.html [deleted file]
www/corelib/core.js
www/corelib/header.js
www/stage/login.js

diff --git a/documents/tips b/documents/tips
new file mode 100644 (file)
index 0000000..1ca14f7
--- /dev/null
@@ -0,0 +1,59 @@
+Tips
+
+<Javascript Tips>
+document.getElementById("main").style.display = "none";
+(mainというIDが振られている要素の表示を消す)
+this.effectSound.pause();
+this.effectSound.currentTime = 0;
+this.effectSound.play();
+this.backgroundImage = new Image();
+this.backgroundMusic = document.getElementById('BGM006');
+this.effectSound = document.getElementById('SE_Select');
+
+<画像読み込み>
+this.backgroundImage.manager = this;
+this.backgroundImage.onload = this.backgroundLoaded;
+this.backgroundImage.src = "title.gif";
+
+<音楽再生>
+this.backgroundMusic.loop = true;
+this.backgroundMusic.play();
+
+<IE>
+-MicrosoftInternetExplorerでは、ローカル変数でparentを使うとappendChildが使えなくなる…。
+-囲まれたブロックの後の末尾部分が実行されない???
+       loadStageFromNetwork: function(name){
+               //URL_PCD_Stage/name.jsを利用してステージを作成する。
+               request = this.networkManager.CreateRequestObject();
+               //同期モード
+               request.open('GET', URL_PCD_Stage + name + ".js", false);
+               this.networkManager.RequestObjectDisableCache(request);
+               request.send(null);
+               
+               if(request.status == 0){
+                       alert("ネットワークにアクセスできません。" + request.status + ":" + request.statusText);
+               }else if((200 <= request.status && request.status < 300) || (request.status == 304)){
+                       var stage = eval(request.responseText);
+                       mainManager.runStage(stage);
+               }else{
+                       alert("サーバーがエラーを返しました。" + request.status + ":" + request.statusText);
+               }
+               //なんで実行されないの????
+               alert("1564426");
+       },
+--以下のコードで解決できる。どこでも良いので実行させる。http://qiita.com/rev84/items/f7ca6a2af00daefa065c
+//IE fix
+if (!window.console){
+    window.console = {
+        log : function(msg){
+            // do nothing.
+        }
+    };
+}
+
+IEではXMLHTTPRequest.onreadystatechangeのthisの値が他と異なるようだ。
+なので、
+request.onreadystatechange = function(){
+       と無名関数で書いて、内部でrequestインスタンスを参照
+};
+しないとうまく動かない。
diff --git a/documents/tips.html b/documents/tips.html
deleted file mode 100644 (file)
index 8fa189a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-Tips
-
-<Javascript Tips>
-document.getElementById("main").style.display = "none";
-(mainというIDが振られている要素の表示を消す)
-this.effectSound.pause();
-this.effectSound.currentTime = 0;
-this.effectSound.play();
-this.backgroundImage = new Image();
-this.backgroundMusic = document.getElementById('BGM006');
-this.effectSound = document.getElementById('SE_Select');
-画像読み込み
-this.backgroundImage.manager = this;
-this.backgroundImage.onload = this.backgroundLoaded;
-this.backgroundImage.src = "title.gif";
-
-音楽再生
-this.backgroundMusic.loop = true;
-this.backgroundMusic.play();
-
-MicrosoftInternetExplorerでは、ローカル変数でparentを使うとappendChildが使えなくなる…。
-
-IEではXMLHTTPRequest.onreadystatechangeのthisの値が他と異なるようだ。
-なので、
-request.onreadystatechange = function(){
-       と無名関数で書いて、内部でrequestインスタンスを参照
-};
-しないとうまく動かない。
index e439eeb..bf721e3 100755 (executable)
@@ -26,9 +26,9 @@ mainManager = new GameManager();
 //定数
 //
 
-var URL_PCD_Root = "http://localhost/pcd2013dev/www/";
+//var URL_PCD_Root = "http://localhost/pcd2013dev/www/";
 //var URL_PCD_Root = "http://192.168.6.242/pcd2013dev/www/";
-//var URL_PCD_Root = "http://192.168.0.3/PCD2013GSCL/www/";
+var URL_PCD_Root = "http://192.168.0.3/PCD2013GSCL/www/";
 //var URL_PCD_Root = "http://192.168.6.242/pcd2013hikarupsp/pcd2013dev/www/";
 var URL_PCD_Auth = URL_PCD_Root + "auth.php";
 var URL_PCD_Audio = URL_PCD_Root + "audio/";
@@ -260,7 +260,6 @@ GameManager.prototype = {
                }
        },
        addWidghet: function(w){
-               w.attached();
                this.runningWidghets.push(w);
        },
        runStage: function(stage){
@@ -328,7 +327,7 @@ GameManager.prototype = {
                        
                }
                //runningStageに登録することで、イベントの通知が開始され、GameStageは実行状態に入る。
-               this.runningStage = stage;
+               mainManager.runningStage = stage;
        },
        pauseStage: function(func){
                //ステージの実行を一時停止する。一時停止中、funcに指定された関数が毎tick毎に呼ばれる
@@ -377,6 +376,7 @@ GameManager.prototype = {
                request.open('GET', URL_PCD_Stage + name + ".js", false);
                this.networkManager.RequestObjectDisableCache(request);
                request.send(null);
+               
                if(request.status == 0){
                        alert("ネットワークにアクセスできません。" + request.status + ":" + request.statusText);
                }else if((200 <= request.status && request.status < 300) || (request.status == 304)){
@@ -385,6 +385,8 @@ GameManager.prototype = {
                }else{
                        alert("サーバーがエラーを返しました。" + request.status + ":" + request.statusText);
                }
+               //なんでここ以下の文がIEでは実行されないの????
+               //
        },
        debugOut: function(str){
                if(this.isIE)
@@ -558,6 +560,12 @@ function createDOMObject(typestr, idstr, parentidstr)
        dobj.id = idstr;
        parentObj.appendChild(dobj);
        
+       for(;;){
+               if(document.getElementById(idstr)){
+                       break;
+               }
+       }
+       
        return dobj;
 }
 
index a9ed51b..7b9e6c9 100644 (file)
@@ -15,3 +15,11 @@ document.write("<script type='text/javascript' src='corelib/classes/MovableStage
 document.write("<script type='text/javascript' src='corelib/classes/CharacterClass.js'></script>");
 document.write("<script type='text/javascript' src='corelib/classes/OperatedCharacterClass.js'></script>");
 document.write("<script type='text/javascript' src='corelib/classes/MainCharacterClass.js'></script>");
+//IE fix
+if (!window.console){
+    window.console = {
+        log : function(msg){
+            // do nothing.
+        }
+    };
+}
index d6db2ed..177df86 100644 (file)
@@ -18,7 +18,6 @@ stage.runStage = function(){
        this.authform.innerHTML += "<input id='authSubmitButton' type='button' value='ログイン'>";
        this.authSubmitButton = document.getElementById("authSubmitButton");
        this.authSubmitButton.onclick = this.submitAuth;
-console.log("init");
 };
 stage.submitAuth = function(){
        request = mainManager.networkManager.CreateRequestObject();
@@ -62,7 +61,7 @@ stage.submitAuth = function(){
                alert("サーバーがエラーを返しました。");
                //console.log("NAK");
        }
-return false; //常に送信しない。
+       return false; //常に送信しない。
 };
 
 stage.stopStage = function(){