PageSourceSearch

https://www.shapeyouripswich.com.au/packages/custom_ipswich/themes/the_hive_ipswich/js/main.js

js shapeyouripswich.com.au collected 2026-09-29 02:39:02 UTC 7,456 bytes, 197 lines download raw bytes

1function inputFocus(i) {
2    if (i.value == i.defaultValue) {
3        i.value = ''
4        i.style.color = '#FFFFFF'
5    }
6}
7
8function inputBlur(i) {
9    if (i.value == '') {
10        i.value = i.defaultValue
11        i.style.color = '#FFFFFF'
12    }
13}
14
15$(function() {
16    // MAIN NAVIGATION
17    var $nav = $('#navlinks')
18    $('.nav-toggle').on('click', function(e) {
19        e.preventDefault()
20        $('span.glyphicon', this)
21            .removeClass('glyphicon-menu-up')
22            .addClass('glyphicon-menu-down')
23        if ($nav.hasClass('is-open')) {
24            $nav.addClass('is-collapsing').removeClass('is-open')
25            setTimeout(function() {
26                $nav.removeClass('is-collapsing')
27            }, 300)
28        } else {
29            $nav.addClass('is-collapsing is-open')
30            $('span.glyphicon', this)
31                .removeClass('glyphicon-menu-down')
32                .addClass('glyphicon-menu-up')
33        }
34    })
35    // SEARCH BAR
36    navSearch()
37
38    // Initialize select2 on selects with the class
39    $('.select2').select2()
40
41    // Since select2 is older version, and doesn't support 'unselect' event
42    var selectVal,
43        selectPrevVal = []
44    $('.select2.select-multiple').on('change', function(e) {
45        selectPrevVal = !!selectVal && selectVal.length > 0 ? selectVal : selectPrevVal
46        optionAll = $(this).find('option[value=0]')
47        options = $(this).find('option')
48        selectVal = $(this).val()
49        if (!!selectVal && selectVal.indexOf('0') === 0) {
50            // if is 'all'
51            $(this)
52                .find('option:not([value=0])')
53                .prop('selected', true)
54        } else if (!!selectPrevVal && selectPrevVal.indexOf('0') === 0) {
55            options.prop('selected', false)
56        } else if (!selectVal || selectVal.length <= 0) {
57            // if no values selected
58            optionAll.prop('disabled', false)
59        } else {
60            // anything other than null or all
61            optionAll.prop('disabled', true)
62        }
63    })
64
65    function navSearch() {
66        var searchBtn = $('.nav-utilities-search-form-btnwrap').html()
67        var searchForm = $('.nav-utilities-search-form')
68            .detach()
69            .prependTo('.search-overlay')
70        $('.nav-utilities-search').html(searchBtn)
71        $('.nav-utilities-search button')
72            .prop('type', 'button')
73            .attr('id', 'js-trigger-overlay')
74
75        var triggerBttn = document.getElementById('js-trigger-overlay'),
76            overlay = document.querySelector('div.search-overlay'),
77            closeBttn = document.getElementById('search-close'),
78            searchInput = $('div.search-overlay input[type="search"]')
79        ;(transEndEventNames = {
80            WebkitTransition: 'webkitTransitionEnd',
81            MozTransition: 'transitionend',
82            OTransition: 'oTransitionEnd',
83            msTransition: 'MSTransitionEnd',
84            transition: 'transitionend',
85        }),
86            (transEndEventName = transEndEventNames[Modernizr.prefixed('transition')]),
87            (support = { transitions: Modernizr.csstransitions })
88
89        function toggleOverlay() {
90            if (classie.has(overlay, 'is-open')) {
91                classie.remove(overlay, 'is-open')
92                classie.add(overlay, 'is-close')
93                var onEndTransitionFn = function(ev) {
94                    if (support.transitions) {
95                        if (ev.propertyName !== 'visibility') return
96                        this.removeEventListener(transEndEventName, onEndTransitionFn)
97                    }
98                    classie.remove(overlay, 'is-close')
99                }
100                if (support.transitions) {
101                    overlay.addEventListener(transEndEventName, onEndTransitionFn)
102                } else {
103                    onEndTransitionFn()
104                }
105                triggerBttn.focus()
106                overlay.setAttribute('aria-hidden', 'true')
107                closeBttn.setAttribute('tabindex', '-1')
108            } else if (!classie.has(overlay, 'is-close')) {
109                classie.add(overlay, 'is-open')
110                searchInput.focus()
111                overlay.setAttribute('aria-hidden', 'false')
112                closeBttn.removeAttribute('tabindex')
113            }
114        }
115
116        triggerBttn.addEventListener('click', toggleOverlay)
117        closeBttn.addEventListener('click', toggleOverlay)
118
119        document.onkeydown = kp
120
121        function kp(e) {
122            var charCode = typeof e.which == 'number' ? e.which : e.keyCode
123            if (charCode == 27 && classie.has(overlay, 'is-open')) {
124                e.preventDefault()
125                toggleOverlay()
126            }
127            if (charCode == 9 && classie.has(overlay, 'is-open')) {
128                e.preventDefault()
129                var searchInput = $('#search-input'),
130                    searchBtn = $('#overlay-button'),
131                    closeBtn = $('#search-close')
132                if (e.target.id == 'search-close') {
133                    if (e.shiftKey) {
134                        searchBtn.focus()
135                    } else {
136                        searchInput.focus()
137                    }
138                } else if (e.target.id == 'search-input') {
139                    if (e.shiftKey) {
140                        closeBtn.focus()
141                    } else {
142                        searchBtn.focus()
143                    }
144                } else if (e.target.id == 'overlay-button') {
145                    if (e.shiftKey) {
146                        searchInput.focus()
147                    } else {
148                        closeBtn.focus()
149                    }
150                }
151            }
152        }
153    }
154
155    if (window.location.hash && window.location.hash == '#_=_') {
156        if (window.history !== undefined) {
157            window.history.replaceState ? window.history.replaceState(null, null, window.location.href.split('#')[0]) : (window.location.hash = '')
158        } else {
159            window.location.hash = ''
160        }
161    }
162
163    $(window).on('signedin.hive', function(e) {
164        $('body').addClass('is-logged-in')
165        //Remove Login/Signup button from header and footer upon login, show Signout instead
166        $('.nav-utilities .js-show-guest, footer .js-show-guest')
167            .hide()
168            .attr('aria-hidden', 'true')
169        $('.nav-utilities .js-show-user, footer .js-show-user')
170            .each(function(k, i) {
171                var $i = $(i)
172                var html = $i.html()
173                html = html.replace(/LOGOUT_TOKEN/, e.logout_token)
174                $i.html(html)
175                $i.find('[data-hive-user="username"]').text(e.userName)
176            })
177            .show()
178            .attr('aria-hidden', 'false')
179    })
180
181    $(window).on('signedout.hive', function(e) {
182        $('body').removeClass('is-logged-in')
183        $('.nav-utilities .js-show-user, footer .js-show-user')
184            .each(function(k, i) {
185                var $i = $(i)
186                var html = $i.html()
187                html = html.replace(/(\/logout)\/[^"]+/g, '$1/LOGOUT_TOKEN')
188                $i.html(html)
189                $i.find('[data-hive-user="username"]').text('USERNAME')
190            })
191            .hide()
192            .attr('aria-hidden', 'true')
193        $('.nav-utilities .js-show-guest, footer .js-show-guest')
194            .show()
195            .attr('aria-hidden', 'false')
196    })
197})

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.