1$(document).ready(function () { 2 $(".navbar-toggler").click(function (e) { 3 $(".header-menu-bg").fadeIn(); 4 $(".header-aditional-menu").addClass("menu-on"); 5 $("html").toggleClass("scroll-of"); 6 }); 7 // $('main').click(function (e) { 8 // $('.new-live-news').toggleClass('show-label'); 9 // }); 10 11 $(".header-menu-bg, .close-menu").click(function (e) { 12 $(".header-menu-bg").fadeOut(); 13 $(".header-aditional-menu").removeClass("menu-on"); 14 $("html").toggleClass("scroll-of"); 15 }); 16 17 $(".header-menu .toggle-submenu").click(function (e) { 18 e.preventDefault(); 19 $(this).toggleClass("active-submenu"); 20 $(this).parent().next(".submenu").slideToggle(); 21 $(this).closest(".menu-item").siblings().find(".submenu").slideUp(); 22 $(this) 23 .closest(".menu-item") 24 .siblings() 25 .find(".toggle-submenu") 26 .removeClass("active-submenu"); 27 }); 28 29 //MOBILE MENU 30 31 $(".mobile-navbar-toggler").click(function (e) { 32 $(".mobile-aditional-menu-bg").fadeToggle(); 33 $(".mobile-aditional-menu").toggleClass("menu-on"); 34 $("html").toggleClass("scroll-of"); 35 $(".header-menu-bg").fadeOut(); 36 $(".header-menu-wrapper").removeClass("menu-on"); 37 }); 38 39 $(".mobile-aditional-menu-bg, .close-menu").click(function (e) { 40 $(".mobile-aditional-menu-bg").fadeOut(); 41 $(".mobile-aditional-menu").removeClass("menu-on"); 42 $("html").toggleClass("scroll-of"); 43 }); 44 45 $(".mobile-menu .toggle-submenu").click(function (e) { 46 e.preventDefault(); 47 $(this).toggleClass("active-submenu"); 48 $(this).parent().next(".submenu").slideToggle(); 49 $(this).closest(".menu-item").siblings().find(".submenu").slideUp(); 50 $(this) 51 .closest(".menu-item") 52 .siblings() 53 .find(".toggle-submenu") 54 .removeClass("active-submenu"); 55 }); 56 57 var $input = $("#s"); 58 var $clearBtn = $(".clear-input"); 59 60 $clearBtn.hide(); 61 62 $input.on("input", function () { 63 if ($(this).val().length > 0) { 64 $clearBtn.fadeIn(150); 65 } else { 66 $clearBtn.fadeOut(150); 67 } 68 }); 69 70 $clearBtn.on("click", function () { 71 $input.val("").focus(); 72 $clearBtn.fadeOut(150); 73 }); 74 75 $(".info-box-menu .info-box-menu-item").click(function (e) { 76 e.preventDefault(); 77 $(this).find(".toggle-submenu").toggleClass("active-submenu"); 78 $(this).next(".submenu").slideToggle(); 79 }); 80 81 //HEADER CUSTOM 82 83 $(".header-custom .navbar-toggler").click(function (e) { 84 $(".header-menu-bg").fadeIn(); 85 $(".header-aditional-menu").addClass("menu-on"); 86 $("html").toggleClass("scroll-of"); 87 }); 88 89 $(".header-custom .header-menu-bg, .close-menu").click(function (e) { 90 $(".header-menu-bg").fadeOut(); 91 $(".header-aditional-menu").removeClass("menu-on"); 92 $("html").toggleClass("scroll-of"); 93 }); 94 95 $(".header-custom .header-menu .toggle-submenu").click(function (e) { 96 e.preventDefault(); 97 $(this).toggleClass("active-submenu"); 98 $(this).parent().next(".submenu").slideToggle(); 99 $(this).closest(".menu-item").siblings().find(".submenu").slideUp(); 100 $(this) 101 .closest(".menu-item") 102 .siblings() 103 .find(".toggle-submenu") 104 .removeClass("active-submenu"); 105 }); 106 107 //HEADER SCROLL BANNER 108 109 // var bannerHeaderHeight = $(".banner-header").height(); 110 111 // if (bannerHeaderHeight > 1) { 112 // $(window).scroll(function() { 113 // var scroll = $(window).scrollTop(); 114 // var bannerHeaderHeight = $(".banner-header").height() 115 // if (scroll >= bannerHeaderHeight) { 116 // $("body").addClass("header-fixed"); 117 // }else{ 118 // $("body").removeClass("header-fixed"); 119 // } 120 // }); 121 // } 122 123 // if (bannerHeaderHeight < 1) { 124 // $("header").addClass("header-fixed-default"); 125 // $("main").addClass("header-fixed-default"); 126 // $("body").removeClass("header-fixed"); 127 // } 128 129 // var bannerHeaderHeight = $(".banner-header").height(); 130 // var headerHeight = $("header").height(); 131 132 // if (bannerHeaderHeight > 1) { 133 // $('main').css({"padding-top": bannerHeaderHeight + headerHeight}); 134 // $('header').css({"top": bannerHeaderHeight}); 135 // } 136 137 //TOP NEWS SLIDER 138 139 // if ($('.top-news-slider').length > 0) { 140 // $(function () { 141 // var owl = $('.top-news-slider').owlCarousel({ 142 // dots: true, 143 // dotsData: true, 144 // nav: false, 145 // touchDrag: true, 146 // mouseDrag: false, 147 // items: 1, 148 // loop: false, // Disable loop for this setup 149 // margin: 0, 150 // autoplay: true, 151 // autoplayTimeout: 15000, // Default timeout for all items except the first 152 // onInitialized: startProgressBarOnInit, 153 // onTranslate: resetProgressBar, 154 // onTranslated: startProgressBar 155 // }); 156 157 // // Page visibility event 158 // document.addEventListener("visibilitychange", function () { 159 // if (document.hidden) { 160 // // Pauziranje autoplay-a kada tab postane nevidljiv 161 // owl.trigger('stop.owl.autoplay'); 162 // } else { 163 // // Ponovno pokretanje autoplay-a kada tab postane vidljiv 164 // owl.trigger('play.owl.autoplay', [15000]); 165 // } 166 // }); 167 168 // function startProgressBarOnInit() { 169 // // Reset all progress bars to 0% before starting any animation 170 // var progressBars = $(".progress-bar-inner"); 171 // progressBars.css({ 172 // width: "0%", 173 // transition: "width 0s" 174 // }); 175 176 // // Delay the initialization of the first progress bar animation to mimic the transition 177 // setTimeout(function () { 178 // var firstProgressBar = $(".owl-dot").eq(0).find(".progress-bar-inner"); 179 // firstProgressBar.css({ 180 // width: "100%", 181 // transition: "width 30000ms linear" // 30 seconds for the first item 182 // }); 183 // }, 50); // Small delay to allow for the first transition to be properly set up 184 // } 185 186 // function startProgressBar() { 187 // var activeDot = $(".owl-dot.active .progress-bar-inner"); 188 // var progressBarTimeout = owl.trigger('currentItem') === 0 ? 30000 : 15000; // 30s for first item, 15s for others 189 // activeDot.css({ 190 // width: "100%", 191 // transition: "width " + progressBarTimeout + "ms linear" 192 // }); 193 // } 194 195 // function resetProgressBar() { 196 // // Find all progress bars and reset them to 0 width 197 // var progressBars = $(".progress-bar-inner"); 198 // progressBars.css({ 199 // width: 0, 200 // transition: "width 0s" 201 // }); 202 // } 203 204 // // Handle autoplay timeout based on item change (including manual slide changes) 205 // owl.on('changed.owl.carousel', function (event) { 206 // var currentItem = event.item.index; 207 208 // // Stop the autoplay and restart with new timeout 209 // owl.trigger('stop.owl.autoplay'); 210 211 // // Adjust autoplayTimeout based on the first item 212 // if (currentItem === 0) { 213 // owl.trigger('play.owl.autoplay', [30000]); // Restart autoplay with 30s timeout 214 // } else { 215 // owl.trigger('play.owl.autoplay', [15000]); // Restart autoplay with 15s timeout 216 // } 217 218 // // Reset progress bar with the correct duration based on active item 219 // startProgressBar(); 220 // }); 221 222 // // Ensure that the autoplay timeout and progress bar duration are correctly set when the first item is active on page load or manual navigation 223 // owl.on('initialized.owl.carousel', function () { 224 // if (owl.trigger('currentItem') === 0) { 225 // // When the first item is active, set the autoplay timeout to 30 seconds 226 // owl.trigger('stop.owl.autoplay'); 227 // owl.trigger('play.owl.autoplay', [30000]); // Set timeout to 30 seconds for the first item 228 // startProgressBar(); // Make sure progress bar is properly updated on initialization 229 // } 230 // }); 231 232 // // Handle manual navigation back to first item and reset the progress bar properly 233 // owl.on('to.owl.carousel', function (event) { 234 // var currentItem = event.item.index; 235 // var progressBarTimeout = currentItem === 0 ? 30000 : 15000; // 30s for first item, 15s for others 236 237 // // Reset and force progress bar to use 30s timeout if the first item is active 238 // var activeDot = $(".owl-dot.active .progress-bar-inner"); 239 // activeDot.css({ 240 // width: "0%", // Reset progress bar to 0% immediately 241 // transition: "width 0s" // Immediately reset the width 242 // }); 243 244 // // If it's the first item, apply 30 seconds transition 245 // if (currentItem === 0) { 246 // var firstProgressBar = $(".owl-dot").eq(0).find(".progress-bar-inner"); 247 // firstProgressBar.css({ 248 // width: "100%", 249 // transition: "width 30000ms linear" // 30 seconds for the first item 250 // }); 251 // } else { 252 // var otherProgressBar = $(".owl-dot").eq(currentItem).find(".progress-bar-inner"); 253 // otherProgressBar.css({ 254 // width: "100%", 255 // transition: "width 15000ms linear" // 15 seconds for others 256 // }); 257 // } 258 // }); 259 260 // // Reset progress bar and autoplay when returning to the first item manually 261 // owl.on('changed.owl.carousel', function (event) { 262 // var currentItem = event.item.index; 263 264 // // If it's the first item, reset the progress bar to 100% over 30 seconds 265 // if (currentItem === 0) { 266 // var firstProgressBar = $(".owl-dot").eq(0).find(".progress-bar-inner"); 267 // firstProgressBar.css({ 268 // width: "100%", 269 // transition: "width 30000ms linear" // 30 seconds for the first item 270 // }); 271 // } 272 // }); 273 // }); 274 // } 275 276 // if ($('.top-news-slider').length > 0) { 277 // $(function () { 278 // var owl = $('.top-news-slider').owlCarousel({ 279 // dots: true, 280 // dotsData: true, 281 // nav: false, 282 // touchDrag: true, 283 // mouseDrag: false, 284 // items: 1, 285 // loop: true, 286 // margin: 0, 287 // autoplay: true, 288 // autoplayTimeout: 15000, 289 // onInitialized: startProgressBarOnInit, 290 // onTranslate: resetProgressBar, 291 // onTranslated: startProgressBar, 292 // }); 293 294 // // Funkcija koja proverava koji je prvi slajd i postavlja interval 295 // function updateAutoplayTimeout() { 296 // // Prvi ne-klonirani slajd 297 // var firstItem = $(".owl-item:not(.cloned)").first(); 298 // console.log(firstItem); 299 300 // if (firstItem.hasClass('active')) { 301 // owl.trigger('stop.owl.autoplay');
301 // Stopiraj autoplay 302 // owl.trigger('play.owl.autoplay', [30000]); // Postavi autoplayTimeout na 30s za prvi slajd 303 // } else { 304 // owl.trigger('stop.owl.autoplay'); // Stopiraj autoplay 305 // owl.trigger('play.owl.autoplay', [15000]); // Postavi autoplayTimeout na 15s za ostale slajdove 306 // } 307 // } 308 309 // // Inicijalizacija - provera odmah pri pokretanju carousela 310 // owl.on('initialized.owl.carousel', function () { 311 // updateAutoplayTimeout(); 312 // }); 313 314 // // Kada se slajd promeni, proveri koji je aktivan i promeni autoplayTimeout 315 // owl.on('changed.owl.carousel', function (event) { 316 // updateAutoplayTimeout(); // Pozovi funkciju da proveri koji je aktivni slajd 317 // }); 318 319 // function startProgressBarOnInit() { 320 // // Reset all progress bars to 0% before starting any animation 321 // var progressBars = $(".progress-bar-inner"); 322 // progressBars.css({ 323 // width: "0%", 324 // transition: "width 0s" 325 // }); 326 327 // // Delay the initialization of the first progress bar animation to mimic the transition 328 // setTimeout(function () { 329 // var firstProgressBar = $(".owl-dot").eq(0).find(".progress-bar-inner"); 330 // firstProgressBar.css({ 331 // width: "100%", 332 // transition: "width 15000ms linear" 333 // }); 334 // }, 50); // Small delay to allow for the first transition to be properly set up 335 // } 336 337 // function startProgressBar() { 338 // // Find the progress bar in the active dot and apply the animation 339 // var activeDot = $(".owl-dot.active .progress-bar-inner"); 340 // activeDot.css({ 341 // width: "100%", 342 // transition: "width 15000ms linear" 343 // }); 344 // } 345 346 // function resetProgressBar() { 347 // // Find all progress bars and reset them to 0 width 348 // var progressBars = $(".progress-bar-inner"); 349 // progressBars.css({ 350 // width: 0, 351 // transition: "width 0s" 352 // }); 353 // } 354 355 // // Stop autoplay when slide changes manually 356 // owl.on('changed.owl.carousel', function (event) { 357 // owl.trigger('stop.owl.autoplay'); // Stop autoplay 358 // owl.trigger('play.owl.autoplay', [15000]); // Restart autoplay with the new timeout (reset the timer) 359 // }); 360 // }); 361 // } 362 363 // if ($('.top-news-slider').length > 0) { 364 // $(function () { 365 // var owl = $('.top-news-slider').owlCarousel({ 366 // dots: true, 367 // dotsData: true, 368 // nav: false, 369 // touchDrag: true, 370 // mouseDrag: false, 371 // items: 1, 372 // loop: true, 373 // margin: 0, 374 // autoplay: true, 375 // autoplayTimeout: function() { 376 // Uzmi prvi "owl-item" i iz njega naÄi "news-item" sa data-id=0 377 // var firstItem = $('.owl-item').eq(0); 378 // var newsItem = firstItem.find('.news-item'); 379 // var firstItemId = newsItem.data('id'); 380 // console.log(firstItemId); 381 382 // Ako je data-id za prvi item 0, postavi timeout na 30s, za ostale 15s 383 // return firstItemId === 0 ? 30000 : 15000; 384 // }, 385 // onInitialized: startProgressBarOnInit, 386 // onTranslate: resetProgressBar, 387 // onTranslated: startProgressBar, 388 // }); 389 390 // function startProgressBarOnInit() { 391 // Reset all progress bars to 0% before starting any animation 392 // var progressBars = $(".progress-bar-inner"); 393 // progressBars.css({ 394 // width: "0%", 395 // transition: "width 0s" 396 // }); 397 398 // Delay the initialization of the first progress bar animation to mimic the transition 399 // setTimeout(function () { 400 // var firstProgressBar = $(".owl-dot").eq(0).find(".progress-bar-inner"); 401 // firstProgressBar.css({ 402 // width: "100%", 403 // transition: "width 15000ms linear" 404 // }); 405 // }, 50); // Small delay to allow for the first transition to be properly set up 406 // } 407 408 // function startProgressBar() { 409 // Find the progress bar in the active dot and apply the animation 410 // var activeDot = $(".owl-dot.active .progress-bar-inner"); 411 412 // Uzimamo trenutni aktivni slajd 413 // var currentSlide = $('.owl-item.active'); 414 415 // Unutar tog slajda tražimo news-item i uzimamo njegov data-id 416 // var currentNewsItem = currentSlide.find('.news-item'); 417 // var currentItemId = currentNewsItem.data('id'); 418 419 // Ako je data-id 0, postavljamo timeout na 30s, inaÄe 15s 420 // var progressBarDuration = currentItemId === 0 ? 30000 : 15000; 421 422 // activeDot.css({ 423 // width: "100%", 424 // transition: "width " + progressBarDuration + "ms linear" 425 // }); 426 // } 427 428 // function resetProgressBar() { 429 // Find all progress bars and reset them to 0 width 430 // var progressBars = $(".progress-bar-inner"); 431 // progressBars.css({ 432 // width: 0, 433 // transition: "width 0s" 434 // }); 435 // } 436 437 // Stop autoplay when slide changes manually 438 // owl.on('changed.owl.carousel', function (event) { 439 // Uzimamo trenutni aktivni slajd 440 // var currentSlide = $('.top-news-slider .owl-item.active'); 441 // console.log(currentSlide); 442 443 // Unutar tog slajda tražimo news-item i uzimamo njegov data-id 444 // var currentNewsItem = currentSlide.find('.news-item'); 445 // var currentItemId = currentNewsItem.data('id'); 446 447 // Ako je data-id 0, postavljamo timeout na 30s, inaÄe 15s 448 // var newAutoplayTimeout = currentItemId === 0 ? 30000 : 15000; 449 450 // Stop autoplay 451 // owl.trigger('stop.owl.autoplay'); 452 453 // Restart autoplay sa novim timeout-om 454 // owl.trigger('play.owl.autoplay', [newAutoplayTimeout]); 455 456 // Resetuj i pokreni progres bar sa novim trajanjem 457 // resetProgressBar(); // Resetuj progres bar 458 // startProgressBar(); // Pokreni progres bar sa novim trajanjem 459 // }); 460 // }); 461 // } 462 463 if ($(".top-news-slider").length > 0) { 464 $(function () { 465 var autoplayTimeout = 15000; // Default autoplay timeout (15 seconds) 466 467 var owl = $(".top-news-slider").owlCarousel({ 468 dots: true, 469 dotsData: true, 470 nav: false, 471 touchDrag: true, 472 mouseDrag: false, 473 items: 1, 474 loop: true, 475 margin: 0, 476 autoplay: true, 477 autoplayTimeout: autoplayTimeout, // Set the default timeout 478 onInitialized: function () { 479 startProgressBarOnInit(); 480 removeClonedData(); 481 }, 482 onTranslate: resetProgressBar, 483 onTranslated: startProgressBar, 484 }); 485 486 // Dynamically change autoplayTimeout for the first item 487 var firstNonClonedItem = $(".owl-carousel .owl-item") 488 .not(".cloned") 489 .first(); 490 var firstIndex = $(".owl-carousel .owl-item").index( 491 firstNonClonedItem, 492 ); 493 console.log("Index of first non-cloned item:", firstIndex); 494 495 // Now, change autoplayTimeout for the specific item with the index equal to firstIndex 496 $(".owl-carousel .owl-item") 497 .eq(firstIndex) 498 .each(function () { 499 // Trigger owlCarousel to update the autoplayTimeout for this specific item 500 owl.trigger("stop.owl.autoplay"); // Stop the autoplay first 501 owl.trigger("play.owl.autoplay", [30000]); // Set the new autoplayTimeout for this item 502 }); 503 504 function setAutoplayTimeout(timeout) { 505 owl.trigger("stop.owl.autoplay"); // Stop the autoplay 506 owl.trigger("play.owl.autoplay", [timeout]); // Restart autoplay with the new timeout 507 } 508 509 // Remove data atribute from article cloned 510 function removeClonedData() { 511 $(".owl-item.cloned").each(function () { 512 $(this) 513 .find("article") 514 .each(function () { 515 console.log( 516 "Uklanjam sve data- atribute sa article elementa: ", 517 $(this), 518 ); 519 520 let attributes = [...this.attributes]; 521
522 attributes.forEach((attr) => { 523 if (attr.name.startsWith("data-")) { 524 $(this).removeAttr(attr.name); 525 console.log("Uklonjen atribut:", attr.name); 526 } 527 }); 528 529 $(this).removeAttr("data-upscore-position-index"); 530 }); 531 }); 532 } 533 534 // Set up the progress bar transition for the first dot separately 535 function startProgressBarOnInit() { 536 // Reset all progress bars to 0% before starting any animation 537 var progressBars = $(".progress-bar-inner"); 538 progressBars.css({ 539 width: "0%", 540 transition: "width 0s", 541 }); 542 543 // Apply 30,000ms transition for the first progress bar 544 setTimeout(function () { 545 var firstProgressBar = $(".owl-dot") 546 .eq(0) 547 .find(".progress-bar-inner"); 548 firstProgressBar.css({ 549 width: "100%", 550 transition: "width 30000ms linear", 551 }); 552 }, 50); // Small delay to allow for the first transition to be properly set up 553 } 554 555 function startProgressBar() { 556 // Reset progress bars and start the animation for the active dot 557 var progressBars = $(".progress-bar-inner"); 558 progressBars.css({ 559 width: "0%", 560 transition: "width 0s", 561 }); 562 563 // Apply animation to the progress bar of the active dot 564 var activeDot = $(".owl-dot.active .progress-bar-inner"); 565 activeDot.css({ 566 width: "100%", 567 transition: "width 15000ms linear", // Default transition for other dots 568 }); 569 570 // Check if the active dot is the first one, and change the transition time to 30,000ms 571 if ($(".owl-dot.active").index() === 0) { 572 activeDot.css({ 573 transition: "width 30000ms linear", // 30,000ms for the first dot 574 }); 575 } 576 } 577 578 function resetProgressBar() { 579 // Reset all progress bars to 0 width 580 var progressBars = $(".progress-bar-inner"); 581 progressBars.css({ 582 width: 0, 583 transition: "width 0s", 584 }); 585 } 586 587 // Stop autoplay when slide changes manually 588 owl.on("changed.owl.carousel", function (event) { 589 owl.trigger("stop.owl.autoplay"); // Stop autoplay 590 owl.trigger("play.owl.autoplay", [15000]); // Restart autoplay with the new timeout (reset the timer) 591 592 // Reset the progress bars for all dots first 593 resetProgressBar(); 594 595 setTimeout(function () { 596 // After the slide change, reset the progress bar and set the transition to 15000ms 597 var progressBars = $(".progress-bar-inner"); 598 progressBars.css({ 599 width: "0%", 600 transition: "width 0s", // Reset progress bar width to 0% immediately 601 }); 602 603 // Set the progress bar transition to 15000ms for the active dot 604 var activeDot = $(".owl-dot.active .progress-bar-inner"); 605 activeDot.css({ 606 width: "100%", 607 transition: "width 15000ms linear", // Set transition to 15000ms 608 }); 609 }, 50); // Small delay to allow for the first transition to be properly set up 610 }); 611 612 // Restart progress bar animation and reset the slider timer when the tab becomes visible again 613 document.addEventListener("visibilitychange", function () { 614 if (document.visibilityState === "visible") {
615 // Reset the progress bars for all dots first 616 resetProgressBar(); 617 618 // Start the progress bar animation for the active dot only 619 setTimeout(function () { 620 // After the slide change, reset the progress bar and set the transition to 15000ms 621 var progressBars = $(".progress-bar-inner"); 622 progressBars.css({ 623 width: "0%", 624 transition: "width 0s", // Reset progress bar width to 0% immediately 625 }); 626 627 // Set the progress bar transition to 15000ms for the active dot 628 var activeDot = $( 629 ".owl-dot.active .progress-bar-inner", 630 ); 631 activeDot.css({ 632 width: "100%", 633 transition: "width 15000ms linear", // Set transition to 15000ms 634 }); 635 }, 50); // Small delay to allow for the first transition to be properly set up 636 637 // Reset the autoplay timer to 15 seconds 638 owl.trigger("stop.owl.autoplay"); // Stop autoplay 639 owl.trigger("play.owl.autoplay", [15000]); // Restart autoplay with the new timeout (reset the timer) 640 } 641 }); 642 }); 643 } 644 645 //TAGS NAV 646 647 if ($(".tags-navigation").length > 0) { 648 $(function () { 649 $(".tags-navigation").owlCarousel({ 650 autoWidth: true, 651 dots: false, 652 nav: false, 653 margin: 10, 654 }); 655 }); 656 } 657 658 //WEATHER SLIDER 659 660 if ($(".weather-slider").length > 0) { 661 $(function () { 662 $(".weather-slider").owlCarousel({ 663 items: 1, 664 dots: false, 665 nav: true, 666 }); 667 }); 668 } 669 670 if ($(".weather-slider-single").length > 0) { 671 $(function () { 672 const weatherSwiper = new Swiper(".weather-slider-single", { 673 freeMode: false, 674 slidesPerView: 1, 675 spaceBetween: 15, 676 navigation: { 677 nextEl: ".weather-slider-wrapper .swiper-button-next", 678 prevEl: ".weather-slider-wrapper .swiper-button-prev", 679 }, 680 breakpoints: { 681 576: { 682 slidesPerView: "auto", 683 }, 684 }, 685 }); 686 }); 687 } 688 689 //COMMENTS 690 691 if ($("#commentText").length > 0) { 692 $(function () { 693 $("#commentText").on("keyup", function () { 694 $("#characterCount").html( 695 "<span class='current'>" + 696 $(this).val().length + 697 "</span>/<span class='max'>1500</span>", 698 ); 699 if ($(this).val().length > 1500) { 700 $(this).val($(this).val().substring(0, 1500)); 701 $("#characterCount").html("1500/1500"); 702 } 703 }); 704 }); 705 } 706 707 //COMMENT FORM 708 709 if ($(".comment-form").length > 0) { 710 $(function () { 711 $(".comment-form").validate({ 712 highlight: function (element) { 713 $(element).addClass("is-invalid").removeClass("is-valid"); 714 $(element) 715 .closest(".form-group") 716 .addClass("is-invalid") 717 .removeClass("is-valid"); 718 }, 719 unhighlight: function (element) { 720 $(element).removeClass("is-invalid").addClass("is-valid"); 721 $(element) 722 .closest(".form-group") 723 .addClass("is-valid") 724 .removeClass("is-invalid"); 725 }, 726 rules: { 727 name: { 728 required: true, 729 }, 730 comment: { 731 required: true, 732 }, 733 terms: { 734 required: true, 735 }, 736 }, 737 messages: { 738 name: { 739 required: "This is required field", 740 }, 741 comment: { 742 required: "This is required field", 743 }, 744 terms: { 745 required: "Please accept our policy", 746 }, 747 }, 748 errorElement: "p", 749 errorPlacement: function (error, element) { 750 error.appendTo( 751 $(element) 752 .closest(".form-group")
753 .find(".invalid-feedback"), 754 ); 755 }, 756 }); 757 }); 758 } 759 760 //PUTOVANJA SLIDER 761 762 if ($(".putovanja-slider").length > 0) { 763 $(function () { 764 let screenWidth = $(window).width(); 765 if (screenWidth > 767) { 766 const roomsSwiper = new Swiper(".putovanja-slider", { 767 scrollbar: { 768 el: ".swiper-scrollbar", 769 draggable: true, 770 }, 771 freeMode: false, 772 slidesPerView: 2, 773 spaceBetween: 15, 774 breakpoints: { 775 992: { 776 slidesPerView: 3, 777 }, 778 1300: { 779 spaceBetween: 24, 780 slidesPerView: 3, 781 }, 782 }, 783 }); 784 } 785 // $(window).resize(function () { 786 // location.reload(); 787 // }); 788 }); 789 } 790 791 if ($(".sport-special-category-slider").length > 0) { 792 $(function () { 793 const basicSliderNews = new Swiper( 794 ".sport-special-category-slider", 795 { 796 scrollbar: { 797 el: ".swiper-scrollbar", 798 draggable: true, 799 }, 800 freeMode: true, 801 slidesPerView: "auto", 802 spaceBetween: 12, 803 breakpoints: { 804 1300: { 805 spaceBetween: 23, 806 slidesPerView: 4, 807 }, 808 }, 809 }, 810 ); 811 }); 812 } 813 814 //CONTACT 815 816 $(".contact-options").on("click", ".contact-option-title", function (e) { 817 e.preventDefault(); 818 819 $(this).toggleClass("open"); 820 $(this).next(".contact-form-wrapper").slideToggle(); 821 $(this) 822 .closest(".contact-option") 823 .siblings() 824 .find(".contact-form-wrapper") 825 .slideUp(); 826 $(this) 827 .closest(".contact-option") 828 .siblings() 829 .find(".contact-option-title") 830 .removeClass("open"); 831 }); 832 833 if ($("#webContactForm").length > 0) { 834 $(function () { 835 $("#webContactForm").validate({ 836 ignore: [], 837 highlight: function (element) { 838 $(element).addClass("is-invalid").removeClass("is-valid"); 839 $(element) 840 .closest(".form-group") 841 .addClass("is-invalid") 842 .removeClass("is-valid"); 843 }, 844 unhighlight: function (element) { 845 $(element).removeClass("is-invalid").addClass("is-valid"); 846 $(element) 847 .closest(".form-group") 848 .addClass("is-valid") 849 .removeClass("is-invalid"); 850 }, 851 rules: { 852 name: { 853 required: true, 854 }, 855 email: { 856 required: true, 857 email: true, 858 }, 859 messageTitle: { 860 required: true, 861 }, 862 message: { 863 required: true, 864 }, 865 option: { 866 required: true, 867 }, 868 }, 869 messages: { 870 name: { 871 required: "This is required field", 872 }, 873 email: { 874 required: "This is required field", 875 email: "Please insert valid Email address", 876 }, 877 messageTitle: { 878 required: "This is required field", 879 }, 880 message: { 881 required: "This is required field", 882 }, 883 option: { 884 required: "Please select one option", 885 }, 886 }, 887 errorElement: "p", 888 errorPlacement: function (error, element) { 889 error.appendTo( 890 $(element) 891 .closest(".form-group")
892 .find(".invalid-feedback"), 893 ); 894 }, 895 }); 896 }); 897 } 898 899 if ($("#sportContactForm").length > 0) { 900 $(function () { 901 $("#sportContactForm").validate({ 902 ignore: [], 903 highlight: function (element) { 904 $(element).addClass("is-invalid").removeClass("is-valid"); 905 $(element) 906 .closest(".form-group") 907 .addClass("is-invalid") 908 .removeClass("is-valid"); 909 }, 910 unhighlight: function (element) { 911 $(element).removeClass("is-invalid").addClass("is-valid"); 912 $(element) 913 .closest(".form-group") 914 .addClass("is-valid") 915 .removeClass("is-invalid"); 916 }, 917 rules: { 918 name: { 919 required: true, 920 }, 921 email: { 922 required: true, 923 email: true, 924 }, 925 messageTitle: { 926 required: true, 927 }, 928 message: { 929 required: true, 930 }, 931 option: { 932 required: true, 933 }, 934 }, 935 messages: { 936 name: { 937 required: "This is required field", 938 }, 939 email: { 940 required: "This is required field", 941 email: "Please insert valid Email address", 942 }, 943 messageTitle: { 944 required: "This is required field", 945 }, 946 message: { 947 required: "This is required field", 948 }, 949 option: { 950 required: "Please select one option", 951 }, 952 }, 953 errorElement: "p", 954 errorPlacement: function (error, element) { 955 error.appendTo( 956 $(element) 957 .closest(".form-group") 958 .find(".invalid-feedback"), 959 ); 960 }, 961 }); 962 }); 963 } 964 965 if ($("#prodajaContactForm").length > 0) { 966 $(function () { 967 $("#prodajaContactForm").validate({ 968 ignore: [], 969 highlight: function (element) { 970 $(element).addClass("is-invalid").removeClass("is-valid"); 971 $(element) 972 .closest(".form-group") 973 .addClass("is-invalid") 974 .removeClass("is-valid"); 975 }, 976 unhighlight: function (element) { 977 $(element).removeClass("is-invalid").addClass("is-valid"); 978 $(element) 979 .closest(".form-group") 980 .addClass("is-valid") 981 .removeClass("is-invalid"); 982 }, 983 rules: { 984 name: { 985 required: true, 986 }, 987 email: { 988 required: true, 989 email: true, 990 }, 991 messageTitle: { 992 required: true, 993 }, 994 message: { 995 required: true, 996 }, 997 option: { 998 required: true, 999 }, 1000 }, 1001 messages: { 1002 name: { 1003 required: "This is required field", 1004 }, 1005 email: { 1006 required: "This is required field", 1007 email: "Please insert valid Email address", 1008 }, 1009 messageTitle: { 1010 required: "This is required field", 1011 }, 1012 message: { 1013 required: "This is required field", 1014 }, 1015 option: { 1016 required: "Please select one option", 1017 }, 1018 }, 1019 errorElement: "p", 1020 errorPlacement: function (error, element) { 1021 error.appendTo( 1022 $(element) 1023 .closest(".form-group")
1024 .find(".invalid-feedback"), 1025 ); 1026 }, 1027 }); 1028 }); 1029 } 1030});
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.