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

View File

@ -41,11 +41,11 @@
<span class="postreport"> <span class="postreport">
<label for="report_{{post.PostHash}}">[x]</label> <label for="report_{{post.PostHash}}">[x]</label>
<input type="checkbox" id="report_{{post.PostHash}}"> <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"> <span class="mod-delete">
[delete] [delete]
</span> </span>
</span> </div>
</span> </span>
</span> </span>
</div> </div>

View File

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