More hardcoded id cleanup in notice form...

This commit is contained in:
Brion Vibber 2011-03-04 13:40:33 -08:00
parent e7662bb1d9
commit 56d5c4a4d1
17 changed files with 64 additions and 68 deletions

View File

@ -50,12 +50,6 @@ var SN = { // StatusNet
Processing: 'processing',
CommandResult: 'command_result',
FormNotice: 'form_notice',
NoticeInReplyTo: 'notice_in-reply-to',
NoticeLat: 'notice_data-lat',
NoticeLon: 'notice_data-lon',
NoticeLocationId: 'notice_data-location_id',
NoticeLocationNs: 'notice_data-location_ns',
NoticeGeoName: 'notice_data-geo_name',
NoticeDataGeo: 'notice_data-geo',
NoticeDataGeoCookie: 'NoticeDataGeo',
NoticeDataGeoSelected: 'notice_data-geo_selected',
@ -395,7 +389,7 @@ var SN = { // StatusNet
var notices = $('#notices_primary .notices:first');
if (notices.length > 0 && SN.U.belongsOnTimeline(notice)) {
if ($('#'+notice.id).length === 0) {
var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
var notice_irt_value = form.find('[name=inreplyto]').val();
var notice_irt = '#notices_primary #notice-'+notice_irt_value;
if($('body')[0].id == 'conversation') {
if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
@ -972,12 +966,14 @@ var SN = { // StatusNet
var NLon = form.find('[name=lon]')
var NLNS = form.find('[name=location_ns]').val();
var NLID = form.find('[name=location_id]').val();
var NLN = $('#'+SN.C.S.NoticeGeoName).text(); // @fixme does this exist?
var NLN = ''; // @fixme
var NDGe = form.find('[name=notice_data-geo]');
var check = form.find('[name=notice_data-geo]');
var label = $('label[for='+check.attr('id')+']');
function removeNoticeDataGeo(error) {
$('label[for='+SN.C.S.NoticeDataGeo+']')
.attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()))
label
.attr('title', jQuery.trim(label.text()))
.removeClass('checked');
form.find('[name=lat]').val('');
@ -989,10 +985,10 @@ var SN = { // StatusNet
$.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/' });
if (error) {
$('.geo_status_wrapper').removeClass('success').addClass('error');
$('.geo_status_wrapper .geo_status').text(error);
form.find('.geo_status_wrapper').removeClass('success').addClass('error');
form.find('.geo_status_wrapper .geo_status').text(error);
} else {
$('.geo_status_wrapper').remove();
form.find('.geo_status_wrapper').remove();
}
}
@ -1042,24 +1038,24 @@ var SN = { // StatusNet
});
}
if (NDGe.length > 0) {
if (check.length > 0) {
if ($.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
NDGe.attr('checked', false);
check.attr('checked', false);
}
else {
NDGe.attr('checked', true);
check.attr('checked', true);
}
var NGW = $('#notice_data-geo_wrap');
var NGW = form.find('.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()));
label
.attr('title', label.text());
NDGe.change(function() {
if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) {
$('label[for='+SN.C.S.NoticeDataGeo+']')
check.change(function() {
if (check.attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) {
label
.attr('title', NoticeDataGeo_text.ShareDisable)
.addClass('checked');
@ -1109,8 +1105,8 @@ var SN = { // StatusNet
}
else {
removeNoticeDataGeo();
$('#'+SN.C.S.NoticeDataGeo).remove();
$('label[for='+SN.C.S.NoticeDataGeo+']').remove();
check.remove();
label.remove();
}
}
}
@ -1124,7 +1120,7 @@ var SN = { // StatusNet
form.find('[name=notice_data-geo]').attr('checked', cookieValue.NDG);
SN.U.NoticeGeoStatus(cookieValue.NLN, cookieValue.NLat, cookieValue.NLon, cookieValue.NLNU);
$('label[for='+SN.C.S.NoticeDataGeo+']')
label
.attr('title', NoticeDataGeo_text.ShareDisable + ' (' + cookieValue.NLN + ')')
.addClass('checked');
}

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -206,7 +206,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-geo_wrap',
$this->out->elementStart('div', array('class' => 'notice_data-geo_wrap',
'title' => common_local_url('geocode')));
$this->out->checkbox('notice_data-geo', _('Share my location'), true);
$this->out->elementEnd('div');

View File

@ -664,8 +664,8 @@ float:right;
font-size:0.8em;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
position:absolute;
top:25px;
right:4px;
@ -675,10 +675,10 @@ width:16px;
height:16px;
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
visibility:hidden;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;

View File

@ -524,8 +524,8 @@ float:right;
font-size:0.8em;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
position:absolute;
top:25px;
right:4px;
@ -535,10 +535,10 @@ width:16px;
height:16px;
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
visibility:hidden;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;

View File

@ -119,8 +119,8 @@ address {
top: 27px;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
top: 52px;
}

View File

@ -69,9 +69,9 @@ line-height:auto;
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px;
}
.form_notice #notice_data-geo_wrap label.checked {
.form_notice .notice_data-geo_wrap label.checked {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px;
}

View File

@ -167,8 +167,8 @@ address {
right: 86px;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
top: 52px;
right: 86px;
}
@ -599,7 +599,7 @@ padding-right:0;
top: 3px !important;
}
.realtime-popup .form_notice #notice_data-geo_wrap label, .realtime-popup .form_notice #notice_data-geo_wrap input {
.realtime-popup .form_notice .notice_data-geo_wrap label, .realtime-popup .form_notice .notice_data-geo_wrap input {
right: 8px;
top: 3px !important;
}

View File

@ -73,9 +73,9 @@ line-height:auto;
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px;
}
.form_notice #notice_data-geo_wrap label.checked {
.form_notice .notice_data-geo_wrap label.checked {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px;
}

View File

@ -570,7 +570,7 @@ font-size:0.8em;
float:left;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
position:absolute;
top:25px;
right:4px;
@ -580,10 +580,10 @@ width:16px;
height:16px;
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
display:none;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;

View File

@ -1005,8 +1005,8 @@ float:right;
font-size:0.8em;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
position:absolute;
top:3.25em;
right:0.4em;
@ -1016,10 +1016,10 @@ width:1.6em;
height:1.6em;
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
visibility:hidden;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;

View File

@ -48,11 +48,11 @@ padding:0 4px;
.form_notice #notice_data-attach {
filter: alpha(opacity=0);
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
background:transparent url(../images/icons/icons-01.png) no-repeat
0 -1780px;
}
.form_notice #notice_data-geo_wrap label.checked {
.form_notice .notice_data-geo_wrap label.checked {
background:transparent url(../images/icons/icons-01.png) no-repeat
0 -1846px;
}

View File

@ -519,8 +519,8 @@ float:right;
font-size:0.8em;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
position:absolute;
top:25px;
right:4px;
@ -530,10 +530,10 @@ width:16px;
height:16px;
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
visibility:hidden;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;

View File

@ -317,8 +317,8 @@ address .poweredby {
font-size:0.8em;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
position:absolute;
top: 55px;
right: 88px;
@ -329,11 +329,11 @@ address .poweredby {
display:block;
}
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap input {
visibility:hidden;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
font-weight:normal;
font-size:1em;
margin-bottom:0;
@ -1728,7 +1728,7 @@ body.realtime-popup {
right: 70px;
}
.realtime-popup .form_notice #notice_data-geo_wrap label, .form_notice #notice_data-geo_wrap input {
.realtime-popup .form_notice .notice_data-geo_wrap label, .form_notice .notice_data-geo_wrap input {
right: 2px;
}

View File

@ -69,11 +69,11 @@ line-height:auto;
background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -1780px;
}
.form_notice #notice_data-geo_wrap label.checked {
.form_notice .notice_data-geo_wrap label.checked {
background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -1846px;
}

View File

@ -236,8 +236,8 @@ h6 {font-size: 1em;}
right: 86px;
}
.form_notice #notice_data-geo_wrap label,
.form_notice #notice_data-geo_wrap input {
.form_notice .notice_data-geo_wrap label,
.form_notice .notice_data-geo_wrap input {
top: 50px;
right: 86px;
}

View File

@ -71,10 +71,10 @@ line-height:auto;
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-geo_wrap label {
.form_notice .notice_data-geo_wrap label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px;
}
.form_notice #notice_data-geo_wrap label.checked {
.form_notice .notice_data-geo_wrap label.checked {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px;
}