diff options
| author | hallgren <hallgren@chalmers.se> | 2013-04-23 12:39:18 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-04-23 12:39:18 +0000 |
| commit | bcf834671693592bfe68576b1f6d1f2a59feea46 (patch) | |
| tree | 86216ed69a961bd009d5f9b5084b6f807d247964 | |
| parent | aad274022a53b2d43ecdc6c46fcc401f755cb8ee (diff) | |
minibar: use the common interface to localStorage
...for more streamlined code and better browser compatibility.
| -rw-r--r-- | src/www/minibar/minibar.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/www/minibar/minibar.js b/src/www/minibar/minibar.js index 4ce866867..fa572cfa8 100644 --- a/src/www/minibar/minibar.js +++ b/src/www/minibar/minibar.js @@ -40,6 +40,9 @@ function Minibar(server,opts) { this.server=server; if(opts) for(var o in opts) this.options[o]=opts[o]; + // LocalStorage + this.local=appLocalStorage("gf.minibar.") + /* --- Syntax editor integration ---------------------------------------- */ if(!this.options.abstract_action) this.integrate_syntax_editor() @@ -159,8 +162,7 @@ Minibar.prototype.show_grammarlist=function(dir,grammar_names,dir_count) { appendChildren(grammar_menu,map(opt,grammar_names)); function pick() { var grammar_url=grammar_menu.value - if(window.localStorage) - localStorage["gf.minibar.last_grammar"]=grammar_url; + local.put("last_grammar",grammar_url) t.select_grammar(grammar_url); } function pick_first_grammar() { @@ -172,8 +174,8 @@ Minibar.prototype.show_grammarlist=function(dir,grammar_names,dir_count) { insertFirst(t.menubar,text("Grammar: ")); } var grammar0=t.options.initial_grammar - if(!grammar0 && window.localStorage) { - var last_grammar=localStorage["gf.minibar.last_grammar"]; + if(!grammar0) { + var last_grammar=local.get("last_grammar"); if(last_grammar && elem(last_grammar,t.grammars)) grammar0=last_grammar; } |
