]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - js/util.js
Performance fix for FriendFeed sup interface: MySQL query optimizer was doing a table...
[quix0rs-gnu-social.git] / js / util.js
index d93467d4a5372265bf3c9ca6dc8c81662c0b1827..b864867fd17d12114092c3a9bb5ea5c9b0865fb1 100644 (file)
@@ -495,10 +495,10 @@ var SN = { // StatusNet
                 $('#'+SN.C.S.NoticeLocationId).val('');
                 $('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
 
-                $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled');
+                $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/', expires: SN.U.GetFullYear(2029, 0, 1) });
             }
 
-            function getJSONgeocodeURL(geocodeURL, data, position) {
+            function getJSONgeocodeURL(geocodeURL, data) {
                 $.getJSON(geocodeURL, data, function(location) {
                     var lns, lid;
 
@@ -513,7 +513,7 @@ var SN = { // StatusNet
                     }
 
                     if (typeof(location.name) == 'undefined') {
-                        NLN_text = position.coords.latitude + ';' + position.coords.longitude;
+                        NLN_text = data.lat + ';' + data.lon;
                     }
                     else {
                         NLN_text = location.name;
@@ -537,7 +537,8 @@ var SN = { // StatusNet
                         NLNU: location.url,
                         NDG: true
                     };
-                    $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue));
+
+                    $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/', expires: SN.U.GetFullYear(2029, 0, 1) });
                 });
             }
 
@@ -575,7 +576,7 @@ var SN = { // StatusNet
                                             token: $('#token').val()
                                         };
 
-                                        getJSONgeocodeURL(geocodeURL, data, position);
+                                        getJSONgeocodeURL(geocodeURL, data);
                                     },
 
                                     function(error) {
@@ -597,12 +598,12 @@ var SN = { // StatusNet
                             else {
                                 if (NLat.length > 0 && NLon.length > 0) {
                                     var data = {
-                                        'lat': NLat,
-                                        'lon': NLon,
-                                        'token': $('#token').val()
+                                        lat: NLat,
+                                        lon: NLon,
+                                        token: $('#token').val()
                                     };
 
-                                    getJSONgeocodeURL(geocodeURL, data, position);
+                                    getJSONgeocodeURL(geocodeURL, data);
                                 }
                                 else {
                                     removeNoticeDataGeo();
@@ -658,6 +659,13 @@ var SN = { // StatusNet
                 }
                 return false;
             });
+        },
+
+        GetFullYear: function(year, month, day) {
+            var date = new Date();
+            date.setFullYear(year, month, day);
+
+            return date;
         }
     },