Make javascript XHR timeout a variable.
SN.V.xhrTimeout = [time in milliseconds];
This commit is contained in:
parent
da34491c59
commit
7862b853bf
@ -57,6 +57,7 @@ var SN = { // StatusNet
|
|||||||
},
|
},
|
||||||
|
|
||||||
V: { // Variables
|
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({
|
form.ajaxForm({
|
||||||
dataType: 'xml',
|
dataType: 'xml',
|
||||||
timeout: '60000',
|
timeout: SN.V.xhrTimeout,
|
||||||
beforeSend: function (formData) {
|
beforeSend: function (formData) {
|
||||||
if (form.find('.notice_data-text:first').val() == '') {
|
if (form.find('.notice_data-text:first').val() == '') {
|
||||||
form.addClass(SN.C.S.Warning);
|
form.addClass(SN.C.S.Warning);
|
||||||
|
@ -492,10 +492,12 @@ class Action extends HTMLOutputter // lawsuit
|
|||||||
|
|
||||||
if (Event::handle('StartScriptVariables', array($this, &$vars))) {
|
if (Event::handle('StartScriptVariables', array($this, &$vars))) {
|
||||||
$vars['urlNewNotice'] = common_local_url('newnotice');
|
$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;
|
return $vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user