mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-11 13:59:31 -06:00
Minibar: support for links to open a given grammar in the minibar
When you press the "i" or "More info" button for a grammar, the info now includes a link that can be used by anyone to open this specific grammar in the minibar.
This commit is contained in:
@@ -220,7 +220,7 @@ Minibar.prototype.get_pgf_info=function() {
|
||||
Minibar.prototype.show_pgf_info=function(info) {
|
||||
var t=this;
|
||||
var cnt=0;
|
||||
console.log(info)
|
||||
//console.log(info)
|
||||
info=info.split("\n");
|
||||
for(var i=0;i<info.length;i++) {
|
||||
if(info[i]=="") info[i]="<p>"
|
||||
@@ -270,6 +270,12 @@ Minibar.prototype.show_grammarinfo=function() {
|
||||
|
||||
var info=empty("div")
|
||||
if(t.pgf_info) info.innerHTML=t.pgf_info
|
||||
if(true || /^\/(tmp|grammars)\//.test(server.grammars_url)) {
|
||||
var q="?"+server.grammars_url+" "+server.current_grammar_url
|
||||
var link=node("a",{href:q})
|
||||
link.appendChild(text(link.href));
|
||||
info.appendChild(wrap("p",[text("Link directly to this grammar: "),link]))
|
||||
}
|
||||
|
||||
clear(t.translations.main)
|
||||
var hdr=[text(g.name)]
|
||||
|
||||
@@ -21,7 +21,7 @@ var minibar_options= {
|
||||
try_google: true
|
||||
}
|
||||
|
||||
if(/^\?\/tmp\//.test(location.search)) {
|
||||
if(/^\?\/(tmp|grammars)\//.test(location.search)) {
|
||||
var args=decodeURIComponent(location.search.substr(1)).split(" ")
|
||||
if(args[0]) online_options.grammars_url=args[0];
|
||||
if(args[1]) minibar_options.initial_grammar=args[1];
|
||||
|
||||
Reference in New Issue
Block a user