1/* 2 3 * @Website: rubiktheme.com - prestashop template provider 4 5 * @author rubiktheme <[email protected]> 6 7 * @copyright rubiktheme 8 9 * @description: Rb Theme Dream is module help you can build content for your shop 10 11 */ 12 13/* 14 15 * Custom code goes here. 16 17 * A template should always ship with an empty custom.js 18 19 */ 20 21 22 23/**************** CUSTOM ************/ 24 25 26 27 28 29// clik search 30 31$(document).ready(function () { 32 33 backtotop(); 34 35 ajaxLoading(); 36 37 runTextPlaceholder(); 38 39 AOS.init({ 40 41 duration: 1200, 42 43 }) 44 45 $('#search-widget #click_show_search,#rb-login .popup-title, #gr-lang .popup-title').click(function () { 46 47 var check = 0; 48 49 if ($(this).parent().hasClass('active')) { 50 51 check = 1; 52 53 } 54 55 $('.popup-title').parent().removeClass('active'); 56 57 if (check == 0) { 58 59 $(this).parent().addClass('active'); 60 61 } 62 63 }); 64 65 $('.close-campbar').click(function (e) { 66 67 e.stopPropagation(); 68 69 $('.header-campbar').addClass('hidden') 70 71 }); 72 73 $('.close-search,#click_off').click(function (e) { 74 75 e.stopPropagation(); 76 77 $('.search-widget').removeClass('active') 78 79 $('.rb-login').removeClass('active') 80 81 }); 82 83 $('.bg-over-lay').click(function (e) { 84 85 e.stopPropagation(); 86 87 $('.rb-login').removeClass('active') 88 89 $('#blockcart').removeClass('open') 90 91 }); 92 93}); 94 95 96 97// Back to top 98 99function backtotop() { 100 101 $('#rb-back-top a').click(function() { 102 103 $('body,html').animate({ 104 105 scrollTop: 0 106 107 }, 800); 108 109 110 111 return false; 112 113 }); 114 115 116 117 118 119 // scroll body to 0px on click 120 121 $('#rb-back-top a').click(function () { 122 123 $('body,html').animate({ 124 125 scrollTop: 0 126 127 }, 800); 128 129 return false; 130 131 }); 132 133} 134 135(function ($) { 136 137 "use strict"; 138 139 140 141 $(document).ready(function () { 142 143 "use strict"; 144 145 146 147 //Scroll back to top 148 149 150 151 var progressPath = document.querySelector('.progress-wrap path'); 152 153 var pathLength = progressPath.getTotalLength(); 154 155 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 156 157 progressPath.style.strokeDasharray = pathLength + ' ' + pathLength; 158 159 progressPath.style.strokeDashoffset = pathLength; 160 161 progressPath.getBoundingClientRect(); 162 163 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 164 165 var updateProgress = function () { 166 167 var scroll = $(window).scrollTop(); 168 169 var height = $(document).height() - $(window).height(); 170 171 var progress = pathLength - (scroll * pathLength / height); 172 173 progressPath.style.strokeDashoffset = progress; 174 175 } 176 177 updateProgress(); 178 179 $(window).scroll(updateProgress); 180 181 var offset = 50; 182 183 var duration = 550; 184 185 jQuery(window).on('scroll', function () { 186 187 if (jQuery(this).scrollTop() > offset) { 188 189 jQuery('.progress-wrap').addClass('active-progress'); 190 191 } else { 192 193 jQuery('.progress-wrap').removeClass('active-progress'); 194 195 } 196 197 }); 198 199 jQuery('.progress-wrap').on('click', function (event) { 200 201 event.preventDefault(); 202 203 jQuery('html, body').animate({ scrollTop: 0 }, duration); 204 205 return false; 206 207 }) 208 209 210 211 212 213 }); 214 215 216 217})(jQuery) 218 219 220 221// Loading Product 222 223function ajaxLoading() { 224 225 if ($('#product').length > 0) { 226 227 $(document).ajaxSend(function (event, jqxhr, settings) { 228 229 if (typeof settings.data != 'undefined' && typeof settings.data != 'object' && 230 231 settings.data.indexOf('qty=1&add=1&action=update') != -1) { 232 233 $('.add-to-cart-loading').show(); 234 235 } 236 237 238 239 if (typeof settings.data != 'undefined' && typeof settings.data != 'object' && 240 241 settings.data.indexOf('ajax=1&action=refresh&quantity_wanted=1') != -1) { 242 243 $('.main-product-details-loading').show(); 244 245 } 246 247 }); 248 249 250 251 $(document).ajaxComplete(function (event, jqxhr, settings) { 252 253 if (typeof settings.data != 'undefined' && typeof settings.data != 'object' && 254 255 settings.data.indexOf('qty=1&add=1&action=update') != -1) { 256 257 $('.add-to-cart-loading').hide(); 258 259 } 260 261 if (typeof settings.data != 'undefined' && typeof settings.data != 'object' && 262 263 settings.data.indexOf('ajax=1&action=refresh&quantity_wanted=1') != -1) { 264 265 $('.main-product-details-loading').hide(); 266 267 } 268 269 }); 270 271 } 272 273 274 275} 276 277 278 279// clik showmenu 280 281$(function () { 282 283 $('.show-menu').click(function (e) { 284 285 e.stopPropagation(); 286 287 if ($('.menu-sidebar').hasClass('active')) { 288 289 $('.menu-sidebar').removeClass('active'); 290 291 } 292 293 else { 294 295 $('.menu-sidebar').addClass('active'); 296 297 } 298 299 if ($('body').hasClass('off-canvas-active')) { 300 301 $('body').removeClass('off-canvas-active'); 302 303 } 304 305 else { 306 307 $('body').addClass('off-canvas-active'); 308 309 } 310 311 if ($('.bg-over-lay').hasClass('show-over-lay')) { 312 313 $('.bg-over-lay').removeClass('show-over-lay'); 314 315 } 316 317 else { 318 319 $('.bg-over-lay').addClass('show-over-lay'); 320 321 } 322 323 }); 324 325 $('#click_off_menu').click(function (e) { 326 327 e.stopPropagation(); 328 329 if ($('.menu-sidebar').hasClass('active')) { 330 331 $('.menu-sidebar').removeClass('active'); 332 333 } 334 335 if ($('.bg-over-lay').hasClass('show-over-lay')) { 336 337 $('.bg-over-lay').removeClass('show-over-lay'); 338 339 } 340 341 if ($('body').hasClass('off-canvas-active')) { 342 343 $('body').removeClass('off-canvas-active'); 344 345 } 346 347 }); 348 349 //close menu when click out 350 351 $(document).click(function (event) { 352 353 if (!$(event.target).closest('.menu-sidebar.active').length) { 354 355 if ($('.menu-sidebar.active').is(":visible")) { 356 357 $('.menu-sidebar.active').removeClass('active'); 358 359 $('.bg-over-lay.show-over-lay').removeClass('show-over-lay'); 360 361 } 362 363 } 364 365 }); 366 367}); 368 369// mobile 370 371$( window ).resize(function() { 372 373 if ($( window ).width() >= 992) { 374 375 $('.header-mobile').remove(); 376 377 378 379 $(window).resize(function () { 380 381 if ($( window ).width() < 992) { 382 383 location.reload(); 384 385 } 386 387 }); 388 389 } else { 390 391 $('.header-desktop').remove(); 392 393 394 395 $(window).resize(function () { 396 397 if ($( window ).width() >= 992) { 398 399 location.reload(); 400 401 } 402 403 }); 404 405 } 406 407 if ($( window ).width() < 1200) { 408 409 $('.menu-vertical').remove(); 410 411 412 413 } 414 415}); 416 417 418 419function categoryDescriptionExpand() { 420 421 var $catDesc = $('.js-expand-description'); 422 423 if ($catDesc.length) { 424 425 let maxHeight = $('.descSmall', $catDesc).height(), 426 427 realHeight = $('.descFull', $catDesc).height(); 428 429 console.log('maxHeight',maxHeight,'realHeight',realHeight); 430 431 if (realHeight > maxHeight) { 432 433 $catDesc.addClass('descCollapsed'); 434 435 $('.descSmall', $catDesc).css('max-height', 'none').height(maxHeight); 436 437 438 439 $('.descToggle.expand a', $catDesc).on('click', function(e) { 440 441 e.preventDefault(); 442 443 $catDesc.removeClass('descCollapsed').addClass('descExpanded'); 444 445 $('.descSmall', $catDesc).height(realHeight + 30); 446 447 return false;
448 449 }); 450 451 $('.descToggle.collapse a', $catDesc).on('click', function(e) { 452 453 e.preventDefault(); 454 455 $catDesc.addClass('descCollapsed').removeClass('descExpanded'); 456 457 $('.descSmall', $catDesc).height(maxHeight); 458 459 return false; 460 461 }); 462 463 } 464 465 } 466 467} 468 469 470 471$(window).on('load', function() { 472 473 categoryDescriptionExpand(); 474 475}); 476 477 478 479function runTextPlaceholder() 480 481{ 482return; 483 let textPlaceholder = $('.rb-search').attr('placeholder'); 484 485 let arrTextPlaceholder = textPlaceholder.split(" "); 486 487 let arrTextEmty = ['']; 488 489 let arrText = [...arrTextEmty, ...arrTextPlaceholder]; 490 491 let key = 1; 492 493 setInterval(function () { 494 495 let newText = ''; 496 497 498 499 $.each(arrText, function(index, text) { 500 501 if (index <= key) { 502 503 newText += ' ' + text; 504 505 } 506 507 }); 508 509 510 511 $('.rb-search').attr('placeholder', newText); 512 513 514 515 if (key == (arrText.length - 1)) { 516 517 key = 0; 518 519 } else { 520 521 key ++; 522 523 } 524 525 }, 1000); 526 527} 528 529 530 531// mobile 532 533if (screen.width >= 992) { 534 535 $('.header-mobile').remove(); 536 537 538 539 $(window).on('resize', function () { 540 541 if (screen.width < 992) { 542 543 reloadPage(); 544 545 } 546 547 }); 548 549} else { 550 551 $('.header-desktop').remove(); 552 553 554 555 $(window).on('resize', function () { 556 557 if (screen.width >= 992) { 558 559 reloadPage(); 560 561 } 562 563 }); 564 565} 566 567 568 569function reloadPage() 570 571{ 572 573 setTimeout(function () { 574 575 location.reload(); 576 577 }, 300); 578 579}
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.