infinitescroll.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. // notices
  2. jQuery(document).ready(function($){
  3. $('notices_primary').infinitescroll({
  4. debug: false,
  5. infiniteScroll : !infinite_scroll_on_next_only,
  6. nextSelector : 'body#public li.nav_next a,'+
  7. 'body#all li.nav_next a,'+
  8. 'body#showstream li.nav_next a,'+
  9. 'body#replies li.nav_next a,'+
  10. 'body#showfavorites li.nav_next a,'+
  11. 'body#showgroup li.nav_next a,'+
  12. 'body#favorited li.nav_next a',
  13. loadingImg : ajax_loader_url,
  14. text : "<em>Loading the next set of posts...</em>",
  15. donetext : "<em>Congratulations, you\'ve reached the end of the Internet.</em>",
  16. navSelector : "#pagination",
  17. contentSelector : "#notices_primary ol.notices",
  18. itemSelector : "#notices_primary ol.notices > li"
  19. },function(){
  20. // Reply button and attachment magic need to be set up
  21. // for each new notice.
  22. // DO NOT run SN.Init.Notices() which will duplicate stuff.
  23. $(this).find('.notice').each(function() {
  24. SN.U.NoticeReplyTo($(this));
  25. SN.U.NoticeWithAttachment($(this));
  26. });
  27. // moving the loaded notices out of their container
  28. $('#infscr-loading').remove();
  29. var ids_to_append = Array(); var i=0;
  30. $.each($('.infscr-pages').children('.notice'),function(){
  31. // remove dupes
  32. if($('.threaded-notices > #' + $(this).attr('id')).length > 0) {
  33. $(this).remove();
  34. }
  35. // keep new unique notices
  36. else {
  37. ids_to_append[i] = $(this).attr('id');
  38. i++;
  39. }
  40. });
  41. var loaded_html = $('.infscr-pages').html();
  42. $('.infscr-pages').remove();
  43. // no results
  44. if(loaded_html == '') {
  45. }
  46. // append
  47. else {
  48. $('#notices_primary ol.notices').append(loaded_html);
  49. }
  50. });
  51. });
  52. // users
  53. jQuery(document).ready(function($){
  54. $('profile_list').infinitescroll({
  55. debug: false,
  56. infiniteScroll : !infinite_scroll_on_next_only,
  57. nextSelector : 'body#subscribers li.nav_next a, body#subscriptions li.nav_next a',
  58. loadingImg : ajax_loader_url,
  59. text : "<em>Loading the next set of users...</em>",
  60. donetext : "<em>Congratulations, you\'ve reached the end of the Internet.</em>",
  61. navSelector : "#pagination",
  62. contentSelector : "#content_inner ul.profile_list",
  63. itemSelector : "#content_inner ul.profile_list > li"
  64. },function(){
  65. // Reply button and attachment magic need to be set up
  66. // for each new notice.
  67. // DO NOT run SN.Init.Notices() which will duplicate stuff.
  68. $(this).find('.profile').each(function() {
  69. SN.U.NoticeReplyTo($(this));
  70. SN.U.NoticeWithAttachment($(this));
  71. });
  72. // moving the loaded notices out of their container
  73. $('#infscr-loading').remove();
  74. var ids_to_append = Array(); var i=0;
  75. $.each($('.infscr-pages').children('.profile'),function(){
  76. // remove dupes
  77. if($('.profile_list > #' + $(this).attr('id')).length > 0) {
  78. $(this).remove();
  79. }
  80. // keep new unique notices
  81. else {
  82. ids_to_append[i] = $(this).attr('id');
  83. i++;
  84. }
  85. });
  86. var loaded_html = $('.infscr-pages').html();
  87. $('.infscr-pages').remove();
  88. // no results
  89. if(loaded_html == '') {
  90. }
  91. // append
  92. else {
  93. $('#content_inner ul.profile_list').append(loaded_html);
  94. }
  95. });
  96. });
  97. // user directory
  98. jQuery(document).ready(function($){
  99. $('profile_list').infinitescroll({
  100. debug: false,
  101. infiniteScroll : !infinite_scroll_on_next_only,
  102. nextSelector : 'body#userdirectory li.nav_next a',
  103. loadingImg : ajax_loader_url,
  104. text : "<em>Loading the next set of users...</em>",
  105. donetext : "<em>Congratulations, you\'ve reached the end of the Internet.</em>",
  106. navSelector : "#pagination",
  107. contentSelector : "#profile_directory table.profile_list tbody",
  108. itemSelector : "#profile_directory table.profile_list tbody tr"
  109. },function(){
  110. // Reply button and attachment magic need to be set up
  111. // for each new notice.
  112. // DO NOT run SN.Init.Notices() which will duplicate stuff.
  113. $(this).find('.profile').each(function() {
  114. SN.U.NoticeReplyTo($(this));
  115. SN.U.NoticeWithAttachment($(this));
  116. });
  117. // moving the loaded notices out of their container
  118. $('#infscr-loading').remove();
  119. var ids_to_append = Array(); var i=0;
  120. $.each($('.infscr-pages').children('.profile'),function(){
  121. // remove dupes
  122. if($('.profile_list > #' + $(this).attr('id')).length > 0) {
  123. $(this).remove();
  124. }
  125. // keep new unique notices
  126. else {
  127. ids_to_append[i] = $(this).attr('id');
  128. i++;
  129. }
  130. });
  131. var loaded_html = $('.infscr-pages').html();
  132. $('.infscr-pages').remove();
  133. // no results
  134. if(loaded_html == '') {
  135. }
  136. // append
  137. else {
  138. $('#profile_directory table.profile_list tbody').append(loaded_html);
  139. }
  140. });
  141. });