From 44d1a5a9f71b03d9aceeccd760a63fcdc45f8bad Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 12 Oct 2011 17:03:54 +0000 Subject: Improvements of "gf -server" mode and related setup "gf -server" mode now contains everything needed to run the minibar and the grammar editor (including example-based grammar writing). The Setup.hs script installs the required files where gf -server can find them. These files have been moved to a new directory: src/www. The separate server program pgf-http is now obsolete. --- src/www/gfse/localstorage.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/www/gfse/localstorage.js (limited to 'src/www/gfse/localstorage.js') diff --git a/src/www/gfse/localstorage.js b/src/www/gfse/localstorage.js new file mode 100644 index 000000000..31201998c --- /dev/null +++ b/src/www/gfse/localstorage.js @@ -0,0 +1,21 @@ + +// We use localStorage to store the grammars, +// see http://diveintohtml5.org/storage.html + +var local={ + prefix:"gf.editor.simple.grammar", + get: function (name,def) { + var id=this.prefix+name + return localStorage[id] ? JSON.parse(localStorage[id]) : def; + }, + put: function (name,value) { + var id=this.prefix+name; + localStorage[id]=JSON.stringify(value); + }, + remove: function(name) { + var id=this.prefix+name; + localStorage.removeItem(id); + }, + get count() { return this.get("count",0); }, + set count(v) { this.put("count",v); } +} -- cgit v1.2.3