OSDN Git Service

mbed.htmlのIE10対応
authornyatla <nyatla@47198e57-cb75-475f-84c4-a814cd6f29e0>
Tue, 9 Jul 2013 12:03:02 +0000 (12:03 +0000)
committernyatla <nyatla@47198e57-cb75-475f-84c4-a814cd6f29e0>
Tue, 9 Jul 2013 12:03:02 +0000 (12:03 +0000)
git-svn-id: http://svn.osdn.jp/svnroot/mimic/trunk@276 47198e57-cb75-475f-84c4-a814cd6f29e0

misc/MiMicVM/api.js/MiMicCore-mini.js
misc/MiMicVM/api.js/MiMicCore.js
misc/Win32Dev/Win32Dev.sln
misc/html.mbed/MiMicILEditor.html
misc/html.mbed/MiMicJSEditor.html
misc/html.mbed/dir.html
misc/html.mbed/index.html
misc/html.mbed/memDump.html
misc/html.mbed/setup.html
misc/html.mbed/slib.js

index 5995938..6b7aded 100644 (file)
@@ -1 +1 @@
-var MiMicLib={VERSION:"MiMicJsAPI/1.0.3",getNow:function getNow(){return(new Date()).getTime()},isUndef:function isUndef(b){return typeof b==="undefined"},isArray:function isArray(b){return b instanceof Array},cloneAssoc:function cloneAssoc(b){var d={};for(var c in b){d[c]=b[c]}return d},hexout:function hexout(b,c){try{var f=["","0","00","000","0000","00000","000000","0000000"];var d=(b>>>0).toString(16).toLowerCase();if(d.length>c){throw new MiMicException(EE.NG)}var a=c-d.length;return f[a]+d}catch(g){throw new MiMicException(g)}},assocToStr:function assocToStr(b){var c="";for(k in b){c+=k+":"+b[k]+","}return c}};var MiMicError={OK:[0,"OK"],NG:[1073741824,"NG"],isOK:function(a){return(1073741824&a)==0},MID_MiMic:3735552,CAID_RemoteMCU:256,CAID_LPCXPresso1769:512};function MiMicException(){var d;if(typeof arguments.callee.caller=="function"){if(arguments.callee.caller.name.toString().length>0){d="function '"+arguments.callee.caller.name+"."}else{var b=arguments.callee.caller.toString();d="closure '"+b.substring(0,b.indexOf("{"))+"...'"}}else{d="root document"}var c="";switch(arguments.length){case 0:this.code=MiMicError.NG[0];this.message=d+" code(0x"+this.code.toString(16)+")"+MiMicError.NG[1];return;case 1:var a=arguments[0];if(a instanceof MiMicException){this.code=a.code;c="  \nfrom "+a.message}else{if(typeof a=="object"&&a.length==2){this.code=a[0];c=a[1]}else{this.code=MiMicError.NG[0];c=MiMicError.NG[1]+" "+(((typeof a)!="undefined")?a.toString():"v==undefined")}}this.message=d+" code(0x"+this.code.toString(16)+")"+c;return;case 2:var a=arguments[0];if(a instanceof MiMicException){this.code=a.code;this.message=d+" code(0x"+this.code.toString(16)+")\nfrom "+a.message+":"+arguments[1];return}else{if(typeof a!="string"&&a.length==2){this.code=a[0];this.message=d+" code(0x"+this.code.toString(16)+")"+a[1]+":"+arguments[1]}else{break}}return;default:break}throw new MiMicException("Invalid MiMicException argument.")}MiMicException.prototype={code:MiMicError.OK,message:"",alert:function(){alert(this.message)},toString:function(){return"MiMicException:"+this.message}};var MiMicRemoteMcuInterface;(function(){var EE=function(i_base){return{NG:[i_base|0,"Unknown exception in MiMicRemoteMcuInterface"],TCP_CONNECT:[i_base|1,"TCP CONNECT FAILED"],HTTP:[i_base|2,"HTTP FAILED"]}}(MiMicError.NG[0]|MiMicError.MID_MiMic|MiMicError.CAID_RemoteMCU);MiMicRemoteMcuInterface=function MiMicRemoteMcuInterface(i_path){this._mimic_path=i_path+((i_path.indexOf("/")==-1)?"/mvm/":"")};MiMicRemoteMcuInterface.prototype={_mimic_path:null,_keep_alive:null,_last_xhr_res_time:0,_xhrGet:function(i_url,i_async,i_callback){var xhr=window.XDomainRequest?new XDomainRequest():new XMLHttpRequest();var prog=0;try{if(i_async){xhr.onreadystatechange=function(){if(xhr.readyState==4){this._last_xhr_res_time=MiMicLib.getNow();i_callback(xhr)}}}xhr.open("GET",i_url,i_async);prog=1;xhr.send(null);if(!i_async){this._last_xhr_res_time=MiMicLib.getNow()}prog=2}catch(e){throw new MiMicException(function(){switch(prog){case 1:return EE.HTTP}return EE.TCP_CONNECT}(),"url="+i_url)}return xhr},_isOnline_parseResponse:function(res){function isok(i_s){function parse_version_tag(i_v){var t=i_v.split("/");var n=t[1].split(".");return{name:t[0],major:parseInt(n[0]),minor:parseInt(n[1])}}try{var l=i_s.split(";");var rmcu=parse_version_tag(l[0]);var mcut=l[1];return((rmcu.name=="ModRemoteMcu")&&(rmcu.major==1)&&(rmcu.minor>=0))}catch(e){throw MiMicException(e)}}try{if(res.status!=200){return false}var ret=eval("("+res.responseText+")");if(!isok(ret.application)){return false}}catch(e){return false}return true},_parseMvmResult:function(i_mvmresult){function isok(i_s){var l=i_s.split(";");return((l[0].indexOf("ModRemoteMcu/1.")==0)&&(l[1]=="Json/1.0"))}var ret=eval("("+i_mvmresult+")");if(isok(ret.version)){if(ret.result!=undefined){if(ret.result!=0||ret.stream!=undefined){return ret}}}throw new MiMicException(EE.NG,"Invalid json version:'"+ret.version+"'")},isConnected:function isConnected(){return this._keep_alive!=null},execBc:function execBc(i_bc){try{if(this._keep_alive==null){throw new MiMicException(EE.NG,"disconnected")}var res=this._xhrGet("http://"+this._mimic_path+"mvm.api?v=1&bc="+i_bc,false);if(res.status!=200){throw new MiMicException(EE.HTTP,"i_bc="+i_bc+",XHR.status="+res.status)}return this._parseMvmResult(res.responseText,false)}catch(e){throw new MiMicException(e)}},connect:function connect(i_callback){try{var _t=this;if(this._keep_alive!=null){return}function xhrStatus(i_is_async,i_cb){try{return _t._xhrGet("http://"+_t._mimic_path+"status.api",i_is_async,i_cb)}catch(e){return null}}function intervalProc(){var now=MiMicLib.getNow();var lt=now-_t._last_xhr_res_time;if(lt<3000){return}var res=xhrStatus(false,null);if((res==null)||(!_t._isOnline_parseResponse(res))){if(_t._keep_alive!=null){clearInterval(_t._keep_alive.tid);_t._keep_alive=null;i_callback(false);return}}i_callback(true)}var res=xhrStatus(false,null);if((res==null)||(!_t._isOnline_parseResponse(res))){throw new MiMicException("Bad response from "+this._mimic_path)}this._keep_alive={tid:setInterval(intervalProc,500)}}catch(e){throw new MiMicException(e)}return},disconnect:function disconnect(){try{if(this._keep_alive!=null){clearInterval(this._keep_alive.tid);this._keep_alive=null}}catch(e){throw new MiMicException(e)}}}}());
\ No newline at end of file
+var MiMicLib={VERSION:"MiMicJsAPI/1.0.4",getNow:function getNow(){return(new Date()).getTime()},isUndef:function isUndef(b){return typeof b==="undefined"},isArray:function isArray(b){return b instanceof Array},cloneAssoc:function cloneAssoc(b){var d={};for(var c in b){d[c]=b[c]}return d},hexout:function hexout(b,c){try{var f=["","0","00","000","0000","00000","000000","0000000"];var d=(b>>>0).toString(16).toLowerCase();if(d.length>c){throw new MiMicException(EE.NG)}var a=c-d.length;return f[a]+d}catch(g){throw new MiMicException(g)}},assocToStr:function assocToStr(b){var c="";for(k in b){c+=k+":"+b[k]+","}return c}};var MiMicError={OK:[0,"OK"],NG:[1073741824,"NG"],isOK:function(a){return(1073741824&a)==0},MID_MiMic:3735552,CAID_RemoteMCU:256,CAID_LPCXPresso1769:512};function MiMicException(){var d;if(typeof arguments.callee.caller=="function"){if(arguments.callee.caller.name.toString().length>0){d="function '"+arguments.callee.caller.name+"."}else{var b=arguments.callee.caller.toString();d="closure '"+b.substring(0,b.indexOf("{"))+"...'"}}else{d="root document"}var c="";switch(arguments.length){case 0:this.code=MiMicError.NG[0];this.message=d+" code(0x"+this.code.toString(16)+")"+MiMicError.NG[1];return;case 1:var a=arguments[0];if(a instanceof MiMicException){this.code=a.code;c="  \nfrom "+a.message}else{if(typeof a=="object"&&a.length==2){this.code=a[0];c=a[1]}else{this.code=MiMicError.NG[0];c=MiMicError.NG[1]+" "+(((typeof a)!="undefined")?a.toString():"v==undefined")}}this.message=d+" code(0x"+this.code.toString(16)+")"+c;return;case 2:var a=arguments[0];if(a instanceof MiMicException){this.code=a.code;this.message=d+" code(0x"+this.code.toString(16)+")\nfrom "+a.message+":"+arguments[1];return}else{if(typeof a!="string"&&a.length==2){this.code=a[0];this.message=d+" code(0x"+this.code.toString(16)+")"+a[1]+":"+arguments[1]}else{break}}return;default:break}throw new MiMicException("Invalid MiMicException argument.")}MiMicException.prototype={code:MiMicError.OK,message:"",alert:function(){alert(this.message)},toString:function(){return"MiMicException:"+this.message}};var MiMicRemoteMcuInterface;(function(){var EE=function(i_base){return{NG:[i_base|0,"Unknown exception in MiMicRemoteMcuInterface"],TCP_CONNECT:[i_base|1,"TCP CONNECT FAILED"],HTTP:[i_base|2,"HTTP FAILED"]}}(MiMicError.NG[0]|MiMicError.MID_MiMic|MiMicError.CAID_RemoteMCU);MiMicRemoteMcuInterface=function MiMicRemoteMcuInterface(i_path){this._mimic_path=i_path+((i_path.indexOf("/")==-1)?"/mvm/":"")};MiMicRemoteMcuInterface.prototype={_mimic_path:null,_keep_alive:null,_last_xhr_res_time:0,_xhrGet:function(i_url,i_async,i_callback){var xhr=XMLHttpRequest?new XMLHttpRequest():new XDomainRequest();var prog=0;try{if(i_async){xhr.onreadystatechange=function(){if(xhr.readyState==4){this._last_xhr_res_time=MiMicLib.getNow();i_callback(xhr)}}}xhr.open("GET",i_url,i_async);prog=1;xhr.send(null);if(!i_async){this._last_xhr_res_time=MiMicLib.getNow()}prog=2}catch(e){throw new MiMicException(function(){switch(prog){case 1:return EE.HTTP}return EE.TCP_CONNECT}(),"url="+i_url)}return xhr},_isOnline_parseResponse:function(res){function isok(i_s){function parse_version_tag(i_v){var t=i_v.split("/");var n=t[1].split(".");return{name:t[0],major:parseInt(n[0]),minor:parseInt(n[1])}}try{var l=i_s.split(";");var rmcu=parse_version_tag(l[0]);var mcut=l[1];return((rmcu.name=="ModRemoteMcu")&&(rmcu.major==1)&&(rmcu.minor>=0))}catch(e){throw MiMicException(e)}}try{if(res.status!=200){return false}var ret=eval("("+res.responseText+")");if(!isok(ret.application)){return false}}catch(e){return false}return true},_parseMvmResult:function(i_mvmresult){function isok(i_s){var l=i_s.split(";");return((l[0].indexOf("ModRemoteMcu/1.")==0)&&(l[1]=="Json/1.0"))}var ret=eval("("+i_mvmresult+")");if(isok(ret.version)){if(ret.result!=undefined){if(ret.result!=0||ret.stream!=undefined){return ret}}}throw new MiMicException(EE.NG,"Invalid json version:'"+ret.version+"'")},isConnected:function isConnected(){return this._keep_alive!=null},execBc:function execBc(i_bc){try{if(this._keep_alive==null){throw new MiMicException(EE.NG,"disconnected")}var res=this._xhrGet("http://"+this._mimic_path+"mvm.api?v=1&bc="+i_bc,false);if(res.status!=200){throw new MiMicException(EE.HTTP,"i_bc="+i_bc+",XHR.status="+res.status)}return this._parseMvmResult(res.responseText,false)}catch(e){throw new MiMicException(e)}},connect:function connect(i_callback){try{var _t=this;if(this._keep_alive!=null){return}function xhrStatus(i_is_async,i_cb){try{return _t._xhrGet("http://"+_t._mimic_path+"status.api",i_is_async,i_cb)}catch(e){return null}}function intervalProc(){var now=MiMicLib.getNow();var lt=now-_t._last_xhr_res_time;if(lt<3000){return}var res=xhrStatus(false,null);if((res==null)||(!_t._isOnline_parseResponse(res))){if(_t._keep_alive!=null){clearInterval(_t._keep_alive.tid);_t._keep_alive=null;i_callback(false);return}}i_callback(true)}var res=xhrStatus(false,null);if((res==null)||(!_t._isOnline_parseResponse(res))){throw new MiMicException("Bad response from "+this._mimic_path)}this._keep_alive={tid:setInterval(intervalProc,500)}}catch(e){throw new MiMicException(e)}return},disconnect:function disconnect(){try{if(this._keep_alive!=null){clearInterval(this._keep_alive.tid);this._keep_alive=null}}catch(e){throw new MiMicException(e)}}}}());
\ No newline at end of file
index 8546776..4e8964f 100644 (file)
@@ -11,7 +11,7 @@ var MiMicLib=
        /**\r
         * MiMicJsAPIのバージョン文字列。\r
         */\r
-       VERSION:"MiMicJsAPI/1.0.3",\r
+       VERSION:"MiMicJsAPI/1.0.4",\r
        /**\r
         * 現在の時刻を返す\r
         * @returns\r
@@ -349,7 +349,7 @@ var MiMicRemoteMcuInterface;
                 */\r
                _xhrGet:function(i_url,i_async,i_callback)\r
                {\r
-                   var xhr = window.XDomainRequest ? new XDomainRequest() : new XMLHttpRequest();\r
+                   var xhr = XMLHttpRequest ? new XMLHttpRequest() : new XDomainRequest();\r
                    var prog=0;\r
                    try{\r
                        if(i_async){\r
index f7bb1b2..b76e903 100644 (file)
@@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ParcialTest", "ParcialTest\
 EndProject\r
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mDNSTest", "mDNSTest\mDNSTest\mDNSTest.csproj", "{EDED33CE-D46B-41B1-97DF-5167237A7943}"\r
 EndProject\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HTTPTest", "HTTPTest\HTTPTest.csproj", "{2A9DB566-AFCC-4E50-AFEB-16A2C786C658}"\r
+EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug|Any CPU = Debug|Any CPU\r
@@ -59,6 +61,16 @@ Global
                {EDED33CE-D46B-41B1-97DF-5167237A7943}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\r
                {EDED33CE-D46B-41B1-97DF-5167237A7943}.Release|Mixed Platforms.Build.0 = Release|Any CPU\r
                {EDED33CE-D46B-41B1-97DF-5167237A7943}.Release|Win32.ActiveCfg = Release|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Debug|Win32.ActiveCfg = Debug|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Release|Any CPU.Build.0 = Release|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Release|Mixed Platforms.Build.0 = Release|Any CPU\r
+               {2A9DB566-AFCC-4E50-AFEB-16A2C786C658}.Release|Win32.ActiveCfg = Release|Any CPU\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r
index 28183d7..a92bfb9 100644 (file)
@@ -313,8 +313,9 @@ if (window.addEventListener){
 </script>\r
 </head>\r
 <body onload="init();">\r
-<h1>MiMicIL Editor</h1>\r
-<hr/>\r
+<h1 id="idx" style="float:left;">MiMicIL Editor</h1>\r
+<div style="float:right;" ><a href="/">Return to top</a></div>\r
+<hr  style="clear:both;" />\r
 <div id="menu2">\r
        <button id="menu2_asm"/>Build</button><button id="menu2_run" />Play</button><button id="menu2_save"/>Save</button>\r
 <div id="connect_menu" style="float:right">\r
@@ -334,3 +335,4 @@ if (window.addEventListener){
        MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.\r
 </div>\r
 </body>\r
+</html>\r
index da249ac..abc5f7c 100644 (file)
@@ -47,7 +47,7 @@
                font-size:12px;\r
                padding:0px;\r
        }\r
-       #menu2_stop,#menu2_run,#menu2_save{\r
+       #menu2_stop,#menu2_run,#menu2_expt,#menu2_save{\r
                width:50px;height:40px;\r
        }\r
        .tagp{\r
@@ -141,7 +141,8 @@ Mui.Command=function(id)
        this._tags={\r
                run:getElem(id+"_run"),\r
                stop:getElem(id+"_stop"),\r
-               save:getElem(id+"_save")\r
+               save:getElem(id+"_save"),\r
+               expt:getElem(id+"_expt")\r
        }\r
        this.events={\r
                onCommand:null\r
@@ -156,7 +157,8 @@ Mui.Command=function(id)
        this._tags.stop.disabled=true;\r
        this.CM_RUN=1;\r
        this.CM_STOP=2;\r
-       this.CM_SAVE=3;\r
+       this.CM_EXPT=3;\r
+       this.CM_SAVE=4;\r
        this._tags.run.onclick=function(){\r
                _t._tags.run.disabled=true;\r
                _t._tags.stop.disabled=false;\r
@@ -168,7 +170,13 @@ Mui.Command=function(id)
                _t._tags.stop.disabled=true;\r
                _t._onCommand(_t.CM_STOP);\r
        };\r
-       this._tags.save.onclick=function(){_t._onCommand(_t.CM_SAVE);};\r
+       this._tags.save.onclick=function()\r
+       {\r
+               _t._tags.run.disabled=false;\r
+               _t._tags.stop.disabled=true;\r
+               _t._onCommand(_t.CM_SAVE);\r
+       };\r
+       this._tags.expt.onclick=function(){_t._onCommand(_t.CM_EXPT);};\r
 }\r
 \r
 Mui.Preview=function(id)\r
@@ -198,8 +206,6 @@ Mui.Preview=function(id)
        }\r
 }\r
 \r
-\r
-\r
 function Application()\r
 {\r
        //initialization\r
@@ -208,6 +214,8 @@ function Application()
                cmd:new Mui.Command("menu2"),\r
                preview:new Mui.Preview("preview")\r
        }\r
+       var fname=null;//file name\r
+\r
        this.ui=ui;\r
        var mif=null;\r
        ui.cmd.events.onCommand=function(id)\r
@@ -221,14 +229,30 @@ function Application()
                        ui.preview.updatePreview(ui.source.getText());\r
                        ui.source.readOnly(false);\r
                        return;\r
-               case ui.cmd.CM_SAVE:\r
+               case ui.cmd.CM_EXPT:\r
                        slib.downloadAsFile("miapp.htm",ui.source.getText());\r
                        ui.source.selectall();\r
                        return;\r
+               case ui.cmd.CM_SAVE:\r
+                       var n=window.prompt("Input local file path.",fname==null?"/local/noname.htm":fname);\r
+                       if(n!=null){\r
+                               try{\r
+                                       if(slib.xhr("/fio/upload.api?name="+n,null,"POST",ui.source.getText()).status!=200){\r
+                                               throw "Bad XHR fio status code.";\r
+                                       }\r
+                               }catch(e){\r
+                                       alert("Failed to save the file.\n"+e);\r
+                               }\r
+                               fname=n;\r
+                       }\r
+                       return;\r
                default:\r
                        alert("unknown command id");\r
                }\r
        }\r
+\r
+\r
+       \r
        //preload\r
        {\r
                var q=slib.getUrlQuery(location.href);\r
@@ -240,6 +264,7 @@ function Application()
                                        throw new String("Can not load contet:"+s);\r
                                }\r
                                ui.source.setText(r.responseText);\r
+                               fname=r;\r
                        }catch(e){\r
                                alert("Load failed:\n"+e);\r
                        }\r
@@ -275,10 +300,11 @@ function init()
 </script>\r
 </head>\r
 <body onload="init();">\r
-<h1>MiMic Javascript Editor</h1>\r
-<hr/>\r
+<h1 id="idx" style="float:left;">MiMic Javascript Editor</h1>\r
+<div style="float:right;" ><a href="/">Return to top</a></div>\r
+<hr  style="clear:both;" />\r
 <div id="menu2">\r
-       <button id="menu2_run"/>Play</button><button id="menu2_stop" />Stop</button><button id="menu2_save"/>Save</button>\r
+       <button id="menu2_run"/>Play</button><button id="menu2_stop" />Stop</button><button id="menu2_save"/>Save</button><button id="menu2_expt"/>Export</button>\r
 </div>\r
 <div class="tagp" style="width:60%;position:relative;">\r
        <div class="tag" id="src_tag">Source code</div>\r
@@ -312,9 +338,9 @@ function start()
        <div class="tag">Preview</div>\r
        <div id="preview"></div>\r
 </div>\r
-\r
 <div class="footer" style="clear:both">\r
        <a href="http://nyatla.jp/mimic/wp" alt="http://nyatla.jp/mimic/wp"><img src="/rom/mimiclogo.png"/></a>\r
        MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.\r
 </div>\r
 </body>\r
+</html>\r
index c89fecb..1986742 100644 (file)
        th{\r
                padding:5px 5px 10px 10px;\r
        }\r
+       td>a,td>span{\r
+               margin-right:10px;\r
+       }\r
+       .hide{\r
+               color:#aaaaaa;\r
+       }\r
        </style>\r
        <script langurge="Javascript">\r
 function gElem(id){return document.getElementById(id);}\r
@@ -34,6 +40,27 @@ function newElem(n){return document.createElement(n);}
                }\r
                return ret;\r
        }\r
+       function confirm_remove(n)\r
+       {\r
+               if(window.confirm('Are you sure you want to delete the file?\n'+n)){\r
+                       try{\r
+                               if(slib.xhr("/fio/remove.api?name="+n,null).status!=200){\r
+                                       throw "Bad XHR fio status code.";\r
+                               }\r
+                               window.location.reload();\r
+                       }catch(e){\r
+                               alert("Failed to save the file.\n"+e);\r
+                       }\r
+               }\r
+       }\r
+       function action_line(dir,di)\r
+       {\r
+               var r="";\r
+               var f=(di.mtype.indexOf("text/html")!=-1);\r
+               r+=f?"<a href='./MiMicJSEditor.html?src="+dir+di.name+"'>edit</a>":"<span class='hide'>edit</span>";\r
+               r+="<a href='javascript:void(0);' onclick='confirm_remove(\""+dir+di.name+"\");return false;'>remove</a>";\r
+               return r;\r
+       }\r
        function init()\r
        {\r
                var dir=slib.getUrlQuery(window.location.href)["dir"];\r
@@ -58,7 +85,7 @@ function newElem(n){return document.createElement(n);}
                                        row+='<tr><td><a href="'+path+'?dir='+dir+di.name+'/">./'+di.name+'</a></td><td>'+di.mtype+'</td><td></td></tr>';\r
                                }else{\r
                                        row+='<tr><td><a href="'+dir+di.name+'">'+di.name+'</a></td><td>'+di.mtype+'</td><td>'+(isFinite(di.size)?di.size:"unknown")+'</td>'\r
-                                       +'<td>'+((di.mtype.indexOf("text/html")!=-1)?'<a href="./MiMicJSEditor.html?src='+dir+di.name+'">JsEditor</a>':"")+'</td>'\r
+                                       +'<td>'+action_line(dir,di)+'</td>'\r
                                        +'</tr>';\r
                                }\r
                        }\r
@@ -68,8 +95,9 @@ function newElem(n){return document.createElement(n);}
        </script>\r
 </head>\r
 <body onload="init();">\r
-<h1 id="idx"></h1>\r
-<hr/>\r
+<h1 id="idx" style="float:left;"></h1>\r
+<div style="float:right;" ><a href="/">Return to top</a></div>\r
+<hr  style="clear:both;" />\r
 <table><tbody id="tbl">\r
 <tr><th>Name</th><th>MIME Type</th><th>File size</th></tr>\r
 </tbody></table>\r
@@ -80,3 +108,4 @@ function newElem(n){return document.createElement(n);}
        Copyright (C) 2011-2013 <a href="http://nyatla.jp/">nyatla.jp</a> All Rights Reserved.\r
 </div>\r
 </body>\r
+</html>\r
index 99e1c54..3b61c4c 100644 (file)
@@ -59,3 +59,4 @@ Software modules and development tool.
        Copyright (C) 2011-2013 <a href="http://nyatla.jp/">nyatla.jp</a> All Rights Reserved.\r
 </div>\r
 </body>\r
+</html>\r
index b751bc8..cba3c07 100644 (file)
@@ -248,8 +248,9 @@ function init()
 </script>\r
 </head>\r
 <body onload="init();">\r
-<h1>MemoryDump</h1>\r
-<hr/>\r
+<h1 id="idx" style="float:left;">MemoryDump</h1>\r
+<div style="float:right;" ><a href="/">Return to top</a></div>\r
+<hr  style="clear:both;" />\r
 <div id="menu2">\r
        <button id="menu2_dump" style="float:left"/>Dump</button>\r
        <table class="table" style="float:left">\r
@@ -271,4 +272,4 @@ function init()
        MiMic project<br/>Copyright (C) 2011-2013 <a href="http://nyatla.jp">nyatla.jp</a> All Rights Reserved.\r
 </div>\r
 </body>\r
-\r
+</html>\r
index 242e67e..004b3c7 100644 (file)
@@ -312,8 +312,9 @@ function init()
 </script>\r
 </head>\r
 <body onload="init();">\r
-<h1>MiMic RemoteMCU configuration </h1>\r
-<hr/>\r
+<h1 id="idx" style="float:left;">MiMic RemoteMCU configuration </h1>\r
+<div style="float:right;" ><a href="/">Return to top</a></div>\r
+<hr  style="clear:both;" />\r
        <h2>Current configuration</h2>\r
        <table class="table1 ">\r
                <colgroup><col span="1" class="col1" /></colgroup>\r
@@ -370,3 +371,4 @@ MiMic<br/>
 Copyright (C) 2011-2013 nyatla.jp All Rights Reserved.\r
 </div>\r
 </body>\r
+</html>\r
index 84d047e..8c0b563 100644 (file)
@@ -47,18 +47,25 @@ slib={
        }\r
        },\r
        strtrim:function(s){return s.replace(/^\s+|\s+$/g, "")},\r
-       xhr:function(i_url,i_cb)\r
+       xhr:function(i_url,i_cb,i_method,i_data)\r
        {\r
-               var x = window.XDomainRequest ? new XDomainRequest() : new XMLHttpRequest();\r
+               var x = XMLHttpRequest ?  new XMLHttpRequest():new XDomainRequest();\r
        if(i_cb!=undefined){\r
                x.onreadystatechange = function(){\r
                                if (x.readyState == 4){\r
                                        i_cb(x);\r
                                }\r
                        }\r
+       }else{\r
+               x.onreadystatechange = function(){};\r
+       }\r
+        x.open(i_method==undefined?"GET":i_method,i_url,false);\r
+       try{\r
+               x.setRequestHeader('Content-Type',"text/plain");\r
+       }catch(e){\r
+               alert(e);\r
        }\r
-        x.open("GET",i_url,false);\r
-        x.send(null);  \r
+        x.send(i_data==undefined?null:i_data);\r
            return x;\r
        }\r
 }\r