PageSourceSearch

https://www.cicero.no/wp-content/themes/organic-purpose/js/jquery.custom.js?ver=1.0

js cicero.no collected 2026-10-02 21:03:44 UTC 7,631 bytes, 235 lines download raw bytes

1(function ($) {
2  function removeNoJsClass () {
3    $('html:first').removeClass('no-js')
4  }
5
6  /* Sidr Menu --------------------- */
7  function sidrMenu () {
8    if ($('body.purpose-logo-right')[0]) {
9      $('#menu-toggle').sidr({
10        name: 'side-menu',
11        side: 'left', // By default
12        source: '#navigation'
13      })
14    } else {
15      $('#menu-toggle').sidr({
16        name: 'side-menu',
17        side: 'right', // By default
18        source: '#navigation'
19      })
20    }
21    var win = $(window).width()
22    $(window).on('resize', function () {
23      if (win <= 1024) {
24        if ($('body').hasClass('sidr-open') && !$('html').hasClass('no-js')) {
25          $.sidr('close', 'side-menu')
26          $('.icon-menu-close').hide()
27          $('.icon-menu-open').show()
28        }
29      }
30    })
31  }
32
33  /* Mobile Submenu --------------------- */
34  function subMenuSetup () {
35    if ($(window).width() <= 1025) {
36      // Toggle submenus
37      $('li.sidr-class-menu-item-has-children > a').after('<i class="fas fa-chevron-down"></i>')
38      $('li.sidr-class-menu-item-has-children i.fa-chevron-down').on('touchstart click', function () {
39        var submenu = $(this).parent().children('ul.sidr-class-sub-menu')
40        if ($(submenu).is(':hidden')) {
41          $(submenu).slideDown(200)
42        } else {
43          $(submenu).slideUp(200)
44        }
45      })
46    }
47  }
48
49  /* Submenu Offset Fix --------------------- */
50  function menuOffset () {
51    // Fix menu if off screen.
52    var mainWindowWidth = $(window).width() + 180
53
54    $('#navigation ul.menu li.menu-item-has-children').mouseover(function () {
55      // Checks if second level menu exist.
56      var subMenuExist = $(this).find('.sub-menu').length
57
58      if (subMenuExist > 0) {
59        var subMenuWidth = $(this).find('.sub-menu').width()
60        var subMenuOffset = $(this).find('.sub-menu').parent().offset().left + subMenuWidth
61
62        // If sub menu is off screen, give new position.
63        if ((subMenuOffset + subMenuWidth) > mainWindowWidth) {
64          var newSubMenuPosition = subMenuWidth
65          $(this).find('ul.sub-menu').css({
66            right: 0,
67            left: 'auto'
68          })
69          $(this).find('ul.sub-menu ul.sub-menu').css({
70            left: -newSubMenuPosition - 24,
71            right: 'auto'
72          })
73        }
74      }
75    })
76  }
77
78  /* Flexslider --------------------- */
79  function flexSliderSetup () {
80    if (($).flexslider) {
81      var slider = $('.flexslider')
82      slider.fitVids().flexslider({
83        slideshowSpeed: slider.attr('data-speed'),
84        animationDuration: 600,
85        animation: 'fade',
86        video: false,
87        useCSS: false,
88        prevText: '<i class="fa fa-angle-left"></i>',
89        nextText: '<i class="fa fa-angle-right"></i>',
90        touch: false,
91        animationLoop: true,
92        smoothHeight: true,
93        pauseOnAction: true,
94        pauseOnHover: true,
95
96        start: function (slider) { // Fires when the slider loads the first slide
97          slider.removeClass('loading')
98          $('.preloader').hide()
99        }
100      })
101    }
102  }
103
104  /* Animating Menu Setup --------------------- */
105  function navScrollSetup () {
106    $('#header').data('size', 'big')
107  }
108
109  /* Header Check for custom widgets ------------------ */
110  function headerCheck (onScroll) {
111    var ocwContainer = $('.organic-ocw-container')
112
113    if (ocwContainer.length && !ocwContainer.children('div:first').hasClass('organic-widget_widget_organic_widgets_hero_section')) {
114      if ($(document).width() > 1024) {
115        var headerHeight = $('#header').outerHeight()
116        if (onScroll) {
117          ocwContainer.animate({
118            'padding-top': headerHeight + 'px'
119          })
120        } else {
121          ocwContainer.css('padding-top', headerHeight)
122        }
123      } else {
124        ocwContainer.css('padding-top', '')
125        setTimeout(function () {
126          ocwContainer.css('padding-top', '')
127        }, 250)
128      }
129    }
130  }
131
132  /* Nav Scroll Animation --------------------- */
133  function navScroll () {
134    var $header = $('#header')
135    var $headerbg = $('.header-bg')
136
137    if ($(document).scrollTop() > 24) {
138      if ($header.data('size') === 'big') {
139        $headerbg.data('size', 'small').fadeIn(250, function () {
140          headerCheck(true)
141        })
142        $header.data('size', 'small').removeClass('header-large')
143        $header.data('size', 'small').addClass('header-small')
144      }
145    } else {
146      if ($header.data('size') === 'small') {
147        $headerbg.data('size', 'big').fadeOut(250, function () {
148          headerCheck(true)
149        })
150        $header.data('size', 'big').addClass('header-large')
151        $header.data('size', 'big').removeClass('header-small')
152      }
153    }
154  }
155
156  /* Masonry --------------------- */
157  function masonrySetup () {
158    var $container = $('#portfolio-list')
159    $container.masonry({
160      itemSelector: '.single, .half, .third'
161    })
162  }
163
164  function modifyPosts () {
165    /* Add Padding To Pages Without Images To Match Header Height --------------------- */
166    var headerHeight = $('#header').outerHeight()
167    $('.purpose-singular.purpose-no-img:not(.purpose-home-template):not(.page-template-template-slideshow) .hentry .content, .organic-widgets-custom-template .organic-ocw-container, .blog.purpose-header-inactive .hentry .content, .archive.purpose-header-inactive .hentry .content, .woocommerce-page.purpose-header-inactive .content.shop, .woocommerce-page.single-product .content.shop').css('padding-top', headerHeight)
168
169    if ($('.organic-ocw-container > .organic-widget:first-child .organic-widgets-section').hasClass('organic-widgets-hero-section')) {
170      $('#header').removeClass('text-dark').addClass('text-light')
171      $('.organic-ocw-container').css({
172        'padding-top': 0
173      })
174    }
175
176    /* Toggle Mobile Menu Icon --------------------- */
177    $('.menu-toggle').click(function () {
178      $('.icon-menu-open').toggle()
179      $('.icon-menu-close').toggle()
180    })
181
182    /* Insert Nav Arrow Before Submenu --------------------- */
183    $('<span class="nav-arrow"></span>').insertBefore('ul.sub-menu li:first-child, ul.menu ul li:first-child')
184
185    /* Hide Comments When No Comments Activated --------------------- */
186    $('.nocomments').parent().css('display', 'none')
187
188    /* Animate Page Scroll --------------------- */
189    $('.scroll').click(function (event) {
190      event.preventDefault()
191      $('html,body').animate({
192        scrollTop: $(this.hash).offset().top
193      }, 500)
194    })
195
196    /* Fit Vids --------------------- */
197    $('.feature-vid, .content').fitVids()
198
199    /* Check Element BG Color --------------------- */
200    $('.footer').colourBrightness()
201    if ($('.featured-page.home-content').length) {
202      $('.featured-page.home-content').colourBrightness()
203    }
204    if ($('.featured-page.page-one').length) {
205      $('.featured-page.page-one').colourBrightness()
206    }
207    if ($('.featured-page.page-two').length) {
208      $('.featured-page.page-two').colourBrightness()
209    }
210    if ($('.featured-page.page-three').length) {
211      $('.featured-page.page-three').colourBrightness()
212    }
213    if ($('.featured-posts').length) {
214      $('.featured-posts').colourBrightness()
215    }
216  }
217
218  $(document)
219    .ready(removeNoJsClass)
220    .ready(navScrollSetup)
221    .ready(navScroll)
222    .ready(sidrMenu)
223    .ready(subMenuSetup)
224    .ready(menuOffset)
225    .ready(modifyPosts)
226    .ready(headerCheck)
227    .on('post-load', modifyPosts)
228
229  $(window)
230    .on('load', flexSliderSetup)
231    .on('load', masonrySetup)
232    .resize(masonrySetup)
233    .resize(headerCheck)
234    .scroll(navScroll)
235})(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.