Archived
1
0

* try fixing report form

* make captcha widget optional
This commit is contained in:
Jeff Becker 2017-03-30 08:51:59 -04:00
parent bff7dadaa1
commit 6247d0cfff
3 changed files with 16 additions and 9 deletions

View File

@ -4,6 +4,7 @@
function show_censortools() {
var e = document.getElementById("censor-tools");
if(e) e.checked = true;
else throw "censor tools element not found wtfug?";
}
function nntpchan_report_thread(posthash) {
@ -58,11 +59,14 @@ function nntpchan_submit_censor(form, regular_url) {
var url = parts.join('/');
url += '/json';
console.log(url);
var captcha = form.captcha.value;
var captcha = null;
if(form.captcha) {
captcha = form.captcha.value;
if(!captcha) {
show_result("no captcha solution provided");
return;
}
}
var secret = document.getElementById("nntp_censor_secret").value;
if(!secret) {
show_result("no mod key provided");
@ -88,8 +92,9 @@ function nntpchan_submit_censor(form, regular_url) {
formdata.append("name", "mod#"+secret);
formdata.append("subject", "censor");
formdata.append("message", msg);
if(captcha) {
formdata.append("captcha", captcha);
}
formdata.append("reference", "");
nntpchan_apicall(url, handle_result, null, "POST", formdata);
}

View File

@ -41,11 +41,11 @@
<span class="postreport">
<label for="report_{{post.PostHash}}">[x]</label>
<input type="checkbox" id="report_{{post.PostHash}}">
<span style="display: none;" onclick="nntpchan_report('{{post.MessageID}}', '{{post.PostHash}}', '{{post.Reference}}', '{{post.ReferenceHash}}')">
<div style="display: none;" onclick="nntpchan_report('{{post.MessageID}}', '{{post.PostHash}}', '{{post.Reference}}', '{{post.ReferenceHash}}')">
<span class="mod-delete">
[delete]
</span>
</span>
</div>
</span>
</span>
</div>

View File

@ -53,6 +53,8 @@
</td>
</tr>
{{/files}}
{{#DisableCaptcha}}
{{^DisableCaptcha}}
<tr>
<th>
{{#i18n.Translations}}{{captcha}}{{/i18n.Translations}}
@ -69,6 +71,7 @@
<input type="text" name="captcha" autocomplete="off" id="captcha_solution" height="175" width="350"/>
</td>
</tr>
{{/DisableCaptcha}}
<tr>
<th>
<label id="censor-toggle" for="censor-tools">[censor tools]</label>
@ -111,4 +114,3 @@
</div>
</div>
</form>