Notice form cleanup: removing hardcoded id from counter references; prep for reusable notice forms.

This commit is contained in:
Brion Vibber 2011-03-03 17:15:17 -08:00
parent f94a5e1a6a
commit b58aa29168
35 changed files with 94 additions and 97 deletions

View File

@ -50,7 +50,6 @@ var SN = { // StatusNet
Processing: 'processing',
CommandResult: 'command_result',
FormNotice: 'form_notice',
NoticeTextCount: 'notice_text-count',
NoticeInReplyTo: 'notice_in-reply-to',
NoticeActionSubmit: 'notice_action-submit',
NoticeLat: 'notice_data-lat',
@ -103,7 +102,7 @@ var SN = { // StatusNet
*/
FormNoticeEnhancements: function(form) {
if (jQuery.data(form[0], 'ElementData') === undefined) {
MaxLength = form.find('#'+SN.C.S.NoticeTextCount).text();
MaxLength = form.find('.count').text();
if (typeof(MaxLength) == 'undefined') {
MaxLength = SN.C.I.MaxLength;
}
@ -131,7 +130,7 @@ var SN = { // StatusNet
.bind('paste', delayedUpdate);
}
else {
form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength);
form.find('.count').text(jQuery.data(form[0], 'ElementData').MaxLength);
}
},
@ -159,7 +158,7 @@ var SN = { // StatusNet
}
var remaining = MaxLength - SN.U.CharacterCount(form);
var counter = form.find('#'+SN.C.S.NoticeTextCount);
var counter = form.find('.count');
if (remaining.toString() != counter.text()) {
if (!SN.C.I.CounterBlackout || remaining === 0) {

2
js/util.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -163,8 +163,7 @@ class MessageForm extends Form
if ($contentLimit > 0) {
$this->out->element('span',
array('id' => 'notice_text-count',
'class' => 'form_note'),
array('class' => 'count'),
$contentLimit);
}
}

View File

@ -183,8 +183,7 @@ class NoticeForm extends Form
if ($contentLimit > 0) {
$this->out->element('span',
array('id' => 'notice_text-count',
'class' => 'form_note'),
array('class' => 'count'),
$contentLimit);
}

View File

@ -141,7 +141,7 @@ class GroupMessageForm extends Form
if ($contentLimit > 0) {
$this->out->elementStart('dl', 'form_note');
$this->out->element('dt', null, _('Available characters'));
$this->out->element('dd', array('id' => 'notice_text-count'),
$this->out->element('dd', array('class' => 'count'),
$contentLimit);
$this->out->elementEnd('dl');
}

View File

@ -355,7 +355,7 @@ class MobileProfilePlugin extends WAP20Plugin
$contentLimit = Notice::maxContent();
if ($contentLimit > 0) {
$form->out->element('div', array('id' => 'notice_text-count'),
$form->out->element('div', array('class' => 'count'),
$contentLimit);
}

View File

@ -94,7 +94,7 @@ width:60%;
height:20px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
right:40%;
@ -104,7 +104,7 @@ z-index:9;
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
#form_notice #notice_text-count + label,
.form_notice .count + label,
#form_notice label[for="notice_data-attach"] {
display:none;
}

View File

@ -611,17 +611,17 @@ height:16px;
padding:0;
height:16px;
}
.form_notice .form_note {
.form_notice .count {
position:absolute;
bottom:2px;
right:21.715%;
z-index:9;
}
.form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
.form_notice #notice_text-count {
.form_notice .count {
font-weight:bold;
line-height:1.15;
padding:1px 2px;

View File

@ -13,7 +13,7 @@ top:0;
.form_notice textarea {
width:78%;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;

View File

@ -480,17 +480,17 @@ text-indent:-279px;
#form_notice #notice_submit label {
display:none;
}
#form_notice .form_note {
.form_notice .count {
position:absolute;
top:99px;
right:98px;
z-index:9;
}
#form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
#notice_text-count {
.form_notice .count {
font-weight:bold;
line-height:1.15;
padding:1px 2px;

View File

@ -60,12 +60,12 @@ border-color:#DDDDDD;
background:none;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
background-color:#9BB43E;
}
input.submit,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions a,
.entity_actions input,
@ -83,7 +83,7 @@ background-color:transparent;
}
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
border-color:#9BB43E;
}
@ -166,10 +166,10 @@ background-image:url(../images/illustrations/illu_pattern-02.png);
background-repeat:no-repeat;
}
#notice_text-count {
.form_notice .count {
color:#333333;
}
#form_notice.warning #notice_text-count {
#form_notice.warning .count {
color:#000000;
}
.form_notice label[for=notice_data-attach] {

View File

@ -7,7 +7,7 @@ top:0;
.form_notice textarea {
width: 362px;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;
@ -65,7 +65,7 @@ line-height:auto;
filter: alpha(opacity=0);
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}

View File

@ -75,7 +75,7 @@ float:left;
padding: 4px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
left: 175px;
@ -83,14 +83,14 @@ bottom:2px;
z-index:9;
}
#form_notice-direct.form_notice #notice_text-count {
#form_notice-direct.form_notice .count {
left: 0px;
}
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
.form_notice #notice_text-count + label,
.form_notice .count + label,
.form_notice label[for="notice_data-attach"] {
display:none;
}

View File

@ -7,7 +7,7 @@ top:0;
.form_notice textarea {
width: 328px;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;
@ -69,7 +69,7 @@ line-height:auto;
filter: alpha(opacity=0);
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}

View File

@ -80,7 +80,7 @@ float:left;
padding: 4px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
left: 175px;
@ -88,14 +88,14 @@ bottom:2px;
z-index:9;
}
#form_notice-direct.form_notice #notice_text-count {
#form_notice-direct.form_notice .count {
left: 0px;
}
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
.form_notice #notice_text-count + label,
.form_notice .count + label,
.form_notice label[for="notice_data-attach"] {
display:none;
}

View File

@ -509,17 +509,17 @@ height:16px;
padding:0;
height:16px;
}
.form_notice .form_note {
.form_notice .count {
position:absolute;
bottom:2px;
right:21.715%;
z-index:9;
}
.form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
.form_notice #notice_text-count {
.form_notice .count {
font-weight:bold;
line-height:1.15;
padding:1px 2px;
@ -1673,7 +1673,7 @@ background-position:0 -1912px;
}
input.submit,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions a,
.entity_actions input,
@ -1691,7 +1691,7 @@ background-color:transparent;
}
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
border-color:#9BB43E;
}
@ -1706,7 +1706,7 @@ background-color:transparent;
}
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
border-color:#9BB43E;
}
@ -1781,10 +1781,10 @@ border-color:#AAAAAA;
background-color:#DDFFCC;
}
#notice_text-count {
.form_notice .count {
color:#000000;
}
#form_notice.warning #notice_text-count {
#form_notice.warning .count {
color:#000000;
}
#form_notice label[for=notice_data-attach] {
@ -2071,7 +2071,7 @@ border-color:#FFFF00;
}
#form_notice .form_note {
.form_notice .count {
color:#CCC;
}

View File

@ -18,14 +18,14 @@ background-color:#ddffcc;
#form_notice {
width:525px;
}
#form_notice .form_note {
.form_notice .count {
top:-5px;
right:0;
}
#form_notice textarea {
width:97.75%;
}
#form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:87px;
left:77%;

View File

@ -57,12 +57,12 @@ border-color:#DDDDDD;
background:none;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
background-color:#9BB43E;
}
input.submit,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions a,
.entity_actions input,
@ -81,7 +81,7 @@ background-color:transparent;
}
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions .dialogbox .form_data input:focus {
border-color:#9BB43E;
@ -144,10 +144,10 @@ border-top-color:#C8D1D5;
background-color:#C8D1D5;
}
#notice_text-count {
.form_notice .count {
color:#333333;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.dialogbox,
.entity_actions .dialogbox input {
color:#000000;

View File

@ -13,7 +13,7 @@ color:#FFFFFF;
#site_nav_local_views a {
background-color:#C8D1D5;
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../base/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-attach {

View File

@ -432,17 +432,17 @@ margin-bottom:7px;
#form_notice #notice_submit label {
display:none;
}
#form_notice .form_note {
.form_notice .count {
position:absolute;
top:99px;
right:98px;
z-index:9;
}
#form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
#notice_text-count {
.form_notice .count {
font-weight:bold;
line-height:1.15;
padding:1px 2px;

View File

@ -44,7 +44,7 @@ background:none;
}
input.submit,
#form_notice.warning #notice_text-count,
#form_notice.warning .count,
.form_settings .form_note,
.entity_remote_subscribe {
background-color:rgba(0, 255, 0, 0.5);
@ -82,10 +82,10 @@ border-top-color:#87B4C8;
background-color:rgba(0,128,0,0.3);
}
#notice_text-count {
.form_notice .count {
color:#0f0;
}
#form_notice.warning #notice_text-count {
#form_notice.warning .count {
color:#000;
}
#form_notice.processing #notice_action-submit {

View File

@ -57,12 +57,12 @@ border-color:#DDDDDD;
background:none;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
background-color:#9BB43E;
}
input.submit,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions a,
.entity_actions input,
@ -81,7 +81,7 @@ background-color:transparent;
}
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions .dialogbox .form_data input:focus {
border-color:#9BB43E;
@ -145,10 +145,10 @@ border-top-color:#CEE1E9;
background-color:#CEE1E9;
}
#notice_text-count {
.form_notice .count {
color:#333333;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.dialogbox,
.entity_actions .dialogbox input {
color:#000000;

View File

@ -13,7 +13,7 @@ color:#FFFFFF;
#site_nav_local_views a {
background-color:#D9DADB;
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../base/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-attach {

View File

@ -954,17 +954,17 @@ opacity: 0;
padding:0;
height:1.6em;
}
.form_notice .form_note {
.form_notice .count {
position:absolute;
bottom:2px;
right:21.715%;
z-index:9;
}
.form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
.form_notice #notice_text-count {
.form_notice .count {
font-family: 'TeXGyreHerosBold', sans-serif;
line-height:1.15;
padding:1px 2px;

View File

@ -20,7 +20,7 @@ img.logo {
.form_notice textarea {
width:78%;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;
@ -41,7 +41,7 @@ width:78.75%;
.form_notice #notice_data-geo_selected button {
padding:0 4px;
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../images/icons/icons-01.png) no-repeat 0 -328px;
}

View File

@ -100,7 +100,7 @@ width:60%;
height:20px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
right:40%;
@ -110,7 +110,7 @@ z-index:9;
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
#form_notice #notice_text-count + label,
.form_notice .count + label,
#form_notice label[for="notice_data-attach"] {
display:none;
}

View File

@ -467,17 +467,17 @@ left:183px;
padding:0;
height:16px;
}
#form_notice .form_note {
.form_notice .count {
position:absolute;
top:76px;
right:98px;
z-index:9;
}
#form_notice .form_note dt {
.form_notice .count dt {
font-weight:bold;
display:none;
}
#notice_text-count {
.form_notice .count {
font-weight:bold;
line-height:1.15;
padding:1px 2px;

View File

@ -43,7 +43,7 @@ background:none;
}
input.submit,
#form_notice.warning #notice_text-count,
#form_notice.warning .count,
.form_settings .form_note,
.entity_remote_subscribe {
background-color:#8F0000;
@ -186,10 +186,10 @@ border-top-color:#87B4C8;
background:url(../images/illustrations/illu_pigeons-02.png) no-repeat 10% 100%;
}
#notice_text-count {
.form_notice .count {
color:#333333;
}
#form_notice.warning #notice_text-count {
#form_notice.warning .count {
color:#000000;
}
#form_notice label[for=notice_data-attach] {

View File

@ -245,7 +245,7 @@ address .poweredby {
height:16px;
}
.form_notice .form_note {
.form_notice .count {
position: absolute;
bottom: 0px;
right: 125px;
@ -253,15 +253,15 @@ address .poweredby {
font-size: 0.8em;
}
.form_notice .form_note dt {
.form_notice .count dt {
display:none;
}
.form_notice #notice_text-count {
.form_notice .count {
color: #777;
}
.form_notice.warning #notice_text-count {
.form_notice.warning .count {
color: #ff0000;
}

View File

@ -7,7 +7,7 @@ top:0;
.form_notice textarea {
width: 485px;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;
@ -65,7 +65,7 @@ line-height:auto;
filter: alpha(opacity=0);
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -328px;
}

View File

@ -7,7 +7,7 @@ top:0;
.form_notice textarea {
width: 362px;
}
.form_notice .form_note + label {
.form_notice .count + label {
position:absolute;
top:25px;
left:83%;
@ -67,7 +67,7 @@ line-height:auto;
filter: alpha(opacity=0);
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px;
}

View File

@ -80,7 +80,7 @@ float:left;
padding: 4px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
left: 175px;
@ -88,14 +88,14 @@ bottom:2px;
z-index:9;
}
#form_notice-direct.form_notice #notice_text-count {
#form_notice-direct.form_notice .count {
left: -185px;
}
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
.form_notice #notice_text-count + label,
.form_notice .count + label,
.form_notice label[for="notice_data-attach"] {
display:none;
}

View File

@ -43,7 +43,7 @@
/* bolding */
caption, legend, input.submit, form label, .form_settings #settings_autosubscribe label, address .fn, .system_notice dt, #anon_notice, #site_nav_local_views a, #licenses dt, .form_notice .form_note dt, .form_notice #notice_text-count, button.close, button.minimize, .entity_profile dt, #entity_statistics dt, .entity_profile .fn, .entity_profile .nickname, .entity_actions a, .entity_moderation p, .entity_role p, #showapplication .entity_data dt, .notice .author .fn, .dialogbox .submit_dialogbox, #attachments dt, #attachment_view #oembed_info dt, #filter_tags_all a, .pagination dt, .pagination a, #tagcloud.section dt {
caption, legend, input.submit, form label, .form_settings #settings_autosubscribe label, address .fn, .system_notice dt, #anon_notice, #site_nav_local_views a, #licenses dt, .form_notice .count dt, .form_notice .count, button.close, button.minimize, .entity_profile dt, #entity_statistics dt, .entity_profile .fn, .entity_profile .nickname, .entity_actions a, .entity_moderation p, .entity_role p, #showapplication .entity_data dt, .notice .author .fn, .dialogbox .submit_dialogbox, #attachments dt, #attachment_view #oembed_info dt, #filter_tags_all a, .pagination dt, .pagination a, #tagcloud.section dt {
font-weight: normal;
font-family: 'LinuxLibertineBold', serif;
}
@ -228,13 +228,13 @@ h1, h2, h3, h4, h5, h6 {
background:none;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note {
background-color:#9BB43E;
}
input.submit,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions a,
.entity_actions input,
@ -255,7 +255,7 @@ button {
input:focus, textarea:focus, select:focus,
.form_notice.warning textarea,
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.form_settings .form_note,
.entity_actions .dialogbox .form_data input:focus {
border-color:#9BB43E;
@ -318,11 +318,11 @@ a,
border-top-color:#C8D1D5;
}
#notice_text-count {
.form_notice .count {
color:#333333;
}
.form_notice.warning #notice_text-count,
.form_notice.warning .count,
.dialogbox,
.entity_actions .dialogbox input {
color:#000000;

View File

@ -6,7 +6,7 @@ color:#FFFFFF;
#site_nav_local_views a {
background-color:#C8D1D5;
}
.form_notice .form_note + label {
.form_notice .count + label {
background:transparent url(../../base/images/icons/icons-01.gif) no-repeat 0 -328px;
}
.form_notice #notice_data-attach {

View File

@ -95,7 +95,7 @@ width:60%;
height:20px;
}
#notice_text-count {
.form_notice .count {
position:absolute;
bottom:2px;
right:40%;
@ -105,7 +105,7 @@ z-index:9;
/*input type=file no good in
iPhone/iPod Touch, Android, Opera Mini Simulator
*/
#form_notice #notice_text-count + label,
.form_notice .count + label,
#form_notice label[for="notice_data-attach"] {
display:none;
}