This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
forked from Danappelxx/notion-calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_url.html
49 lines (45 loc) · 1.84 KB
/
create_url.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
<html>
<head>
<title>Export Notion Calendar to ICS (and import anywhere else)</title>
<style>
input {
display: block;
width: calc(100% - 20px);
margin: 10px;
font-size: 20px;
}
</style>
</head>
<body>
<label for='token'>Notion token</label>
<input id='token' placeholder="secret_8f9f923fd723df...">
<label for='db_id'>Database ID (last path component of calendar page)</label>
<input id='db_id' placeholder="asdfsfs-1234-a4f2-bsdfd-23446356tsdd">
<label for='format'>Title format</label>
<input id='format' value='[{Tags[0]}] {Name}'>
<label for='result'>Resulting URL</label>
<input id='result' placeholder='loading...' readonly onclick="this.select(); document.execCommand('copy')">
<script>
document.addEventListener("DOMContentLoaded", function(event) {
let token_el = document.getElementById('token');
let db_id_el = document.getElementById('db_id');
let format_el = document.getElementById('format');
let res_el = document.getElementById('result');
function recalc_url() {
let token = window.btoa(token_el.value);
let db_id = window.btoa(db_id_el.value);
let format = window.btoa(format_el.value);
res = new URL('/ics', window.location.href);
res.searchParams.append('token', token);
res.searchParams.append('db_id', db_id);
res.searchParams.append('format', format);
res_el.value = res.href;
}
token_el.addEventListener("input", recalc_url);
db_id_el.addEventListener("input", recalc_url);
format_el.addEventListener("input", recalc_url);
recalc_url();
});
</script>
</body>
</html>