ugh
This commit is contained in:
parent
c8b0acac47
commit
863ab8cce7
2 changed files with 4 additions and 4 deletions
|
|
@ -206,7 +206,7 @@ type statusjson struct {
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Face string `json:"face"`
|
Face string `json:"face"`
|
||||||
TimeAgo string `json:"timeAgo"`
|
TimeAgo string `json:"timeAgo"`
|
||||||
}
|
Number int `json:"number"` }
|
||||||
|
|
||||||
func (h *Handler) showUserStatusJSONView(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) showUserStatusJSONView(w http.ResponseWriter, r *http.Request) {
|
||||||
user := mux.Vars(r)["user"]
|
user := mux.Vars(r)["user"]
|
||||||
|
|
@ -227,7 +227,7 @@ func (h *Handler) showUserStatusJSONView(w http.ResponseWriter, r *http.Request)
|
||||||
res.Content = statuses[0].ContentDisplay()
|
res.Content = statuses[0].ContentDisplay()
|
||||||
res.Face = statuses[0].Face
|
res.Face = statuses[0].Face
|
||||||
res.TimeAgo = statuses[0].TimeAgo()
|
res.TimeAgo = statuses[0].TimeAgo()
|
||||||
}
|
res.Number = statuses[0].Number }
|
||||||
json.NewEncoder(w).Encode(res)
|
json.NewEncoder(w).Encode(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ document.writeln('<div id="sillywordz"><div id="sillywordz-username"></div><div
|
||||||
fetch("https://sillywordz.kissing.computer/users/` + escName + `/status.json")
|
fetch("https://sillywordz.kissing.computer/users/` + escName + `/status.json")
|
||||||
.then( r => r.json() )
|
.then( r => r.json() )
|
||||||
.then( r => {
|
.then( r => {
|
||||||
if (!r.content.length || r.number <1) {
|
if (!r.number || !r.content.length || r.number <1) {
|
||||||
document.getElementById("sillywordz-content").innerHTML = "No updates yet."
|
document.getElementById("sillywordz-content").innerHTML = "No updates yet."
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ fetch("https://sillywordz.kissing.computer/users/` + escName + `/status.json")
|
||||||
let safeContent = DOMPurify.sanitize(r.content);
|
let safeContent = DOMPurify.sanitize(r.content);
|
||||||
document.getElementById("sillywordz-username").innerHTML= '<a href="https://sillywordz.kissing.computer/users/` + escName + `status.json" target="_blank">' + safeAuthor + '</a> ' + r.face + ' ' + r.timeAgo
|
document.getElementById("sillywordz-username").innerHTML= '<a href="https://sillywordz.kissing.computer/users/` + escName + `status.json" target="_blank">' + safeAuthor + '</a> ' + r.face + ' ' + r.timeAgo
|
||||||
document.getElementById("sillywordz-number").innerHTML = "I wrote " + r.number + " words on my project!"
|
document.getElementById("sillywordz-number").innerHTML = "I wrote " + r.number + " words on my project!"
|
||||||
if (!r.number >= 1) {
|
if (r.number >= 1) {
|
||||||
document.getElementById("sillywordz-content").innerHTML = "And I had this to say about it:" + safeContent
|
document.getElementById("sillywordz-content").innerHTML = "And I had this to say about it:" + safeContent
|
||||||
} })
|
} })
|
||||||
`))
|
`))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue