PageSourceSearch

https://nairnhighlandgames.co.uk/wp-content/themes/wisdom-blog/assets/js/cv-custom-scripts.js?ver=1.0.2

js nairnhighlandgames.co.uk collected 2026-10-02 10:31:22 UTC 4,148 bytes, 108 lines download raw bytes

1jQuery(document).ready(function($) {
2
3    "use strict";
4    var KEYCODE_TAB = 9;
5
6    if($('body').hasClass("rtl")) {
7        var rtlValue = true;
8    } else {
9        var rtlValue = false;
10    }
11
12    /**
13     * Header Search script
14     */
15    $('.cv-menu-search .cv-search-icon').click(function() {
16        $('.cv-menu-search .cv-form-wrap').toggleClass('search-activate');
17        var element = document.querySelector( '.cv-menu-search .cv-form-wrap' );
18        var focusable = element.querySelectorAll( 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
19        var firstFocusable = focusable[0];
20        var lastFocusable = focusable[focusable.length - 1];
21        wisdom_blog_focus_trap( firstFocusable, lastFocusable );
22    });
23
24    $('.cv-menu-search .cv-form-close').click(function() {
25        $('.cv-menu-search .cv-form-wrap').removeClass('search-activate');
26        var focusClass = $(".cv-menu-search .cv-form-wrap .cv-form-close").data( 'focus' );
27        $( '.' + focusClass ).find( 'a' ).focus();
28    });
29
30    /**
31     * Settings about WOW animation
32     */
33    new WOW().init();
34    
35    /**
36     * responsive sub menu toggle
37     */
38    $('#masthead .menu-toggle').click(function(event) {
39        $( '#site-navigation' ).slideToggle('slow').addClass('active-nav');
40        var element = document.querySelector( '#site-navigation' );
41        var focusable = element.querySelectorAll( 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
42        var firstFocusable = focusable[0];
43        var lastFocusable = focusable[focusable.length - 1];
44        wisdom_blog_focus_trap( firstFocusable, lastFocusable );
45    });
46    
47    $('body .menu-toggle-off').on('click', function(){
48        $( '#site-navigation' ).removeClass('active-nav').slideToggle('slow');
49        var focusClass = $(this).data( 'focus' );
50        $( focusClass ).find( 'a' ).focus();
51    });
52
53    /*$('#site-navigation .menu-item-has-children').append('<span class="sub-toggle"> <i class="fa fa-angle-right"></i> </span>');
54    $('#site-navigation .page_item_has_children').append('<span class="sub-toggle"> <i class="fa fa-angle-right"></i> </span>');*/
55    $('<span class="sub-toggle"><a href="javascript:void(0);"><i class="fa fa-angle-right"></i></a></span>').insertAfter('#site-navigation .menu-item-has-children>a, #site-navigation .page_item_has_children>a');
56    
57
58    $('#site-navigation .menu-item-has-children .sub-toggle').on( 'click', function() {
59        $(this).parent('.menu-item-has-children').children('ul.sub-menu').first().slideToggle('1000');
60        $(this).parent('.page_item_has_children').children('ul.children').first().slideToggle('1000');
61        $(this).children('.fa-angle-right').first().toggleClass('fa-angle-down');
62    });
63
64    /**
65     * Sticky sidebar
66     */
67    $('#primary, #secondary').theiaStickySidebar({
68        additionalMarginTop: 40
69    });
70
71    /**
72     * Scroll To Top
73     */
74    $(window).scroll(function() {
75        if ($(this).scrollTop() > 1000) {
76            $('#cv-scrollup').fadeIn('slow');
77        } else {
78            $('#cv-scrollup').fadeOut('slow');
79        }
80    });
81    $('#cv-scrollup').click(function() {
82        $("html, body").animate({
83            scrollTop: 0
84        }, 600);
85        return false;
86    });
87
88    /**
89     * Focus trap in popup.
90     */
91    function wisdom_blog_focus_trap( firstFocusable, lastFocusable ) {
92        $(document).on('keydown', function(e) {
93            if (e.key === 'Tab' || e.keyCode === KEYCODE_TAB) {
94                if ( e.shiftKey ) /* shift + tab */ {
95                    if (document.activeElement === firstFocusable) {
96                        lastFocusable.focus();
97                        e.preventDefault();
98                    }
99                } else /* tab */ {
100                    if (document.activeElement === lastFocusable) {
101                        firstFocusable.focus();
102                        e.preventDefault();
103                    }
104                }
105            }
106        });
107    }
108});

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.