PageSourceSearch

https://dearclark.com/wp-content/themes/flatsome/js/theme_v-2.6-ver-1.2.1.js

js dearclark.com collected 2026-10-05 07:54:05 UTC 15,232 bytes, 470 lines download raw bytes

1/* add browser info to HTML tag */
2var doc = document.documentElement; doc.setAttribute('data-useragent', navigator.userAgent);
3
4
5;(function ($) {
6"use strict";
7
8
9// Disable fast click for touch devices
10if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
11  $('.header-nav .nav-top-link').addClass('needsclick');
12}
13
14// Run fastclick script
15FastClick.attach(document.body);
16
17
18// Mobile sidebar menu toggle
19$('.mobile-sidebar li.menu-item-has-children > ul, .mobile-sidebar li.menu-item-has-children > a[href="#"]').click(function(e){
20    $(this).parent().toggleClass('open');
21});
22
23
24// Mobile sidebar open
25$('a.off-canvas-overlay').magnificPopup({
26  removalDelay: 300, 
27  closeBtnInside: true,
28  callbacks: {
29    beforeOpen: function() {
30       this.st.mainClass = 'off-canvas '+this.st.el.attr('data-pos')+' '+this.st.el.attr('data-color');
31    },
32    open: function () {
33       $('html').addClass('has-off-canvas push-' +this.st.el.attr('data-pos'));
34    },
35    beforeClose: function() {
36       $('html').removeClass('has-off-canvas push-' +this.st.el.attr('data-pos'));
37    }
38  }
39});
40
41
42/******** Dropdown Scripts ***********/
43$('.nav-top-link').parent().hoverIntent(
44  function () {
45       var max_width = '1080';
46       if(max_width > $(window).width()) {max_width = $(window).width();}
47       $(this).find('.nav-dropdown').css('max-width',max_width);
48       $(this).find('.nav-dropdown').fadeIn(20);
49       $(this).addClass('active');
50       /* fix dropdown if it has too many columns */
51       var dropdown_width = $(this).find('.nav-dropdown').outerWidth();
52       var col_width =  $(this).find('.nav-dropdown > ul > li.menu-parent-item').width();
53       var cols = ($(this).find('.nav-dropdown > ul > li.menu-parent-item').length) + ($(this).find('.nav-dropdown').find('.image-column').length);
54       var col_must_width = cols*col_width;
55       if($('.wide-nav').hasClass('nav-center')){
56        $(this).find('.nav-dropdown').css('margin-left','-70px');
57      }
58
59       if(col_must_width > dropdown_width){
60          $(this).find('.nav-dropdown').width(col_must_width);
61          $(this).find('.nav-dropdown').addClass('no-arrow');
62          $(this).find('.nav-dropdown').css('left','auto');
63          $(this).find('.nav-dropdown').css('right',0);
64          $(this).find('ul:after').remove();
65       }
66  },
67  function () {
68        $(this).find('.nav-dropdown').fadeOut(20);
69        $(this).removeClass('active');
70  }
71);
72
73/* WPML dropdown */
74$('.menu-item-language-current').hoverIntent(
75  function () {
76       $(this).find('.sub-menu').fadeIn(50);
77
78  },
79  function () {
80       $(this).find('.sub-menu').fadeOut(50);
81  }
82);
83
84
85/* SEARCH DROPDOWN */
86$('.search-dropdown').hoverIntent(
87  function () {
88       if($('.wide-nav').hasClass('nav-center')){
89          $(this).find('.nav-dropdown').css('margin-left','-85px');
90        }
91       $(this).find('.nav-dropdown').fadeIn(50);
92       $(this).addClass('active');
93       $(this).find('input').focus();
94
95  },
96  function () {
97       $(this).find('.nav-dropdown').fadeOut(50);
98       $(this).removeClass('active');
99       $(this).find('input').blur();
100  }
101);
102
103
104/* PRODUCT NEXT / PREV NAV */
105$('.prod-dropdown').hoverIntent(
106  function () {
107       $(this).find('.nav-dropdown').fadeIn(50);
108       $(this).addClass('active');
109
110  },
111  function () {
112       $(this).find('.nav-dropdown').fadeOut(50);
113       $(this).removeClass('active');
114  }
115);
116
117/* CART DROPDOWN */
118$('.cart-link').parent().parent().hoverIntent(
119  function () {
120       $(this).find('.nav-dropdown').fadeIn(50);
121       $(this).addClass('active');
122
123  },
124  function () {
125       $(this).find('.nav-dropdown').fadeOut(50);
126       $(this).removeClass('active');
127  }
128);
129
130/******** GLOBAL LIGHTBOX SCRIPTS ***********/
131  /* add popup for product slider */
132  $('.gallery-popup').magnificPopup({
133      delegate: 'a',
134      type: 'image',
135      tLoading: '<div class="ux-loading dark"><i></i><i></i><i></i><i></i></div>',
136      removalDelay: 300,
137      closeOnContentClick: true,
138      gallery: {
139          enabled: true,
140          navigateByImgClick: false,
141          preload: [0,1] // Will preload 0 - before current, and 1 after the current image
142      },
143      image: {
144          verticalFit: false,
145          tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
146      }
147  });
148
149   /* add lightbox for images */
150  $("*[id^='attachment'] a, a.image-lightbox, .entry-content a[href$='.jpg'], .entry-content a[href$='.jpeg']").not('.gallery a[href$=".jpg"], .gallery a[href$=".jpeg"]').magnificPopup({
151    type: 'image',
152    tLoading: '<div class="ux-loading dark"><i></i><i></i><i></i><i></i></div>',
153    closeOnContentClick: true,
154    removalDelay: 300,
155    image: {
156      verticalFit: false
157    }
158  }); // image lightbox
159
160
161   /* add lightbox for blog galleries */
162  $(".column-inner a[href$='.jpg'], .column-inner a[href$='.jpeg'], .gallery a[href$='.jpg'],.gallery a[href$='.jpeg'],.featured-item a[href$='.jpeg'],.featured-item a[href$='.gif'],.featured-item a[href$='.jpg'], .page-featured-item .slider a[href$='.jpg'], .page-featured-item a[href$='.jpg'],.page-featured-item .slider a[href$='.jpeg'], .page-featured-item a[href$='.jpeg'], .gallery a[href$='.png'], .gallery a[href$='.jpeg'], .gallery a[href$='.gif']").parent().magnificPopup({
163    delegate: 'a',
164    type: 'image',
165    tLoading: '<div class="ux-loading dark"><i></i><i></i><i></i><i></i></div>',
166    removalDelay: 300,
167    gallery: {
168      enabled: true,
169      navigateByImgClick: true,
170      preload: [0,1] // Will preload 0 - before current, and 1 after the current image
171    },
172    image: {
173      tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
174      verticalFit: false
175    }
176  }); 
177
178
179  /* Youtube and Vimeo links */
180  $("a.button[href*='vimeo'],a.button[href*='youtube']").magnificPopup({
181    disableOn: 700,
182    type: 'iframe',
183    mainClass: 'my-mfp-video',
184    removalDelay: 300,
185    preloader: false,
186  }); 
187
188
189/* ****** PRODUCT QUICK VIEW  ******/
190$('.quick-view,.open-quickview').click(function(e){
191   /* add loader  */
192   $(this).after('<div class="ux-loading dark"><i></i><i></i><i></i><i></i></div>');
193   var product_id = $(this).attr('data-prod');
194   var data = { action: 'jck_quickview', product: product_id};
195    $.post(ajaxURL.ajaxurl, data, function(response) {
196     $.magnificPopup.open({
197        removalDelay: 300,
198        items: {
199          src: '<div class="product-lightbox">'+response+'</div>',
200          type: 'inline'
201        }
202      });
203     $('.ux-loading,.color-overlay').remove();
204
205     setTimeout(function() {
206
207         function slideLoad(args) {
208            /* set height of first slide */
209            var slide_height = $(args.currentSlideObject).outerHeight();
210            $(args.sliderContainerObject).height(slide_height);
211         }
212
213         $('.product-lightbox .iosSlider.product-gallery-slider').iosSlider({
214              snapToChildren: true,
215              scrollbar: true,
216              scrollbarHide: false,
217              desktopClickDrag: true,
218              snapFrictionCoefficient: 0.7,
219              infiniteSlider: true,
220              autoSlideTransTimer: 500,
221              onSliderLoaded: slideLoad,
222              navPrevSelector: $('.product-lightbox .prev_product_slider'),
223              navNextSelector: $('.product-lightbox .next_product_slider'),
224
225          });
226         
227          $('.product-lightbox form').wc_variation_form();
228          $('.product-lightbox form select').change();
229
230          $('[name*="color"]').change(function(){
231            $('.product-lightbox .iosSlider.product-gallery-slider').iosSlider('goToSlide', '1');
232          });
233    
234
235    }, 600);
236    });
237    
238
239    e.preventDefault();
240}); // product lightbox
241
242
243// Activate product Zoom for non-touch
244if(!/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
245
246     /* Start Zoom images */
247     var $easyzoom = $('.product-zoom .easyzoom').easyZoom({ loadingNotice: '' });
248
249     /* Swap Zoom Images */
250     var firstZoomItem = $easyzoom.filter('.product-zoom .easyzoom.first').data('easyZoom');
251     
252     if(firstZoomItem) {
253       setTimeout(function(){
254         $('select[name*="attribute"]').change(function(){
255              firstZoomItem.swap($('.easyzoom.first img').attr('src'), $('.easyzoom.first a').attr('href'));
256         });
257       }, 300);
258     }
259
260}
261
262/* Disable animate for touch devices */
263if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
264$('.scroll-animate').each(function() {
265      $(this).removeClass('scroll-animate');
266  });
267}
268
269/********* WAYPOINTS (sticky header, banner animations etc.) **********/
270/* add animations to banners in view */
271$('.ux_banner .inner-wrap.animated').waypoint(function() {
272  if(!$(this).parent().parent().parent().parent().hasClass('slider')){
273     var animation = $(this).attr("data-animate");
274     $(this).addClass(animation);
275     $(this).addClass('start-anim');
276  }
277},{ offset: '95%' });
278
279/* show Back to top links */
280$('#main-content').waypoint(function() {
281  $('#top-link').toggleClass('active fadeInUp animated');
282},{offset:'-100%'});
283
284/* animate Col, Blocks and Rows */
285setTimeout(function() {
286  $('.scroll-animate').waypoint(function() {
287     if(!$(this).parent().parent().parent().parent().hasClass('slider')){
288      $(this).addClass('animated');
289      $(this).addClass($(this).data('animate')); 
290      }
291  },{offset: '95%'});
292}, 100);
293
294/* Add sticky header */
295var header_offset = -$('#masthead').outerHeight();
296
297$('.sticky_header #masthead').waypoint('sticky', {
298  offset: header_offset
299});
300
301$('.sticky_header .wide-nav').waypoint('sticky', {
302  offset: header_offset
303});
304
305/* make sticky header move down while scrolling */
306$('#main-content').waypoint(function() {
307   $('body.has-dark-header:not(.org-dark-header)').toggleClass('dark-header');
308   $('.header-wrapper').toggleClass('before-sticky');
309   $('.sticky_header #masthead, .wide-nav').toggleClass('move_down');
310},{offset: '-200px'});
311
312/********* SCROLL TO LINKS **********/
313/* top link */
314$('#top-link').click(function(e) {
315    $.scrollTo(0,300);
316    e.preventDefault();
317}); // top link
318
319
320/* reviews link */
321$('.scroll-to-reviews').click(function(e){
322    $('.product-details .tabs-nav li').removeClass('current-menu-item');
323    $('.product-details .tabs-nav').find('a[href=#panelreviews]').parent().addClass('current-menu-item');
324    $('.tabs li, .tabs-inner,.panel.entry-content').removeClass('active');
325    $('.tabs li.reviews_tab, #panelreviews, #tab-reviews').addClass('active');
326    $('.panel.entry-content').css('display','none');
327    $('#tab-reviews').css('display','block');
328    $.scrollTo('#panelreviews',300,{offset:-90});
329    $.scrollTo('.reviews_tab',300,{offset:-90});
330    $.scrollTo('#section-reviews',300,{offset:-90});
331    e.preventDefault();
332});
333
334
335
336/****** ACCORDIAN / TABS *******/
337
338/* accordian toggle */
339$('.accordion').each(function(){
340  var acc = $(this).attr("rel") * 2;
341  $(this).find('.accordion-inner:nth-child(' + acc + ')').show();
342  $(this).find('.accordion-inner:nth-child(' + acc + ')').prev().addClass("active");
343});
344  
345$('.accordion .accordion-title').click(function() {
346  if($(this).next().is(':hidden')) {
347    $(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200);
348    $(this).toggleClass('active').next().slideDown(200);   
349    if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
350        $.scrollTo($(this),300,{offset:-100});
351    }
352  } else {
353    $(this).parent().find('.accordion-title').removeClass('active').next().slideUp(200);
354  }
355  return false;
356});
357
358/* tabs toggle */
359$('.shortcode_tabgroup ul.tabs li a').click(function(e){
360  e.preventDefault();
361  $(this).parent().parent().parent().find('ul li').removeClass('active');
362  $(this).parent().addClass('active');
363  var currentTab = $(this).attr('href');
364  $(this).parent().parent().parent().find('div.panel').removeClass('active');
365  $(currentTab).addClass('active');
366  $(currentTab).find('p script').unwrap();
367
368  // Find iosSliders and update them and go to slide 1.
369  var iOS = ( navigator.userAgent.match(/(Android|webOS|iPhone|iPad|iPod|BlackBerry)/g) ? true : false );
370  if($(currentTab).find('.iosSlider') && iOS) {
371    $(currentTab).find('.iosSlider').each(function(){
372      var id = $(this).attr('id');
373      $('#'+id).iosSlider('update').iosSlider('goToSlide', 1);
374    });
375  }
376  $(window).resize();
377  return false;
378});
379
380$('.product-details .tabbed-content .tabs a').click(function(){
381  $('.panel').removeClass('active');
382  var panel = $(this).attr('href');
383  $(panel).addClass('active');
384});
385
386/* tabs vertical */
387$('.shortcode_tabgroup_vertical ul.tabs-nav li a').click(function(e){
388  e.preventDefault();
389  $(this).parent().parent().parent().find('ul li').removeClass('current-menu-item');
390  $(this).parent().addClass('current-menu-item');
391  var currentTab = $(this).attr('href');
392  $(this).parent().parent().parent().parent().find('div.tabs-inner').removeClass('active');
393  $(currentTab).addClass('active');
394  $(window).resize();
395  return false;
396});
397
398/****** TOOLTIPS *********/
399if(! /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
400  $('.yith-wcwl-wishlistexistsbrowse.show').each(function(){
401      var tip_message = $(this).find('a').text();
402      $(this).find('a').attr('title',tip_message).addClass('tip-top');
403  });
404
405  $('.yith-wcwl-add-button.show').each(function(){
406      var tip_message = $(this).find('a.add_to_wishlist').text();
407      $(this).find('a.add_to_wishlist').attr('title',tip_message).addClass('tip-top');
408  });
409
410  $('.chosen a').tooltipster({delay: 50, contentAsHTML: true,touchDevices: false});
411  $('.tip-left').tooltipster({position: 'left', delay: 50, contentAsHTML: true,touchDevices: false});
412  $('.tip, .tip-top,.tip-bottom').tooltipster({delay: 50, contentAsHTML: true,touchDevices: false});
413}
414
415
416/******* blog stuff ******/
417$('textarea#comment').focus(function(){
418    $('.form-allowed-tags').slideDown();
419    $('.form-submit').slideDown();
420});
421
422$('textarea#comment').blur(function(){
423  if(!$(this).val()){
424    $('.form-allowed-tags').slideUp();
425    $('.form-submit').slideUp();
426  }
427});
428
429$('textarea#comment').blur(function(){
430  if(!$(this).val()){
431    $('.form-allowed-tags').slideUp();
432    $('.form-submit').slideUp();
433  }
434});
435
436/****** Layout fixes *********/
437$( window ).resize(function() {
438  $('.ux_banner.full-height').height($( window ).height());
439});
440
441
442/* slider fix */
443$('.slider .add_to_cart_button').hover(
444  function() {
445    $('.sliderControlls').css('pointer-events','none');
446  }, function() {
447    $('.sliderControlls').css('pointer-events','all');
448  }
449);
450
451
452/* Ajax add to cart */
453$('body').on('added_to_cart', function(){
454    jQuery('.mini-cart').addClass('active cart-active');
455    jQuery('.mini-cart').hover(function(){jQuery('.cart-active').removeClass('cart-active');});
456    setTimeout(function(){jQuery('.cart-active').removeClass('active');}, 5000);
457});
458
459
460//  hacks
461$('.ux_banner [class^="text-box-"], .ux_banner [class^="text-border"]').after('<div class="clearfix"/>');
462$('.ux_banner .inner-wrap p > br, .accordion > br, #content > br, .ux-section-content > br, .social-icons > br').remove();
463
464// Mega menu fix
465$('#megaMenu').wrap('<li/>');
466
467
468$(window).resize();
469
470}(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.