jnxckj
This commit is contained in:
parent
0b620172d2
commit
ebc23d652f
2 changed files with 16 additions and 12 deletions
|
|
@ -70,9 +70,14 @@ var TplCommonMap = map[string]string{
|
||||||
</div>
|
</div>
|
||||||
<div class="number">
|
<div class="number">
|
||||||
What's your current word count?
|
What's your current word count?
|
||||||
<input type="number" name="number" value="{{ .Number }}" min="1" max="1000000000" required>
|
<input type="number"
|
||||||
<br><div class="field">
|
name="number"
|
||||||
<textarea class="edit-status" name="content" maxlength="140" placeholder="What project are you working on?" required autofocus>{{ .Content }}</textarea>
|
min="1"
|
||||||
|
max="1000000000"
|
||||||
|
value="{{ .Number }}"
|
||||||
|
required><br>What do you want to say about your project? (Optional)<br><div class="field"> <textarea class="edit-status" name="content" maxlength="140"
|
||||||
|
placeholder="What project are you working on?" autofocus>{{ .Content }}</textarea>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -15,16 +15,15 @@ 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.number || !r.content.length || r.number <1) {
|
if (!r.number || r.number < 1) {
|
||||||
document.getElementById("sillywordz-content").innerHTML = "No updates yet."
|
document.getElementById("sillywordz-number").innerHTML = "No updates yet.";
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
let safeAuthor = DOMPurify.sanitize(r.author);
|
|
||||||
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 + '"target="_blank">' + r.Author + '</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.content && r.content.trim().length > 0) {
|
||||||
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