forked from rDrama/rDrama
fix wordle
parent
cf9500ddbd
commit
95d1e69c68
|
@ -318,7 +318,8 @@ function handle_action(type, cid, thing) {
|
|||
catch(e) {console.log(e)}
|
||||
if (data && data["response"]) {
|
||||
const element = document.getElementById(`${type}-${cid}`);
|
||||
element.innerHTML = data["response"]
|
||||
element.innerHTML = data["response"].replace(/data-nonce=".*?"/g, `data-nonce="${nonce}"`)
|
||||
register_new_elements(element)
|
||||
} else {
|
||||
showToast(false, getMessageFromJsonData(false, data));
|
||||
}
|
||||
|
@ -332,3 +333,7 @@ function handle_action(type, cid, thing) {
|
|||
}
|
||||
xhr.send(form)
|
||||
}
|
||||
|
||||
function wordle(t) {
|
||||
handle_action('wordle', t.dataset.cid, t.previousElementSibling.value)
|
||||
}
|
||||
|
|
|
@ -363,7 +363,7 @@ class Comment(Base):
|
|||
body = f"<span id='wordle-{self.id}' class='ml-2'><small>{wordle_guesses}</small>"
|
||||
|
||||
if wordle_status == 'active' and v and v.id == self.author_id:
|
||||
body += f'''<input autocomplete="off" id="guess_box" type="text" name="guess" class="form-control" maxsize="4" style="width: 200px;display: initial"placeholder="5-letter guess"><button class="action-{self.id} btn btn-success small" style="text-transform: uppercase; padding: 2px"onclick="handle_action('wordle','{self.id}',document.getElementById('guess_box').value)">Guess</button>'''
|
||||
body += f'''<input autocomplete="off" type="text" class="form-control" maxsize="4" style="width:200px;display:initial" placeholder="5-letter guess"><button class="action-{self.id} btn btn-success small text-uppercase px-2 mb-2" data-cid="{self.id}" data-nonce="{g.nonce}" data-onclick="wordle(this)">Guess</button>'''
|
||||
elif wordle_status == 'won':
|
||||
body += "<strong class='ml-2'>Correct!</strong>"
|
||||
elif wordle_status == 'lost':
|
||||
|
|
Loading…
Reference in New Issue