PageSourceSearch

https://www.icandrive.com/wp-content/themes/johnsdriving/js/theme.js?ver=1791381980

js icandrive.com collected 2026-10-07 14:06:31 UTC 5,015 bytes, 182 lines download raw bytes

1(function($) {
2
3  document.addEventListener("DOMContentLoaded", function() {
4    new WOW().init();
5
6    var acc = document.getElementsByClassName("accordion");
7
8    for (var i = 0; i < acc.length; i++) {
9      acc[i].addEventListener("click", function(e) {
10        e.preventDefault();
11        this.classList.toggle("active");
12      });
13    }
14
15    var hash = window.location.hash;
16    if ($(hash).length > 0) {
17      $(hash).trigger('click');
18    }
19
20    var dropdown = document.querySelectorAll(
21      ".mobile-menu .menu-item-has-children"
22    );
23
24    for (var p = 0; p < dropdown.length; p++) {
25      dropdown[p].onclick = function() {
26        this.classList.toggle("active");
27      };
28    }
29  });
30
31  window.addEventListener("load", function() {
32    var iconClose = document.querySelector(".menu-toggle");
33    var body = document.querySelector("body");
34    var menu = document.querySelector(".mobile-menu .nav");
35
36    iconClose.onclick = function() {
37      event.preventDefault();
38    //   body.classList.toggle("scroll-none");
39      menu.classList.toggle("visible");
40      iconClose.classList.toggle("menu-icon-close");
41    };
42
43    document.addEventListener("touchstart", function() {}, true);
44  });
45
46  window.addEventListener(
47    "resize",
48    function() {
49      if (window.innerWidth > 1200) {
50        // document.querySelector("body").classList.remove("scroll-none");
51        document.querySelector(".mobile-menu .nav").classList.remove("visible");
52        document
53          .querySelector(".menu-toggle")
54          .classList.remove("menu-icon-close");
55      }
56    },
57    true
58  );
59
60  $(document).ready(function() {
61    $("[data-testimonial-slider]").slick({
62      slidesToShow: 1,
63      slidesToScroll: 1,
64      // autoplay: true,
65      arrows: false,
66      dots: true
67    });
68
69  // update the sorting fields in the sidebar filter when sorting is changed, and automatically submit the filters
70  console.log('test console.log');
71  function updateBlogSorting() {
72    console.log('run update sorting function');
73    var sorting = $('#blog-sorting').val(),
74      s_order = 'DESC',
75      s_orderby = 'date';
76    if (sorting == 'latest') {
77      s_order = 'ASC',
78      s_orderby = 'date';
79    } else if (sorting == 'asc') {
80      s_order = 'ASC',
81      s_orderby = 'title';
82    } else if (sorting == 'desc') {
83      s_order = 'DESC',
84      s_orderby = 'title';
85    }
86    $('#s_order').val(s_order);
87    $('#s_orderby').val(s_orderby);
88  }
89  if ($('#blog-sorting').length > 0) {
90    updateBlogSorting();
91    console.log('update filter on load');
92  }
93  updateBlogSorting();
94  $('#blog-sorting').on('change', function(e) {
95    console.log('blog sorting changed');
96    updateBlogSorting();
97    $('#post-cat-filter').submit();
98  });
99
100
101    /* ===========================================================
102      ZIP CODE LANDING PAGES
103    =========================================================== */
104
105    // set the active service type based on the slug
106    function setActiveServiceType(dataServiceSlug) {
107      var elsToActivate = $('*[data-service-type="' + dataServiceSlug + '"]'),
108          dataServiceName = dataServiceSlug.substr(0,1).toUpperCase()+dataServiceSlug.substr(1);
109
110      $('.active-type').removeClass('active-type');
111      elsToActivate.addClass('active-type');
112      $('#location-type-name').text(dataServiceName);
113    }
114
115    //set the first service type as active (if there are 2)
116    var serviceTypeBtn = $('.service-type-button');
117
118    if ( serviceTypeBtn.length > 1 ) {
119      console.log('service buttons found, activate things');
120      var firstDataServiceType = serviceTypeBtn.first(),
121        dataServiceSlug = firstDataServiceType.attr('data-service-type');
122
123      setActiveServiceType(dataServiceSlug);
124
125      serviceTypeBtn.on('click', function(e) {
126        e.preventDefault();
127        dataServiceSlug = $(this).attr('data-service-type');
128        setActiveServiceType(dataServiceSlug);
129      });
130    }
131
132  });
133})(jQuery);
134
135
136jQuery(document).ready(function ($) {
137	$(document).on('fancybox-cleanup', function () {
138		$('video, audio').trigger('pause');
139	});
140});
141
142console.log('ready');
143
144function GetIEVersion() {
145
146	var sAgent = window.navigator.userAgent;
147	var Idx = sAgent.indexOf("MSIE");
148
149	// If IE, return version number.
150	if (Idx > 0) {
151		return parseInt(sAgent.substring(Idx + 5, sAgent.indexOf(".", Idx)));
152
153		// If IE 11 then look for Updated user agent string.
154	} else if (!!navigator.userAgent.match(/Trident\/7\./)) {
155		return 11;
156
157	} else {
158		return 0; //It is not IE
159	}
160
161}
162
163var ua = navigator.userAgent.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i),
164	browser;
165
166if (navigator.userAgent.match(/Edge/i)) {
167	browser = 'edge';
168} else if (navigator.userAgent.match(/Trident.*rv[ :]*11\./i)) {
169	browser = 'ie';
170} else {
171	browser = ua[1].toLowerCase();
172}
173
174setTimeout(function () {
175	if (GetIEVersion() > 0) {
176		// alert("This is IE " + GetIEVersion());
177		$('body').addClass(browser);
178	} else {
179		// alert("This is not IE.");
180		$('body').addClass(browser);
181	}
182}, 1000);

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.