]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added timeout error handling for geo location
authorSarven Capadisli <csarven@status.net>
Wed, 13 Jan 2010 15:36:42 +0000 (15:36 +0000)
committerSarven Capadisli <csarven@status.net>
Wed, 13 Jan 2010 15:36:42 +0000 (15:36 +0000)
js/util.js
lib/noticeform.php

index 0ee3d53bd52ef0f0c47556c79c251d731b4a9d45..b56410e62fe2f771083da2f74e7e618e4e481200 100644 (file)
@@ -632,9 +632,18 @@ var SN = { // StatusNet
                                     },
 
                                     function(error) {
-                                        if (error.PERMISSION_DENIED == 1) {
-                                            removeNoticeDataGeo();
+                                        switch(error.code) {
+                                            case error.PERMISSION_DENIED:
+                                                removeNoticeDataGeo();
+                                                break;
+                                            case error.TIMEOUT:
+                                                $('#'+SN.C.S.NoticeGeoName).text(NoticeDataGeo_text.ErrorTimeout).removeClass('processing');
+                                                break;
                                         }
+                                    },
+
+                                    {
+                                        timeout: 10000
                                     }
                                 );
                             }
index 41504b7356b4cfcc6f3f56f28806aa1d21176c76..a00615ce79ae3220c4b707582c76a4b7a0429a7d 100644 (file)
@@ -213,7 +213,8 @@ class NoticeForm extends Form
                 $this->out->elementEnd('div');
                 $this->out->inlineScript(' var NoticeDataGeo_text = {'.
                     'ShareDisable: "'._('Do not share my location').'",'.
-                    'InfoMinimize: "'._('Hide this info').'"'.
+                    'InfoMinimize: "'._('Hide this info').'",'.
+                    'ErrorTimeout: "'._('Sorry, retrieving your geo location is taking longer than expected, please try again later').'"'.
                     '}');
             }