PageSourceSearch

https://stax.organicthemes.com/wp-content/plugins/organic-blocks-bundle/js/masonry-setup.js?ver=1763654358

js organicthemes.com collected 2026-10-02 04:30:10 UTC 2,665 bytes, 93 lines download raw bytes

1(function ($) {
2  'use strict'
3
4  /* Masonry --------------------- */
5  function masonrySetup () {
6    var $container = $('.obb-masonry-container');
7    
8    // Ensure Masonry initializes after images have loaded
9    $container.imagesLoaded(function() {
10      $container.masonry({
11        gutter: '.obb-grid-spacer',
12        itemSelector: '.obb-masonry-wrapper'
13      });
14    });
15  }
16
17  /* Isotope --------------------- */
18  function isotopeSetup () {
19    $('.obb-portfolio, .obb-posts').each(function (index, obj) {
20      var filterID = obj.getAttribute('data-id')
21      var $grid = $('#' + filterID + ' .obb-masonry-container.obb-isotope')
22      // Quick search regex
23      var qsRegex
24
25      // Initialize Isotope after images have loaded
26      $grid.imagesLoaded(function () {
27        $grid.isotope({
28          itemSelector: '.obb-masonry-wrapper',
29          percentPosition: true,
30          masonry: {
31            gutter: '.obb-grid-spacer'
32          }
33        })
34      });
35
36      // use value of search field to filter
37      $('#' + filterID + ' .obb-filter-search').on('click', 'input', function () {
38        $('.obb-filter-buttons button').off('click')
39        var $quicksearch = $('.quicksearch').keyup(debounce(function () {
40          qsRegex = new RegExp($quicksearch.val(), 'gi')
41          $grid.isotope({
42            filter: function () {
43              return qsRegex ? $(this).text().match(qsRegex) : true
44            }
45          })
46        }, 200))
47      })
48
49      $('#' + filterID + ' .obb-filter-buttons').on('click', 'button', function () {
50        var filterValue = $(this).attr('data-filter')
51        $grid.isotope({ filter: filterValue })
52      })
53
54      // debounce so filtering doesn't happen every millisecond
55      function debounce (fn, threshold) {
56        var timeout
57        threshold = threshold || 100
58        return function debounced () {
59          clearTimeout(timeout)
60          var args = arguments
61          var _this = this
62          function delayed () {
63            fn.apply(_this, args)
64          }
65          timeout = setTimeout(delayed, threshold)
66        }
67      }
68    })
69  }
70
71  // Recalculate layout on scroll to ensure items are in the correct positions
72  function recalculateLayoutOnScroll() {
73    $(window).on('scroll', function() {
74      $('.obb-masonry-container').each(function() {
75        var $this = $(this);
76        if ($this.is(':visible')) {
77          $this.masonry('layout');
78        }
79      });
80    });
81  }
82
83  $(document).ready(() => {
84    isotopeSetup();
85    masonrySetup();
86    recalculateLayoutOnScroll();
87  });
88
89  $(window).on('resize', () => {
90    isotopeSetup();
91    masonrySetup();
92  });
93})(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.