From d13f30b39f93f694241239c86c08c306c7b94fd4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 18 Sep 2013 14:40:39 +1000 Subject: js/settings.js: Simple config stuff for javascript extensions --- js/ajax.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 74cfe9c0..276e1ac7 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -12,6 +12,7 @@ */ $(window).ready(function() { + var settings = new script_settings('ajax'); var do_not_ajax = false; var setup_form = function($form) { @@ -61,7 +62,8 @@ $(window).ready(function() { $(form).find('input[type="submit"]').removeAttr('disabled'); } } else if (post_response.redirect && post_response.id) { - if (!$(form).find('input[name="thread"]').length) { + if (!$(form).find('input[name="thread"]').length + || (!settings.get('always_noko_replies', true) && !post_response.noko)) { document.location = post_response.redirect; } else { $.ajax({ -- cgit v1.3 From 70e5d64c1bec487db027ba8a176b0bc5cfea2c82 Mon Sep 17 00:00:00 2001 From: czaks Date: Tue, 17 Sep 2013 18:54:06 -0400 Subject: ajax.js: fix upload progress display in firefox --- js/ajax.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'js/ajax.js') diff --git a/js/ajax.js b/js/ajax.js index 276e1ac7..8f0f7258 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -29,7 +29,14 @@ $(window).ready(function() { formData.append('post', submit_txt); var updateProgress = function(e) { - $(form).find('input[type="submit"]').val(_('Posting... (#%)').replace('#', Math.round(e.position / e.total * 100))); + var percentage; + if (e.position === undefined) { // Firefox + percentage = Math.round(e.loaded * 100 / e.total); + } + else { // Chrome? + percentage = Math.round(e.position * 100 / e.total); + } + $(form).find('input[type="submit"]').val(_('Posting... (#%)').replace('#', percentage)); }; $.ajax({ -- cgit v1.3