1function truncate(str, n, useWordBoundary) { 2 if (str.length <= n) { 3 return str; 4 } 5 const subString = str.substr(0, n - 1); // the original check 6 return ( 7 (useWordBoundary 8 ? subString.substr(0, subString.lastIndexOf(" ")) 9 : subString) + "…" 10 ); 11} 12 13(function ($) { 14 $(document).ready(function () { 15 const pluginUrl = customWidgetsPlugin.pluginUrl; 16 17 var slider = $(".text-slider"), 18 singleItemWidth = slider.parents(".elementor-widget-container").width(), 19 singleItemHeight = slider.find("li").height(), 20 maxItems = slider.find("li").length, 21 index = 0; 22 slider 23 .width(singleItemWidth) 24 .height(singleItemHeight) 25 .children(".text-slides") 26 .width(singleItemWidth * maxItems) 27 .children("li") 28 .width(singleItemWidth); 29 30 $("<ul />", { 31 class: "bullets", 32 }).appendTo(slider); 33 for (var i = 0; i < maxItems; i++) { 34 if (i == 0) { 35 $("<li />", { 36 class: "active", 37 html: '<a href="#" data-index="' + i + '"></a>', 38 }).appendTo($(".bullets")); 39 } else { 40 $("<li />", { 41 html: '<a href="#" data-index="' + i + '"></a>', 42 }).appendTo($(".bullets")); 43 } 44 } 45 slider.find(".bullets a").on("click", function (e) { 46 e.preventDefault(); 47 clearInterval(timeout); 48 index = $(this).data("index"); 49 $(this) 50 .parent("li") 51 .addClass("active") 52 .siblings("li") 53 .removeClass("active"); 54 slider.children(".text-slides").animate( 55 { 56 marginLeft: -(index * singleItemWidth), 57 }, 58 1000 59 ); 60 timeout = setInterval(slider_carousel, 5000); 61 }); 62 63 function slider_carousel() { 64 $(".bullets") 65 .find("li") 66 .eq(index) 67 .addClass("active") 68 .siblings("li") 69 .removeClass("active"); 70 slider.children(".text-slides").animate( 71 { 72 marginLeft: -(index * singleItemWidth), 73 }, 74 1000 75 ); 76 if (index < maxItems - 1) { 77 index++; 78 } else { 79 index = 0; 80 } 81 } 82 83 var timeout = setInterval(slider_carousel, 5000); 84 85 var oImgW = parseInt($(".banner .banner-image img").width()), 86 oImgH = parseInt($(".banner .banner-image img").height()), 87 bW = parseInt($(".banner .banner-image").width()), 88 bH = parseInt($(".banner").height()); 89 90 $(".blog-cards .elementor-post__read-more").text(""); 91 $("<i />", { 92 class: "eicon-arrow-right", 93 }).appendTo($(".blog-cards .elementor-post__read-more")); 94 $(".blog-cards article").each(function (i, art) { 95 $(art) 96 .find(".elementor-post__text .elementor-post__read-more") 97 .clone(true) 98 .appendTo($(art).find(".elementor-post__meta-data")); 99 $(art).find(".elementor-post__text .elementor-post__read-more").remove(); 100 }); 101 102 /** 103 * Country List 104 */ 105 $(".city_dropdown ul.cities").hide(); 106 $(".city_dropdown .has-cities").on("click", function (e) { 107 e.preventDefault(); 108 $(this).children(".down-arrow").toggleClass("up-arrow"); 109 $(this) 110 .siblings(".cities") 111 .slideToggle(500) 112 .parent("li") 113 .siblings("li") 114 .find(".cities") 115 .slideUp(400); 116 }); 117 118 /** 119 * Custom Select Menu 120 */ 121 122 /** 123 * FAQ 124 */ 125 $(".faq-content dd").hide(); 126 $(".faq-content dt").first().toggleClass("active").next("dd").slideToggle(); 127 $(".faq-content dt").on("click", function () { 128 $(this).toggleClass("active").next("dd").slideToggle(); 129 }); 130 131 /** 132 * Search Results 133 */ 134 var oldTitle = $(".search-results h4.elementor-heading-title").text(), 135 newTitle = oldTitle.replace(/.+:\s(.+)/, "$1"); 136 $(".search-results h4.elementor-heading-title").text(newTitle); 137 138 /** 139 * Register Form 140 */ 141 $("#signup-form").on("submit", function (e) { 142 e.preventDefault(); 143 var data = $(this).serialize(), 144 url = 145 window.location.protocol + 146 "//" + 147 window.location.host + 148 "/wp-json/wp/v2/users/register"; 149 console.log(data, url); 150 $.post(url, data, function (result) { 151 console.log(result); 152 }); 153 }); 154 155 /** 156 * My Account Divider 157 */ 158 $(".ma-divider").height($(".ma-divider-wrapper").height()); 159 160 /** 161 * Single Video Carousel
162 */ 163 /* 164 $(window).on('load', function () { 165 var options = { 166 items: 1, 167 merge:true, 168 loop: false, 169 margin: 15, 170 video: true, 171 lazyLoad:false, 172 center: false, 173 nav: true, 174 dots: true, 175 // autoHeight: true, 176 // videoHeight: 296, 177 // responsiveClass: true, 178 responsive: { 179 0: { 180 items: 1, 181 nav: true 182 }, 183 600: { 184 items: 2, 185 nav: true 186 } 187 } 188 }; 189 if( $(".owl-carousel .item-video").length > 1 ){ 190 options.loop = true; 191 } 192 193 $(".owl-carousel").owlCarousel(options); 194 }); 195 $(".owl-carousel").on('mousewheel', '.owl-stage', function (e) { 196 if (e.deltaY>0) { 197 owl.trigger('next.owl'); 198 } else { 199 owl.trigger('prev.owl'); 200 } 201 e.preventDefault(); 202 }); 203 */ 204 // }); 205 /** 206 * Terms 207 */ 208 $("body").on( 209 "click", 210 ".fake-checkout-term input[type=checkbox]", 211 function () { 212 if ($(this).is(":checked")) { 213 $(this) 214 .parents(".fake-checkout-term") 215 .removeClass("woocommerce-invalid-required-field"); 216 $( 217 ".woocommerce-terms-and-conditions-wrapper input[type=checkbox]" 218 ).trigger("click"); 219 } else { 220 $(this) 221 .parents(".fake-checkout-term") 222 .addClass("woocommerce-invalid-required-field"); 223 $( 224 ".woocommerce-terms-and-conditions-wrapper input[type=checkbox]" 225 ).trigger("click"); 226 } 227 } 228 ); 229 $("body").on("submit", ".woocommerce-checkout", function (e) { 230 if (!$(".fake-checkout-term input[type=checkbox]").is(":checked")) { 231 $(".fake-checkout-term input[type=checkbox]") 232 .parents(".fake-checkout-term") 233 .addClass("woocommerce-invalid-required-field"); 234 } 235 }); 236 237 /** 238 * Country List Modal 239 */ 240 $(".country-list-modal .country-box h4").on("click", function () { 241 $(this).next("ol").slideToggle(600); 242 }); 243 244 /** 245 * Mini Cart 246 */ 247 function mobile_mini_cart() { 248 // if ($(".mobile_cart .header-cart-cnt").is(":visible")) { 249 // $("<div></div>", { 250 // class: 'mobile-cart-mobile-overlay' 251 // }).prependTo($(".mobile_cart .header-cart-cnt")); 252 // $("<div></div>", { 253 // class: 'mobile-cart-mobile-header', 254 // html: '<i class="fas fa-window-close"></i>' 255 // }).prependTo($('.mobile_cart .header-cart-cnt .popup-cart')); 256 // } 257 //$('.popup-cart').unbind('click'); 258 $(".mobile_cart .header-cart-cnt .basket-icon").on("click", function (e) { 259 $(this) 260 .parent(".header-cart") 261 .siblings(".mobile-cart-mobile-overlay") 262 .fadeToggle(400); 263 $(this).parent().find(".popup-cart").toggleClass("open"); 264 }); 265 $(".mobile_cart .mobile-cart-mobile-overlay").click(function (e) { 266 $(".mobile_cart .mobile-cart-mobile-overlay").fadeToggle(400); 267 $(".mobile_cart .popup-cart").toggleClass("open"); 268 }); 269 $("body").on("click", ".mobile_cart i.fa-window-close", function (e) { 270 $(".mobile_cart .mobile-cart-mobile-overlay").fadeToggle(400); 271 $(".mobile_cart .popup-cart").toggleClass("open"); 272 }); 273 } 274 275 mobile_mini_cart(); 276 277 /** 278 * Product Custom Gallery 279 */ 280 var largeCarousel = $(".custom-product-gallery .gallery-large-image"), 281 thumbnailCarousel = $(".custom-product-gallery .gallery-thumbnails"); 282 largeCarousel.owlCarousel({ 283 items: 1, 284 loop: false, 285 nav: true, 286 dots: false, 287 navText: [ 288 '<img src="/wp-content/themes/camelot/theme-assets/svg/icon_dropdown_down.svg">', 289 '<img src="/wp-content/themes/camelot/theme-assets/svg/icon_dropdown_down.svg">', 290 ], 291 }); 292 thumbnailCarousel.owlCarousel({ 293 items: 6, 294 loop: false, 295 nav: false, 296 dots: false, 297 }); 298 $(document).on( 299 "click",
300 ".custom-product-gallery .gallery-thumbnails .item", 301 function (e) { 302 largeCarousel.trigger("to.owl.carousel", [$(this).data("index"), 300]); 303 } 304 ); 305 306 /** 307 * PORTFOLIO 308 */ 309 $(".portfolio_thumb .overlayed").each(function (index, image) { 310 var count = $(image).data("overlay-count"); 311 if (count.length != 0) { 312 $("<div></div>", { 313 text: count, 314 class: "overlay-count", 315 }) 316 .appendTo($(image)) 317 .css({ 318 width: $(image).children("img").width(), 319 height: $(image).children("img").height(), 320 lineHeight: $(image).children("img").height() + "px", 321 fontSize: ($(image).children("img").width() / 3) + "px", 322 }); 323 } 324 }); 325 326 }); 327})(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.