1
0
forked from GitHub/gf-core

RGL browser: bug in "show local". better screen-space usage.

This commit is contained in:
john.j.camilleri
2012-05-15 14:03:41 +00:00
parent ab28a26db5
commit 0ed07b14bb
3 changed files with 41 additions and 25 deletions

View File

@@ -13,7 +13,6 @@
<body>
<header>
<h1>GF RGL Browser</h1>
<p style="font-style:italic;margin-top:-0.5em;">Updated 2012-05-15</p>
</header>
<div role="main">
<div class="pane left">
@@ -72,21 +71,21 @@
</dl>
<h3>About</h3>
<p>A basic tool for looking up module scopes and quickly looking at module sources, created out of necessity. It is experimental and has only been tested on the latest Chrome under Ubuntu. Even then, the page sometimes crashes and has to be closed. All feedback is welcome.</p>
<p>A basic tool for looking up module scopes and quickly looking at module sources, created out of necessity. It is experimental and is known to hang when handling large files. All feedback is welcome.</p>
<h3>Known issues and To-do</h3>
<ul>
<li>Some way of browsing just the API</li>
<li>Some visual cue for </li>
<li>Better visual cues for functions in scope</li>
<li>Customised GF syntax highlighting (currently using a Haskell default)</li>
<li>The page sometimes stalls when handling large files (in particular the dictionary modules)</li>
<li>Syntax highlighting is using a Haskell default, could cusomtise for GF</li>
</ul>
</div>
</div>
<br style="clear:both" />
</div>
<footer id="footer">
<p><em>John J. Camilleri, 2012</em></p>
John J. Camilleri. <em>Updated 2012-05-15.</em>
</footer>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="google-code-prettify/prettify.js"></script>

View File

@@ -34,8 +34,21 @@ $(document).ready(function() {
}, 1500);
}
var clearCode = function(code) {
var clearScope = function(msg) {
$('#scope_list').empty();
updateScopeCount();
if (msg) {
$('#scope_list').html("<em>"+msg+"</em>");
}
}
var setScope = function(code) {
$('#scope_list').html(code);
}
var clearCode = function(msg) {
$('#code pre').empty();
if (msg) {
$('#codes pre').html("<em>"+msg+"</em>");
}
}
var setCode = function(code) {
$('#code pre').html(code);
@@ -118,7 +131,7 @@ $(document).ready(function() {
showPanel(b);
return false;
})
.insertBefore("#loading");
.appendTo("#tabbar");
});
showPanel(".panel:first");
@@ -139,9 +152,7 @@ $(document).ready(function() {
// Load a tags file
var loadTagsFile = function(module) {
$('#search').val("");
$('#scope dl').empty();
updateScopeCount();
clearScope();
loading(true);
$.ajax({
url: "tags/"+module+".gf-tags",
@@ -159,7 +170,7 @@ $(document).ready(function() {
return '<tr class="local" name="'+b+'"><th>'+b+'</th><td>'+c+'</td><td></td><td></td><td>'+anchor+'</td><td>'+s[1]+'</td></tr>'
}
});
$('#scope_list').html(data);
setScope(data);
$('#scope_list a').click(function(){
var href = $(this).attr('href');
var m = href.match(/([^\/]+)\/([^\/]+)\.(gf(-tags)?)(:\d+)?/);
@@ -188,10 +199,11 @@ $(document).ready(function() {
return false;
});
updateScopeCount();
runFilter();
loading(false);
},
error: function(data){
$('#scope_list').html("<em>No scope available</em>");
clearScope("No scope available");
loading(false);
},
});
@@ -223,7 +235,7 @@ $(document).ready(function() {
}
},
error: function(data){
setCode("<em>No code available</em>");
clearCode("No code available");
loading(false);
}
});
@@ -241,7 +253,7 @@ $(document).ready(function() {
else
return haystack.toLowerCase().indexOf(needle.toLowerCase())>=0;
};
var runfilter = function() {
var runFilter = function() {
// Hide anything which doesn't match
var s = $("#search").val();
loading(true);
@@ -263,23 +275,23 @@ $(document).ready(function() {
}
// Instant results
$("#search").keyup(runfilter);
$("#search").keyup(runFilter);
$("#submit").hide();
// Filter & clear buttons
// $("#submit").click(runfilter);
// $("#submit").click(runFilter);
$("#search").keypress(function(e){
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { // Enter
runfilter();
runFilter();
}
});
$("#clear").click(function(){
$("#search").val('');
runfilter();
runFilter();
});
$("#case_sensitive").change(runfilter);
$("#show_all").change(runfilter);
$("#show_local").change(runfilter);
$("#case_sensitive").change(runFilter);
$("#show_all").change(runFilter);
$("#show_local").change(runFilter);
});

View File

@@ -5,6 +5,7 @@
header h1
{
text-align:left;
margin:0 0 0.2em;
}
div[role='main']
{
@@ -60,10 +61,13 @@ div[role='main']
.tab
{
cursor:pointer;
padding:0.5em;
padding:0.3em 0.5em;
margin-right:0.5em;
display:inline-block;
text-transform:capitalize;
text-decoration:none;
font-family:sans-serif;
font-weight:bold;
}
#loading
{
@@ -124,7 +128,9 @@ input#search
#scope_list th, #scope_list td
{
padding:0.4em;
border: 1px solid #aaa;
border-style: solid;
border-width: 0 0 1px 0;
border-color: #ddd;
background:none;
white-space:nowrap;
}
@@ -144,7 +150,6 @@ dt
footer
{
padding-left: 0.5em;
border-top: 1px solid #999;
margin-top: 1em;
color:#333;
text-align:right;
}