diff options
author | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-23 17:29:07 +0200 |
---|---|---|
committer | Feuerfuchs <git@feuerfuchs.dev> | 2019-06-23 17:29:07 +0200 |
commit | c448abd99a470e1ec541027077dcdef0745270d8 (patch) | |
tree | 433def56b6f0e81457cbe39fc85f402a9e4e18a8 /assets | |
parent | Check type instead of file ext to render text via tpl (diff) | |
download | gopherproxy-c448abd99a470e1ec541027077dcdef0745270d8.tar.gz gopherproxy-c448abd99a470e1ec541027077dcdef0745270d8.tar.bz2 gopherproxy-c448abd99a470e1ec541027077dcdef0745270d8.zip |
Show expandable thumbnails for images
Diffstat (limited to 'assets')
-rw-r--r-- | assets/main.js | 39 | ||||
-rw-r--r-- | assets/style.css | 2 |
2 files changed, 40 insertions, 1 deletions
diff --git a/assets/main.js b/assets/main.js new file mode 100644 index 0000000..46cb7ee --- /dev/null +++ b/assets/main.js | |||
@@ -0,0 +1,39 @@ | |||
1 | "use strict"; | ||
2 | var linkQryEls = document.getElementsByClassName('link--QRY'); | ||
3 | var i = linkQryEls.length; | ||
4 | while (i--) { | ||
5 | linkQryEls[i].addEventListener('click', function (e) { | ||
6 | e.preventDefault(); | ||
7 | var resp = prompt('Please enter required input: ', ''); | ||
8 | if ((resp !== null) && (resp !== "")) { | ||
9 | window.location.href = e.target.href + '?' + resp; | ||
10 | } | ||
11 | return false; | ||
12 | }); | ||
13 | } | ||
14 | var imgPreviewEls = document.getElementsByClassName('img-preview'); | ||
15 | i = imgPreviewEls.length; | ||
16 | var _loop_1 = function () { | ||
17 | var imgPreviewEl = imgPreviewEls[i]; | ||
18 | var child = imgPreviewEl.children[0]; | ||
19 | var thumbnailUrl = child.src; | ||
20 | child.addEventListener('load', function (e) { | ||
21 | child.classList.remove('faded'); | ||
22 | }); | ||
23 | imgPreviewEls[i].addEventListener('click', function (e) { | ||
24 | e.preventDefault(); | ||
25 | child.classList.add('faded'); | ||
26 | if (child.classList.contains('expanded')) { | ||
27 | child.classList.remove('expanded'); | ||
28 | child.src = thumbnailUrl; | ||
29 | } | ||
30 | else { | ||
31 | child.classList.add('expanded'); | ||
32 | child.src = imgPreviewEl.href; | ||
33 | } | ||
34 | return false; | ||
35 | }); | ||
36 | }; | ||
37 | while (i--) { | ||
38 | _loop_1(); | ||
39 | } | ||
diff --git a/assets/style.css b/assets/style.css index 5891d3b..46ad8cb 100644 --- a/assets/style.css +++ b/assets/style.css | |||
@@ -1 +1 @@ | |||
@font-face{font-family:'Iosevka Term SS03';font-style:normal;font-weight:normal;src:url("/iosevka-term-ss03-regular.woff2") format("woff2"),url("/iosevka-term-ss03-regular.woff") format("woff")}body{margin:0;padding:0;background-color:#14171a;color:#cad1d8}::selection{color:#000;background-color:rgba(239,198,138,0.996)}:link{color:#fff}:visited{color:#cad1d8}.header{padding:.9em 1em;border-bottom:1px solid #353a3f;font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1.0625em;line-height:1.3;color:#686f76}.header__uripart{color:#929ba3}.header__uripart--last{color:#fff}.wrap{text-align:center}.content{display:inline-block;min-width:50em;min-width:85ch;margin:0;padding:2em 1em;text-align:left;font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1.0625em;line-height:1.5}.link-type{color:#929ba3} | @font-face{font-family:'Iosevka Term SS03';font-style:normal;font-weight:normal;src:url("/iosevka-term-ss03-regular.woff2") format("woff2"),url("/iosevka-term-ss03-regular.woff") format("woff")}body{margin:0;padding:0;background-color:#14171a;color:#cad1d8}button{font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1.0625em;line-height:1.5;background:none;border:0;padding:0;color:#fff}img{display:inline-block;vertical-align:top;max-width:8em;margin:.1em 0}img::selection{background-color:rgba(239,198,138,0.35)}img.expanded{max-width:40em;max-width:80ch}img.faded{opacity:.5}::selection{color:#000;background-color:rgba(239,198,138,0.996)}:link{color:#fff}:visited{color:#cad1d8}.header{font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1.0625em;line-height:1.5;padding:.9em 1em;border-bottom:1px solid #353a3f;line-height:1.3;color:#686f76}.header__uripart{color:#929ba3}.header__uripart--last{color:#fff}.wrap{text-align:center}.content{font-family:'Iosevka Term SS03', 'IBM Plex Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Droid Sans Mono', Monaco, Consolas, Courier, monospace;font-size:1.0625em;line-height:1.5;display:inline-block;min-width:50em;min-width:85ch;margin:0;padding:2em 1em;text-align:left}.type-annotation{color:#929ba3} | ||