From 7862b853bf05908f342afd175c13bad300bd5c10 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 1 Mar 2016 13:10:18 +0100 Subject: [PATCH] Make javascript XHR timeout a variable. SN.V.xhrTimeout = [time in milliseconds]; --- js/util.js | 3 ++- lib/action.php | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/js/util.js b/js/util.js index 29650b1a4d..15bff959ee 100644 --- a/js/util.js +++ b/js/util.js @@ -57,6 +57,7 @@ var SN = { // StatusNet }, V: { // Variables + // These get set on runtime via inline scripting, so don't put anything here. }, /** @@ -358,7 +359,7 @@ var SN = { // StatusNet form.ajaxForm({ dataType: 'xml', - timeout: '60000', + timeout: SN.V.xhrTimeout, beforeSend: function (formData) { if (form.find('.notice_data-text:first').val() == '') { form.addClass(SN.C.S.Warning); diff --git a/lib/action.php b/lib/action.php index 4e629c2bc3..513666a656 100644 --- a/lib/action.php +++ b/lib/action.php @@ -492,10 +492,12 @@ class Action extends HTMLOutputter // lawsuit if (Event::handle('StartScriptVariables', array($this, &$vars))) { $vars['urlNewNotice'] = common_local_url('newnotice'); + $vars['xhrTimeout'] = ini_get('max_execution_time')*1000; // milliseconds + Event::handle('EndScriptVariables', array($this, &$vars)); } - if (!empty($vars)) { - $this->inlineScript('SN.V = ' . json_encode($vars)); - } + + $this->inlineScript('SN.V = ' . json_encode($vars) . ';'); + return $vars; } -- 2.39.5