summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-10-27 08:48:19 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-10-27 08:48:19 -0700
commit6c3ed4e899bfba4dddd763045fcec2375341e4fc (patch)
tree565ab7ff5f803d741834d5ae2dbd409232175172
parent9d8dba5acd00edec29e385ac859bc28c9991dae9 (diff)
dingus: Show HTML tab if query has text.
This should be a safer default; if someone sends you dangerous HTML, you'll see it immediately.
-rw-r--r--dingus.html11
1 files changed, 8 insertions, 3 deletions
diff --git a/dingus.html b/dingus.html
index 8c35fe5..7c3a7c7 100644
--- a/dingus.html
+++ b/dingus.html
@@ -20,7 +20,7 @@ function getQueryVariable(variable)
var pair = vars[i].split("=");
if(pair[0] == variable){return decodeURIComponent(pair[1]);}
}
- return('');
+ return null;
}
@@ -64,7 +64,12 @@ $(document).ready(function() {
render();
}, 0); // ms delay
};
- $("#text").val(getQueryVariable("text"));
+ var initial_text = getQueryVariable("text");
+ if (initial_text) {
+ $("#text").val(initial_text);
+ // show HTML tab if text is from query
+ $('#result-tabs a[href="#result"]').tab('show');
+ }
parseAndRender();
$("#clear-text-box").click(function(e) {
$("#text").val('');
@@ -114,7 +119,7 @@ $(document).ready(function() {
<ul id="warnings"></ul>
</div>
<div class="col-md-6">
- <ul class="nav nav-tabs" role="tablist">
+ <ul id="result-tabs" class="nav nav-tabs" role="tablist">
<li class="active"><a href="#preview" role="tab" data-toggle="tab">Preview</a></li>
<li><a href="#result" role="tab" data-toggle="tab">HTML</a></li>
<li><a href="#result-ast" role="tab" data-toggle="tab">AST</a></li>