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 class="number">
|
||||
What's your current word count?
|
||||
<input type="number" name="number" value="{{ .Number }}" min="1" max="1000000000" required>
|
||||
<br><div class="field">
|
||||
<textarea class="edit-status" name="content" maxlength="140" placeholder="What project are you working on?" required autofocus>{{ .Content }}</textarea>
|
||||
<input type="number"
|
||||
name="number"
|
||||
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>
|
||||
<input type="submit" value="Submit">
|
||||
{{ 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")
|
||||
.then( r => r.json() )
|
||||
.then( r => {
|
||||
if (!r.number || !r.content.length || r.number <1) {
|
||||
document.getElementById("sillywordz-content").innerHTML = "No updates yet."
|
||||
return
|
||||
}
|
||||
let safeAuthor = DOMPurify.sanitize(r.author);
|
||||
if (!r.number || r.number < 1) {
|
||||
document.getElementById("sillywordz-number").innerHTML = "No updates yet.";
|
||||
return;
|
||||
}
|
||||
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-number").innerHTML = "I wrote " + r.number + " words on my project!"
|
||||
if (r.number >= 1) {
|
||||
document.getElementById("sillywordz-content").innerHTML = "And I had this to say about it:" + safeContent
|
||||
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! "
|
||||
if (r.content && r.content.trim().length > 0) {
|
||||
document.getElementById("sillywordz-content").innerHTML = "And I had this to say about it: " + safeContent
|
||||
} })
|
||||
`))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue