PageSourceSearch

https://yulingtianxia.com/js/gallery.js

js yulingtianxia.com collected 2026-10-04 00:13:35 UTC 1,683 bytes, 67 lines download raw bytes

1(function($){
2  // Caption
3  $('.entry').each(function(i){
4    $(this).find('img').each(function(){
5      if (!$(this).hasClass('nofancybox')){
6        var alt = this.alt;
7
8        if (alt){
9          $(this).after('<span class="caption">' + alt + '</span>');
10        }
11
12        $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox" rel="gallery' + i + '" />');
13      }
14    });
15  });
16
17  // Gallery
18  var play = function(parent, item, callback){
19    var width = parent.width();
20
21    item.imagesLoaded(function(){
22      var _this = this[0],
23        nWidth = _this.naturalWidth,
24        nHeight = _this.naturalHeight;
25
26      callback();
27      this.animate({opacity: 1}, 500);
28      parent.animate({height: width * nHeight / nWidth}, 500);
29    });
30  };
31
32  $('.gallery').each(function(){
33    var $this = $(this),
34      current = 0,
35      photoset = $this.children('.photoset').children(),
36      all = photoset.length,
37      loading = true;
38
39    play($this, photoset.eq(0), function(){
40      loading = false;
41    });
42
43    $this.on('click', '.prev', function(){
44      if (!loading){
45        var next = (current - 1) % all;
46        loading = true;
47
48        play($this, photoset.eq(next), function(){
49          photoset.eq(current).animate({opacity: 0}, 500);
50          loading = false;
51          current = next;
52        });
53      }
54    }).on('click', '.next', function(){
55      if (!loading){
56        var next = (current + 1) % all;
57        loading = true;
58
59        play($this, photoset.eq(next), function(){
60          photoset.eq(current).animate({opacity: 0}, 500);
61          loading = false;
62          current = next;
63        });
64      }
65    });
66  });
67})(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.