1(function ($) { 2 "use strict"; 3 4 if ($(".nav-tabs--with-btns").length) { 5 $(".nav-tabs--with-btns").each(function () { 6 let self = $(this); 7 let nextBtn = self.find(".nav-tabs--btns .next a"); 8 let prevBtn = self.find(".nav-tabs--btns .prev a"); 9 10 nextBtn.on("click", function (e) { 11 e.preventDefault(); 12 const nextTabLinkEl = self.find('.active').closest('li').next('li').find('button')[0]; 13 const nextTab = new bootstrap.Tab(nextTabLinkEl); 14 nextTab.show(); 15 }); 16 17 prevBtn.on("click", function (e) { 18 e.preventDefault(); 19 const prevTabLinkEl = self.find('.active').closest('li').prev('li').find('button')[0]; 20 const prevTab = new bootstrap.Tab(prevTabLinkEl); 21 prevTab.show(); 22 }); 23 }); 24 } 25 26 //adds the class 27 $('.accordion-collapse').on('shown.bs.collapse', function () { 28 $(this).parent().addClass('accordion--active'); 29 }); 30 31 //removes the class 32 $('.accordion-collapse').on('hidden.bs.collapse', function () { 33 $(this).parent().removeClass('accordion--active'); 34 }); 35 36 // ===Portfolio=== 37 function projectMasonaryLayout() { 38 if ($(".masonary-layout").length) { 39 $(".masonary-layout").isotope({ 40 layoutMode: "masonry" 41 }); 42 } 43 if ($(".post-filter").length) { 44 $(".post-filter li") 45 .children(".filter-text") 46 .on("click", function () { 47 var Self = $(this); 48 var selector = Self.parent().attr("data-filter"); 49 $(".post-filter li").removeClass("active"); 50 Self.parent().addClass("active"); 51 $(".filter-layout").isotope({ 52 filter: selector, 53 animationOptions: { 54 duration: 500, 55 easing: "linear", 56 queue: false 57 } 58 }); 59 return false; 60 }); 61 } 62 63 if ($(".post-filter.has-dynamic-filters-counter").length) { 64 // var allItem = $('.single-filter-item').length; 65 var activeFilterItem = $(".post-filter.has-dynamic-filters-counter").find( 66 "li" 67 ); 68 activeFilterItem.each(function () { 69 var filterElement = $(this).data("filter"); 70 var count = $(".filter-layout").find(filterElement).length; 71 $(this) 72 .children(".filter-text") 73 .append('<span class="count">(' + count + ")</span>"); 74 }); 75 } 76 } 77 if ($('.datepicker').length) { 78 $('.datepicker').each(function () { 79 let self = $(this); 80 self.datepicker({ 81 'format': 'd M yyyy', 82 }); 83 }); 84 } 85 if ($(".contact-two__progress-range").length) { 86 $(".contact-two__progress-range").each(function () { 87 let balanceTag = $(this).find(".contact-two__balance span"); 88 let balanceInput = $(this).find(".contact-two__balance__input"); 89 $(this).find(".balance-range-slider").ionRangeSlider({ 90 onStart: function (data) { 91 balanceTag.html(data.from); 92 balanceInput.prop("value", data.from); 93 }, 94 onChange: function (data) { 95 balanceTag.html(data.from); 96 balanceInput.prop("value", data.from); 97 } 98 }); 99 }); 100 } 101 if ($('.niceselect').length) { 102 $('.niceselect').niceSelect(); 103 } 104 if ($(".video-popup").length) { 105 $('.video-popup').YouTubePopUp(); 106 } 107 //Fact Counter + Text Count 108 if ($(".count-box").length) { 109 $(".count-box").appear( 110 function () { 111 var $t = $(this), 112 n = $t.find(".count-text").attr("data-stop"), 113 r = parseInt($t.find(".count-text").attr("data-speed"), 10); 114 115 if (!$t.hasClass("counted")) { 116 $t.addClass("counted"); 117 $({ 118 countNum: $t.find(".count-text").text() 119 }).animate({ 120 countNum: n 121 }, { 122 duration: r, 123 easing: "linear", 124 step: function () { 125 $t.find(".count-text").text(Math.floor(this.countNum)); 126 }, 127 complete: function () { 128 $t.find(".count-text").text(this.countNum); 129 } 130 }); 131 } 132 }, { 133 accY: 0 134 } 135 ); 136 } 137 if ($(".count-bar").length) { 138 $(".count-bar").appear( 139 function () { 140 var el = $(this); 141 var percent = el.data("percent"); 142 $(el).css("width", percent).addClass("counted"); 143 }, { 144 accY: -50 145 } 146 ); 147 } 148 if ($(".count-bar--no-appear").length) { 149 $(".count-bar--no-appear").each( 150 function () { 151 var el = $(this); 152 var percent = el.data("percent"); 153 $(el).css("width", percent).addClass("counted"); 154 } 155 ); 156 } 157 if ($(".img-popup").length) { 158 var groups = {}; 159 $(".img-popup").each(function () { 160 var id = parseInt($(this).attr("data-group"), 10); 161 162 if (!groups[id]) { 163 groups[id] = []; 164 } 165 166 groups[id].push(this); 167 }); 168 169 $.each(groups, function () { 170 $(this).magnificPopup({ 171 type: "image", 172 closeOnContentClick: true, 173 closeBtnInside: false, 174 gallery: { 175 enabled: true 176 } 177 }); 178 }); 179 } 180 181 let thmOwlCarousels = $(".thm-owl__carousel"); 182 if (thmOwlCarousels.length) { 183 thmOwlCarousels.each(function () { 184 let elm = $(this); 185 let options = elm.data("owl-options"); 186 let thmOwlCarousel = elm.owlCarousel( 187 "object" === typeof options ? options : JSON.parse(options) 188 ); 189 }); 190 } 191 192 let thmOwlNavCarousels = $(".thm-owl__carousel--custom-nav"); 193 if (thmOwlNavCarousels.length) { 194 thmOwlNavCarousels.each(function () { 195 let elm = $(this); 196 let owlNavPrev = elm.data("owl-nav-prev"); 197 let owlNavNext = elm.data("owl-nav-next");
198 $(owlNavPrev).on("click", function (e) { 199 elm.trigger("prev.owl.carousel"); 200 e.preventDefault(); 201 }); 202 203 $(owlNavNext).on("click", function (e) { 204 elm.trigger("next.owl.carousel"); 205 e.preventDefault(); 206 }); 207 }); 208 } 209 210 // mailchimp form 211 if ($(".mc-form").length) { 212 $(".mc-form").each(function () { 213 var Self = $(this); 214 var mcURL = Self.data("url"); 215 var mcResp = Self.parent().find(".mc-form__response"); 216 217 Self.ajaxChimp({ 218 url: mcURL, 219 callback: function (resp) { 220 // appending response 221 mcResp.append(function () { 222 return '<p class="mc-message">' + resp.msg + "</p>"; 223 }); 224 // making things based on response 225 if (resp.result === "success") { 226 // Do stuff 227 Self.removeClass("errored").addClass("successed"); 228 mcResp.removeClass("errored").addClass("successed"); 229 Self.find("input").val(""); 230 231 mcResp.find("p").fadeOut(10000); 232 } 233 if (resp.result === "error") { 234 Self.removeClass("successed").addClass("errored"); 235 mcResp.removeClass("successed").addClass("errored"); 236 Self.find("input").val(""); 237 238 mcResp.find("p").fadeOut(10000); 239 } 240 } 241 }); 242 }); 243 } 244 if ($(".contact-form-validated").length) { 245 $(".contact-form-validated").each(function () { 246 let contactForm = $(this); 247 contactForm.validate({ 248 // initialize the plugin 249 rules: { 250 name: { 251 required: true 252 }, 253 phone: { 254 required: true 255 }, 256 email: { 257 required: true, 258 email: true 259 }, 260 message: { 261 required: true 262 }, 263 subject: { 264 required: true 265 } 266 }, 267 submitHandler: function (form) { 268 // sending value with ajax request 269 $.post( 270 $(form).attr("action"), 271 $(form).serialize(), 272 function (response) { 273 $(form).parent().find(".result").append(response); 274 $(form).find('input[type="text"]').val(""); 275 $(form).find('input[type="email"]').val(""); 276 $(form).find("textarea").val(""); 277 } 278 ); 279 return false; 280 } 281 }); 282 }); 283 } 284 285 286 function dynamicCurrentMenuClass(selector) { 287 let FileName = window.location.href.split("/").reverse()[0]; 288 289 selector.find("li").each(function () { 290 let anchor = $(this).find("a"); 291 if ($(anchor).attr("href") == FileName) { 292 $(this).addClass("current"); 293 } 294 }); 295 // if any li has .current elmnt add class 296 selector.children("li").each(function () { 297 if ($(this).find(".current").length) { 298 $(this).addClass("current"); 299 } 300 }); 301 // if no file name return 302 if ("" == FileName) { 303 selector.find("li").eq(0).addClass("current"); 304 } 305 } 306 307 if ($(".main-menu__list").length) { 308 // dynamic current class 309 let mainNavUL = $(".main-menu__list"); 310 dynamicCurrentMenuClass(mainNavUL); 311 } 312 313 if ($(".main-menu__list").length && $(".mobile-nav__container").length) { 314 $(".main-menu__list").clone().removeClass('main-menu__list').addClass('mobile-menu__list').appendTo('.mobile-nav__container'); 315 } 316 if ($(".sticky-header").length) { 317 $(".sticky-header").clone().insertAfter('.sticky-header').addClass('sticky-header--cloned'); 318 } 319 320 if ($(".mobile-menu__list").length) { 321 let dropdownAnchor = $(".mobile-menu__list .menu-item-has-children > a"); 322 dropdownAnchor.each(function () { 323 let self = $(this); 324 let toggleBtn = document.createElement("BUTTON"); 325 toggleBtn.setAttribute("aria-label", "dropdown toggler"); 326 toggleBtn.innerHTML = "<i class='fa fa-angle-down'></i>"; 327 self.append(function () { 328 return toggleBtn; 329 }); 330 self.find("button").on("click", function (e) { 331 e.preventDefault(); 332 let self = $(this); 333 self.toggleClass("expanded"); 334 self.parent().toggleClass("expanded"); 335 self.parent().parent().children("ul").slideToggle(); 336 }); 337 }); 338 } 339 340 if ($(".mobile-nav__toggler").length) { 341 $(".mobile-nav__toggler").on("click", function (e) { 342 e.preventDefault(); 343 $(".mobile-nav__wrapper").toggleClass("expanded"); 344 $("body").toggleClass("locked"); 345 }); 346 } 347 348 if ($(".side-drawer__toggler").length) { 349 $(".side-drawer__toggler").on("click", function (e) { 350 e.preventDefault(); 351 $(".side-drawer__wrapper").toggleClass("expanded"); 352 $("body").toggleClass("locked"); 353 }); 354 } 355 356 if ($(".search-toggler").length) { 357 $(".search-toggler").on("click", function (e) { 358 e.preventDefault(); 359 $(".search-popup").toggleClass("active"); 360 $(".mobile-nav__wrapper").removeClass("expanded"); 361 $("body").toggleClass("locked"); 362 }); 363 } 364 365 if ($(".scroll-to-target").length) { 366 $(".scroll-to-target").on("click", function () { 367 var target = $(this).attr("data-target"); 368 $("html, body").animate({ 369 scrollTop: $(target).offset().top, 370 }, 371 1000 372 ); 373 return false;
374 }); 375 } 376 if ($(".dynamic-year").length) { 377 let currentYear = new Date().getFullYear(); 378 $(".dynamic-year").html(currentYear); 379 } 380 if ($(".wow").length) { 381 var wow = new WOW({ 382 boxClass: "wow", // animated element css class (default is wow) 383 animateClass: "animated", // animation css class (default is animated) 384 mobile: true, // trigger animations on mobile devices (default is true) 385 live: true // act on asynchronously loaded content (default is true) 386 }); 387 wow.init(); 388 } 389 390 $(window).on("scroll", function () { 391 if ($(".sticky-header--cloned").length) { 392 var headerScrollPos = 130; 393 var stricky = $(".sticky-header--cloned"); 394 if ($(window).scrollTop() > headerScrollPos) { 395 stricky.addClass("sticky-fixed"); 396 } else if ($(this).scrollTop() <= headerScrollPos) { 397 stricky.removeClass("sticky-fixed"); 398 } 399 } 400 if ($(".scroll-to-top").length) { 401 var strickyScrollPos = 100; 402 if ($(window).scrollTop() > strickyScrollPos) { 403 $(".scroll-to-top").fadeIn(500); 404 } else if ($(this).scrollTop() <= strickyScrollPos) { 405 $(".scroll-to-top").fadeOut(500); 406 } 407 } 408 409 }); 410 411 $(window).on("load", function () { 412 if ($(".preloader").length) { 413 $(".preloader").fadeOut(); 414 } 415 projectMasonaryLayout(); 416 }); 417 418})(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.