]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Make javascript XHR timeout a variable.
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 1 Mar 2016 12:10:18 +0000 (13:10 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 1 Mar 2016 12:10:18 +0000 (13:10 +0100)
SN.V.xhrTimeout = [time in milliseconds];

js/util.js
lib/action.php

index 29650b1a4d4007c50d430c12fe668e9b602ffdb7..15bff959eef7c67d9d8d6de67c0ad5ef4eecff0c 100644 (file)
@@ -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);
index 4e629c2bc34d0b6c3fb730670d53bdbafc6ebe69..513666a65678afc17072107fc7212eebb57d4df8 100644 (file)
@@ -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;
     }