1$(document).ready(function () { 2 /* navigation drop down */ 3 $("li.level1").hover( 4 function () { 5 $(this).addClass("hoverL1"); 6 }, function () { 7 $(this).removeClass("hoverL1"); 8 }); 9 $("div.navL1 li").hover( 10 function () { 11 $(this).addClass("hoverL2"); 12 }, function () { 13 $(this).removeClass("hoverL2"); 14 }); 15}); 16 17/* popup window */ 18(function ($) { 19 $.fn.popupWindow = function (instanceSettings) { 20 return this.each(function () { 21 $(this).click(function () { 22 $.fn.popupWindow.defaultSettings = { 23 centerBrowser: 0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left 24 centerScreen: 0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left 25 height: 500, // sets the height in pixels of the window. 26 left: 0, // left position when the window appears. 27 location: 0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}. 28 menubar: 0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}. 29 resizable: 0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable. 30 scrollbars: 0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}. 31 status: 0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}. 32 width: 500, // sets the width in pixels of the window. 33 windowName: null, // name of window set from the name attribute of the element that invokes the click 34 windowURL: null, // url used for the popup 35 top: 0, // top position when the window appears. 36 toolbar: 0 // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}. 37 }; 38 settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {}); 39 var windowFeatures = 'height=' + settings.height + 40 ',width=' + settings.width + 41 ',toolbar=' + settings.toolbar + 42 ',scrollbars=' + settings.scrollbars + 43 ',status=' + settings.status + 44 ',resizable=' + settings.resizable + 45 ',location=' + settings.location + 46 ',menuBar=' + settings.menubar; 47 settings.windowName = this.name || settings.windowName; 48 settings.windowURL = this.href || settings.windowURL; 49 var centeredY, centeredX; 50 if (settings.centerBrowser) { 51 if ($.browser.msie) {//hacked together for IE browsers 52 centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (settings.height / 2))); 53 centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (settings.width / 2))); 54 } else { 55 centeredY = window.screenY + (((window.outerHeight / 2) - (settings.height / 2))); 56 centeredX = window.screenX + (((window.outerWidth / 2) - (settings.width / 2))); 57 } 58 window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus(); 59 } else if (settings.centerScreen) { 60 centeredY = (screen.height - settings.height) / 2; 61 centeredX = (screen.width - settings.width) / 2; 62 window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus(); 63 } else { 64 window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + settings.left + ',top=' + settings.top).focus(); 65 } 66 return false;
67 }); 68 }); 69 }; 70})(jQuery); 71/* scroll content */ 72(function ($) { 73 function fireEvent(opts, name, self, arg) { 74 var fn = opts[name]; 75 if ($.isFunction(fn)) { 76 try { 77 return fn.call(self, arg); 78 } catch (error) { 79 if (opts.alert) { 80 alert("Error calling scrollable." + name + ": " + error); 81 } else { 82 throw error; 83 } 84 return false; 85 } 86 } 87 return true; 88 } 89 var current = null; 90 function Scrollable(root, conf) { 91 var self = this; 92 if (!current) { 93 current = self; 94 } 95 var horizontal = !conf.vertical; 96 var wrap = $(conf.items, root); 97 var index = 0; 98 var navi = root.siblings(conf.navi).eq(0); 99 var prev = root.siblings(conf.prev).eq(0); 100 var next = root.siblings(conf.next).eq(0); 101 var prevPage = root.siblings(conf.prevPage).eq(0); 102 var nextPage = root.siblings(conf.nextPage).eq(0); 103 $.extend(self, { 104 getVersion: function () { 105 return[1, 0, 1]; 106 }, 107 getIndex: function () { 108 return index; 109 }, 110 getConf: function () { 111 return conf; 112 }, 113 getSize: function () { 114 return self.getItems().size(); 115 }, 116 getPageAmount: function () { 117 return Math.ceil(this.getSize() / conf.size); 118 }, 119 getPageIndex: function () { 120 return Math.ceil(index / conf.size); 121 }, 122 getRoot: function () { 123 return root; 124 }, 125 getItemWrap: function () { 126 return wrap; 127 }, 128 getItems: function () { 129 return wrap.children(); 130 }, 131 seekTo: function (i, time, fn) { 132 time = time || conf.speed; 133 if ($.isFunction(time)) { 134 fn = time; 135 time = conf.speed; 136 } 137 if (i < 0) { 138 i = 0; 139 } 140 if (i > self.getSize() - conf.size) { 141 return self; 142 } 143 var item = self.getItems().eq(i); 144 if (!item.length) { 145 return self; 146 } 147 if (fireEvent(conf, "onBeforeSeek", self, i) === false) { 148 return self; 149 } 150 if (horizontal) { 151 var left = -(item.outerWidth(true) * i); 152 wrap.animate({ 153 left: left 154 }, time, conf.easing, fn ? function () { 155 fn.call(self); 156 } : null); 157 } else { 158 var top = -(item.outerHeight(true) * i); 159 wrap.animate({ 160 top: top 161 }, time, conf.easing, fn ? function () { 162 fn.call(self); 163 } : null); 164 } 165 if (navi.length) { 166 var klass = conf.activeClass; 167 var page = Math.ceil(i / conf.size); 168 page = Math.min(page, navi.children().length - 1); 169 navi.children().removeClass(klass).eq(page).addClass(klass); 170 } 171 if (i === 0) { 172 prev.add(prevPage).addClass(conf.disabledClass); 173 } else { 174 prev.add(prevPage).removeClass(conf.disabledClass); 175 } 176 if (i >= self.getSize() - conf.size) { 177 next.add(nextPage).addClass(conf.disabledClass); 178 } else { 179 next.add(nextPage).removeClass(conf.disabledClass); 180 } 181 current = self; 182 index = i; 183 fireEvent(conf, "onSeek", self, i); 184 return self; 185 }, 186 move: function (offset, time, fn) { 187 var to = index + offset; 188 if (conf.loop && to > (self.getSize() - conf.size)) { 189 to = 0; 190 } 191 return this.seekTo(to, time, fn); 192 }, 193 next: function (time, fn) { 194 return this.move(1, time, fn); 195 }, 196 prev: function (time, fn) { 197 return this.move(-1, time, fn); 198 }, 199 movePage: function (offset, time, fn) { 200 return this.move(conf.size * offset, time, fn); 201 }, 202 setPage: function (page, time, fn) { 203 var size = conf.size; 204 var index = size * page; 205 var lastPage = index + size >
205= this.getSize(); 206 if (lastPage) { 207 index = this.getSize() - conf.size; 208 } 209 return this.seekTo(index, time, fn); 210 }, 211 prevPage: function (time, fn) { 212 return this.setPage(this.getPageIndex() - 1, time, fn); 213 }, 214 nextPage: function (time, fn) { 215 return this.setPage(this.getPageIndex() + 1, time, fn); 216 }, 217 begin: function (time, fn) { 218 return this.seekTo(0, time, fn); 219 }, 220 end: function (time, fn) { 221 return this.seekTo(this.getSize() - conf.size, time, fn); 222 }, 223 reload: function () { 224 return load(); 225 }, 226 click: function (index, time, fn) { 227 var item = self.getItems().eq(index); 228 var klass = conf.activeClass; 229 if (!item.hasClass(klass) && (index >= 0 || index < this.getSize())) { 230 self.getItems().removeClass(klass); 231 item.addClass(klass); 232 var delta = Math.floor(conf.size / 2); 233 var to = index - delta; 234 if (to > self.getSize() - conf.size) { 235 to--; 236 } 237 if (to !== index) { 238 return this.seekTo(to, time, fn); 239 } 240 } 241 return self; 242 } 243 }); 244 if ($.isFunction($.fn.mousewheel)) { 245 root.bind("mousewheel.scrollable", function (e, delta) { 246 var step = $.browser.opera ? 1 : -1; 247 self.move(delta > 0 ? step : -step, 50); 248 return false; 249 }); 250 } 251 prev.addClass(conf.disabledClass).click(function () { 252 self.prev(); 253 }); 254 next.click(function () { 255 self.next(); 256 }); 257 nextPage.click(function () { 258 self.nextPage(); 259 }); 260 prevPage.addClass(conf.disabledClass).click(function () { 261 self.prevPage(); 262 }); 263 if (conf.keyboard) { 264 $(window).unbind("keypress.scrollable").bind("keypress.scrollable", function (evt) { 265 var el = current; 266 if (!el) { 267 return; 268 } 269 if (horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) { 270 el.move(evt.keyCode == 37 ? -1 : 1); 271 return evt.preventDefault(); 272 } 273 if (!horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) { 274 el.move(evt.keyCode == 38 ? -1 : 1); 275 return evt.preventDefault(); 276 } 277 return true; 278 }); 279 } 280 function load() { 281 navi.each(function () { 282 var nav = $(this); 283 if (nav.is(":empty") || nav.data("me") == self) { 284 nav.empty(); 285 nav.data("me", self); 286 for (var i = 0; i < self.getPageAmount(); i++) { 287 var item = $("<" + conf.naviItem + "/>").attr("href", i).click(function (e) { 288 var el = $(this); 289 el.parent().children().removeClass(conf.activeClass); 290 el.addClass(conf.activeClass); 291 self.setPage(el.attr("href")); 292 return e.preventDefault(); 293 }); 294 if (i === 0) { 295 item.addClass(conf.activeClass); 296 } 297 nav.append(item); 298 } 299 } else { 300 var els = nav.children(); 301 els.each(function (i) { 302 var item = $(this); 303 item.attr("href", i); 304 if (i === 0) { 305 item.addClass(conf.activeClass); 306 } 307 item.click(function () { 308 nav.find("." + conf.activeClass).removeClass(conf.activeClass); 309 item.addClass(conf.activeClass); 310 self.setPage(item.attr("href")); 311 }); 312 }); 313 } 314 }); 315 if (conf.clickable) { 316 self.getItems().each(function (index, arg) { 317 var el = $(this); 318 if (!el.data("set")) { 319 el.bind("click.scrollable", function () { 320 self.click(index); 321 }); 322 el.data("set", true); 323 } 324 }); 325 } 326 if (conf.hoverClass) { 327 self.getItems().hover(function () { 328 $(this).addClass(conf.hoverClass); 329 }, function () { 330 $(this).removeClass(conf.hoverClass); 331 }); 332 } 333 return self; 334 } 335 load(); 336 var timer = null; 337 function setTimer() { 338 timer = setInterval(function () { 339 self.next(); 340 }, conf.interval); 341 } 342 if (conf.interval > 0) { 343 root.hover(function () { 344 clearInterval(timer); 345 }, function () { 346 setTimer(); 347 }); 348 setTimer(); 349 } 350 } 351 jQuery.prototype.scrollable = function (conf) { 352 var api = this.eq(typeof conf == 'number' ? conf : 0).data("scrollable"); 353 if (api) { 354 return api; 355 } 356 var opts = { 357 size: 5, 358 vertical: false, 359 clickable: true, 360 loop: false, 361 interval: 0, 362 speed: 400, 363 keyboard: true, 364 activeClass: 'active', 365 disabledClass: 'disabled', 366 hoverClass: null, 367 easing: 'swing', 368 items: '.items', 369 prev: '.prev', 370 next: '.next', 371 prevPage: '.prevPage', 372 nextPage: '.nextPage', 373 navi: '.navigator', 374 naviItem: 'a', 375 onBeforeSeek: null, 376 onSeek: null, 377 alert: true 378 }; 379 $.extend(opts, conf); 380 this.each(function () { 381 var el = new Scrollable($(this), opts); 382 $(this).data("scrollable", el); 383 }); 384 return this; 385 }; 386})(jQuery); 387/* text resize */ 388$(document).ready(function () { 389 $(".increaseFont").click(function () { 390 jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody,p').each(function () {
391 var oldf = parseInt(jQuery(this).css('font-size')); 392 jQuery(this).css({ 393 'font-size': oldf + 2 + 'px', 394 'line-height': Math.round(oldf * 1.5) + 'px' 395 }); 396 }); 397 return false; 398 }); 399 $(".decreaseFont").click(function () { 400 jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody, p').each(function () { 401 var oldf = parseFloat(jQuery(this).css('font-size')); 402 jQuery(this).css({ 403 'font-size': oldf - 2 + 'px', 404 'line-height': Math.round(oldf * 1.5) + 'px' 405 }); 406 }); 407 return false; 408 }); 409 $(".resetFont").click(function () { 410 jQuery('div.story p,div.story h1,div.story h2,div.story h3,div.story h4,div.story h5,div.story td,div.story li p,div.item p,div.item h1,div.item h2,div.item h3,div.item h4,div.item h5,div.item td,div.item li p,span.priceText,p.lead, div.productSpec p,div.holderSize label, div.productBody, p').each(function () { 411 jQuery(this).removeAttr("style"); 412 }); 413 return false; 414 }); 415}); 416/* focus input */ 417function showValue(defaultText) { 418 var search = document.getElementById('searchText'); 419 if (search.value == '') 420 search.value = defaultText; 421 return; 422} 423function hideValue(defaultText) { 424 var search = document.getElementById('searchText'); 425 if (search.value == defaultText) 426 search.value = ''; 427 return; 428} 429 430function focusInput(selector) { 431 $(selector).each(function () { 432 var domObj = $(this)[0]; 433 var defaultValue = domObj.value; 434 $(this).focus(function () { 435 if (this.value == defaultValue) 436 this.value = ''; 437 console.log("focus: " + this.value); 438 return; 439 }); 440 $(this).blur(function () { 441 if (this.value == '') 442 this.value = defaultValue; 443 console.log("blur: " + this.value); 444 return; 445 }); 446 }); 447} 448/* used on every page! */ 449 450/* top scroller */ 451//$(document).ready(function () { 452// $('a[href="#top"]').click(function () { 453// $('html, body').animate({ 454// scrollTop: 0 455// }, 'slow'); 456// return false; 457// }); 458//}); 459/* call to popup window */ 460$(document).ready(function () { 461 $('.printPage').popupWindow({ 462 height: 500, 463 width: 800, 464 centerBrowser: 1, 465 scrollbars: 1 466 }); 467}); 468function pollValidate(warningMessage) { 469 var pollValid = false; 470 $('.pollHolder .radioButton').each(function (index, value) { 471 if (value.checked) 472 pollValid = true; 473 }); 474 if (!pollValid) 475 alert(warningMessage); 476 return pollValid; 477} 478/* normalni popup prozor */ 479function openPopup(url, width, height) { 480 window.open(url, "popup_id", "location=no,scrollbars=no,resizeble=no,status=no,width=" + width + ",height=" + height); 481 return false; 482} 483/* breaking news */ 484var starteddd = false; 485$(function () { 486 //$("ul#ticker02").liScroll({travelocity: 0.03}); 487 var nnn = $(".breakingDiv").length; 488 var iiiii = 0; 489 var pauseddd = false; 490 var refreshIntervalId; 491 if (nnn > 0 && !starteddd) { 492 starteddd = true; 493 refreshIntervalId = setInterval(function () { 494 if (!pauseddd) { 495 if (iiiii + 1 < nnn) { 496 iiiii++; 497 } else { 498 iiiii = 0; 499 } 500 // alert($(".breakingDiv:visible").attr("id")); 501 $(".breakingDiv:visible").slideUp(500); 502 $("#breakingDiv" + iiiii).slideDown(1000); 503 } 504 }, 3000); 505 } 506 $(".breakingDiv").hover(function () { 507 pauseddd = true; 508 //clearInterval(refreshIntervalId); 509 }, function () { 510 pauseddd = false; 511 //starteddd=false; 512 }); 513 $(window).focus(function () { 514 pauseddd = false;
515 }); 516 $(window).blur(function () { 517 pauseddd = true; 518 }); 519}); 520 521$(() => { 522////////////////////////|////* SHOP *////////////////////////////////////////// 523 let basket = { 524 initialize: () => { 525 $.ajaxSetup({cache: false}); 526 }, 527 callApi: (sendData) => { 528 $.getJSON("/srv/changeOrderItemQuantity", 529 sendData, 530 (data) => { 531 location.reload(); 532 }); 533 } 534 }; 535 basket.initialize(); 536 $('.js-order-item').on('click', function (e) { 537 if (!$(e.target).attr('action')) { 538 return; 539 } 540 541 let action = $(e.target).attr('action'); 542 let orderItemContext = {}; 543 orderItemContext.hash = $(this).attr('hash'); 544 orderItemContext.quantity = 1; 545 orderItemContext.action = action; 546 console.log(orderItemContext); 547 basket.callApi(orderItemContext); 548 }); 549 550 551 $('#js-add-product-quantity').on('click', function (e) { 552 var newQuantity = parseInt($('#js-product-quantity').html()) + 1; 553 $('#js-product-quantity').html(newQuantity); 554 }); 555 $('#js-subtract-product-quantity').on('click', function (e) { 556 if ($('#js-product-quantity').html() > 1) { 557 var newQuantity = parseInt($('#js-product-quantity').html()) - 1; 558 $('#js-product-quantity').html(newQuantity); 559 } 560 }); 561 562 563 if (!window.buyButtonOneItemDefined) { 564// to make sure that onClick handler is defined only one time no matter how many product parts are loaded 565 window.buyButtonOneItemDefined = true; 566 $('.js-add-to-cart').on('click', function (e) { 567 var paramsMap = {}; 568 paramsMap.productId = $(this).data('id'); 569 570 $(".js-property-one").each(function () { 571 if ($(this).val() === "") { 572 console.log('djokaaa'); 573 paramsMap[$(this).data("property-type")] = $(this).data("property-id"); 574 } else { 575 paramsMap[$(this).data("property-type")] = $(this).val(); 576 } 577 console.log("prop type: " + $(this).data("property-type") + " propertyId: " + $(this).val()); 578 }); 579 580 $(".js-property-one-radio").each(function () { 581 if ($(this).attr("checked")) { 582 paramsMap[$(this).data("property-type")] = $(this).data("property-id"); 583 console.log("prop type: " + $(this).data("property-type") + " propertyId: " + $(this).val()); 584 } 585 }); 586 paramsMap.quantity = $('#js-product-quantity').html(); 587 588 e.preventDefault(); 589// let params = {}; 590// let id = $(this).attr('data-id'); 591// let typeId = $(this).attr('property-id'); 592// params.productId = id; 593// params.propertySizeId = $('.js-property-dropdown-velicina').children("option:selected").val(); 594// params.properties = ""; 595 596// $('.selectWrapper').each(function () { 597// var propertyId = $(this).children("span").attr('data-property-id'); 598// if (typeof (propertyId) !== 'undefined') { 599// params.properties = params.properties + $(this).children("span").attr('data-property-id') + ','; 600// } else { 601// params.properties = params.properties + $(this).children("select").children("option:selected").val() + ','; 602// } 603// }); 604// if ($('.propertyColor').children().hasClass('js-color-selected')) { 605// params.properties = params.properties + $('.js-color-selected').attr('data-property-id'); 606 $.getJSON("/srv/changeOrderItem", paramsMap, function (data) { 607 if (data.success) { 608 jQuery('#js-quick-cart-preview').load(' #js-quick-cart-preview'); 609 } else { 610 console.log(data.error); 611 } 612 }); 613 $('#js-color-validator').addClass('d-none'); 614 return false; 615// } else { 616// $('#js-color-validator').removeClass('d-none'); 617// } 618 }); 619 620 621 } 622 $('.js-delete-from-cart').on('click', function (e) { 623 console.log($(this).attr('hash')); 624 e.preventDefault(); 625 let params = {}; 626 let hash = $(this).attr('hash'); 627 params.hash = hash; 628 $.getJSON("/srv/deleteOrderItem", params, function (data) { 629 if (data.success) { 630 jQuery('#js-quick-cart-preview').load(' #js-quick-cart-preview'); 631 location.reload(); 632 } else { 633 console.log(data.error); 634 } 635 }); 636 return false;
637 }); 638 639//////////////////////////* VOTE *////////////////////////////////////////////// 640 let itsVote = { 641 initialize: (element) => { 642 $(element).mouseenter(function () { 643 $(this).mouseleave(function () { 644 itsVote.revertState(this); 645 }); 646 }).children('span').on('click', function (e) { 647 itsVote.vote(this); 648 }).each(function () { 649 $(this).mouseenter(function () { 650 $(this).prevAll('span').addClass('checked'); 651 $(this).nextAll('span').removeClass('checked'); 652 $(this).addClass('checked'); 653 }); 654 }); 655 }, 656 657 revertState: (element) => { 658 let rate = $(element).attr('data-rate'); 659 $(element).children('span').each(function () { 660 $(this).removeClass('checked'); 661 }).slice(0, rate).each(function () { 662 $(this).addClass('checked'); 663 }); 664 }, 665 666 vote: (e) => { 667 let parent = $(e).parent('.js-vote'); 668 let children = $(parent).children('span'); 669 $(parent).off('mouseleave'); 670 671 let target = $(parent).attr('data-id'); 672 let type = $(parent).attr('data-type'); 673 let rate = $(e).prevAll('span').length + 1; 674 let params = {}; 675 params.rate = rate; 676 params.target = target; 677 params.type = type; 678 $.ajax({ 679 url: '/srv/rate', 680 type: 'POST', 681 data: params, 682 success: function (data, textStatus, jqXHR) { 683 if (data.success) { 684 let resultRate = Math.round(data.rate); 685 $(parent).attr('data-rate', resultRate); 686 $(children).each(function () { 687 $(this).removeClass('checked'); 688 }); 689 $(children).slice(0, resultRate).each(function () { 690 $(this).addClass('checked'); 691 }); 692 itsVote.disableVoteOnElement(parent); 693 } else { 694 itsVote.revertState(parent); 695 } 696 697 } 698 }); 699 }, 700 701 disableVoteOnElement(element) { 702 $(element).children('span').off('click'); 703 } 704 }; 705// itsVote.initialize('.js-vote'); 706//////////////////////////* VOTE *////////////////////////////////////////////// 707 708}); 709 710////////////////////////* SEARCH *////////////////////////////////////////// 711$(() => { 712 $('.js-clear-filed').on('click', (e) => { 713 let target = $(e.target).attr('field'); 714 $('[id=' + target + ']').val(''); 715 }); 716}); 717 718$(() => { 719 $('.js-select-single-option').on('click', function () { 720 let that = $(this); 721 let id = that.attr('data-id'); 722 let target = that.attr('data-type'); 723 $('#' + target + '_search').val(id); 724 $(this).siblings(".title").show(); 725 726 $(this).parent().siblings('.js-select-display').html(that.html()).addClass('selected').attr("data-id", id); 727 }); 728 $('.js-search-context').each(function () { 729 let context = $(this).attr('data-context'); 730 $('.js-' + context + '-select-overlay').on('click', function () { 731 $(this).children('.js-' + context + '-select-options').first().slideToggle(); 732 733 if ($(this).children('.js-' + context + '-select-options').first().hasClass("country-select-options")) { 734 $('.category-select-options').slideUp(); 735 } else if ($(this).children('.js-' + context + '-select-options').first().hasClass("category-select-options")) { 736 $('.country-select-options').slideUp(); 737 } 738 }); 739 }); 740 741 $('.js-custom-select-display').on('click', function (e) { 742 $(this).siblings('.js-custom-select-options').slideToggle(); 743 }); 744 745 $('.js-custom-select-options').on('click', function (e) { 746 let that = $(e.target); 747 let data = that.attr('data-id').trim(); 748 let html = that.html();
749 $(this).siblings('.js-custom-select-display').html(html).addClass('selected').attr("data-id", data); 750 $(this).siblings('input').val(data); 751 }); 752 753 $(document).on('click', function (e) { 754 if (!$(e.target).hasClass('js-custom-select-display') && !$(e.target).hasClass('selectedOption')) { 755 $('.js-custom-select-options').slideUp(); 756 } else { 757 if (!$(e.target).hasClass('selectedOption')) { 758 $('.js-custom-select-options').not($(e.target).siblings('.js-custom-select-options')).slideUp(); 759 } 760 $(e.target).find('.js-custom-select-options').slideDown(); 761 } 762 }); 763}); 764 765$(document).keypress(function (e) { 766 var keycode = (e.keyCode ? e.keyCode : e.which); 767 if (keycode == '13') { 768 $("#searchBtn").click(); 769 } 770}); 771 772 773$(document).click(function (e) { 774 e.stopPropagation(); 775 var context = $('.js-search-context').attr('data-context'); 776 var container = $(".js-select-display"); 777 778 if (!$(e.target).is(".js-select-display, .selectedOption")) { 779 $('.js-' + context + '-select-options').slideUp(); 780 } 781}); 782 783////////////////////////* THUMB ZOOM *////////////////////////////////////////// 784$(() => { 785// var screenWidth = $(window).width(); 786// if (screenWidth < 768) { 787// $('.js-its-zoom').each(function () { 788// $(this).removeAttr('href'); 789// }); 790// } 791// if (typeof $.fn.zoomple == 'function') { 792// $('.js-its-zoom').zoomple({ 793// offset: {x: 10, y: 0}, 794// showOverlay: true, 795// roundedCorners: false, 796// windowPosition: {x: 'right', y: 'top'}, 797// zoomWidth: 500, 798// zoomHeight: 500, 799// attachWindowToMouse: false 800// }); 801// } 802}); 803////////////////////////* CUSTOM HTML *///////////////////////////////////////// 804let itsCheckbox = { 805 init: function () { 806 $('.js-custom-checkbox').on('click', function (e) { 807 itsCheckbox.onClick.bind(this)(); 808 }); 809 }, 810 onClick: function () { 811 $(this).toggleClass('active'); 812 813 let input = $(this).siblings('input').first(); 814 let checked = input.attr('checked'); 815 if (checked == 'checked') { 816 $(input).removeAttr('checked'); 817 $(input).val('false'); 818 } else { 819 $(input).attr('checked', ''); 820 $(input).val('true'); 821 } 822 } 823}; 824itsCheckbox.init(); 825 826 827$('.js-custom-radio').on('click', function () { 828 let div = $(this); 829 let input = $(this).siblings('input').first(); 830 $('[name=' + input.attr('name') + ']').each(function () { 831 if ($(this).get(0) !== $(input).get(0)) { 832 $(this).prop('checked', false); 833 $(this).siblings('.js-custom-radio').removeClass('active'); 834 } else { 835 $(this).prop('checked', true); 836 $(div).addClass('active'); 837 } 838 }); 839}); 840 841$('.js-disable').off('click hover'); 842////////////////////////* YOUTUBE EMBED */////////////////////////////////////// 843 844// EMBED 845$(document).ready(function () { 846 setTimeout(function () { 847 $('.body .embed-box iframe[src*="youtube"]').parents(".embed-box").addClass("youtube"); 848 $('.body .boxBox iframe[src*="youtube"]').parents(".boxBox").addClass("youtube"); 849 $('.body .boxBox iframe#odysee-iframe').parents(".boxBox").addClass("youtube"); 850 851 $('.body .embed-box iframe[src*="google.com/maps/"]').parents(".embed-box").addClass("googleMaps"); 852 853 $('.body .embed-box iframe[src*="www.facebook.com"]').parents(".embed-box").addClass("facebook"); 854 855 $('.body .embed-box iframe[src*="assets.pinterest.com/"]').parents(".embed-box").addClass("pinterest"); 856 857 $('.body .embed-box iframe[src*="https://t.me/"]').parents(".embed-box").addClass("telegram"); 858 }, 1000); 859}); 860 861// GOOGLE EMBED 862//$(document).ready(function () { 863// $('.contentBody iframe[src*="google.com/maps/"]').wrap("<div class='googleMapWrapper'></div>"); 864//}); 865// HOME PEGE LEFT - RIGHT 866 867$(document).ready(function () { 868 equalHeight(); 869}); 870$(window).resize(function () { 871 equalHeight(); 872}); 873function equalHeight() { 874 if ($(window).width() >= 1024) { 875 var divHeight = $('.homeRightContent').height(); 876 $('.homeLeftContent .homeIntro .txt-wrapper').css('min-height', divHeight + 'px'); 877 } else { 878 $('.homeLeftContent .homeIntro .txt-wrapper').css('min-height', ''); 879 } 880} 881 882/* BURGER NAVIGATION */ 883 884$(document).ready(function () { 885 $(".mobTrigger").click(function () { 886 $(".mobNavigation").toggleClass("active"); 887 $(".okoMobNavigation").removeClass("active"); 888 $("body").toggleClass("lock"); 889 }); 890}); 891 892$(window).on('load, resize', function mobileViewUpdate() { 893 var viewportWidth = $(window).width(); 894 if (viewportWidth > 998) { 895 $("body").removeClass("lock"); 896 $(".mobNavigation").removeClass("active"); 897 } 898}); 899 900$(document).ready(function () { 901 $(".okoMobNavTrigger").click(function () { 902 $(".okoMobNavigation").toggleClass("active"); 903 $(".mobNavigation").removeClass("active"); 904 $("body").toggleClass("lock"); 905 }); 906}); 907 908$(window).on('load, resize', function mobileViewUpdate() { 909 var viewportWidth = $(window).width(); 910 if (viewportWidth > 960) { 911 $("body").removeClass("lock"); 912 $(".okoMobNavigation").removeClass("active"); 913 } 914}); 915 916//Toggle BR 917var removeBrElements = [ 918 $('.homeIntro h5.lead'), 919 $('.greenCircle .content p') 920]; 921 922removeBR(removeBrElements); 923 924function removeBR(elements) { 925 $(document).ready(function () { 926 $.each(elements, function () { 927 if ($(window).width() < 1023) { 928 let html = $(this).html(); 929 if (html) { 930 html = html.split("<br>"); 931 html = html.join(" "); 932 $(this).empty(); 933 $(this).append(html); 934 } 935 } else { 936 let html = $(this).html(); 937 if (html) { 938 html = html.split(' '); 939 html = html.join("<br>"); 940 $(this).empty(); 941 $(this).append(html); 942 } 943 } 944 }); 945 }); 946 $(window).resize(function () { 947 $.each(elements, function () { 948 if ($(window).width() < 1024) { 949 let html = $(this).html(); 950 if (typeof html != 'undefined') { 951 html = html.split("<br>"); 952 html = html.join(" "); 953 $(this).empty(); 954 $(this).append(html); 955 } 956 } else { 957 if (typeof html != 'undefined') { 958 let html = $(this).html(); 959 html = html.split(' '); 960 html = html.join("<br>"); 961 $(this).empty(); 962 $(this).append(html); 963 } 964 } 965 }); 966 }); 967} 968 969/* HOME SEARCH TOGGLE */ 970 971$(document).ready(function () { 972 $(".searchTitlesFullWidthTrigger").click(function () { 973 $(this).addClass("active"); 974 $(".searchTitles .searForm.home").addClass("active"); 975 }); 976}); 977 978$(window).on('load, resize', function mobileViewUpdate() { 979 var viewportWidth = $(window).width(); 980 if (viewportWidth > 767) { 981 $(".searchTitlesFullWidthTrigger").removeClass("active"); 982 $(".searchTitles .searForm.home").removeClass("active"); 983 } 984}); 985 986/* PRODUCTS INDEX SEARCH */ 987 988$(document).ready(function () { 989 searchPosition(); 990}); 991$(window).resize(function () { 992 searchPosition(); 993}); 994function searchPosition() { 995 var viewportWidth = $(window).width(); 996 if (viewportWidth < 1440) { 997// $('.productsIndex .searForm.fragment').appendTo('.searchNest'); 998// } else { 999// $('.searchNest .searForm.fragment').insertAfter('.productsIndex .numberOfTitles'); 1000// } 1001 $('.productsIndex .searchTitles.sidebar.fragment').appendTo('.searchNest'); 1002 } else { 1003 $('.searchNest .searchTitles.sidebar.fragment').prependTo('.productsIndex'); 1004 } 1005} 1006///////////////////////////////////// VALIDATION ////////////////////////////// 1007const removeCharacters = (e) => {
1008 const key = e.keyCode ? e.keyCode : e.which; 1009 if (!([8, 9, 13, 27, 46, 110, 190].indexOf(key) !== -1 || 1010 (key == 65 && (e.ctrlKey || e.metaKey)) || 1011 (key >= 35 && key <= 40) || 1012 (key >= 48 && key <= 57 && !(e.shiftKey || e.altKey)) || 1013 (key >= 96 && key <= 105) 1014 )) 1015 e.preventDefault(); 1016}; 1017$(document).ready(function () { 1018 $(".searchTrigger").click(function () { 1019 $(".nav-search").toggleClass("active"); 1020 }); 1021}); 1022//Footer bottom 1023$(document).ready(function () { 1024 contentHeight(); 1025}); 1026 1027$(window).resize(function () { 1028 contentHeight(); 1029}); 1030 1031function contentHeight() { 1032 let footer = $('#footer'); 1033 if (footer.length > 0) { 1034 let containerHeight = $('#container').height(); 1035 let footerHeight = $('#footer').outerHeight(true); 1036 let totalHeight = containerHeight + footerHeight; 1037 if ($(window).height() > totalHeight) { 1038 let differenceHeight = $(window).height() - $('#footer').outerHeight(true); 1039 $('#container').css('height', differenceHeight + 'px'); 1040 } else { 1041 $('#container').css('height', ''); 1042 } 1043 } 1044}
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.