PageSourceSearch

https://www.cti.gr/wp-content/plugins/organic-blocks-bundle/js/masonry-setup.js?ver=1711029036

js cti.gr collected 2026-09-24 09:04:37 UTC 3,890 bytes, 122 lines download raw bytes

1(function ($) {
2  'use strict'
3
4  /* Masonry --------------------- */
5  function masonrySetup () {
6    var $container = $('.obb-masonry-container')
7    $container.masonry({
8      gutter: '.obb-grid-spacer',
9      itemSelector: '.obb-masonry-wrapper'
10    })
11  }
12
13  /* Isotope --------------------- */
14  function isotopeSetup () {
15    $('.obb-portfolio, .obb-posts').each(function (index, obj) {
16      var filterID = obj.getAttribute('data-id')
17      var $grid = $('#' + filterID + ' .obb-masonry-container.obb-isotope')
18      // Quick search regex
19      var qsRegex
20
21      // init Isotope
22      $grid.imagesLoaded(function () {
23        $grid.isotope({
24          itemSelector: '.obb-masonry-wrapper',
25          percentPosition: true,
26          masonry: {
27            gutter: '.obb-grid-spacer'
28          }
29        })
30      })
31
32      // use value of search field to filter
33      $('#' + filterID + ' .obb-filter-search').on('click', 'input', function () {
34        $('.obb-filter-buttons button').off('click')
35        var $quicksearch = $('.quicksearch').keyup(debounce(function () {
36          qsRegex = new RegExp($quicksearch.val(), 'gi')
37          $grid.isotope({
38            filter: function () {
39              return qsRegex ? $(this).text().match(qsRegex) : true
40            }
41          })
42        }, 200))
43      })
44
45      $('#' + filterID + ' .obb-filter-buttons').on('click', 'button', function () {
46        var filterValue = $(this).attr('data-filter')
47        $grid.isotope({ filter: filterValue })
48      })
49
50      // debounce so filtering doesn't happen every millisecond
51      function debounce (fn, threshold) {
52        var timeout
53        threshold = threshold || 100
54        return function debounced () {
55          clearTimeout(timeout)
56          var args = arguments
57          var _this = this
58          function delayed () {
59            fn.apply(_this, args)
60          }
61          timeout = setTimeout(delayed, threshold)
62        }
63      }
64    })
65  }
66
67  $(window).on('load', isotopeSetup)
68  $(window).on('load', masonrySetup)
69  $(window).on('resize', masonrySetup)
70  $(window).on('resize', isotopeSetup)
71  $('iframe.edit-site-visual-editor__editor-canvas').ready(function (e) {
72    setTimeout(function () {
73      isotopeSetup()
74      masonrySetup()
75    }, 1500)
76    // On scroll within FSE iframe.
77    $(this).on('scroll', function () {
78      isotopeSetup()
79      masonrySetup()
80    })
81  })
82  // if ($('.obb-masonry-container.obb-isotope').length) {
83  //   $(window).on('scroll', function () {
84  //     // This is then function used to detect if the element is scrolled into view.
85  //     function elementScrolled (elem) {
86  //       // if ($(elem).length === 0) {
87  //       //   return
88  //       // }
89  //       var docViewTop = $(window).scrollTop()
90  //       var docViewBottom = docViewTop + $(window).height()
91  //       var elemTop = $(elem).offset.top
92  //       return ((elemTop <= docViewBottom) && (elemTop >= docViewTop))
93  //     }
94  //     // This is where we use the function to detect if element is scrolled into view.
95  //     if (elementScrolled('.obb-masonry-container.obb-isotope')) {
96  //       isotopeSetup()
97  //     }
98  //   })
99  // }
100  // $('iframe.edit-site-visual-editor__editor-canvas').ready(function (e) {
101  //   // On initial load.
102  //   // setTimeout(function () {
103  //   //   // console.log('I loaded!')
104  //   //   isotopeSetup()
105  //   // }, 4500)
106  //   // On scroll within FSE iframe.
107  //   $(this).on('scroll', function () {
108  //     // console.log('I scrolled!')
109  //     isotopeSetup()
110  //   })
111  //   // On click within FSE iframe.
112  //   $(this).contents().bind('click', function (e) {
113  //     setTimeout(function () {
114  //       // console.log('I clicked!')
115  //       window.triggerReload = function () {
116  //         isotopeSetup()
117  //       }
118  //       window.triggerReload()
119  //     }, 500)
120  //   })
121  // })
122})(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.