1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-12-01 02:27:24 +01:00

Remember flag setting like name and email

This commit is contained in:
Fredrick Brennan 2015-05-30 15:41:47 +08:00
parent d6e2a0126d
commit 80d78f2157
2 changed files with 15 additions and 1 deletions

View File

@ -210,7 +210,7 @@
// Synchronise other inputs // Synchronise other inputs
$origPostForm.find('input[type="text"],select').on('change input propertychange', function() { $origPostForm.find('input[type="text"],select').on('change input propertychange', function() {
$postForm.find('[name="' + $(this).attr('name') + '"]').val($(this).val()); $postForm.find('[name="' + $(this).attr('name') + '"]').val($(this).val());
}); }).change();
$postForm.find('input[type="text"],select').on('change input propertychange', function() { $postForm.find('input[type="text"],select').on('change input propertychange', function() {
$origPostForm.find('[name="' + $(this).attr('name') + '"]').val($(this).val()); $origPostForm.find('[name="' + $(this).attr('name') + '"]').val($(this).val());
}); });

View File

@ -211,6 +211,16 @@ function dopost(form) {
if (form.elements['password']) { if (form.elements['password']) {
localStorage.password = form.elements['password'].value; localStorage.password = form.elements['password'].value;
} }
if (form.elements['user_flag']) {
if (localStorage.userflags) {
var userflags = JSON.parse(localStorage.userflags);
} else {
localStorage.userflags = '{}';
userflags = {};
}
userflags[board_name] = form.elements['user_flag'].value;
localStorage.userflags = JSON.stringify(userflags);
}
if (form.elements['email'] && form.elements['email'].value != 'sage') { if (form.elements['email'] && form.elements['email'].value != 'sage') {
localStorage.email = form.elements['email'].value; localStorage.email = form.elements['email'].value;
} }
@ -277,6 +287,10 @@ function rememberStuff() {
document.forms.post.elements['name'].value = localStorage.name; document.forms.post.elements['name'].value = localStorage.name;
if (localStorage.email && document.forms.post.elements['email']) if (localStorage.email && document.forms.post.elements['email'])
document.forms.post.elements['email'].value = localStorage.email; document.forms.post.elements['email'].value = localStorage.email;
if (localStorage.userflags && document.forms.post.elements['user_flag']) {
var userflags = JSON.parse(localStorage.userflags);
document.forms.post.elements['user_flag'].value = userflags[board_name];
}
if (window.location.hash.indexOf('q') == 1) if (window.location.hash.indexOf('q') == 1)
citeReply(window.location.hash.substring(2), true); citeReply(window.location.hash.substring(2), true);