From 6c3ed4e899bfba4dddd763045fcec2375341e4fc Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 27 Oct 2014 08:48:19 -0700 Subject: 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. --- dingus.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'dingus.html') 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() {
-