1
0
forked from GitHub/gf-core

translator: use a more robust test for localStorage support and show a warning if it is missing

This commit is contained in:
hallgren
2012-05-23 14:39:05 +00:00
parent f4c17cb7aa
commit 215ec25a41

View File

@@ -5,6 +5,10 @@
function Translator() {
this.local=tr_local();
this.view=element("document")
if(!supports_html5_storage()) {
var warning=span_class("error",text("It appears that localStorage is unsupported or disabled in this browser. Documents will not be preserved after you leave or reload this page!"))
insertAfter(warning,this.view)
}
this.current=this.local.get("current")
this.document=this.current && this.current!="/" && this.local.get("/"+this.current) || empty_document()
this.server=pgf_online({})
@@ -395,7 +399,7 @@ function tr_local() {
}
}
}
return window.localStorage ? real(localStorage) : real([])
return supports_html5_storage() ? real(localStorage) : real([])
}
// Collect alternative texts in the output from PGF service translate command