193 lines
4.8 KiB
HTML
193 lines
4.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ha.mr - link compressor</title>
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Hammersmith+One&display=swap');
|
|
|
|
:root {
|
|
color-scheme: light dark;
|
|
}
|
|
|
|
html, body {
|
|
margin: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
body {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-size: 120%;
|
|
}
|
|
* {
|
|
font-family: "Hammersmith One", sans-serif;
|
|
}
|
|
#loader {
|
|
position: absolute;
|
|
border: 0.5em solid lightgray;
|
|
border-radius: 50%;
|
|
border-top: 0.5em solid gray;
|
|
width: 3em;
|
|
height: 3em;
|
|
-webkit-animation: spin 1.5s linear infinite;
|
|
animation: spin 1.5s linear infinite;
|
|
opacity: 1;
|
|
pointer-events: none;
|
|
transition: opacity 1s;
|
|
}
|
|
@-webkit-keyframes spin {
|
|
0% { -webkit-transform: rotate(0deg); }
|
|
100% { -webkit-transform: rotate(360deg); }
|
|
}
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
#content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transition: opacity 1s;
|
|
}
|
|
h1 {
|
|
margin: 0;
|
|
}
|
|
p {
|
|
margin-top: 0;
|
|
}
|
|
label {
|
|
font-size: 0.9em;
|
|
}
|
|
span {
|
|
text-align: center;
|
|
}
|
|
a {
|
|
color: rgb(50, 100, 255);
|
|
}
|
|
.title {
|
|
font-size: 2.5em;
|
|
}
|
|
.subtitle {
|
|
font-size: 0.6em;
|
|
margin-top: -10px;
|
|
font-style: italic;
|
|
opacity: 0.8;
|
|
}
|
|
.source-link {
|
|
font-size: 0.75em;
|
|
}
|
|
#input-link {
|
|
padding: 5px 8px;
|
|
border: 0;
|
|
outline: 0;
|
|
border-bottom: 2px solid light-dark(
|
|
rgba(0, 0, 0, 0.2),
|
|
rgba(255, 255, 255, 0.2)
|
|
);
|
|
border-radius: 10px;
|
|
margin: 10px 0;
|
|
font-size: 16px;
|
|
background-color: light-dark(
|
|
rgba(0, 0, 0, 0.1),
|
|
rgba(255, 255, 255, 0.1)
|
|
);
|
|
}
|
|
#output-link-container {
|
|
margin: 10px 0 0 0;
|
|
text-align: center;
|
|
}
|
|
#output-link {
|
|
word-break: break-all;
|
|
}
|
|
#output-ratio {
|
|
transition: color 0.5s;
|
|
color: gray;
|
|
user-select: none;
|
|
}
|
|
#qrcode {
|
|
display: none;
|
|
}
|
|
#qr-correct-level-container {
|
|
display: none;
|
|
}
|
|
#query-warning {
|
|
display: none;
|
|
font-size: 1rem;
|
|
text-align: justify;
|
|
text-align-last: center;
|
|
max-width: 80vmin;
|
|
background-color: gold;
|
|
padding: 5px 10px;
|
|
border-radius: 10px;
|
|
margin: 5px 0 15px 0;
|
|
}
|
|
#query-warning summary {
|
|
cursor: pointer;
|
|
}
|
|
header {
|
|
position: absolute;
|
|
top: 20px;
|
|
}
|
|
</style>
|
|
<script src="/qrcode.js"></script>
|
|
</head>
|
|
<body>
|
|
|
|
<div id="loader"></div>
|
|
|
|
<header>
|
|
<a class="source-link" href="https://github.com/p2r3/ha.mr">Source code on GitHub</a>
|
|
|
|
|
<a class="source-link" href="https://www.youtube.com/watch?v=TOr1Vvji6jA">Explanation video</a>
|
|
</header>
|
|
|
|
<div id="content">
|
|
|
|
<h1 class="title">ha.mr</h1>
|
|
<p class="subtitle">(read: "hammer")</p>
|
|
|
|
<input type="text" id="input-link" placeholder="https://some-long.link/" autofocus>
|
|
<details id="query-warning">
|
|
<summary>Consider removing parameters...</summary>
|
|
<br>
|
|
Some links include data that isn't necessary for the link to function,
|
|
such as tracking information or page state. This data comes in the
|
|
form of <i>query parameters</i>, marked by "?" and "&" characters.
|
|
<br><br>
|
|
Removing these segments can sometimes significantly shorten the link
|
|
without breaking it. For example, an Amazon product link contains a lot
|
|
of tracking information. Everything past the "?" symbol can be safely
|
|
removed, making the link much shorter.
|
|
</details>
|
|
<p id="output-link-container">
|
|
<a id="output-link" target="_blank">Enter a link above to compress</a>
|
|
<br><span id="output-ratio"> </span>
|
|
</p>
|
|
|
|
<image width="256" height="256" id="qrcode"></image>
|
|
|
|
<span id="qr-correct-level-container">
|
|
<label>QR code error correction threshold</label>
|
|
<br>
|
|
<input type="range" name="qr-correct-level" id="qr-correct-level" autocomplete="off" min="0" max="3" value="1">
|
|
</span>
|
|
|
|
<span style="margin-top:20px">
|
|
<input type="checkbox" id="settings-emoji" name="settings-emoji" autocomplete="off">
|
|
<label for="settings-emoji"> Use emoji in text output</label><br>
|
|
</span>
|
|
<span>
|
|
<input type="checkbox" id="settings-qr" name="settings-qr" autocomplete="off">
|
|
<label for="settings-qr"> Output QR code</label><br>
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<script type="module" src="/main.js"></script>
|
|
</body>
|
|
</html> |