Separated Init functions to NoticeForm, Notices, EvenActions.

This commit is contained in:
Sarven Capadisli 2009-11-11 18:47:14 +00:00
parent b8b4d3d2f2
commit 095cf8ebf1
1 changed files with 25 additions and 10 deletions

View File

@ -373,36 +373,51 @@ var SN = { // StatusNet
}, },
Init: { Init: {
Notices: function() { NoticeForm: function() {
if ($('body.user_in').length > 0) { if ($('body.user_in').length > 0) {
$('.'+SN.C.S.FormNotice).each(function() { $('.'+SN.C.S.FormNotice).each(function() {
SN.U.FormNoticeXHR($(this)); SN.U.FormNoticeXHR($(this));
SN.U.FormNoticeEnhancements($(this)); SN.U.FormNoticeEnhancements($(this));
}); });
$('.form_user_subscribe').each(function() { SN.U.FormXHR($(this)); }); SN.U.NoticeDataAttach();
$('.form_user_unsubscribe').each(function() { SN.U.FormXHR($(this)); }); }
},
Notices: function() {
if ($('body.user_in').length > 0) {
$('.form_favor').each(function() { SN.U.FormXHR($(this)); }); $('.form_favor').each(function() { SN.U.FormXHR($(this)); });
$('.form_disfavor').each(function() { SN.U.FormXHR($(this)); }); $('.form_disfavor').each(function() { SN.U.FormXHR($(this)); });
SN.U.NoticeReply();
}
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_join').each(function() { SN.U.FormXHR($(this)); });
$('.form_group_leave').each(function() { SN.U.FormXHR($(this)); }); $('.form_group_leave').each(function() { SN.U.FormXHR($(this)); });
$('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); }); $('.form_user_nudge').each(function() { SN.U.FormXHR($(this)); });
SN.U.NoticeReply();
SN.U.NoticeDataAttach();
SN.U.NewDirectMessage(); SN.U.NewDirectMessage();
} }
SN.U.NoticeAttachments();
} }
} }
}; };
$(document).ready(function(){ $(document).ready(function(){
if ($('.'+SN.C.S.FormNotice).length > 0) {
SN.Init.NoticeForm();
}
if ($('#content .notices').length > 0) { if ($('#content .notices').length > 0) {
SN.Init.Notices(); SN.Init.Notices();
} }
if ($('#content .entity_actions').length > 0) {
SN.Init.EntityActions();
}
}); });