PageSourceSearch

https://www.orix.com/wp-content/themes/orix/assets/js/custom.js?ver=1790349397

js orix.com collected 2026-09-25 15:24:48 UTC 20,864 bytes, 526 lines download raw bytes

1let OPDelay;
2
3// Get Query String
4function getParameterByName(name, url) {
5    if (!url) url = window.location.href;
6    name = name.replace(/[\[\]]/g, '\\$&');
7    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
8        results = regex.exec(url);
9    if (!results) return null;
10    if (!results[2]) return '';
11    return decodeURIComponent(results[2].replace(/\+/g, ' '));
12}
13
14function trigger_animaiton() {
15    $(".slide_up").slideUp();
16};
17
18
19function OPSubmitDelay() {
20    clearTimeout(OPDelay);
21    OPDelay = setTimeout(() => {
22        jQuery('form.op-filter').submit();
23    }, 800);
24}
25
26
27$.fn.slideUp = function () {
28    const $elem = this;
29    const eachFn = function () {
30        const $el = $(this);
31        function init() {
32            gsap.from($el[0], {
33                scrollTrigger: {
34                    start: '0 80%',
35                    end: 'bottom top',
36                    trigger: $el[0],
37                    onEnter() {
38                        $el.addClass('slide_up__active');
39                    },
40                    onLeaveBack() {
41                        $el.removeClass('slide_up__active');
42                    }
43                }
44            });
45        }
46        init();
47    };
48    $elem.each(eachFn);
49    return $elem;
50};
51
52jQuery(document).ready(function ($) {
53    let activeAjaxRequest;
54    // Our People Filter
55    jQuery('form.op-filter input[type="radio"]').on('change', function () {
56        OPSubmitDelay();
57    });
58
59    jQuery('.btn_reset_filters').on('click', function () {
60        jQuery('form.op-filter').submit();
61        jQuery('form.search-filter').submit();
62        jQuery('form.ni-filter').submit();
63    });
64
65    // btn_reset_filters
66
67    jQuery(document).on('submit', 'form.op-filter', function (e) {
68        e.preventDefault();
69        jQuery('.page-our-people').addClass('people-loading');
70        var $thisForm = jQuery(this);
71        var current_page_url = jQuery('input[name="current_page_url"]', $thisForm).val();
72        var page_id = jQuery('input[name="page_id"]', $thisForm).val();
73
74        var people_category = [];
75        jQuery.each(jQuery('input[data-name="people_category[]"]:checked', $thisForm), function () {
76            people_category.push(jQuery(this).val());
77        });
78
79        var capabilities = [];
80        jQuery.each(jQuery('input[data-name="capabilities[]"]:checked', $thisForm), function () {
81            capabilities.push(jQuery(this).val());
82        });
83
84        var selected_item_count = people_category.length + capabilities.length;
85        var category_selected_item_count = people_category.length;
86        var unit_selected_item_count = capabilities.length;
87
88        if (selected_item_count == 1) {
89            if (category_selected_item_count) {
90                // console.log('Category');
91                history.pushState(null, null, current_page_url); // Reset URL
92                window.history.pushState("", "Category", people_category[0] + '/');
93            }
94
95            if (unit_selected_item_count) {
96                // console.log('Unit');
97                history.pushState(null, null, current_page_url); // Reset URL
98                window.history.pushState("", "Unit", capabilities[0] + '/');
99            }
100
101
102        } else if (selected_item_count > 1) {
103            history.pushState(null, null, current_page_url); // Reset URL
104            var qr_string = [];
105            if (category_selected_item_count) {
106                qr_string.push('category=' + people_category);
107            }
108
109            if (unit_selected_item_count) {
110                qr_string.push('business-unit=' + capabilities);
111            }
112            window.history.pushState("", "", '?' + qr_string.join("&"));
113        } else {
114            history.pushState(null, null, current_page_url); // Reset URL
115        }
116
117        var paged = jQuery('input[name="paged"]', $thisForm).val();
118        var page_id = jQuery('input[name="page_id"]', $thisForm).val();
119        if (activeAjaxRequest) {
120            activeAjaxRequest.abort();
121            activeAjaxRequest = null;
122        }
123        activeAjaxRequest = jQuery.ajax({
124            type: "POST",
125            dataType: "json",
126            url: orix_object.ajax_url,
127            data: {
128                action: "orix_op_filter",
129                people_category: people_category,
130                capabilities: capabilities,
131                paged: paged,
132                page_id: page_id
133            },
134            success: function (response) {
135                // console.log(response);
136                jQuery('div.card_people, .editor-content.not-result').remove();
137                if (response.found_posts > 0) {
138                    jQuery(".container_list").append(response.content);
139                } else {
140                    jQuery(".ct_people_list").append(response.content);
141                }
142                // jQuery('button.btn_filter_mobile .text').html(response.filter_applied);
143                if (jQuery('.card_people').length) {
144                    gsap.fromTo('.card_people', {
145                        y: 40,
146                        opacity: 0,
147                    }, {
148                        y: 0,
149                        opacity: 1,
150                        duration: 1, // seconds
151                        delay: 0.4,
152                        ease: "power2.inOut",
153                        stagger: 0.1, // stagger start times
154                    });
155                }
156                jQuery('.page-our-people').removeClass('people-loading');
157            },
158            error: function (e) {
159                console.warn('ajax error', e);
160            },
161            complete: function() {
162                activeAjaxRequest = null;
163            }
164        });
165    });
166
167    if (jQuery('.card_people').length) {
168        gsap.fromTo('.card_people', {
169            y: 40,
170            opacity: 0,
171        }, {
172            y: 0,
173            opacity: 1,
174            duration: 1, // seconds
175            delay: 0.4,
176            ease: "power2.inOut",
177            stagger: 0.1, // stagger start times
178        });
179    }
180
181    // News & Insights Filter
182    jQuery('form.ni-filter input[type="checkbox"]').on('change', function () {
183        jQuery('form.ni-filter input[name="paged"]').val('1');
184        var has_parent = jQuery(this).attr('data-parent-capability');
185        if (typeof has_parent !== 'undefined' && has_parent !== false && this.checked) {
186            jQuery("form.ni-filter input[type=checkbox][value=" + has_parent + "]").prop("checked", true);
187        }
188        jQuery('form.ni-filter').submit();
189    });
190
191    jQuery(document).on('submit', 'form.ni-filter', function (e) {
192        e.preventDefault();
193        var $thisForm = jQuery(this);
194        var current_page_url = jQuery('input[name="current_page_url"]', $thisForm).val();
195        var paged = jQuery('input[name="paged"]', $thisForm).val();
196        var page_id = jQuery('input[name="page_id"]', $thisForm).val();
197
198        var post_types = [];
199        jQuery.each(jQuery('input[name="post_type[]"]:checked', $thisForm), function () {
200            post_types.push(jQuery(this).val());
201        });
202
203        var capabilities = [];
204        jQuery.each(jQuery('input[name="capabilities[]"]:checked', $thisForm), function () {
205            capabilities.push(jQuery(this).val());
206        });
207
208        var parent_capabilities = [];
209        jQuery.each(jQuery('input[name="capabilities[]"][data-type="type"]:checked', $thisForm), function () {
210            parent_capabilities.push(jQuery(this).val());
211        });
212
213        var child_capabilities = [];
214        jQuery.each(jQuery('input[name="capabilities[]"][data-type="unit"]:checked', $thisForm), function () {
215            child_capabilities.push(jQuery(this).val());
216        });
217
218        var selected_item_count = post_types.length + capabilities.length;
219        var category_selected_item_count = post_types.length;
220        var type_selected_item_count = parent_capabilities.length;
221        var unit_selected_item_count = child_capabilities.length;
222
223        if (selected_item_count == 1) {
224            if (category_selected_item_count) {
225                // console.log('Category');
226                history.pushState(null, null, current_page_url); // Reset URL
227                window.history.pushState("", "Category", post_types[0] + '/');
228            }
229            if (type_selected_item_count) {
230                // console.log('Type');
231                history.pushState(null, null, current_page_url); // Reset URL
232                window.history.pushState("", "Type", parent_capabilities[0] + '/');
233            }
234            if (unit_selected_item_count) {
235                // console.log('Unit');
236                history.pushState(null, null, current_page_url); // Reset URL
237                window.history.pushState("", "Unit", child_capabilities[0] + '/');
238            }
239            var pathname = window.location.pathname;
240            if (paged > 1) {
241                window.history.pushState(null, null, paged + '/');
242            }
243
244        } else if (selected_item_count > 1) {
245            history.pushState(null, null, current_page_url); // Reset URL
246            var qr_string = [];
247            if (category_selected_item_count) {
248                qr_string.push('category=' + post_types);
249            }
250
251            if (type_selected_item_count) {
252                qr_string.push('type=' + parent_capabilities);
253            }
254
255            if (unit_selected_item_count) {
256                qr_string.push('business-unit=' + child_capabilities);
257            }
258
259            if (paged > 1) {
260                qr_string.push('paged=' + paged);
261            }
262            var pathname = window.location.pathname;
263            window.history.pushState("", "", '?' + qr_string.join("&"));
264        } else {
265            history.pushState(null, null, current_page_url); // Reset URL
266            var pathname = window.location.pathname;
267            if (paged > 1) {
268                window.history.pushState(null, null, paged + '/');
269            }
270        }
271
272        // console.log('Category Selected: ' + category_selected_item_count);
273        // console.log('Type Selected: ' + type_selected_item_count);
274        // console.log('Unit Capabilities Selected: ' + unit_selected_item_count);
275        // console.log('Total Filter Selected: ' + selected_item_count);
276        var current_full_path = window.location.href.split('?')[0];
277        var current_full_path_with_query = window.location.href;
278
279        jQuery('.loader').remove();
280        jQuery('<span class="loader"><i class="fas fa-spinner fa-pulse"></i></span>').insertAfter(".container_list");
281        if (activeAjaxRequest) {
282            activeAjaxRequest.abort();
283            activeAjaxRequest = null;
284        }
285        activeAjaxRequest = jQuery.ajax({
286            type: "POST",
287            dataType: "json",
288            url: orix_object.ajax_url,
289            data: {
290                action: "orix_ni_filter",
291                post_types: post_types,
292                capabilities: capabilities,
293                paged: paged,
294                page_id: page_id,
295                current_full_path: current_full_path,
296                pathname: pathname,
297                full_path: current_full_path_with_query,
298                parent_capabilities: parent_capabilities,
299                child_capabilities: child_capabilities
300
301            },
302            success: function (response) {
303                // console.log(response);
304                jQuery('.loader').remove();
305                jQuery('.container_load_more').hide();
306                jQuery('.editor-content.not-result').remove();
307                jQuery('.ct_search_result_list ul li').remove();
308                jQuery(".ct_search_result_list ul").append(response.content);
309                // jQuery('button.btn_filter_mobile .text').html(response.filter_applied);
310                jQuery("div.container_pagination").empty().append(response.pagination);
311                jQuery("div.container_pagination").show();
312                trigger_animaiton();
313            },
314            error: function (e) {
315                console.warn('ajax error', e);
316            },
317            complete: function() {
318                activeAjaxRequest = null;
319            }
320        });
321    });
322
323    // Ajax Pagination
324    jQuery('body').on('click', '.ajax-pagination a', function (e) {
325        e.preventDefault();
326        var paged = getParameterByName('paged', jQuery(this).attr('href'));
327        var paged_by_url = jQuery(this).attr('href').match(/\d+/);
328        var paged_by_text = jQuery(this).text();
329        if (!paged) {
330            if (paged_by_url) {
331                paged = paged_by_url[0];
332            } else {
333                paged = 1;
334            }
335        }
336        jQuery('input[name="paged"]').val(paged);
337        if (jQuery('form.ni-filter').length) {
338            jQuery('form.ni-filter').submit();
339            jQuery(document).ajaxComplete(function () {
340                var offset_top = jQuery(".page-news").offset();
341                if (offset_top) {
342                    window.scrollTo(0, offset_top.top); // values are x,y-offset
343                }
344            });
345        }
346        if (jQuery('form.search-filter').length) {
347            jQuery('form.search-filter').submit();
348            jQuery(document).ajaxComplete(function () {
349                var offset_top = jQuery(".ct_search_result_list").offset();
350                if (offset_top) {
351                    window.scrollTo(0, offset_top.top); // values are x,y-offset
352                }
353            });
354        }
355    });
356
357    // Load More News & Insights Posts
358    var count = jQuery("#load-more").attr('data-current-paged');
359    $("#load-more").click(function () {
360        count++;
361        var max_pages = jQuery(this).attr('data-max-pages');
362        var page_url = jQuery(this).attr('data-current-url');
363        $.ajax({
364            url: page_url + count + '/',
365            success: function (data) {
366                history.pushState(null, null, page_url);
367                window.history.pushState(null, null, count + '/');
368                jQuery('.ct_search_result_list ul').append($(data).find("li.item_result"));
369                trigger_animaiton();
370            }
371        });
372        if (max_pages == count) { $("#load-more").hide(); } // Hide Button if no more post available
373    });
374
375    // Auto Search Result jQuery
376    var typingTimer;                //timer identifier
377    var doneTypingInterval = 1000;  //time in ms, 5 seconds for example
378    var $input = jQuery("input[name='s']");
379
380    //on keyup, start the countdown
381    jQuery(".auto-search input[name='s']").on('keyup', function () {
382        jQuery('.auto-search div.spinner').remove();
383        jQuery('<div class="spinner"><div class="spinner__circle"><div class="spinner__circle-gradient"></div><div class="spinner__circle-inner"></div></div></div>').insertBefore(".auto-search .btn_form_reset");
384        clearTimeout(typingTimer);
385        typingTimer = setTimeout(search_callback, doneTypingInterval);
386    });
387
388    //on keydown, clear the countdown
389    jQuery(".auto-search input[name='s']").on('keydown', function () {
390        jQuery('.auto-search div.spinner').remove();
391        jQuery('<div class="spinner"><div class="spinner__circle"><div class="spinner__circle-gradient"></div><div class="spinner__circle-inner"></div></div></div>').insertBefore(".auto-search .btn_form_reset");
392        clearTimeout(typingTimer);
393    });
394
395    //user is "finished typing," do something
396    function search_callback() {
397        var string = jQuery(".auto-search input[name='s']").val();
398        // console.log(string);
399        if (string) {
400            jQuery('.auto-search div.spinner').remove();
401            jQuery('<div class="spinner"><div class="spinner__circle"><div class="spinner__circle-gradient"></div><div class="spinner__circle-inner"></div></div></div>').insertBefore(".auto-search .btn_form_reset");
402        } else {
403            jQuery('.auto-search div.spinner').remove();
404        }
405        jQuery.ajax({
406            type: 'POST',
407            url: orix_object.ajax_url,
408            dataType: "json",
409            data: {
410                action: "auto_search",
411                string: string
412            },
413            success: function (response) {
414                // console.log(response);
415                jQuery('.auto-result').show();
416                jQuery('.auto-result').empty();
417                jQuery('.auto-result').append(response.html);
418                jQuery('.auto-search div.spinner').remove();
419                if (!string) {
420                    jQuery('.auto-result').empty();
421                    jQuery('.auto-result').hide();
422                }
423            }
424        })
425    }
426
427    // Search Result Page
428    jQuery('form.search-filter input[type="checkbox"]').on('change', function () {
429        jQuery('form.search-filter input[name="paged"]').val('1');
430        jQuery('form.search-filter').submit();
431    });
432
433    jQuery(document).on('submit', 'form.search-string', function (e) {
434        e.preventDefault();
435        jQuery('form.search-filter').submit();
436    });
437
438    jQuery('form.search-filter input[name="orderby"]').val('relevance');
439    jQuery('.sort_controls a[data-orderby="relevance"]').css('background-size', '100% 2px');
440    jQuery('.sort_controls a').click(function () {
441        jQuery('.sort_controls a').removeAttr("style");
442        jQuery('.sort_controls a').removeClass('active');
443        jQuery(this).addClass('active');
444        jQuery(this).css('background-size', '100% 2px');
445        // console.log(jQuery(this).attr('data-orderby'));
446        jQuery('form.search-filter input[name="orderby"]').val(jQuery(this).attr('data-orderby'));
447        jQuery('form.search-filter').submit();
448    })
449
450    jQuery(document).on('submit', 'form.search-filter', function (e) {
451        e.preventDefault();
452
453        var $thisForm = jQuery(this);
454
455        jQuery('form.search-string div.spinner').remove();
456        jQuery('<div class="spinner"><div class="spinner__circle"><div class="spinner__circle-gradient"></div><div class="spinner__circle-inner"></div></div></div>').insertBefore("form.search-string .btn_form_reset");
457
458        var post_types = [];
459        jQuery.each(jQuery('input[name="post_type[]"]:checked', $thisForm), function () {
460            post_types.push(jQuery(this).val());
461        });
462
463        var post_category = [];
464        jQuery.each(jQuery('input[name="post_category[]"]:checked', $thisForm), function () {
465            post_category.push(jQuery(this).val());
466        });
467
468        var capabilities = [];
469        jQuery.each(jQuery('input[name="capabilities[]"]:checked', $thisForm), function () {
470            capabilities.push(jQuery(this).val());
471        });
472
473
474        if (post_types.length == 1 && post_category.length == 0) {
475            jQuery('.sort_controls').hide();
476        } else {
477            jQuery('.sort_controls').show();
478        }
479
480        var paged = jQuery('input[name="paged"]', $thisForm).val();
481        var order_by = jQuery('input[name="orderby"]', $thisForm).val();
482        var search_string = jQuery('#search_page_term').val();
483        jQuery('.loader').remove();
484        jQuery('<span class="loader"><i class="fas fa-spinner fa-pulse"></i></span>').insertAfter(".container_list");
485        jQuery.ajax({
486            type: "POST",
487            dataType: "json",
488            url: orix_object.ajax_url,
489            data: {
490                action: "orix_search_filter",
491                post_types: post_types,
492                capabilities: capabilities,
493                post_category: post_category,
494                paged: paged,
495                order_by: order_by,
496                search_string: search_string,
497            },
498            success: function (response) {
499                // console.log(response);
500                jQuery('form.search-string div.spinner').remove();
501                jQuery('.loader').remove();
502                jQuery('.container_load_more').hide();
503                jQuery('.editor-content.not-result').remove();
504                jQuery('.ct_search_result_list ul li').remove();
505                jQuery(".ct_search_result_list ul").append(response.content);
506                // jQuery('button.btn_filter_mobile .text').html(response.filter_applied);
507                jQuery("div.ajax-pagination").empty().append(response.pagination);
508                jQuery("div.ajax-pagination").show();
509                jQuery('.nb_result_txt').html(response.found_posts_html);
510                trigger_animaiton();
511            },
512            error: function (e) {
513                console.warn('ajax error', e);
514            }
515        });
516    });
517
518    // Fix Drawers Issue
519    jQuery('[data-toggle-parent]').click(function (e) {
520        jQuery(this).parent().find('.block_drawers-item-description').slideToggle();
521    })
522
523    // add class on #site div
524    jQuery('body.page-template-template-our-firm #site').addClass('ourfirm bluebg');
525
526})

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.