diff options
author | Sarven Capadisli <csarven@status.net> | 2009-11-11 18:20:58 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-11-11 18:20:58 +0000 |
commit | b8b4d3d2f2ab657105a914577c6335be5bb14ae2 (patch) | |
tree | 7ba2b3fffa00b5aeb38e013ff4dd55a74eb62e3e | |
parent | 686c2e5e064573a70e38e8df6d5fb60061858599 (diff) |
Separated actions that's particular to the notice stream pages into
its own function. It can be reused whenever the common behaviours
needs to be initialized.
-rw-r--r-- | js/util.js | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/js/util.js b/js/util.js index b90f33ec7..f03a1e67c 100644 --- a/js/util.js +++ b/js/util.js @@ -370,31 +370,39 @@ var SN = { // StatusNet return false; }); } - } -}; + }, -$(document).ready(function(){ - if ($('body.user_in').length > 0) { - $('.'+SN.C.S.FormNotice).each(function() { - SN.U.FormNoticeXHR($(this)); - SN.U.FormNoticeEnhancements($(this)); - }); + Init: { + Notices: 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)); }); + $('.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.NoticeReply(); + SN.U.NoticeReply(); - SN.U.NoticeDataAttach(); + SN.U.NoticeDataAttach(); - SN.U.NewDirectMessage(); + SN.U.NewDirectMessage(); + } + + SN.U.NoticeAttachments(); + } } +}; - SN.U.NoticeAttachments(); +$(document).ready(function(){ + if ($('#content .notices').length >0) { + SN.Init.Notices(); + } }); |