|
15 | 15 | overflow: hidden;
|
16 | 16 |
|
17 | 17 | background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiPjxkZWZzPjxwYXR0ZXJuIGlkPSJwYXR0ZXJuX1o2Nmk1ZyIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgd2lkdGg9IjEyIiBoZWlnaHQ9IjEyIiBwYXR0ZXJuVHJhbnNmb3JtPSJyb3RhdGUoNDUpIj48bGluZSB4MT0iMCIgeT0iMCIgeDI9IjAiIHkyPSIxMiIgc3Ryb2tlPSIjRjNGM0YzIiBzdHJva2Utd2lkdGg9IjEyIiAvPjwvcGF0dGVybj48L2RlZnM+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idXJsKCNwYXR0ZXJuX1o2Nmk1ZykiICAvPjwvc3ZnPg==);
|
| 18 | + display: flex; |
| 19 | + justify-content: center; |
| 20 | + align-items: center; |
| 21 | + height: 100vh; |
| 22 | + } |
18 | 23 |
|
19 |
| - img { |
20 |
| - width: 100vw; |
21 |
| - height: 100vh; |
22 |
| - object-fit: contain; |
23 |
| - display: block; |
24 |
| - } |
| 24 | + body.img img { |
| 25 | + max-width: 100%; |
| 26 | + max-height: 100vh; |
| 27 | + width: auto; |
| 28 | + height: auto; |
| 29 | + display: block; |
25 | 30 | }
|
26 | 31 | #doc {
|
27 | 32 | display: none;
|
28 | 33 | }
|
29 | 34 | input {
|
30 | 35 | width: 90%;
|
| 36 | + padding: 5px; |
| 37 | + font-size: 17px; |
31 | 38 | }
|
32 | 39 | </style>
|
33 | 40 | </head>
|
|
42 | 49 | Probably because it detects request header accept: text/html
|
43 | 50 | </pre>
|
44 | 51 |
|
45 |
| - <label> |
46 |
| - type img url: |
47 |
| - <input type="text" id="url" value="" /> |
48 |
| - </label> |
| 52 | + <div> |
| 53 | + <label> |
| 54 | + type img url: |
| 55 | + <input type="text" id="url" value="" /> |
| 56 | + </label> |
| 57 | + </div> |
49 | 58 |
|
50 | 59 | <br />
|
51 | 60 |
|
52 |
| - <a href=""></a> |
| 61 | + <div> |
| 62 | + <a href=""></a> |
| 63 | + </div> |
| 64 | + |
53 | 65 | <br />
|
| 66 | + |
| 67 | + <div> |
| 68 | + <label> |
| 69 | + generated link |
| 70 | + <input type="text" id="link" value="" /> |
| 71 | + </label> |
| 72 | + </div> |
| 73 | + |
| 74 | + <br /> |
| 75 | + |
54 | 76 | <div>
|
55 | 77 | <a href="i.html">reset</a>
|
56 | 78 | </div>
|
| 79 | + |
57 | 80 | <br />
|
58 | 81 |
|
59 | 82 | <div>
|
60 | 83 | direct link to original
|
61 | 84 | <a href="https://i.imgur.com/q3CHEJs.png" target="_blank">https://i.imgur.com/q3CHEJs.png</a> - will redirect to
|
62 | 85 | https://imgur.com/q3CHEJs
|
63 | 86 | </div>
|
| 87 | + |
| 88 | + <br /> |
| 89 | + |
| 90 | + <div> |
| 91 | + the same image (https://i.imgur.com/q3CHEJs.png) but handled with this document - |
| 92 | + <a href="?i=https://i.imgur.com/q3CHEJs.png">link</a> |
| 93 | + </div> |
| 94 | + |
| 95 | + <br /> |
| 96 | + |
| 97 | + <div> |
| 98 | + <a href="?i=https://i.imgur.com/CjDxZsm.png">big image example</a> |
| 99 | + </div> |
| 100 | + |
| 101 | + <br /> |
| 102 | + |
| 103 | + <div> |
| 104 | + <a href="?i=https://i.imgur.com/6N0MVlA.png">small image example</a> |
| 105 | + </div> |
64 | 106 | </div>
|
65 |
| - <br /> |
66 |
| - <div>the same image (https://i.imgur.com/q3CHEJs.png) but handled with this document - <a href="?i=https://i.imgur.com/q3CHEJs.png">link</a></div> |
67 | 107 | </body>
|
68 | 108 | <script>
|
69 | 109 | const i = new URLSearchParams(window.location.search).get("i");
|
|
76 | 116 |
|
77 | 117 | const input = document.querySelector("#url");
|
78 | 118 | const a = document.querySelector("a");
|
| 119 | + const link = document.querySelector("#link"); |
79 | 120 |
|
80 | 121 | input.addEventListener("input", (e) => {
|
81 | 122 | const url = `${location.origin}${location.pathname}?i=${encodeURIComponent(e.target.value)}`;
|
82 | 123 | a.href = url;
|
83 | 124 | a.innerText = url;
|
| 125 | + link.value = url; |
| 126 | + }); |
| 127 | + |
| 128 | + link.addEventListener("focus", (e) => { |
| 129 | + e.target.select(); |
| 130 | + // copy on focus |
| 131 | + // and change input background to green for 1 sec |
| 132 | + e.target.style.backgroundColor = "green"; |
| 133 | + setTimeout(() => { |
| 134 | + e.target.style.backgroundColor = ""; |
| 135 | + }, 1000); |
| 136 | + // copy to clipboard |
| 137 | + navigator.clipboard.writeText(e.target.value).then( |
| 138 | + () => { |
| 139 | + console.log("Copying to clipboard was successful!"); |
| 140 | + }, |
| 141 | + (err) => { |
| 142 | + console.error("Could not copy text: ", err); |
| 143 | + } |
| 144 | + ); |
84 | 145 | });
|
85 | 146 | }
|
86 | 147 | </script>
|
|
0 commit comments