-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToTodayDynalist.html
65 lines (59 loc) · 2.46 KB
/
ToTodayDynalist.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
<!DOCTYPE html>
<html style="background: #35363A;">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="https://dynalist.io/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>To Today!</title>
<style>
html {
font-family: sans-serif;
font-size: 30px;
}
.fade-in {
animation: fadeIn 5s;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style>
</head>
<body class="fade-in" style=" background: white; padding: 15px; border-radius: 10px; overflow-wrap: anywhere;">
<p>This webpage will redirect you to the first instance of today's date in a Dynalist file. You have to pass in a
file_id and token like this:
<a href="http://Jesse-Hufstetler.github.io/ToTodayDynalist.html?file_id=HereIsWhereYouPutTheFlId&token=HereIsWhereYouPutYourTokenThatYouHaveToGoGetFromDynalistAndIfYouDontKnowHowThereAreInstructionsYouCanSearchForHoorayItsNeatYayyy">http://Jesse-Hufstetler.github.io/ToTodayDynalist.html?file_id=HereIsWhereYouPutTheFlId&token=HereIsWhereYouPutYourTokenThatYouHaveToGoGetFromDynalistAndIfYouDontKnowHowThereAreInstructionsYouCanSearchForHoorayItsNeatYayyy</a>
</p>
<script type="text/javascript">
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const token = urlParams.get('token')
const file_id = urlParams.get('file_id')
console.log(file_id);
(
function() {
fetch('https://dynalist.io/api/v1/doc/read', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"token": token,
"file_id": file_id
})
})
.then(response => response.json())
.then(response => location.href = `https://dynalist.io/d/${file_id}#z=` + response.nodes.filter((item) => item.content.includes(`!(${new Date().getFullYear()}-${(new Date().getMonth() + 1).toString().padStart(2, "0")}-${new Date().getDate().toString().padStart(2, "0")})`))[0].id)
}
)();
</script>
</body>
</html>