Add poster name saving via cookie
When a user makes a new post with a name set, it will get saved via a cookie to the user's client and it will automatically get set the next time a user makes a post. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -55,4 +55,15 @@ input[type=text] {
|
||||
<tr><td> </td><td><input type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$("#submit").on("click", (e) => {
|
||||
let name = $("#{{form.name.auto_id}}");
|
||||
setCookie(NAME_COOKIE, name.val(), 3600 * 24 * 28);
|
||||
});
|
||||
|
||||
$(window).on("load", (e) => {
|
||||
$("#{{form.name.auto_id}}").val(getCookie(NAME_COOKIE));
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
@@ -67,7 +67,18 @@ input[type=text] {
|
||||
{{ max_upload_size|measure_bytes }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td> </td><td><input type="submit" value="Submit" /></td></tr>
|
||||
<tr><td> </td><td><input id="submit" type="submit" value="Submit" /></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$("#submit").on("click", (e) => {
|
||||
let name = $("#{{form.name.auto_id}}");
|
||||
setCookie(NAME_COOKIE, name.val(), 3600 * 24 * 28);
|
||||
});
|
||||
|
||||
$(window).on("load", (e) => {
|
||||
$("#{{form.name.auto_id}}").val(getCookie(NAME_COOKIE));
|
||||
});
|
||||
</script>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user