diff options
Diffstat (limited to 'template.go')
-rw-r--r-- | template.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/template.go b/template.go index 33486d5..f5f4f2b 100644 --- a/template.go +++ b/template.go | |||
@@ -47,7 +47,10 @@ var tpltext = `<!doctype html> | |||
47 | {{- $content = printf "%s\n" $content -}} | 47 | {{- $content = printf "%s\n" $content -}} |
48 | {{- end -}} | 48 | {{- end -}} |
49 | {{- if .Link -}} | 49 | {{- if .Link -}} |
50 | {{- $content = printf "%s%s" $content (printf "<span class=\"link-type\">%s </span><a class=\"link link--%s\" href=\"%s\">%s</a>" .Type .Type .Link (.Text | HTMLEscape)) -}} | 50 | {{- $content = printf "%s%s" $content (printf "<span class=\"type-annotation\">%s </span><a class=\"link link--%s\" href=\"%s\">%s</a>" .Type .Type .Link (.Text | HTMLEscape)) -}} |
51 | {{- if or (eq .Type "IMG") (eq .Type "GIF") -}} | ||
52 | {{- $content = printf "%s\n%s" $content (printf "<span class=\"type-annotation\"> -> </span><a class=\"img-preview\" href=\"%s\"><img src=\"%s\" /></a>" .Link (.Link | replace "^/(.*?)/I" "/$1/T")) -}} | ||
53 | {{- end -}} | ||
51 | {{- else -}} | 54 | {{- else -}} |
52 | {{- $content = printf "%s%s" $content (printf " %s" (.Text | HTMLEscape)) -}} | 55 | {{- $content = printf "%s%s" $content (printf " %s" (.Text | HTMLEscape)) -}} |
53 | {{- end -}} | 56 | {{- end -}} |
@@ -59,16 +62,7 @@ var tpltext = `<!doctype html> | |||
59 | </pre> | 62 | </pre> |
60 | </main> | 63 | </main> |
61 | <script type="text/javascript"> | 64 | <script type="text/javascript"> |
62 | var qry=document.getElementsByClassName('link--QRY') | 65 | {{ .Script | safeJs }} |
63 | var i=qry.length | ||
64 | while (i--) { | ||
65 | qry[i].addEventListener('click', function(e) { | ||
66 | e.preventDefault(); | ||
67 | var resp=prompt("Please enter required input: ", "") | ||
68 | if (resp !== null && resp !== "") window.location = e.target.href + "?" + resp | ||
69 | return false; | ||
70 | }) | ||
71 | } | ||
72 | </script> | 66 | </script> |
73 | </body> | 67 | </body> |
74 | </html>` | 68 | </html>` |