summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2009-10-30 13:56:01 +0100
committerSarven Capadisli <csarven@status.net>2009-10-30 13:56:01 +0100
commitad759b2bc81e3676cec61257c6080821b7569559 (patch)
treeed16c242062fb015a9432b4bb3912dc6852a89d0
parent5a48a387fc20c5fbc1fb930e39fdbc5cf0862fbd (diff)
Updated NoticeReply and NoticeReplySet
-rw-r--r--js/util.js65
1 files changed, 33 insertions, 32 deletions
diff --git a/js/util.js b/js/util.js
index 77fbc1ee9..9874d614c 100644
--- a/js/util.js
+++ b/js/util.js
@@ -99,42 +99,12 @@ $(document).ready(function(){
SN.U.FormNoticeXHR();
- NoticeReply();
+ SN.U.NoticeReply();
NoticeAttachments();
NoticeDataAttach();
});
-function NoticeReply() {
- if ($('#notice_data-text').length > 0 && $('#content .notice_reply').length > 0) {
- $('#content .notice').each(function() {
- var notice = $(this)[0];
- $($('.notice_reply', notice)[0]).click(function() {
- var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
- NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
- return false;
- });
- });
- }
-}
-function NoticeReplySet(nick,id) {
- rgx_username = /^[0-9a-zA-Z\-_.]*$/;
- if (nick.match(rgx_username)) {
- var text = $("#notice_data-text");
- if (text.length) {
- replyto = "@" + nick + " ";
- text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
- $("#form_notice input#notice_in-reply-to").val(id);
- if (text.get(0).setSelectionRange) {
- var len = text.val().length;
- text.get(0).setSelectionRange(len,len);
- text.get(0).focus();
- }
- return false;
- }
- }
- return true;
-}
function NoticeAttachments() {
$.fn.jOverlay.options = {
@@ -319,7 +289,7 @@ var SN = { // StatusNet
$('#'+notice.id).css({display:'none'});
$('#'+notice.id).fadeIn(2500);
// SN.U.NoticeAttachments();
-// SN.U.NoticeReply();
+ SN.U.NoticeReply();
}
}
$('#'+SN.C.S.NoticeDataText).val('');
@@ -334,6 +304,37 @@ var SN = { // StatusNet
$('#'+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled);
}
});
+ },
+
+ NoticeReply: function() {
+ if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
+ $('#content .notice').each(function() {
+ var notice = $(this)[0];
+ $($('.notice_reply', notice)[0]).click(function() {
+ var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
+ SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
+ return false;
+ });
+ });
+ }
+ },
+
+ NoticeReplySet function(nick,id) {
+ if (nick.match(SN.C.I.PatternUsername)) {
+ var text = $('#'+SN.C.S.NoticeDataText);
+ if (text.length) {
+ replyto = '@' + nick + ' ';
+ text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
+ $('#'+SN.C.S.FormNotice+' input#'+SN.C.S.NoticeInReplyTo).val(id);
+ if (text.get(0).setSelectionRange) {
+ var len = text.val().length;
+ text.get(0).setSelectionRange(len,len);
+ text.get(0).focus();
+ }
+ return false;
+ }
+ }
+ return true;
}
}
}