diff options
Diffstat (limited to 'src/www/gfse/cloud2.js')
| -rw-r--r-- | src/www/gfse/cloud2.js | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/www/gfse/cloud2.js b/src/www/gfse/cloud2.js index e32749dc1..71de22387 100644 --- a/src/www/gfse/cloud2.js +++ b/src/www/gfse/cloud2.js @@ -42,16 +42,28 @@ function upload(g) { // Upload the grammar to store it in the cloud function upload_json(cont) { - function upload3(resptext,status) { - local.put("json_uploaded",Date.now()); - //debug("Upload complete") - if(cont) cont(); - else { - var sharing=element("sharing"); - if(sharing) sharing.innerHTML=resptext; - } - } function upload2(dir) { + function upload3(resptext,status) { + local.put("json_uploaded",Date.now()); + //debug("Upload complete") + if(cont) cont(); + else { + var sharing=element("sharing"); + if(sharing) { + if(status==204) { + var a=empty("a"); + a.href="share.html#"+dir.substr(5) // skip "/tmp/" + a.innerHTML=a.href; + sharing.innerHTML=""; + sharing.appendChild(text("Use the following link for shared access to your grammars from multiple devices: ")) + sharing.appendChild(a) + } + else + sharing.innerHTML=resptext; + } + } + } + var prefix=dir.substr(10)+"-" // skip "/tmp/gfse." //debug("New form data"); //var form=new FormData(); // !!! Doesn't work on Android 2.2! |
