From 54c18e68dadc37174e8631db76dae064a88920a6 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Fri, 8 Jan 2010 13:58:23 +0000 Subject: [PATCH] Some code cleaning for geo UI --- js/util.js | 42 ++++++++++++++++------------------ lib/noticeform.php | 2 +- theme/base/css/display.css | 10 ++++---- theme/default/css/display.css | 6 ++--- theme/identica/css/display.css | 6 ++--- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/js/util.js b/js/util.js index a29b158be5..9c6342ffe7 100644 --- a/js/util.js +++ b/js/util.js @@ -51,8 +51,7 @@ var SN = { // StatusNet NoticeLon: 'notice_data-lon', NoticeLocationId: 'notice_data-location_id', NoticeLocationNs: 'notice_data-location_ns', - NoticeLocationName: 'notice_data-location_name', - NoticeLocationCookieName: 'location_enabled', + NoticeGeoName: 'notice_data-geo_name', NoticeDataGeo: 'notice_data-geo', NoticeDataGeoSelected: 'notice_data-geo_selected' } @@ -460,7 +459,7 @@ var SN = { // StatusNet var NLon = $('#'+SN.C.S.NoticeLon).val(); var NLNS = $('#'+SN.C.S.NoticeLocationNs).val(); var NLID = $('#'+SN.C.S.NoticeLocationId).val(); - var NLN = $('#'+SN.C.S.NoticeLocationName).text(); + var NLN = $('#'+SN.C.S.NoticeGeoName).text(); var NDGe = $('#'+SN.C.S.NoticeDataGeo); function removeNoticeDataGeo() { @@ -473,7 +472,7 @@ var SN = { // StatusNet $('#'+SN.C.S.NoticeLocationId).val(''); $('#'+SN.C.S.NoticeDataGeo).attr('checked', false); - $.cookie(SN.C.S.NoticeLocationCookieName, 'disabled'); + $.cookie(SN.C.S.NoticeDataGeo, 'disabled'); } function getJSONgeocodeURL(geocodeURL, data) { @@ -497,10 +496,10 @@ var SN = { // StatusNet NLN_text = location.name; } - $('#'+SN.C.S.NoticeLocationName) - .replaceWith(''); + $('#'+SN.C.S.NoticeGeoName) + .replaceWith(''); - $('#'+SN.C.S.NoticeLocationName) + $('#'+SN.C.S.NoticeGeoName) .attr('href', location.url) .text(NLN_text) .click(function() { @@ -524,32 +523,31 @@ var SN = { // StatusNet 'NLNU': location.url, 'NDG': true }; - $.cookie(SN.C.S.NoticeLocationCookieName, JSON.stringify(cookieValue)); + $.cookie(SN.C.S.NoticeDataGeo, JSON.stringify(cookieValue)); }); } if (NDGe.length > 0) { - var cookieValue = $.cookie(SN.C.S.NoticeLocationCookieName); - if (cookieValue == 'disabled') { + if ($.cookie(SN.C.S.NoticeDataGeo) == 'disabled') { NDGe.attr('checked', false); } else { NDGe.attr('checked', true); } - var NLE = $('#notice_data-location_wrap'); - var geocodeURL = NLE.attr('title'); - NLE.removeAttr('title'); + var NGW = $('#notice_data-geo_wrap'); + var geocodeURL = NGW.attr('title'); + NGW.removeAttr('title'); $('label[for='+SN.C.S.NoticeDataGeo+']').attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text())); NDGe.change(function() { - var NLN = $('#'+SN.C.S.NoticeLocationName); + var NLN = $('#'+SN.C.S.NoticeGeoName); if (NLN.length > 0) { NLN.remove(); } - if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeLocationCookieName) === null) { + if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeo) === null) { $('label[for='+SN.C.S.NoticeDataGeo+']').addClass('checked'); var S = '
'; @@ -563,9 +561,9 @@ var SN = { // StatusNet } NDGS = $('#'+SN.C.S.NoticeDataGeoSelected); - NDGS.prepend('Geo '); + NDGS.prepend('Geo '); - var NLN = $('#'+SN.C.S.NoticeLocationName); + var NLN = $('#'+SN.C.S.NoticeGeoName); NLN.addClass('processing'); $('#'+SN.C.S.NoticeDataGeoSelected+' button.close').click(function(){ @@ -582,7 +580,7 @@ var SN = { // StatusNet return false; }); - if ($.cookie(SN.C.S.NoticeLocationCookieName) === null || $.cookie(SN.C.S.NoticeLocationCookieName) == 'disabled') { + if ($.cookie(SN.C.S.NoticeDataGeo) === null || $.cookie(SN.C.S.NoticeDataGeo) == 'disabled') { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( function(position) { @@ -623,17 +621,17 @@ var SN = { // StatusNet } } else { - var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeLocationCookieName)); + var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeDataGeo)); $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat); $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon); $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS); $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID); $('#'+SN.C.S.NoticeDataGeo).attr('checked', cookieValue.NDG); - $('#'+SN.C.S.NoticeLocationName) - .replaceWith(''); + $('#'+SN.C.S.NoticeGeoName) + .replaceWith(''); - $('#'+SN.C.S.NoticeLocationName) + $('#'+SN.C.S.NoticeGeoName) .attr('href', cookieValue.NLNU) .text(cookieValue.NLN) .click(function() { diff --git a/lib/noticeform.php b/lib/noticeform.php index 99865645aa..ddfe450556 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -207,7 +207,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? (empty($this->profile->location_id) ? null : $this->profile->location_id) : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); - $this->out->elementStart('div', array('id' => 'notice_data-location_wrap', + $this->out->elementStart('div', array('id' => 'notice_data-geo_wrap', 'title' => common_local_url('geocode'))); $this->out->checkbox('notice_data-geo', _('Share your location'), true); $this->out->elementEnd('div'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 2031aed216..cdacb9a629 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -555,7 +555,7 @@ margin-bottom:0; line-height:1.618; } .form_notice #notice_data-attach_selected code, -.form_notice #notice_data-location_name { +.form_notice #notice_data-geo_name { float:left; width:80%; display:block; @@ -575,7 +575,7 @@ font-size:0.8em; float:left; } -.form_notice #notice_data-location_wrap label { +.form_notice #notice_data-geo_wrap label { position:absolute; top:25px; right:4px; @@ -585,16 +585,16 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-location_wrap input { +.form_notice #notice_data-geo_wrap input { display:none; } -.form_notice #notice_data-location_wrap label { +.form_notice #notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; text-indent:-9999px; } -.form_notice #notice_data-location_name { +.form_notice #notice_data-geo_name { display:block; padding-left:21px; } diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 1fe2bd5695..2360976e57 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -111,10 +111,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice span#notice_data-location_name { +.form_notice span#notice_data-geo_name { background-position:0 47%; } -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-geo_name { background-position:0 -1711px; } .form_notice label[for=notice_data-geo] { @@ -192,7 +192,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name, +.form_notice a#notice_data-geo_name, .form_notice label[for=notice_data-geo], button.minimize { background-image:url(../../base/images/icons/icons-01.gif); diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index dd02de6b97..91af1d8ec8 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -111,10 +111,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice span#notice_data-location_name { +.form_notice span#notice_data-geo_name { background-position:0 47%; } -.form_notice a#notice_data-location_name { +.form_notice a#notice_data-geo_name { background-position:0 -1711px; } .form_notice label[for=notice_data-geo] { @@ -192,7 +192,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice a#notice_data-location_name, +.form_notice a#notice_data-geo_name, .form_notice label[for=notice_data-geo], button.minimize { background-image:url(../../base/images/icons/icons-01.gif);