PageSourceSearch

https://elquestro.com.au/js/posts.js?v=1760928867

js elquestro.com.au collected 2026-10-02 11:40:30 UTC 9,843 bytes, 266 lines download raw bytes

1/* Post archive list */
2$(document).ready(function() {
3    $('.post-sidebar-archive-list__item button').on('click', function() {
4        $(this).parent().toggleClass('post-sidebar-archive-list__item--expanded')
5        // $(this).next('.sidebar-linklist__item__sublist').slideToggle()
6    });
7});
8
9
10/* Post Hub */
11$(document).ready(function() {
12    var loadState = 'ready';
13
14    /**
15    * Method to load post's image
16    *
17    * @param {jquery-object} $selector
18    * @param {bool} animate Animate on true
19    * @return {void}
20    */
21    function loadPosts($selector, animate) {
22        animate = animate || false;
23
24        var numberOfPosts = $selector.length;
25        var postsLoaded = 0;
26
27        loadState = 'loading';
28
29        $selector.each(function() {
30            var $this = $(this);
31
32            // If post has image, load full size over top of placeholder
33            if ($this.attr('data-img') !== undefined) {
34                $('<img src="' + $this.attr("data-img") + '" alt="" class="post-grid__img">').prependTo($this.find(".post-grid__img-link"));
35
36                $this.find(".post-grid__img").load(function() {
37                    $this.removeClass("post-grid__item__image-loading").addClass("post-grid__item__image-loaded");
38                });
39            }
40
41            $this.removeClass("post-grid__item--hidden");
42
43            if (animate) {
44                $this.addClass("post-grid__item--animate");
45            }
46
47            postsLoaded++;
48            if (postsLoaded == numberOfPosts) {
49                // Reset load state
50                loadState = 'ready';
51            }
52        });
53    }
54
55    // First, hide other blog posts
56    $(".post-grid__item:gt(8)").addClass("post-grid__item--hidden");
57
58    // Load first blog posts
59    loadPosts($(".post-grid__item:lt(9)"));
60
61    // Show more posts on scroll
62    $(window).scroll(function() {
63        if ($('.js--load-on-scroll').length < 1) return;
64        if ($(window).scrollTop() + $(window).height() >= $(".post-grid").offset().top + $(".post-grid").height() - 300 && loadState == 'ready') {
65            // Load next 3 posts if they exist
66            if ($(".post-grid__item--hidden").length) {
67                loadPosts($(".post-grid__item--hidden:lt(9)"), true);
68            }
69        }
70    });
71
72
73    /**
74    * Method to filter posts by given category
75    *
76    * @param {string} category
77    * @return {void}
78    */
79    function filterPostsByCats(category) {
80        $('.post-grid').removeClass('post-grid--unfiltered').addClass('post-grid--filtered');
81        $('.post-grid__item, .post-grid .card').removeClass('post-grid__item--filtered-visible post-grid__item--filtered-pre-visible').addClass('post-grid__item--filtered-hidden');
82
83        $('.post-grid__item, .post-grid .card').each(function() {
84            var categories = $(this).attr('data-categories');
85
86            if (categories.search(category) >= 0) {
87                $(this).removeClass('post-grid__item--filtered-hidden').addClass('post-grid__item--filtered-pre-visible');
88                loadPosts($(this));
89            }
90        });
91
92        window.location.hash = category;
93
94        setTimeout(function() {
95            $(".post-grid__item--filtered-pre-visible").removeClass("post-grid__item--filtered-pre-visible").addClass("post-grid__item--filtered-visible");
96        }, 1);
97    }
98
99
100    /**
101    * Method to filter posts by given tag
102    *
103    * @param {string} tag
104    * @return {void}
105    */
106    function filterPostsByTags(tag) {
107        $('.post-grid').removeClass('post-grid--unfiltered').addClass('post-grid--filtered');
108        $('.post-grid__item').removeClass('post-grid__item--filtered-visible post-grid__item--filtered-pre-visible').addClass('post-grid__item--filtered-hidden');
109
110        $('.post-grid__item').each(function() {
111            var tags = $(this).attr('data-tags');
112
113            if (tags.search(tag) >= 0) {
114                $(this).removeClass('post-grid__item--filtered-hidden').addClass('post-grid__item--filtered-pre-visible');
115                loadPosts($(this));
116            }
117        });
118
119        setTimeout(function() {
120            $(".post-grid__item--filtered-pre-visible").removeClass("post-grid__item--filtered-pre-visible").addClass("post-grid__item--filtered-visible");
121        }, 1);
122    }
123
124
125    /**
126     * Click handler for category filter buttons
127     *
128     * @return {void}
129     */
130    $(".js-post-grid-filter-cat").click(function() {
131
132        var filterCategory = $(this).attr("data-category");
133
134        $(".js-post-grid-filter-cat").addClass("button-inactive");
135        $(this).removeClass("button-inactive");
136
137        if (filterCategory !== '*') {
138            filterPostsByCats(filterCategory);
139        } else {
140            $(".post-grid").removeClass("post-grid--filtered").addClass("post-grid--unfiltered");
141            $(".post-grid__item, .post-grid .card").removeClass("post-grid__item--filtered-visible post-grid__item--filtered-pre-visible post-grid__item--filtered-hidden").addClass("post-grid__item--animate-grow");
142            history.pushState("", document.title, window.location.pathname + window.location.search);
143        }
144    });
145
146
147    /**
148     * Click handler for tag filter buttons
149     *
150     * @return {void}
151     */
152    $(".js-post-grid-filter-tag").click(function() {
153
154        var filterTag = $(this).attr("data-tag");
155
156        $(".js-post-grid-filter-tag").addClass("button-inactive");
157        $(this).removeClass("button-inactive");
158
159        if (filterTag !== '*') {
160            filterPostsByTags(filterTag);
161        } else {
162            $(".post-grid").removeClass("post-grid--filtered").addClass("post-grid--unfiltered");
163            $(".post-grid__item").removeClass("post-grid__item--filtered-visible post-grid__item--filtered-pre-visible post-grid__item--filtered-hidden").addClass("post-grid__item--animate-grow");
164        }
165    });
166
167
168    // URL anchor support for filters
169    if (window.location.hash) {
170        var filter = window.location.hash.substr(1);
171
172        if ($('.js-post-grid-filterlist').length > 0) {
173            $(".js-post-grid-filter-cat").addClass("button-inactive");
174            $('.js-post-grid-filter-cat[data-category="' + filter +'"]').removeClass('button-inactive');
175
176            filterPostsByCats(filter);
177        }
178
179        if ($('.js-post-grid-tag-filterlist').length > 0) {
180            $(".js-post-grid-filter-tag").addClass("button-inactive");
181            $('.js-post-grid-filter-tag[data-tag="' + filter +'"]').removeClass('button-inactive');
182
183            filterPostsByTags(filter);
184        }
185
186    } else {
187        if ($('.js-post-grid-filterlist').length > 0) {
188            $(".js-post-grid-filter-cat").addClass("button-inactive");
189            $('.js-post-grid-filter-cat[data-category="*"]').removeClass('button-inactive');
190        }
191
192        if ($('.js-post-grid-tag-filterlist').length > 0) {
193            $(".js-post-grid-filter-tag").addClass("button-inactive");
194            $('.js-post-grid-filter-tag[data-tag="*"]').removeClass('button-inactive');
195        }
196    }
197
198
199    /**
200    * Change the filter buttons to a select menu on mobile
201    *
202    */
203
204    // Create a select and append to #menu
205    var $selectCat = $("<select class='js-post-grid-filter-cat__select post-grid-filter-cat__select'><option>-- Filter by category --</option></select>");
206    $(".js-post-grid-filterlist .field-input").append($selectCat);
207
208    var $selectTag = $("<select class='js-post-grid-filter-tag__select'><option>-- Filter by tag --</option></select>");
209    $(".js-post-grid-tag-filterlist .field-input").append($selectTag);
210
211    // Cycle over category buttons
212    $(".js-post-grid-filter-cat").each(function() {
213        var $anchor = $(this);
214        var $option = $("<option></option>");
215
216        // Deal with selected options depending on current page
217        if ($anchor.parent().hasClass("selected")) {
218            $option.prop("selected", true);
219        }
220
221        // Option's value is the href
222        $option.val($anchor.attr("data-category"));
223        // Option's text is the text of link
224        $option.text($anchor.text());
225        // Append option to select
226        $selectCat.append($option);
227    });
228
229    // Cycle over tag buttons
230    $(".js-post-grid-filter-tag").each(function() {
231        var $anchor = $(this);
232        var $option = $("<option></option>");
233
234        // Deal with selected options depending on current page
235        if ($anchor.parent().hasClass("selected")) {
236            $option.prop("selected", true);
237        }
238
239        // Option's value is the href
240        $option.val($anchor.attr("data-tag"));
241        // Option's text is the text of link
242        $option.text($anchor.text());
243        // Append option to select
244        $selectTag.append($option);
245    });
246
247    // Bind change listener to the category select
248    $selectCat.change(function() {
249        if ($selectCat.val() != '*' && $selectCat.val() != '-- Filter by category --') {
250            filterPostsByCats($selectCat.val());
251        } else {
252            $(".post-grid").removeClass("post-grid--filtered").addClass("post-grid--unfiltered");
253            $(".post-grid__item").removeClass("post-grid__item--filtered-visible post-grid__item--filtered-pre-visible post-grid__item--filtered-hidden").addClass("post-grid__item--animate-grow");
254        }
255    });
256
257    // Bind change listener to the tag select
258    $selectTag.change(function() {
259        if ($selectTag.val() != '*' && $selectTag.val() != '-- Filter by tag --') {
260            filterPostsByTags($selectTag.val());
261        } else {
262            $(".post-grid").removeClass("post-grid--filtered").addClass("post-grid--unfiltered");
263            $(".post-grid__item").removeClass("post-grid__item--filtered-visible post-grid__item--filtered-pre-visible post-grid__item--filtered-hidden").addClass("post-grid__item--animate-grow");
264        }
265    });
266});

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.