U: { // Utils
FormNoticeEnhancements: function(form) {
form_id = form.attr('id');
+ $('#'+form_id+' #'+SN.C.S.NoticeDataText).unbind('keyup');
+ $('#'+form_id+' #'+SN.C.S.NoticeDataText).unbind('keydown');
if (maxLength > 0) {
$('#'+form_id+' #'+SN.C.S.NoticeDataText).bind('keyup', function(e) {
SN.U.Counter(form);
if($('body')[0].id != 'conversation') {
$('#'+form_id+' textarea').focus();
}
-
- SN.U.FormNoticeXHR(form);
},
SubmitOnReturn: function(event, el) {
}
else {
$('#'+form_id+' #'+SN.C.S.NoticeDataText).val('');
- SN.U.FormNoticeEnhancements($('#'+SN.C.S.FormNotice));
+ SN.U.FormNoticeEnhancements($('#'+form_id));
}
}
}
$('#'+notice.id).fadeIn(2500);
SN.U.NoticeAttachments();
SN.U.NoticeReply();
+ SN.U.NoticeFavor();
}
}
$('#'+form_id+' #'+SN.C.S.NoticeDataText).val('');
return true;
},
+ NoticeFavor: function() {
+ $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
+ $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
+ },
+
NoticeAttachments: function() {
$.fn.jOverlay.options = {
method : 'GET',
$.get(NDM.attr('href'), null, function(data) {
$('.entity_send-a-message').append(document._importNode($('form', data)[0], true));
NDMF = $('.entity_send-a-message .form_notice');
+ SN.U.FormNoticeXHR(NDMF);
SN.U.FormNoticeEnhancements(NDMF);
NDMF.append('<button class="close">×</button>');
$('.entity_send-a-message button').click(function(){
return false;
});
}
- }
-};
+ },
-$(document).ready(function(){
- if ($('body.user_in').length > 0) {
- $('.'+SN.C.S.FormNotice).each(function() { SN.U.FormNoticeEnhancements($(this)); });
+ Init: {
+ NoticeForm: function() {
+ if ($('body.user_in').length > 0) {
+ $('.'+SN.C.S.FormNotice).each(function() {
+ SN.U.FormNoticeXHR($(this));
+ SN.U.FormNoticeEnhancements($(this));
+ });
- $('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); });
- $('.form_user_unsubscribe').each(function() { SN.U.FormXHR($(this)); });
- $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
- $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
- $('.form_group_join').each(function() { SN.U.FormXHR($(this)); });
- $('.form_group_leave').each(function() { SN.U.FormXHR($(this)); });
- $('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); });
+ SN.U.NoticeDataAttach();
+ }
+ },
- SN.U.NoticeReply();
+ Notices: function() {
+ if ($('body.user_in').length > 0) {
+ SN.U.NoticeFavor();
- SN.U.NoticeDataAttach();
+ SN.U.NoticeReply();
+ }
- SN.U.NewDirectMessage();
+ SN.U.NoticeAttachments();
+ },
+
+ EntityActions: function() {
+ if ($('body.user_in').length > 0) {
+ $('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); });
+ $('.form_user_unsubscribe').each(function() { SN.U.FormXHR($(this)); });
+ $('.form_group_join').each(function() { SN.U.FormXHR($(this)); });
+ $('.form_group_leave').each(function() { SN.U.FormXHR($(this)); });
+ $('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); });
+
+ SN.U.NewDirectMessage();
+ }
+ }
}
+};
- SN.U.NoticeAttachments();
+$(document).ready(function(){
+ if ($('.'+SN.C.S.FormNotice).length > 0) {
+ SN.Init.NoticeForm();
+ }
+ if ($('#content .notices').length > 0) {
+ SN.Init.Notices();
+ }
+ if ($('#content .entity_actions').length > 0) {
+ SN.Init.EntityActions();
+ }
});