1
0
forked from GitHub/gf-core

minibar: add a button to show some grammar info

This commit is contained in:
hallgren
2011-10-18 14:34:00 +00:00
parent 99795c3035
commit 3b428fc5ba
2 changed files with 16 additions and 0 deletions

View File

@@ -75,6 +75,7 @@ Minibar.prototype.show_grammarlist=function(grammars) {
appendChildren(grammar_menu,map(opt,grammars));
grammar_menu.onchange=
bind(function() { select_grammar(grammar_menu.value); },this);
insertFirst(menubar,button("i",bind(show_grammarinfo,this)))
insertFirst(menubar,grammar_menu);
insertFirst(menubar,text("Grammar: "));
}
@@ -104,6 +105,20 @@ Minibar.prototype.change_grammar=function(grammar_info) {
}
}
Minibar.prototype.show_grammarinfo=function() {
this.translations.main.innerHTML=""
var g=this.grammar;
appendChildren(this.translations.main,
[wrap("h3",text(g.name)),
node("dl",{},
[dt(text("Start category")),
dd(text(g.startcat || "")),
dt(text("Categories")),
dd(text(g.categories.join(", "))),
dt(text("Functions")),
dd(text(g.functions.join(", ")))])])
}
Minibar.prototype.append_extra_buttons=function(extra,options) {
with(this) {
if(options.try_google)

View File

@@ -157,6 +157,7 @@ function div_class(cls,contents) { return wrap_class("div",cls,contents); }
function p(contents) { return wrap("p",contents); }
function dt(contents) { return wrap("dt",contents); }
function dd(contents) { return wrap("dd",contents); }
function li(contents) { return wrap("li",contents); }
function th(contents) { return wrap("th",contents); }