remove jquery & replace with vanilla-js; cleaned stray html: char (#8)

This commit is contained in:
James Tomasino 2018-03-24 02:48:16 -04:00 committed by James Mills
parent c0ee3d4e64
commit 5518da1cb6
1 changed files with 11 additions and 11 deletions

View File

@ -1,7 +1,7 @@
package gopherproxy
var tpltext = `<!doctype html>
<html:>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
@ -13,17 +13,17 @@ var tpltext = `<!doctype html>
{{range .Lines}} {{if .Link}}({{.Type}}) <a class="{{ .Type }}" href="{{.Link}}">{{.Text}}</a>{{else}} {{.Text}}{{end}}
{{end}}</pre>
</section>
<script src="https://code.jquery.com/jquery-3.1.0.slim.min.js" integrity="sha256-cRpWjoSOw5KcyIOaZNo4i6fZ9tKPhYYb6i5T9RSVJG8=" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".QRY").click(function (e) {
e.preventDefault();
var query = prompt("Please enter required input: ", "");
if (query != null) {
window.location = e.target.href + "?" + query;
}
});
});
var qry=document.getElementsByClassName('QRY')
var i=qry.length
while (i--) {
qry[i].addEventListener('click', function(e) {
e.preventDefault();
var resp=prompt("Please enter required input: ", "")
if (resp !== "") window.location = e.target.href + "?" + resp
return false;
})
}
</script>
</body>
</html>`