-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
148 lines (143 loc) · 5.95 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html lang="en">
<head>
<script src="head.js"></script>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, shrink-to-fit=no">
<title>mnmlurl - Minimal URL is a modern URL shortener with support for custom alias</title>
<meta name="description" content="Minimal URL is a modern URL shortener with support for custom alias">
<link rel="icon" href="favicon.ico">
<meta itemprop="name" content="mnmlurl">
<meta itemprop="description" content="Minimal URL is a modern URL shortener with support for custom alias">
<meta itemprop="image" content="icons/icon-192x192.png">
<!-- See https://goo.gl/OOhYW5 -->
<link rel="manifest" href="manifest.json">
<!-- See https://goo.gl/qRE0vM -->
<meta name="theme-color" content="#ffffff">
<!-- Add to homescreen for Chrome on Android. Fallback for manifest.json -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="mnmlurl">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="white-translucent">
<meta name="apple-mobile-web-app-title" content="mnmlurl">
<!-- Homescreen icons -->
<link rel="apple-touch-icon" href="icons/icon-48x48.png">
<link rel="apple-touch-icon" sizes="72x72" href="icons/icon-72x72.png">
<link rel="apple-touch-icon" sizes="96x96" href="icons/icon-96x96.png">
<link rel="apple-touch-icon" sizes="144x144" href="icons/icon-144x144.png">
<link rel="apple-touch-icon" sizes="192x192" href="icons/icon-192x192.png">
<!-- Tile icon for Windows 8 (144x144 + tile color) -->
<meta name="msapplication-TileImage" content="icons/icon-144x144.png">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-tap-highlight" content="no">
<!-- OpenGraph -->
<meta property="og:site_name" content="mnmlurl">
<meta property="og:url" content="https://mnmlurl.ml">
<meta property="og:type" content="website">
<meta property="og:title" content="mnmlurl">
<meta property="og:description" content="Minimal URL is a modern URL shortener with support for custom alias">
<meta property="og:image" content="icons/icon-144x144.png">
<!-- Twitter -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@liyasthomas">
<meta name="twitter:creator" content="@liyasthomas">
<meta name="twitter:url" content="https://mnmlurl.ml">
<meta name="twitter:title" content="mnmlurl">
<meta name="twitter:description" content="Minimal URL is a modern URL shortener with support for custom alias">
<meta name="twitter:image" content="icons/icon-144x144.png">
<!-- Web Fonts -->
<link href="https://fonts.googleapis.com/css?family=Poppins:700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('sw.js').then(function(registration) {
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
console.log('ServiceWorker registration failed: ', err);
});
});
}
</script>
</head>
<body>
<main class="main">
<form class="form" action="javascript:void(0);">
<input type="url" id="urlinput" placeholder="paste a long url" label="paste a long url" required>
<input type="text" maxlength="20" id="custominput" placeholder="optional custom alias" label="optional custom alias">
<button id="sbtn" type="submit" aria-label="Shorten">
<span id="status">shorten</span>
</button>
</form>
<div id="erbox"></div>
<div class="form" id="output" style="display: none">
<div id="alias"></div>
<input type="text" id="shortenedURL" placeholder="Output" label="short url">
<div id="sucess"></div>
<div id="qr"></div>
</div>
<div class="flex"></div>
<footer>
<a href="manage">
<img src="icons/manage.svg" alt="logo" style="height: 24px; margin-right: 8px;">Manage URLs
</a>
<a href="https://github.com/liyasthomas/mnmlurl-extension" target="_blank" rel="noopener">
<img src="icons/extension.svg" alt="GitHub" style="height: 24px; margin-right: 8px;">Get browser extension
</a>
<a href="https://github.com/liyasthomas/mnmlurl" target="_blank" rel="noopener">
<img src="icons/github.svg" alt="GitHub" style="height: 24px; margin-right: 8px;">GitHub
</a>
<button id="installPWA" onclick="installPWA()" style="padding: 16px;">
<img src="icons/pwalogo.svg" alt="PWA" style="height: 16px;">
</button>
<div class="flex"></div>
<a href="https://mnmlurl.ml">
<img src="icons/logo.svg" alt="logo" style="height: 24px; margin-right: 8px;">©2019
</a>
</footer>
</main>
<script src="index.js"></script>
<script>
let pwaInstalled = localStorage.getItem('pwaInstalled') == 'yes'
if (window.matchMedia('(display-mode: standalone)').matches) {
localStorage.setItem('pwaInstalled', 'yes')
pwaInstalled = true
}
if (window.navigator.standalone === true) {
localStorage.setItem('pwaInstalled', 'yes')
pwaInstalled = true
}
if (pwaInstalled) {
document.getElementById('installPWA').style.display = 'none'
} else {
document.getElementById('installPWA').style.display = 'block'
}
let deferredPrompt = null
window.addEventListener('beforeinstallprompt', (e) => {
deferredPrompt = e
})
async function installPWA() {
if (deferredPrompt) {
deferredPrompt.prompt()
deferredPrompt.userChoice.then(({
outcome
}) => {
if (outcome === 'accepted') {
console.log('Your PWA has been installed')
} else {
console.log('User chose to not install your PWA')
}
deferredPrompt = null
})
}
}
window.addEventListener('appinstalled', (evt) => {
localStorage.setItem('pwaInstalled', 'yes')
pwaInstalled = true
document.getElementById('installPWA').style.display = 'none'
})
</script>
</body>
</html>