diff --git a/js/save-user_flag.js b/js/save-user_flag.js index 120dfa08..d588a424 100644 --- a/js/save-user_flag.js +++ b/js/save-user_flag.js @@ -1,8 +1,14 @@ -onready(function(){ - var flagStorage = "flag_"+window.location.pathname.split('/')[1]; +function user_flag() { + var flagStorage = "flag_" + document.getElementsByName('board')[0].value; var item = window.localStorage.getItem(flagStorage); $('select[name=user_flag]').val(item); $('select[name=user_flag]').change(function() { window.localStorage.setItem(flagStorage, $(this).val()); }); -}); \ No newline at end of file + $(window).on('quick-reply', function() { + $('form#quick-reply select[name="user_flag"]').val($('select[name="user_flag"]').val()); + }); +} +if (active_page == 'thread' || active_page == 'index') { + $(document).ready(user_flag); +}