mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
RGL browser: add ability to search for module name
This commit is contained in:
@@ -158,7 +158,7 @@
|
||||
</header>
|
||||
|
||||
<footer id="footer">
|
||||
John J. Camilleri<br/><em>Updated 2013-07-23</em>
|
||||
John J. Camilleri<br/><em>Updated 2014-01-29</em>
|
||||
</footer>
|
||||
</div><!-- ui-layout-north -->
|
||||
|
||||
@@ -168,4 +168,4 @@
|
||||
</div><!-- ui-layout-west -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -216,6 +216,20 @@ function Thing() {
|
||||
}
|
||||
t.setLanguage("english");
|
||||
|
||||
// Module search box
|
||||
var module_search = $("<input>")
|
||||
.attr('id', 'module_search')
|
||||
.keyup(function(){
|
||||
t.searchModule($(this).val());
|
||||
})
|
||||
.appendTo("#languages");
|
||||
|
||||
$("<a>")
|
||||
.attr('href','#')
|
||||
.click(t.clearSearchModule)
|
||||
.html("Clear")
|
||||
.appendTo("#languages");
|
||||
|
||||
// Initialize API results
|
||||
t.initAPI();
|
||||
|
||||
@@ -251,6 +265,8 @@ function Thing() {
|
||||
t.state.current.set(lang, module);
|
||||
t.loadTagsFile(module);
|
||||
t.loadSourceFile(lang, module, lineNo);
|
||||
if ($('.tab.api').hasClass('active'))
|
||||
t.showPanel("#scope");
|
||||
}
|
||||
|
||||
// Load a tags file
|
||||
@@ -382,6 +398,35 @@ function Thing() {
|
||||
t.hideLoading();
|
||||
}
|
||||
|
||||
// ===== Module search =====
|
||||
|
||||
this.searchModule = function(s) {
|
||||
if (!s) {
|
||||
return t.clearSearchModule();
|
||||
}
|
||||
$('#language_select').hide();
|
||||
$("#modules").empty();
|
||||
for (var lang in t.state.index['languages']) {
|
||||
var modules = t.state.index['languages'][lang];
|
||||
for (var j in modules) {
|
||||
var module = modules[j];
|
||||
var full_module = lang+'/'+module;
|
||||
if (!module) continue;
|
||||
if (full_module.toLowerCase().indexOf(s.toLowerCase())==-1) continue;
|
||||
$('<a>')
|
||||
.html(full_module)
|
||||
.attr('href', "#"+lang+"/"+module+".gf")
|
||||
.appendTo("#modules");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.clearSearchModule = function() {
|
||||
$('#module_search').val('');
|
||||
$('#language_select').show();
|
||||
t.setLanguage(t.state.language);
|
||||
return false;
|
||||
};
|
||||
|
||||
// ===== Filtering of scope info =====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user