-
Notifications
You must be signed in to change notification settings - Fork 4
/
renderId.js
135 lines (130 loc) · 3.45 KB
/
renderId.js
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
const queryString = window.location.search;
const onloadLocation = window.location;
const urlParams = new URLSearchParams(queryString);
const doki_id = urlParams.get('doki_id')
const profile_id = urlParams.get('profile_id')
function detect_id() {
console.log(onloadLocation.hash)
if (onloadLocation.hash !== undefined) {
switch (onloadLocation.hash){
case "#nostr-event-kind-registry":
displayKinds()
return;
case "#status":
displayStatus()
return;
case "#protocol":
displayProtocol()
return;
case "#problems":
displayProblemTracker()
return;
case "#nostr":
displayNostr()
return;
case "#identity_tree":
displayUshTree()
return;
case "#samizdat":
displaySamizdat()
return;
case "#patches":
displayPatches()
return;
case "#doki":
displayDoki()
return;
case "#expenses":
displayExpenses()
return;
case "#dividends":
displayDividends()
return;
case "#nostranker":
displayRankings()
return;
}
}
if (doki_id !== null) {
if (doki_id.length === 64) {
displaySingleDoki(doki_id)
return
}
}
if (profile_id !== null) {
displaySingleProfile(profile_id)
return
}
//renderHome()
displayStatus()
}
function prepWindow(kind) {
replacer = document.createElement("div")
replacer.innerHTML = `
<div class="columns">
<div class="column is-half">
<div class="box">
<div class="block">
<div class="content">
<h3 class="is-3" id="heading"></h3>
<h6 class="subtitle is-6" id="description"></h6>
</div>
</div>
<div class="content" id="content"></div>
</div>
</div>
<div class="column is-half">
<div class="box">
<div class="content" id="details"></div>
</div>
</div>
</div>
`
if (kind === "doki_id") {
replacer.innerHTML = `
<div class="columns">
<div class="column is-half">
<div class="box">
<div class="content" id="content"></div>
</div>
</div>
<div class="column is-half">
<div class="box">
<div class="content" id="details"></div>
</div>
</div>
</div>
`
}
return replacer
}
function rewriteURL(page) {
getMuhPubkey().then(pubkey => {
storedPubkey = pubkey
})
//setURLID(page, "")
loc = window.location.href
loc = loc.split("index.html")
console.log(loc)
loc = loc[0] + "index.html"
loc = loc + "#" + page
window.history.pushState("", "", loc)
}
function setURLID(type, id) {
loc = window.location.href
loc = loc.split("index.html")
loc = loc[0] + "index.html"
loc = loc + "?" + type + "=" + id
window.history.pushState("", "", loc)
switch (type) {
case "doki_id":
displaySingleDoki(id)
break;
case "profile_id":
displaySingleProfile(id)
break;
// case "nostr":
// displayNostr()
// break;
}
}