PageSourceSearch

https://s2.poringa.net/js/shouts.lightbox.js?820

js poringa.net collected 2026-09-24 18:14:42 UTC 5,508 bytes, 187 lines download raw bytes

1$(document).ready(function () {
2  $(document).on('click.shout', '.shout-item .light-shoutbox', function (event) {
3    event.preventDefault();
4    var me = $(this);
5
6    var shout = me.closest('.shout-item');
7    var player = shout.find('embed')[0];
8    //check if is youtube video
9    if (player && player.src.indexOf('.swf') == -1 && player.pauseVideo) {
10      player.pauseVideo();
11    }
12
13    //check if is flash video (iframe)
14    if ((player = shout.find('iframe')[0])) {
15      player.contentWindow.postMessage('{"method": "pause", "value": 0}', '*');
16    }
17
18    $.getLightbox(me.data('id'));
19  });
20
21  $(document).on('click.shout', '.lightbox__close', $.closeLightbox);
22
23  $(document).keyup(function (e) {
24    if (e.keyCode == 27) {
25      $.closeLightbox();
26    }
27  });
28
29  $(document).on('click.shout', '.lightbox__next', function (event) {
30    $.lightBoxNext();
31  });
32
33  $(document).on('click.shout', '.lightbox__prev', function (event) {
34    $.lightBoxPrev();
35  });
36
37  $(document).on('click.shout', '#btn-top.lightbox__top', function (event) {
38    $(this).parents('.lightbox').stop().animate({ scrollTop: 0 }, '500', 'swing');
39  });
40
41  $(document).on('click.shout', '.comments-primary .comments-load-more-lightbox', function (event) {
42    var container = $(this).parents('#comments');
43    var loadMoreBtn = $(this);
44
45    loadMoreBtn.find('.loading').show();
46    $(this).find('.btn').hide();
47
48    iScroll.loadMore(container, {
49      success: function (response) {
50        if (container.data('page') == container.data('commentpages')) {
51          loadMoreBtn.remove();
52        } else {
53          loadMoreBtn.appendTo(loadMoreBtn.parent());
54          loadMoreBtn.find('.loading').hide();
55          loadMoreBtn.find('.btn').show();
56        }
57      },
58      error: function (response) {
59        loadMoreBtn.remove();
60      },
61    });
62  });
63});
64
65$(document).keydown(function (e) {
66  switch (e.which) {
67    case 37: // left
68      $.lightBoxPrev();
69      break;
70
71    case 39: // right
72      $.lightBoxNext();
73      break;
74
75    default:
76      return; // exit this handler for other keys
77  }
78  e.preventDefault(); // prevent the default action (scroll / move caret)
79});
80
81(function ($) {
82  var lightBoxIdle = false;
83  var shoutLightbox = $('#shout-lightbox').length
84    ? $('#shout-lightbox')
85    : $('<div id="shout-lightbox"></div>').appendTo('body');
86
87  $.getLightbox = function (shoutId, success) {
88    var lightBox = $('#shout-lightbox').find('.lightbox[data-id=' + shoutId + ']');
89    if (lightBox.length) {
90      return $.showLightbox(shoutId);
91    }
92    if (lightBoxIdle) {
93      return;
94    }
95    lightBoxIdle = true;
96    $('#shout-lightbox').addClass('lightbox-loading');
97    $.ajax({
98      type: 'get',
99      url: '/serv/shout/lightbox/' + shoutId,
100      success: function (lightboxContent) {
101        lightBoxIdle = false;
102        shoutLightbox.removeClass('lightbox-loading');
103        shoutLightbox.append(lightboxContent);
104        var lightbox = shoutLightbox.children().last();
105        $('.body_comm')
106          .filter(function () {
107            return !$(this).hasClass('markItUpEditor');
108          })
109          .markItUp(settingsComment);
110        $('.body_comm.emoji-picker-bottom').emojiPicker({
111          pickerPosition: 'bottom',
112        });
113
114        $.showLightbox(shoutId);
115        if (success) {
116          success(lightbox);
117        }
118
119        lightbox.find('.comments-main').iScroll({
120          scrollContainer: lightbox,
121          contentContainer: lightbox.find('.lightbox__content'),
122        });
123
124        lightbox.find('.hastipsy').tipsy({ gravity: 'n' });
125
126        // TODO: Since there's infinite scroll, the btn btn-top won't be seen
127        $(lightbox).scroll(function () {
128          var commentsSection = $(this).find('.comments-main');
129          var btnTop = $(this).find('#btn-top');
130
131          if ($(this).scrollTop() + 50 > commentsSection.offset().top) {
132            btnTop.fadeIn('slow');
133          } else {
134            btnTop.fadeOut('slow');
135          }
136        });
137      },
138      error: function (response) {
139        mydialog.alert(response.responseText);
140      },
141    });
142  };
143
144  $.showLightbox = function (shoutId) {
145    shoutLightbox.find('.lightbox').hide();
146
147    var lightBox = shoutLightbox.find('.lightbox[data-id=' + shoutId + ']');
148
149    lightBox.show().focus();
150    $('html').css({ overflow: 'hidden' });
151    $('.lightbox__prev').toggle(!$('#item_' + shoutId).is(':first-child'));
152    $.refreshWebms();
153  };
154
155  $.lightBoxNext = function () {
156    var shoutId = $('.lightbox:visible').data('id');
157    var currentShout = $('#item_' + shoutId);
158
159    var nextShout = currentShout.next();
160    if (!nextShout.length) {
161      return;
162    }
163    $.getLightbox(nextShout.data('fetchid'), function () {
164      if (nextShout.is(':nth-last-child(2)')) {
165        shoutsFeedScroll.trigger();
166      }
167    });
168  };
169
170  $.lightBoxPrev = function (prevBtn) {
171    var shoutId = $('.lightbox:visible').data('id');
172    var currentShout = $('#item_' + shoutId);
173
174    var prevShout = currentShout.prev();
175    if (!prevShout.length) {
176      return;
177    }
178    $('.lightbox__prev').toggle(prevShout.is(':first-child'));
179
180    $.getLightbox(prevShout.data('fetchid'));
181  };
182
183  $.closeLightbox = function () {
184    shoutLightbox.find('.lightbox').hide();
185    $('html').css({ overflow: 'auto' });
186  };
187})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.