1var $ = jQuery.noConflict(); 2 3$(window).on("load", function () { 4 console.log("doc.load new"); 5}); 6 7// localstorage handler for webview 8if ($("body").hasClass("page-node-99")) { 9 console.log("Bayi webview start page"); 10 localStorage.setItem("isWebview", "yes"); 11} 12 13if (localStorage.getItem("isWebview") == "yes") { 14 console.log("Webview storage is yes"); 15 $("body").addClass("is-webview"); 16 $(".region-header").addClass("scroll"); 17} 18 19let dotComma = Intl.NumberFormat("de-DE", { 20 style: "currency", 21 currency: "EUR", 22}).resolvedOptions().maximumFractionDigits; 23 24// session token for fakeCart 25if ($("body").hasClass("node-type-takim")) { 26 var sessionTok = ""; 27 $.ajax({ 28 type: "GET", 29 url: "/session/token", 30 success: function (theToken) { 31 sessionTok = theToken; 32 }, 33 }); 34 35 $( 36 ".pt-urun-ozellikleri .paragraph--type--urun-ozelligi .field--name-field-ozellik" 37 ).click(function () { 38 var thisOzellik = $(this); 39 if ( 40 thisOzellik.closest(".paragraph--type--urun-ozelligi").hasClass("active") 41 ) { 42 $(this).closest(".paragraph--type--urun-ozelligi").removeClass("active"); 43 } else { 44 $(".paragraph--type--urun-ozelligi").removeClass("active"); 45 $(this).closest(".paragraph--type--urun-ozelligi").addClass("active"); 46 } 47 }); 48} 49 50/*/varyasona göre sepete ekleme iÅleri */ 51// Satır bazında varyasyon deposu: { variationId: {quantity, price, sku, title, olcuLabel} } 52function initVariationStore() { 53 $( 54 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 55 ).each(function () { 56 var $row = $(this); 57 if (!$row.data("variationInit")) { 58 var $select = $row.find( 59 "select[name*='[attribute_olcu]'], select[name*='[attributes]']" 60 ); 61 $row.data("variationInit", true); 62 $row.data("currentVariationId", $row.find(".p-id").html()); 63 $row.data("lastOlcuLabel", $select.find("option:selected").text()); 64 $row.data("variationStore", {}); 65 } 66 }); 67} 68 69// Ãlçü select'i deÄiÅince (AJAX henüz gitmeden, DOM hâlâ ESKİ varyasyonu gösterirken) anlık durumu kaydet 70$(document).on("change", "select[name*='[attribute_olcu]']", function () { 71 var $row = $(this).closest( 72 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 73 ); 74 var store = $row.data("variationStore") || {}; 75 var oldId = $row.data("currentVariationId"); 76 var qty = Number($row.find(".field--name-quantity .form-number").val()) || 0; 77 78 if (oldId) { 79 store[oldId] = { 80 quantity: qty, 81 title: $row.find(".field--name-title").html(), 82 sku: $row.find(".field--name-sku .field-value").html(), 83 price: Number( 84 $row.find(".field--type-commerce-price .commerce-raw-price-js").html() 85 ), 86 olcuLabel: $row.data("lastOlcuLabel"), 87 }; 88 } 89 $row.data("variationStore", store); 90}); 91 92$(document).ajaxComplete(function () { 93 initVariationStore(); // yeni render edilen satırları da init et 94 95 $( 96 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 97 ).each(function () { 98 var $row = $(this); 99 var newId = $row.find(".p-id").html(); 100 var oldId = $row.data("currentVariationId"); 101 102 if (newId && newId !== oldId) { 103 var store = $row.data("variationStore") || {}; 104 var saved = store[newId]; 105 var $qty = $row.find(".field--name-quantity .form-number"); 106 var $select = $row.find("select[name*='[attribute_olcu]']"); 107 108 $qty.val(saved ? saved.quantity : 0); 109 $qty.toggleClass("in-cart", !!(saved && saved.quantity > 0)); 110 111 $row.data("currentVariationId", newId); 112 $row.data("lastOlcuLabel", $select.find("option:selected").text()); 113 114 buildCart(); 115 } 116 }); 117}); 118 119$(function () { 120 initVariationStore(); 121}); 122/*/varyasona göre sepete ekleme iÅleri */ 123 124// Cart item increase decrease actions 125function numberFieldControls() { 126 $(".js-form-type-number .increase").click(function (e) { 127 e.stopImmediatePropagation(); 128 var theQ = $(this).closest(".js-form-type-number").find(".form-number"); 129 var theQval = Number(jQuery(theQ).val()) + 1; 130 $(theQ).val(theQval); 131 buildCart(); 132 }); 133 $(".js-form-type-number .decrease").click(function (e) { 134 e.stopImmediatePropagation();
135 var theQ = $(this).closest(".js-form-type-number").find(".form-number"); 136 var theQval = Number(jQuery(theQ).val()) - 1; 137 if (theQval != "-1") { 138 $(theQ).val(theQval); 139 } 140 buildCart(); 141 }); 142} 143 144function prepFakeCartProducts() { 145 takCartJson = '{"products":[]}'; 146 takCartJson = JSON.parse(takCartJson); 147 148 $(".tss-products .tss-product").each(function () { 149 var thisID = $(this).find(".p-id").html(); 150 var thisItemQuantity = $(this).find(".tssp-quantity input").val(); 151 takCartJson["products"].push({ 152 variation_id: thisID, 153 quantity: thisItemQuantity, 154 }); 155 }); 156} 157 158$(".tss-add-to-cart").click(function () { 159 $.ajax({ 160 type: "POST", 161 url: "/api/custom/add-to-cart", 162 data: JSON.stringify(takCartJson), 163 success: function (data) { 164 location.href = "https://www.newjoy.com.tr/checkout"; 165 }, 166 dataType: "json", 167 headers: { 168 "X-CSRF-TOKEN": sessionTok, 169 "Content-Type": "application/json", 170 Accept: "application/json", 171 }, 172 }); 173}); 174console.log("yeniSepet"); 175function buildCart() { 176 $(".tss-products").html(""); 177 178 var cartSum = 0; 179 var thisItemCount = 0; 180 var thisCurrency = $(".p-raw-currency").html(); 181 182 $( 183 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 184 ).each(function () { 185 var $row = $(this); 186 var store = $row.data("variationStore") || {}; 187 var currentId = 188 $row.data("currentVariationId") || $row.find(".p-id").html(); 189 var $qtyItem = $row.find(".field--name-quantity .form-number"); 190 var currentQty = Number($qtyItem.val()) || 0; 191 192 // Ekranda Åu an görünen varyasyonun güncel halini store'a yaz 193 store[currentId] = { 194 quantity: currentQty, 195 title: $row.find(".field--name-title").html(), 196 sku: $row.find(".field--name-sku .field-value").html(), 197 price: Number( 198 $row.find(".field--type-commerce-price .commerce-raw-price-js").html() 199 ), 200 olcuLabel: $row.data("lastOlcuLabel"), 201 }; 202 $row.data("variationStore", store); 203 $qtyItem.toggleClass("in-cart", currentQty > 0); 204 205 // Store'daki HER varyasyonu sepete bas 206 $.each(store, function (variationId, data) { 207 if (data.quantity > 0) { 208 var totalPrice = data.price * data.quantity; 209 var priceString = totalPrice.toLocaleString("de-DE", { 210 maximumFractionDigits: dotComma, 211 }); 212 var titleWithSize = 213 data.title + (data.olcuLabel ? " (" + data.olcuLabel + ")" : ""); 214 215 var thisProduct = 216 '<div class="tss-product"><div class="tssp-title">' + 217 titleWithSize + 218 '</div><div class="tssp-price-actions"><div class="tssp-price">' + 219 '<span class="currency-icon">' + 220 thisCurrency + 221 "</span>" + 222 priceString + 223 '</div><div class="tssp-quantity"><div class="decrease"></div><input type="number" value="' + 224 data.quantity + 225 '" step="0.01" min="0" class="form-number"><div class="increase"></div></div><div class="tssp-remove"></div><div class="tssp-sku">' + 226 data.sku + 227 '</div><div class="p-id">' + 228 variationId + 229 "</div></div></div>"; 230 231 $(".tss-products").append(thisProduct); 232 cartSum += totalPrice; 233 thisItemCount += parseInt(data.quantity); 234 } 235 }); 236 }); 237 238 var cartSumNakit = (cartSum * 1.12).toLocaleString("de-DE", { 239 minimumFractionDigits: 0, 240 maximumFractionDigits: 0, 241 }); 242 cartSum = cartSum.toLocaleString("de-DE", { 243 maximumFractionDigits: dotComma, 244 }); 245 246 $(".tss-total-price .items-in-cart-amount").html(thisCurrency + "" + cartSum); 247 $(".tss-total-price .items-in-cart-count").html(thisItemCount); 248 $(".tss-total-price .items-in-cart-amount-nakit").html( 249 thisCurrency + "" + cartSumNakit 250 ); 251 252 $(".tssp-remove").click(function () { 253 var thisProductSKU = $(this) 254 .closest(".tss-product") 255 .find(".tssp-sku") 256 .html(); 257 var thisVariationId = $(this).closest(".tss-product").find(".p-id").html(); 258 259 // İlgili satırın store'undan da bu varyasyonu sil 260 $( 261 '.product-display-card-w-attributes:contains("' + thisProductSKU + '")' 262 ).each(function () { 263 var $row = $(this).closest( 264 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 265 ); 266 var store = $row.data("variationStore") || {}; 267 delete store[thisVariationId]; 268 $row.data("variationStore", store); 269 270 if ($row.data("currentVariationId") === thisVariationId) { 271 $row 272 .find(".field--name-quantity .form-number") 273 .val(0) 274 .removeClass("in-cart"); 275 } 276 }); 277 278 $(this).closest(".tss-product").remove(); 279 buildCart(); 280 }); 281 282 prepFakeCartProducts(); 283} 284 285/* Eski versiyon 286function buildCart() { 287 $(".tss-products").html(""); 288 289 var cartSum = 0; 290 var thisItemCount = 0; 291 var thisCurrency = $(".p-raw-currency").html(); 292 293 $( 294 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 295 ).each(function () { 296 var thisQuantity = $(this).find(".field--name-quantity .form-number").val(); 297 var thisQuantityItem = $(this).find(".field--name-quantity .form-number"); 298 var thisTitle = $(this).find(".field--name-title").html(); 299 var thisSKU = $(this).find(".field--name-sku .field-value").html(); 300 var thisID = $(this).find(".p-id").html(); 301 var thisPrice = $(this) 302 .find(".field--type-commerce-price .commerce-raw-price-js") 303 .html(); 304 305 thisPrice = thisPrice * thisQuantity;
306 thisPriceString = thisPrice.toLocaleString("de-DE", { 307 maximumFractionDigits: dotComma, 308 }); 309 310 var thisProduct = 311 '<div class="tss-product"><div class="tssp-title">' + 312 thisTitle + 313 '</div><div class="tssp-price-actions"><div class="tssp-price">' + 314 '<span class="currency-icon">' + 315 thisCurrency + 316 "</span>" + 317 thisPriceString + 318 '</div><div class="tssp-quantity"><div class="decrease"></div><input type="number" value="' + 319 thisQuantity + 320 '" step="0.01" min="0" class="form-number"><div class="increase"></div></div><div class="tssp-remove"></div><div class="tssp-sku">' + 321 thisSKU + 322 '</div><div class="p-id">' + 323 thisID + 324 "</div></div></div>"; 325 326 if (thisQuantity > 0) { 327 $(".tss-products").append(thisProduct); 328 $(thisQuantityItem).addClass("in-cart"); 329 cartSum += thisPrice; 330 thisItemCount += parseInt(thisQuantity); 331 } else { 332 $(thisQuantityItem).removeClass("in-cart"); 333 } 334 }); 335 336 var cartSumNakit = cartSum * 1.12; 337 cartSumNakit = cartSumNakit.toLocaleString("de-DE", { 338 minimumFractionDigits: 0, 339 maximumFractionDigits: 0, 340 }); 341 342 cartSum = cartSum.toLocaleString("de-DE", { 343 maximumFractionDigits: dotComma, 344 }); 345 346 $(".tss-total-price .items-in-cart-amount").html(thisCurrency + "" + cartSum); 347 $(".tss-total-price .items-in-cart-count").html(thisItemCount); 348 349 $(".tss-total-price .items-in-cart-amount-nakit").html( 350 thisCurrency + "" + cartSumNakit 351 ); 352 console.log("Fiyat =>" + cartSumNakit); 353 354 $(".tssp-remove").click(function () { 355 var thisProductSKU = $(this) 356 .closest(".tss-product") 357 .find(".tssp-sku") 358 .html(); 359 $('.product-display-card-w-attributes:contains("' + thisProductSKU + '")') 360 .find(".form-number") 361 .val("0"); 362 $(this).closest(".tss-product").remove(); 363 buildCart(); 364 }); 365 366 prepFakeCartProducts(); 367} 368*/ 369function inputLabels() { 370 $(".form-item").each(function () { 371 var theLabel = $(this).find("label").html(); 372 $(this) 373 .find( 374 ".form-text:not(.inspectletIgnore), .form-textarea, .form-search, .form-email, .form-number, .form-tel, .form-url, .form-date, .form-password" 375 ) 376 .attr("placeholder", theLabel); 377 }); 378} 379 380$(document).ready(function () { 381 console.log("doc.ready"); 382 383 inputLabels(); 384 // gsap.to("#block-kerataif-page-title", { duration: 1, ease: "Expo.inOut", y: 500 }); 385 386 if ($("body").hasClass("front")) { 387 $("#block-kataloglarikesfetbayilikbasvurusu .k-right").appendTo( 388 "#block-enyakinmagazanerede .content" 389 ); 390 $("#block-mailchimpsubscriptionformfirsatlariyakalamakicin").prependTo( 391 "#block-kataloglarikesfetbayilikbasvurusu .content" 392 ); 393 } 394 395 // change texts for bayi role 396 $(".role-bayi .checkout-pane-coupon-redemption .form-text").attr( 397 "placeholder", 398 "İndirim uygula" 399 ); 400 $( 401 ".role-bayi .checkout-pane-coupon-redemption > .js-form-wrapper > .form-submit" 402 ).val("Uygula"); 403 $(".role-bayi .coupon-redemption-form__coupons .form-submit").val("Kaldır"); 404 405 // move checkout buttons to right 406 if ($("body").hasClass("path-checkout")) { 407 $(".layout-region-checkout-footer").appendTo( 408 ".layout-region-checkout-secondary" 409 ); 410 } 411 412 setTimeout(function () { 413 $( 414 '<div class="close-search"><div class="close-search-btn"></div></div>' 415 ).insertBefore("#block-gosterilenformcustom-aramapage-1 form"); 416 $("#block-searchtoggle").click(function () { 417 //e.preventDefault(); 418 $("#block-gosterilenformcustom-aramapage-1").addClass("active"); 419 $(".black-overlay").addClass("active"); 420 $("#block-gosterilenformcustom-aramapage-1 .form-autocomplete").focus(); 421 }); 422 $("#block-gosterilenformcustom-aramapage-1 .close-search-btn").click( 423 function (e) { 424 //e.preventDefault(); 425 $("#block-gosterilenformcustom-aramapage-1").removeClass("active"); 426 $(".black-overlay").removeClass("active"); 427 } 428 ); 429 430 $("#block-menutoggler").click(function () { 431 $("#menuHolder").toggleClass("active"); 432 $(this).toggleClass("active"); 433 $(".black-overlay").toggleClass("active"); 434 435 if ($("#headerHolder .region-header").hasClass("scroll")) { 436 } else if (!$("#headerHolder .region-header").hasClass("scroll")) { 437 $("#headerHolder .region-header").addClass("scroll"); 438 } 439 }); 440 441 $("#block-views-block-custom-user-menu-block-1 .view-content").click( 442 function () { 443 $( 444 "#block-views-block-custom-user-menu-block-1 .view-footer" 445 ).toggleClass("active"); 446 } 447 ); 448 449 var currentLang = $("html").attr("lang"); 450 console.log(currentLang); 451 452 $( 453 "#block-dildegistirici .links li, #block-dildegistirici-2 .links li" 454 ).each(function () { 455 var thisLink = $(this); 456 var thisLinkLang = $(this).attr("hreflang"); 457 458 if (thisLinkLang == currentLang) { 459 thisLink.addClass("is-active"); 460 } 461 }); 462 463 $("#block-dildegistirici li.is-active").click(function () { 464 $("#block-dildegistirici .links").toggleClass("active"); 465 }); 466 $("#block-dildegistirici-2 li.is-active").click(function () { 467 $("#block-dildegistirici-2 .links").toggleClass("active"); 468 }); 469 470 // change currency labels in currency switcher block 471 $(".commerce-currency-resolver-select-form .form-select option").each( 472 function () { 473 var currencyVal = $(this).attr("value"); 474 $(this).html(currencyVal); 475 } 476 ); 477 478 if ($("#block-views-block-ana-slider-block-1").length) { 479 //$("#block-views-block-ana-slider-block-2 .view-content").addClass("swiper-wrapper"); 480 // var anaSliderThumbs = new Swiper("#block-views-block-ana-slider-block-2 .swiper-container", { 481 // slidesPerView: 'auto', freeMode: true, watchSlidesVisibility: true, watchSlidesProgress: true, 482 // }); 483 484 $("#block-views-block-ana-slider-block-1 .view-content").addClass( 485 "swiper-wrapper" 486 ); 487 $("#block-views-block-ana-slider-block-1").append( 488 '<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>' 489 ); 490 $("#block-views-block-ana-slider-block-1").append( 491 '<div class="swiper-pagination pagination-as"></div>' 492 ); 493 const anaSliderSwiper = new Swiper( 494 "#block-views-block-ana-slider-block-1 .swiper-container", 495 { 496 autoplay: { delay: 4000 }, 497 navigation: { 498 nextEl: ".swiper-button-next", 499 prevEl: ".swiper-button-prev", 500 }, 501 effect: "cards", 502 cardEffect: { 503 perSlideOffset: 10, 504 perSlideRotate: 2, 505 rotate: false, 506 slideShadows: false, 507 }, 508 509 pagination: { 510 el: ".pagination-as", 511 type: "bullets", 512 }, 513 breakpoints: { 514 700: { 515 effect: "fade", 516 }, 517 }, 518 } 519 ); 520 521 $( 522 "#block-views-block-ana-slider-block-1 .view-content .views-field-nothing" 523 ).each(function () { 524 var slideinfos = $(this); 525 var slideTitle = $(this).find(".slide-title").text(); 526 527 if (slideTitle.length <= 0) { 528 console.log("Slide has no title"); 529 $(slideinfos).addClass("hide-info"); 530 } 531 }); 532 } 533 if ($("#block-kerataif-views-block-takimlar-block-1").length) { 534 $("#block-kerataif-views-block-takimlar-block-1 h3").append( 535 '<div class="mobile-sm-toggler"></div>' 536 ); 537 $("#block-kerataif-views-block-kategori-listesi-block-1 h3").append( 538 '<div class="mobile-sm-toggler"></div>' 539 ); 540 541 $(".mobile-sm-toggler").click(function () { 542 $(this).closest(".item-list").toggleClass("active"); 543 }); 544 } 545 546 if ($("#block-views-block-ikincil-slider-block-1").length) { 547 $("#block-views-block-ikincil-slider-block-1 .view-content").addClass( 548 "swiper-wrapper" 549 ); 550 $("#block-views-block-ikincil-slider-block-1").append( 551 '<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>' 552 ); 553 const ikincilSliderSwiper = new Swiper( 554 "#block-views-block-ikincil-slider-block-1 .swiper-container", 555 { 556 autoplay: { delay: 4000 }, 557 navigation: { 558 nextEl: ".swiper-button-next", 559 prevEl: ".swiper-button-prev", 560 }, 561 } 562 ); 563 } 564 565 if ($(".region-kampanyalar").length) { 566 $("#block-views-block-kampanyalar-block-3 .view-content").addClass( 567 "swiper-wrapper" 568 ); 569 var kampanyalarSliderThumbs = new Swiper( 570 "#block-views-block-kampanyalar-block-3 .swiper-container", 571 { 572 direction: "horizontal", 573 observer: true, 574 resizeObserver: true, 575 observeParents: true, 576 observeSlideChildren: true, 577 578 breakpoints: { 579 1150: { 580 direction: "vertical", 581 slidesPerView: "auto", 582 freeMode: false, 583 watchSlidesVisibility: true, 584 watchSlidesProgress: true, 585 }, 586 }, 587 } 588 ); 589 590 $("#block-views-block-kampanyalar-block-2 .view-content").addClass( 591 "swiper-wrapper" 592 ); 593 const anaSliderSwiper = new Swiper( 594 "#block-views-block-kampanyalar-block-2 .swiper-container", 595 { 596 autoplay: { delay: 4000 }, 597 effect: "slide", 598 /*cardEffect: { 599 perSlideOffset: 10, 600 perSlideRotate: 2, 601 rotate: false, 602 slideShadows: false, 603 },*/ 604 thumbs: { swiper: kampanyalarSliderThumbs }, 605 } 606 ); 607 } 608 609 if ($(".view-urun-bloklari").length) { 610 $(".view-urun-bloklari > .view-content").addClass("swiper-wrapper"); 611 $(".view-urun-bloklari").prepend( 612 '<div class="swiper-button-container"><div class="swiper-button-prev-c"></div><div class="swiper-button-next-c"></div></div>' 613 ); 614 const urunBloklariSwiper = new Swiper(".view-urun-bloklari", { 615 autoplay: { delay: 4000 }, 616 slidesPerView: 1, 617 spaceBetween: 30, 618 pauseOnMouseEnter: true, 619 //observer: true, resizeObserver: true, observeParents: true, observeSlideChildren: true, 620 navigation: { 621 nextEl: ".swiper-button-next-c", 622 prevEl: ".swiper-button-prev-c", 623 }, 624 breakpoints: { 625 1150: { slidesPerView: 3 }, 626 700: { slidesPerView: 2 }, 627 }, 628 }); 629 630 $(".view-urun-bloklari").each(function () { 631 var thisUB = $(this); 632 var thisRootTitle = $(this) 633 .closest(".views-element-container") 634 .find("h2"); 635 $(thisUB.find(".swiper-button-container")).prepend(thisRootTitle); 636 }); 637 } 638 if ($("#block-kerataif-views-block-cok-satanlar-takim-block-1").length) { 639 $(".view-cok-satanlar-takim > .view-content").addClass("swiper-wrapper"); 640 $(".view-cok-satanlar-takim").prepend( 641 '<div class="swiper-button-container"><div class="swiper-button-prev-ct"></div><div class="swiper-button-next-ct"></div></div>' 642 ); 643 const urunBloklariSwiper = new Swiper(".view-cok-satanlar-takim", { 644 autoplay: { delay: 4000 }, 645 slidesPerView: 1, 646 spaceBetween: 30, 647 pauseOnMouseEnter: true, 648 centeredSlides: true, 649 pauseOnMouseEnter: true, 650 //observer: true, resizeObserver: true, observeParents: true, observeSlideChildren: true, 651 navigation: { 652 nextEl: ".swiper-button-next-ct", 653 prevEl: ".swiper-button-prev-ct", 654 }, 655 breakpoints: { 656 1150: { slidesPerView: 3 }, 657 700: { slidesPerView: 2 }, 658 }, 659 }); 660 661 $(".view-urun-bloklari").each(function () { 662 var thisUB = $(this); 663 var thisRootTitle = $(this) 664 .closest(".views-element-container") 665 .find("h2"); 666 $(thisUB.find(".swiper-button-container")).prepend(thisRootTitle); 667 }); 668 } 669 670 if ($("#block-views-block-yok-artik-urunleri-block-1").length) { 671 $( 672 "#block-views-block-yok-artik-urunleri-block-1 > div > .view > .view-content" 673 ).addClass("swiper-wrapper"); 674 $("#block-views-block-yok-artik-urunleri-block-1 > div > .view").prepend( 675 '<div class="swiper-button-container-y"><div class="swiper-button-prev-y"></div><div class="swiper-button-next-y"></div></div>' 676 ); 677 const yokArtikSwiper = new Swiper( 678 "#block-views-block-yok-artik-urunleri-block-1 > div > .view", 679 { 680 autoplay: { delay: 4000 }, 681 slidesPerView: 1, 682 spaceBetween: 20, 683 pauseOnMouseEnter: true, 684 observer: true, 685 resizeObserver: true, 686 observeParents: true, 687 observeSlideChildren: true, 688 navigation: { 689 nextEl: ".swiper-button-next-y", 690 prevEl: ".swiper-button-prev-y", 691 }, 692 693 breakpoints: { 694 1150: { slidesPerView: 3 }, 695 700: { slidesPerView: 2, spaceBetween: 30 }, 696 }, 697 } 698 ); 699 700 $("#block-views-block-yok-artik-urunleri-block-1").each(function () { 701 var thisUB = $(this); 702 var thisRootTitle = $(this) 703 .closest(".views-element-container") 704 .find("h2"); 705 $(thisRootTitle).append(thisUB.find(".swiper-button-container-y")); 706 }); 707 } 708 709 if ($(".view-benzer-urunler").length) { 710 $(".view-benzer-urunler > .view-content").addClass("swiper-wrapper"); 711 $(".view-benzer-urunler").prepend( 712 '<div class="swiper-button-container"><div class="swiper-button-prev-b"></div><div class="swiper-button-next-b"></div></div>' 713 ); 714 const benzerUrunlerSwiper = new Swiper(".view-benzer-urunler", { 715 autoplay: { delay: 4000 }, 716 slidesPerView: 1, 717 spaceBetween: 30, 718 pauseOnMouseEnter: true, 719 observer: true, 720 resizeObserver: true, 721 observeParents: true, 722 observeSlideChildren: true, 723 navigation: { 724 nextEl: ".swiper-button-next-b", 725 prevEl: ".swiper-button-prev-b", 726 }, 727 breakpoints: { 728 1150: { slidesPerView: 3 }, 729 700: { slidesPerView: 2 }, 730 }, 731 }); 732 733 $(".view-benzer-urunler").each(function () { 734 var thisUB = $(this); 735 var thisRootTitle = $(this) 736 .closest(".views-element-container") 737 .find("h2"); 738 $(thisUB.find(".swiper-button-container")).prepend(thisRootTitle); 739 }); 740 } 741 742 if ($(".p-taksit").length) { 743 $(".ptp-taksit-toggler").click(function () { 744 $(".ptp-taksit").toggleClass("active"); 745 $(".black-overlay").toggleClass("active"); 746 gsap.to(".ptpt-box", { y: 0, opacity: 1, duration: 0.1, stagger: 0.1 }); 747 }); 748 } 749 750 $(".region-sosyalIcerik .view .view-content").each(function () { 751 var thisContent = $(this); 752 $('<div class="nav-up"></div>').insertBefore(thisContent); 753 $('<div class="nav-down"></div>').insertAfter(thisContent); 754 }); 755 756 $("#block-views-block-youtube-block-block-1 .views-row").click(function () { 757 $(this).find(".views-field-field-video-url").addClass("active"); 758 $(".black-overlay").addClass("active"); 759 }); 760 761 $( 762 ".black-overlay, #menuHolder .main-menu-close-button, .drc-close, .popup-close, .ptp-taksit-close" 763 ).click(function () { 764 $(".views-field-field-video-url").removeClass("active"); 765 $(".black-overlay").removeClass("active"); 766 $("#menuHolder").removeClass("active"); 767 $(".dr-content").removeClass("active"); 768 $(".view-tanitim-videolari .views-field-field-video-upload").removeClass( 769 "active" 770 ); 771 $(".view-tanitim-videolari .views-field-field-video-embed").removeClass( 772 "active" 773 ); 774 $(".jst-slider-video").removeClass("active"); 775 $(".jst-slider-video").remove().delay(400); 776 $("#block-views-block-popup-block-1").removeClass("active"); 777 $(".view-en-yakin-magaza").removeClass("active"); 778 $("#block-gosterilenformcustom-aramapage-1").removeClass("active"); 779 780 if ($(".views-field-field-video-upload").length) { 781 $(".views-field-field-video-upload .field-content").each(function () { 782 var theVideoHtml = $(this).html();
783 $(this).html(theVideoHtml); 784 }); 785 } 786 if ($(".video-embed-field-provider-youtube").length) { 787 $(".video-embed-field-provider-youtube").each(function () { 788 var theVideoHtml = $(this).html(); 789 $(this).html(theVideoHtml); 790 }); 791 } 792 if ($(".p-taksit").length) { 793 $(".ptp-taksit").removeClass("active"); 794 gsap.to(".ptpt-box", { 795 y: 40, 796 opacity: 0, 797 duration: 0.3, 798 stagger: 0.2, 799 }); 800 } 801 }); 802 803 if ($(".swiper-pagination-bullet").length) { 804 $(".swiper-pagination-bullet").hover(function () { 805 $(this).trigger("click"); 806 }); 807 808 $(".product-display-card .swiper-pagination-bullet").each(function () { 809 var linkAttr = $(this) 810 .closest(".product-display-card") 811 .find(".field--name-title a") 812 .attr("href"); 813 $(this).append('<a href="' + linkAttr + '"></a>'); 814 }); 815 $(".product-display-card-w-attributes .swiper-pagination-bullet").each( 816 function () { 817 var linkAttr = $(this) 818 .closest(".product-display-card-w-attributes") 819 .find(".p-title") 820 .attr("href"); 821 $(this).append('<a href="' + linkAttr + '"></a>'); 822 } 823 ); 824 $(".takim-card-container .swiper-pagination-bullet").each(function () { 825 var linkAttr = $(this) 826 .closest(".takim-card-container") 827 .find(".t-title a") 828 .attr("href"); 829 $(this).append('<a href="' + linkAttr + '"></a>'); 830 }); 831 $(".swiper-pagination-bullet a").click(function (e) { 832 e.stopImmediatePropagation(); 833 window.location.href = linkAttr; 834 }); 835 } 836 837 // set default quantity value of custom cart items 838 $( 839 ".paragraph--type--takim-urunu, .paragraph--type--tamamlayici-urunler" 840 ).each(function () { 841 var thisQuantity = Number($(this).find(".field--name-field-adet").html()); 842 $(this).find(".field--name-quantity .form-number").val(thisQuantity); 843 }); 844 845 // special actions for takım page 846 if ($("body").hasClass("node-type-takim")) { 847 // scroll page to takım contents 848 $(".ta-view").click(function () { 849 gsap.to(window, { 850 duration: 1, 851 scrollTo: { y: ".p-bottom", offsetY: 200 }, 852 ease: "expo.inOut", 853 }); 854 }); 855 $(".ta-buy").click(function () { 856 gsap.to(window, { 857 duration: 1, 858 scrollTo: { y: ".takim-sepet", offsetY: 200 }, 859 ease: "expo.inOut", 860 }); 861 }); 862 863 // build initial fakeCart 864 buildCart(); 865 866 var takCartJson = '{"products":[]}'; 867 prepFakeCartProducts(); 868 } 869 870 // cart actions 871 if ($(".custom-cartholder").length) { 872 $("#block-sepet .cart--cart-block").click(function () { 873 $("#block-sepet-2").addClass("active"); 874 }); 875 $("#block-sepet-2 .cc-close").click(function () { 876 $("#block-sepet-2").removeClass("active"); 877 }); 878 } 879 880 if ($("body").hasClass("path-checkout")) { 881 $("#block-kerataif-page-title").prependTo(".layout-checkout-form"); 882 } 883 884 if ($(".view-magazalar").length) { 885 $(".view-magazalar .attachment.attachment-after .item-list h3").click( 886 function () { 887 var thisItem = $(this); 888 var thisItemList = $(this).closest(".item-list"); 889 890 thisItemList.toggleClass("active"); 891 thisItem.toggleClass("active"); 892 gsap.to(window, { 893 duration: 1, 894 scrollTo: { y: thisItemList, offsetY: 200 }, 895 ease: "expo.inOut", 896 }); 897 } 898 ); 899 } 900 901 if ($(".dr-content").length) { 902 $(".diger-dokumanlar-button").click(function () { 903 $(this).closest(".d-right").find(".dr-content").addClass("active"); 904 $(".black-overlay").addClass("active"); 905 }); 906 $(".drc-close").click(function () { 907 $(".dr-content").removeClass("active"); 908 $(".black-overlay").removeClass("active"); 909 }); 910 } 911 912 if ($(".view-tanitim-videolari").length) { 913 $(".view-tanitim-videolari .views-row").each(function () { 914 var coverImage = $(this).find( 915 ".views-field-field-kapak-gorseli-tani-vid" 916 ); 917 var thisVideoEmbed = $(this).find(".views-field-field-video-embed"); 918 var thisVideoUpload = $(this).find(".views-field-field-video-upload"); 919 920 coverImage.click(function () { 921 thisVideoEmbed.addClass("active"); 922 thisVideoUpload.addClass("active"); 923 $(".black-overlay").addClass("active"); 924 }); 925 }); 926 } 927 928 if ($(".views-field-field-video-embed").length) { 929 $(".views-row") 930 .has(".views-field-field-video-embed") 931 .addClass("has-video"); 932 $(".has-video .views-field").click(function () { 933 var theVideo = $(this).find(".field-content").html(); 934 $(".dialog-off-canvas-main-canvas").append( 935 '<div class="jst-slider-video">' + theVideo + "</div>" 936 ); 937 $(".jst-slider-video").addClass("active"); 938 $(".black-overlay").addClass("active"); 939 }); 940 } 941 942 if ($("#block-views-block-popup-block-1").length) { 943 $(".black-overlay").addClass("active"); 944 $("#block-views-block-popup-block-1").addClass("active"); 945 946 $("#block-views-block-popup-block-1 .popup-close").click(function () { 947 var videoFrame = $( 948 "#block-views-block-popup-block-1 .video-embed-field-provider-youtube" 949 ).html(); 950 $( 951 "#block-views-block-popup-block-1 .video-embed-field-provider-youtube" 952 ).html(videoFrame); 953 $(".black-overlay").removeClass("active"); 954 $("#block-views-block-popup-block-1").removeClass("active"); 955 }); 956 } 957 958 if ($(".view-magazalar").length) { 959 $(".view-magazalar .view-filters .views-exposed-form").append( 960 '<div class="js-form-item form-item"><div class="en-yakin-button">En yakın maÄaza</div></div>' 961 ); 962 963 $(".en-yakin-button").click(function () { 964 $(".view-en-yakin-magaza").addClass("active"); 965 $(".black-overlay").addClass("active"); 966 }); 967 } 968 969 if ($(window).width() < 1181) { 970 $("#headerHolder .region-header").addClass("scroll"); 971 972 $("#block-enyakinmagazanerede").insertAfter( 973 "#featuredHolder .region-featured" 974 ); 975 976 if ($("#block-views-block-yok-artik-urunleri-block-2").length) { 977 $( 978 "#block-views-block-yok-artik-urunleri-block-2 > div > .view > .view-content" 979 ).addClass("swiper-wrapper"); 980 $( 981 "#block-views-block-yok-artik-urunleri-block-2 > div > .view" 982 ).prepend( 983 '<div class="swiper-button-container-y2"><div class="swiper-button-prev-y2"></div><div class="swiper-button-next-y2"></div></div>' 984 ); 985 const yokArtik2Swiper = new Swiper( 986 "#block-views-block-yok-artik-urunleri-block-2 > div > .view", 987 { 988 autoplay: { delay: 4000 }, 989 slidesPerView: 1, 990 spaceBetween: 30, 991 pauseOnMouseEnter: true, 992 observer: true, 993 resizeObserver: true, 994 observeParents: true, 995 observeSlideChildren: true, 996 navigation: { 997 nextEl: ".swiper-button-next-y2", 998 prevEl: ".swiper-button-prev-y2", 999 }, 1000 1001 breakpoints: { 1002 1150: { slidesPerView: 3 }, 1003 }, 1004 } 1005 ); 1006 1007 $("#block-views-block-yok-artik-urunleri-block-2").each(function () { 1008 var thisUB = $(this); 1009 var thisRootTitle = $(this) 1010 .closest(".views-element-container") 1011 .find("h2"); 1012 $(thisRootTitle).append(thisUB.find(".swiper-button-container-y2")); 1013 }); 1014 } 1015 1016 $("#block-kerataif-bebekcocukgenc").addClass("swiper-container"); 1017 $("#block-kerataif-bebekcocukgenc").prepend( 1018 '<div class="swiper-button-container-bcg"><div class="swiper-button-prev-bcg"></div><div class="swiper-button-next-bcg"></div></div>' 1019 ); 1020 $("#block-kerataif-bebekcocukgenc").append( 1021 '<div class="swiper-pagination pagination-bcg"></div>' 1022 ); 1023 $("#block-kerataif-bebekcocukgenc .menu").addClass("swiper-wrapper"); 1024 $("#block-kerataif-bebekcocukgenc .menu .menu-item").addClass( 1025 "swiper-slide" 1026 ); 1027 1028 const bcgSwiper = new Swiper("#block-kerataif-bebekcocukgenc", { 1029 autoplay: { delay: 4000 }, 1030 pauseOnMouseEnter: true, 1031 spaceBetween: 20, 1032 observer: true, 1033 resizeObserver: true, 1034 observeParents: true, 1035 observeSlideChildren: true, 1036 navigation: { 1037 nextEl: ".swiper-button-next-bcg", 1038 prevEl: ".swiper-button-prev-bcg", 1039 }, 1040 pagination: { 1041 el: ".pagination-bcg", 1042 type: "bullets", 1043 }, 1044 }); 1045 1046 $("#block-views-block-joyblog-block-1 .view-joyblog").addClass( 1047 "swiper-container" 1048 ); 1049 // $("#block-views-block-joyblog-block-1 .view-joyblog .view-content").prepend('<div class="swiper-button-container-bcg"><div class="swiper-button-prev-bcg"></div><div class="swiper-button-next-bcg"></div></div>'); 1050 $("#block-views-block-joyblog-block-1 .view-joyblog .view-footer").append( 1051 '<div class="swiper-pagination pagination-jb"></div>' 1052 ); 1053 $( 1054 "#block-views-block-joyblog-block-1 .view-joyblog .view-content " 1055 ).addClass("swiper-wrapper"); 1056 $( 1057 "#block-views-block-joyblog-block-1 .view-joyblog .view-content .views-row" 1058 ).addClass("swiper-slide"); 1059 1060 const jbSwiper = new Swiper( 1061 "#block-views-block-joyblog-block-1 .view-joyblog", 1062 { 1063 autoplay: { delay: 4000 }, 1064 pauseOnMouseEnter: true, 1065 spaceBetween: 20, 1066 observer: true, 1067 resizeObserver: true, 1068 observeParents: true, 1069 observeSlideChildren: true, 1070 // navigation: { nextEl: '.swiper-button-next-bcg', prevEl: '.swiper-button-prev-bcg'}, 1071 pagination: { 1072 el: ".pagination-jb", 1073 type: "bullets", 1074 }, 1075 } 1076 ); 1077 } 1078 1079 $(".takim-container .paragraph--type--takim-urunu").each(function () { 1080 var thisTakimItem = $(this); 1081 if (!thisTakimItem.find("article").length > 0) { 1082 thisTakimItem.addClass("hidden-for-country"); 1083 } 1084 }); 1085 }, 600); 1086 1087 numberFieldControls(); 1088 1089 gtag("consent", "update", { 1090 ad_user_data: "granted", 1091 ad_personalization: "granted", 1092 ad_storage: "granted", 1093 analytics_storage: "granted", 1094 }); 1095}); 1096 1097$(document).ajaxComplete(function () { 1098 console.log("doc.ajaxComplete"); 1099 1100 // change texts for bayi role 1101 $(".role-bayi .checkout-pane-coupon-redemption .form-text").attr( 1102 "placeholder", 1103 "İndirim uygula" 1104 ); 1105 $( 1106 ".role-bayi .checkout-pane-coupon-redemption > .js-form-wrapper > .form-submit" 1107 ).val("Uygula"); 1108 $(".role-bayi .coupon-redemption-form__coupons .form-submit").val("Kaldır"); 1109 1110 numberFieldControls(); 1111 buildCart(); 1112 inputLabels(); 1113}); 1114 1115$(window).on("scroll", function () { 1116 if ($(window).width() < 1150) { 1117 $("#headerHolder .region-header").addClass("scroll"); 1118 } else { 1119 if ($(document).scrollTop() >= 40) { 1120 if (!$("#headerHolder .region-header").hasClass("scroll")) { 1121 $("#headerHolder .region-header").addClass("scroll"); 1122 } 1123 } else if ($("#menuHolder").hasClass("active")) { 1124 $("#headerHolder .region-header").addClass("scroll"); 1125 } else { 1126 $("#headerHolder .region-header").removeClass("scroll"); 1127 } 1128 } 1129}); 1130 1131var pageTitle = $("title").html(); 1132 1133document.addEventListener("visibilitychange", (event) => { 1134 if (document.visibilityState == "visible") { 1135 $("title").html(pageTitle); 1136 } else { 1137 $("title").html("Heey! Bizi unutmayın..."); 1138 } 1139}); 1140 1141console.log("codiva"); 1142 1143document 1144 .querySelectorAll(".field--name-field-tamamlayici-urunler .field__item") 1145 .forEach(function (item) { 1146 if (item.querySelector(".urun--unpublished")) { 1147 item.style.display = "none"; 1148 } 1149 }); 1150 1151if ($(window).width() < 768) { 1152 setTimeout(function () { 1153 var anaSayfaBloglarSwiper = document.getElementById( 1154 "swiper-joyblog-block-1" 1155 ); 1156 var mySwiperBloglar = anaSayfaBloglarSwiper.swiper; 1157 1158 mySwiperBloglar.params.slidesPerView = 1; 1159 mySwiperBloglar.params.loopedSlides = 1;
1160 mySwiperBloglar.update(); // Güncellemeleri uygula 1161 1162 var cokSatanlarSwiper = document.getElementById( 1163 "swiper-cok-satanlar-takim-block-1" 1164 ); 1165 var mySwiperCokSatanlar = cokSatanlarSwiper.swiper; 1166 1167 mySwiperCokSatanlar.params.slidesPerView = 1; 1168 mySwiperCokSatanlar.params.loopedSlides = 1; 1169 mySwiperCokSatanlar.update(); // Güncellemeleri uygula 1170 1171 var yeniCikanlarSwiper = document.getElementById( 1172 "swiper-yeni-cikanlar-takim-block-1" 1173 ); 1174 var mySwiperYenicikanlar = yeniCikanlarSwiper.swiper; 1175 1176 mySwiperYenicikanlar.params.slidesPerView = 1; 1177 mySwiperYenicikanlar.params.loopedSlides = 1; 1178 mySwiperYenicikanlar.update(); // Güncellemeleri uygula 1179 }, 600); 1180} 1181if ($(window).width() < 768) { 1182 $("#block-kerataif-content-article").addClass("swiper-container"); 1183 $("#block-kerataif-content-article").prepend( 1184 '<div class="swiper-button-container-bcg"><div class="swiper-button-prev-bcg"></div><div class="swiper-button-next-bcg"></div></div>' 1185 ); 1186 $("#block-kerataif-content-article").append( 1187 '<div class="swiper-pagination pagination-bcg"></div>' 1188 ); 1189 $("#block-kerataif-content-article .articles").addClass("swiper-wrapper"); 1190 $("#block-kerataif-content-article .articles .article-box").addClass( 1191 "swiper-slide" 1192 ); 1193 1194 const bcgSwiper = new Swiper("#block-kerataif-content-article", { 1195 autoplay: { delay: 4000 }, 1196 pauseOnMouseEnter: true, 1197 spaceBetween: 0, 1198 observer: true, 1199 resizeObserver: true, 1200 observeParents: true, 1201 observeSlideChildren: true, 1202 navigation: { 1203 nextEl: ".swiper-button-next-bcg", 1204 prevEl: ".swiper-button-prev-bcg", 1205 }, 1206 pagination: { 1207 el: ".pagination-bcg", 1208 type: "bullets", 1209 }, 1210 }); 1211} 1212 1213/* 1214// Åehirâilçe JSON yükleme 1215fetch("tr_cities.json") 1216 .then((res) => res.json()) 1217 .then((data) => { 1218 const sehirSelect = document.getElementById("sehir"); 1219 const ilceSelect = document.getElementById("ilce"); 1220 // İlk seçenekleri ekle 1221 sehirSelect.innerHTML = `<option value="">Åehir Seçiniz</option>`; 1222 ilceSelect.innerHTML = `<option value="">İlçe Seçiniz</option>`; 1223 // Åehirleri yükle 1224 Object.keys(data).forEach((sehir) => { 1225 sehirSelect.innerHTML += `<option value="${sehir}">${sehir}</option>`; 1226 }); 1227 // Åehir deÄiÅince ilçe doldur 1228 sehirSelect.onchange = function () { 1229 ilceSelect.innerHTML = `<option value="">İlçe Seçiniz</option>`; 1230 if (this.value !== "") { 1231 data[this.value].forEach((ilce) => { 1232 ilceSelect.innerHTML += `<option value="${ilce}">${ilce}</option>`; 1233 }); 1234 } 1235 }; 1236 }); 1237// AJAX FORM GÃNDERİMİ 1238document.getElementById("kuponForm").addEventListener("submit", function (e) { 1239 e.preventDefault(); 1240 const form = this; 1241 const sonuc = document.getElementById("sonuc"); 1242 // Loading efekti 1243 form.classList.add("loading"); 1244 sonuc.style.display = "none"; 1245 const formData = new FormData(form); 1246 fetch("kupon-ver.php", { 1247 method: "POST", 1248 body: formData, 1249 }) 1250 .then((res) => res.text()) 1251 .then((data) => { 1252 form.classList.remove("loading"); 1253 // BaÅarı mı hata mı? 1254 if (data.includes("Kuponunuz:")) { 1255 sonuc.className = "success"; 1256 } else { 1257 sonuc.className = "error"; 1258 } 1259 sonuc.innerHTML = data; 1260 sonuc.style.display = "block"; 1261 if (data.includes("Kuponunuz:")) { 1262 form.reset(); 1263 } 1264 }) 1265 .catch((err) => { 1266 form.classList.remove("loading"); 1267 sonuc.className = "error"; 1268 sonuc.innerHTML = "Sunucu hatası oluÅtu."; 1269 sonuc.style.display = "block"; 1270 }); 1271}); 1272*/
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.