summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-19 15:17:18 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-19 15:17:58 -0500
commit62b66d12d697e62039fa04525c33328a7d31f31c (patch)
tree200aaba24ea67796f54bd777037f0385db8fe446 /js
parent8628db5208a08716d4b4d7fddc270efbbefc6459 (diff)
Use the browser's geolocation API to set the location on the notice form
Diffstat (limited to 'js')
-rw-r--r--js/util.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/js/util.js b/js/util.js
index c59c63910..9c79f837f 100644
--- a/js/util.js
+++ b/js/util.js
@@ -46,7 +46,11 @@ var SN = { // StatusNet
NoticeInReplyTo: 'notice_in-reply-to',
NoticeDataAttach: 'notice_data-attach',
NoticeDataAttachSelected: 'notice_data-attach_selected',
- NoticeActionSubmit: 'notice_action-submit'
+ NoticeActionSubmit: 'notice_action-submit',
+ NoticeLat: 'notice_data-lat',
+ NoticeLon: 'notice_data-lon',
+ NoticeLocationId: 'notice_data-location_id',
+ NoticeLocationNs: 'notice_data-location_ns'
}
},
@@ -351,6 +355,13 @@ var SN = { // StatusNet
});
},
+ NoticeLocationAttach: function() {
+ if(navigator.geolocation) navigator.geolocation.watchPosition(function(position) {
+ $('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
+ $('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
+ });
+ },
+
NewDirectMessage: function() {
NDM = $('.entity_send-a-message a');
NDM.attr({'href':NDM.attr('href')+'&ajax=1'});
@@ -387,6 +398,7 @@ var SN = { // StatusNet
});
SN.U.NoticeDataAttach();
+ SN.U.NoticeLocationAttach();
}
},