Notice form cleanup: drop use of id for #notice_data-text (prep for reusable notice form)
This commit is contained in:
parent
1ff17f0ed9
commit
f94a5e1a6a
38
js/util.js
38
js/util.js
@ -50,7 +50,6 @@ var SN = { // StatusNet
|
||||
Processing: 'processing',
|
||||
CommandResult: 'command_result',
|
||||
FormNotice: 'form_notice',
|
||||
NoticeDataText: 'notice_data-text',
|
||||
NoticeTextCount: 'notice_text-count',
|
||||
NoticeInReplyTo: 'notice_in-reply-to',
|
||||
NoticeActionSubmit: 'notice_action-submit',
|
||||
@ -112,7 +111,7 @@ var SN = { // StatusNet
|
||||
|
||||
SN.U.Counter(form);
|
||||
|
||||
NDT = form.find('#'+SN.C.S.NoticeDataText);
|
||||
NDT = form.find('[name=status_textarea]');
|
||||
|
||||
NDT.bind('keyup', function(e) {
|
||||
SN.U.Counter(form);
|
||||
@ -191,7 +190,7 @@ var SN = { // StatusNet
|
||||
* @return number of chars
|
||||
*/
|
||||
CharacterCount: function(form) {
|
||||
return form.find('#'+SN.C.S.NoticeDataText).val().length;
|
||||
return form.find('[name=status_textarea]').val().length;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -332,7 +331,7 @@ var SN = { // StatusNet
|
||||
dataType: 'xml',
|
||||
timeout: '60000',
|
||||
beforeSend: function(formData) {
|
||||
if (form.find('#'+SN.C.S.NoticeDataText)[0].value.length === 0) {
|
||||
if (form.find('[name=status_textarea]').val() == '') {
|
||||
form.addClass(SN.C.S.Warning);
|
||||
return false;
|
||||
}
|
||||
@ -507,7 +506,7 @@ var SN = { // StatusNet
|
||||
* @access private
|
||||
*/
|
||||
NoticeReply: function() {
|
||||
if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
|
||||
if ($('#content .notice_reply').length > 0) {
|
||||
$('#content .notice').each(function() { SN.U.NoticeReplyTo($(this)); });
|
||||
}
|
||||
},
|
||||
@ -530,7 +529,6 @@ var SN = { // StatusNet
|
||||
notice.find('.notice_reply').live('click', function(e) {
|
||||
e.preventDefault();
|
||||
var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
|
||||
/* SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text()); */
|
||||
SN.U.NoticeInlineReplyTrigger(notice, '@' + nickname.text());
|
||||
return false;
|
||||
});
|
||||
@ -666,34 +664,6 @@ var SN = { // StatusNet
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* FIXME OBSOLETE?
|
||||
* Updates the new notice posting form with bits for replying to the
|
||||
* given user. Adds replyto parameter to the form, and a "@foo" to the
|
||||
* text area.
|
||||
*
|
||||
* @fixme replyto is a global variable, but probably shouldn't be
|
||||
*
|
||||
* @param {String} nick
|
||||
* @param {String} id
|
||||
*/
|
||||
NoticeReplySet: function(nick,id) {
|
||||
if (nick.match(SN.C.I.PatternUsername)) {
|
||||
var text = $('#'+SN.C.S.NoticeDataText);
|
||||
if (text.length > 0) {
|
||||
replyto = '@' + nick + ' ';
|
||||
text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
|
||||
$('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
|
||||
|
||||
text[0].focus();
|
||||
if (text[0].setSelectionRange) {
|
||||
var len = text.val().length;
|
||||
text[0].setSelectionRange(len,len);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Setup function -- DOES NOT apply immediately.
|
||||
*
|
||||
|
2
js/util.min.js
vendored
2
js/util.min.js
vendored
File diff suppressed because one or more lines are too long
@ -82,7 +82,7 @@ border-color:transparent;
|
||||
background-color:transparent;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note {
|
||||
border-color:#9BB43E;
|
||||
|
@ -1690,7 +1690,7 @@ border-color:transparent;
|
||||
background-color:transparent;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note {
|
||||
border-color:#9BB43E;
|
||||
@ -1705,7 +1705,7 @@ border-color:transparent;
|
||||
background-color:transparent;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note {
|
||||
border-color:#9BB43E;
|
||||
|
@ -80,7 +80,7 @@ border-color:transparent;
|
||||
background-color:transparent;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note,
|
||||
.entity_actions .dialogbox .form_data input:focus {
|
||||
|
@ -51,7 +51,7 @@ background-color:rgba(0, 255, 0, 0.5);
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, select:focus,
|
||||
#form_notice.warning #notice_data-text {
|
||||
#form_notice.warning textarea {
|
||||
border-color:#9BB43E;
|
||||
}
|
||||
input.submit,
|
||||
|
@ -80,7 +80,7 @@ border-color:transparent;
|
||||
background-color:transparent;
|
||||
}
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note,
|
||||
.entity_actions .dialogbox .form_data input:focus {
|
||||
|
@ -50,7 +50,7 @@ background-color:#8F0000;
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, select:focus,
|
||||
#form_notice.warning #notice_data-text {
|
||||
#form_notice.warning textarea {
|
||||
border-color:#8F0000;
|
||||
box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
|
||||
-moz-box-shadow:3px 3px 3px rgba(194, 194, 194, 0.3);
|
||||
|
@ -254,7 +254,7 @@ button {
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, select:focus,
|
||||
.form_notice.warning #notice_data-text,
|
||||
.form_notice.warning textarea,
|
||||
.form_notice.warning #notice_text-count,
|
||||
.form_settings .form_note,
|
||||
.entity_actions .dialogbox .form_data input:focus {
|
||||
|
Loading…
Reference in New Issue
Block a user