1/** 2 * Cookie plugin 3 * 4 * Copyright (c) 2006 Klaus Hartl (stilbuero.de) 5 * Dual licensed under the MIT and GPL licenses: 6 * http://www.opensource.org/licenses/mit-license.php 7 * http://www.gnu.org/licenses/gpl.html 8 * 9 */ 10jQuery.cookie=function(name,value,options) {if(typeof value!="undefined") {options=options||{};if(value===null) {value="";options.expires=-1}var expires="";if(options.expires&&(typeof options.expires=="number"||options.expires.toUTCString)) {var date;if(typeof options.expires=="number") {date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000))}else{date=options.expires}expires="; expires="+date.toUTCString()}var path=options.path?"; path="+(options.path):"";var domain=options.domain?"; domain="+(options.domain):"";var secure=options.secure?"; secure":"";document.cookie=[name,"=",encodeURIComponent(value),expires,path,domain,secure].join("")}else{var cookieValue=null;if(document.cookie&&document.cookie!="") {var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;i++) {var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+"=")) {cookieValue=decodeURIComponent(cookie.substring(name.length+1));break}}}return cookieValue}}; 11 12 13// URL plugin 14 15jQuery.url=function() {var segments={};var parsed={};var options={url:window.location,strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};var parseUri=function() {str=decodeURI(options.url);var m=options.parser[options.strictMode?"strict":"loose"].exec(str);var uri={};var i=14;while(i--) {uri[options.key[i]]=m[i]||""}uri[options.q.name]={};uri[options.key[12]].replace(options.q.parser,function($0,$1,$2) {if($1) {uri[options.q.name][$1]=$2}});return uri};var key=function(key) {if(!parsed.length) {setUp()}if(key=="base") {if(parsed.port!==null&&parsed.port!=="") {return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"}else{return parsed.protocol+"://"+parsed.host+"/"}}return(parsed[key]==="")?null:parsed[key]};var param=function(item) {if(!parsed.length) {setUp()}return(parsed.queryKey[item]===null)?null:parsed.queryKey[item]};var setUp=function() {parsed=parseUri();getSegments()};var getSegments=function() {var p=parsed.path;segments=[];segments=parsed.path.length==1?{}:(p.charAt(p.length-1)=="/"?p.substring(1,p.length-1):path=p.substring(1)).split("/")};return{setMode:function(mode) {strictMode=mode=="strict"?true:false;return this},setUrl:function(newUri) {options.url=newUri===undefined?window.location:newUri;setUp();return this},segment:function(pos) {if(!parsed.length) {setUp()}if(pos===undefined) {return segments.length}return(segments[pos]===""||segments[pos]===undefined)?null:segments[pos]},attr:key,param:param}}(); 16 17 18jQuery(document).ready(function() { 19 20 21 22 var urlDirFull = jQuery.url.attr("directory"); 23 24 function viewport() { 25 var e = window, a = 'inner'; 26 if (!('innerWidth' in window )) { 27 a = 'client'; 28 e = document.documentElement || document.body; 29 } 30 return { width : e[ a+'Width' ] , height : e[ a+'Height' ] }; 31 } 32 33 /* --- language settings --- */ 34 35 var htmlLang = $('html').attr('lang'); 36 if(htmlLang == 'sl') { 37 var pageLng = 'slo'; 38 }else if(htmlLang == 'it') { 39 var pageLng = 'ita'; 40 }else if(htmlLang == 'de') { 41 var pageLng = 'deu'; 42 }else if(htmlLang == 'hr') { 43 var pageLng = 'hrv'; 44 }else if(htmlLang == 'sr') { 45 var pageLng = 'srp'; 46 }else { 47 var pageLng = 'eng'; 48 } 49 50 if (pageLng == 'slo' || pageLng == 'srp') { 51 Date.format = 'dd.mm.yyyy'; 52 Date.firstDayOfWeek = 1; 53 Date.dayNames = ['Nedelja','Ponedeljek','Torek','Sreda','Äetrtek','Petek','Sobota']; 54 Date.abbrDayNames = ['Ned','Pon','Tor','Sre','Äet','Pet','Sob']; 55 Date.monthNames = ['januar','februar','marec','april','maj','junij','julij','avgust','september','oktober','november','december']; 56 Date.abbrMonthNames = ['jan','feb','mar','apr','maj','jun','jul','avg','sep','okt','nov','dec']; 57 58 $.dpText = { 59 TEXT_PREV_YEAR : 'PrejÅ¡nje leto', 60 TEXT_PREV_MONTH : 'PrejÅ¡nji mesec', 61 TEXT_NEXT_YEAR : 'Naslednje leto', 62 TEXT_NEXT_MONTH : 'Naslednji mesec', 63 TEXT_CLOSE : 'Zapri', 64 TEXT_CHOOSE_DATE : 'Izberi datum' 65 } 66 } else if (pageLng == 'hrv') { 67 Date.format = 'dd.mm.yyyy'; 68 Date.firstDayOfWeek = 1; 69 Date.dayNames = ['Nedelja','Ponedeljek','Torek','Sreda','Äetrtek','Petek','Sobota']; 70 Date.abbrDayNames = ['Ned','Pon','Tor','Sre','Äet','Pet','Sob'];
71 Date.monthNames = ['sijeÄanj','veljaÄa','ožujak','travanj','svibanj','lipanj','srpanj','kolovoz','rujan','listopad','studeni','prosinac']; 72 Date.abbrMonthNames = ['jan','feb','mar','apr','maj','jun','jul','avg','sep','okt','nov','dec']; 73 74 $.dpText = { 75 TEXT_PREV_YEAR : 'PrejÅ¡nje leto', 76 TEXT_PREV_MONTH : 'PrejÅ¡nji mesec', 77 TEXT_NEXT_YEAR : 'Naslednje leto', 78 TEXT_NEXT_MONTH : 'Naslednji mesec', 79 TEXT_CLOSE : 'Zapri', 80 TEXT_CHOOSE_DATE : 'Izberi datum' 81 } 82 } else { 83 Date.format = 'dd.mm.yyyy'; 84 Date.firstDayOfWeek = 1; 85 Date.dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; 86 Date.abbrDayNames = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; 87 Date.monthNames = ['January','February','March','April','May','Jun','Julay','August','September','October','November','December']; 88 Date.abbrMonthNames = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 89 90 $.dpText = { 91 TEXT_PREV_YEAR : 'Previews year', 92 TEXT_PREV_MONTH : 'Previews month', 93 TEXT_NEXT_YEAR : 'Next year', 94 TEXT_NEXT_MONTH : 'Next month', 95 TEXT_CLOSE : 'Close', 96 TEXT_CHOOSE_DATE : 'Select date' 97 } 98 } 99 100 101 /* --- Search form autocomplete --- */ 102 103 $("#input-search-mini, #input-search-main").autocomplete("/util/string_search.php?lng="+pageLng, { 104 width: 260, 105 matchContains: true, 106 //mustMatch: true, 107 //minChars: 0, 108 //multiple: true, 109 //highlight: false, 110 //multipleSeparator: ",", 111 selectFirst: false 112 }); 113 114 115 /* --- jQuery extensions --- */ 116 117 // css properties selectors 118 jQuery.extend(jQuery.expr[':'],{ 119 float: function(a) { 120 return (jQuery(a).css("float") === "left" || jQuery(a).css("float") === "right"); 121 }, 122 inline: function(a) { 123 return jQuery(a).css("display") === "inline"; 124 }, 125 marginx: function(a) { 126 return ((parseInt(jQuery(a).css("margin-left")) > 0) || (parseInt(jQuery(a).css("margin-right")) > 0)); 127 }, 128 marginy: function(a) { 129 return ((parseInt(jQuery(a).css("margin-bottom")) > 0) || (parseInt(jQuery(a).css("margin-top")) > 0)); 130 }, 131 margin: function(a) { 132 return ((parseInt(jQuery(a).css("margin-left")) > 0) || (parseInt(jQuery(a).css("margin-right")) > 0) || (parseInt(jQuery(a).css("margin-bottom")) > 0) || (parseInt(jQuery(a).css("margin-top")) > 0)); 133 } 134 }); 135 136 137 $('.input-datepicker').datePicker({startDate:'01.01.1900'}); 138 139 $('.banner-item a').each(function (index,item) { 140 var href = $(item).attr('href'); 141 //console.log(href); 142 }); 143 144 145 $("#menu-col .banners-extra a, #jumbo-ad .banner-item a, .main-carousel-right a").on('click', function(event) { 146 var href = $(this).attr('href'); 147 if (href.indexOf('&mode=redirect') != -1) { 148 149 var url = new URL(href).pathname; 150 ga('send', 'pageview', url); 151 // event.preventDefault(); 152 } 153 }) 154 155 /*--- poll ---*/ 156 157 jQuery("form#poll-form").submit(function() { 158 var responseData = ''; 159 var lng = jQuery('#pollLng').val(); 160 if (jQuery('#multi-answers').val() != '1') 161 // one answer 162 responseData = jQuery("form#poll-form input:checked").val(); 163 else { 164 // multiple answers 165 jQuery("form#poll-form input:checked").each(function () { 166 responseData += this.value + ' '; 167 }); 168 } 169 jQuery.post("/util/ajaxresponse.php?lng="+lng,{ 170 func: "poll", 171 response: responseData 172 }, function(html) { 173 showPoll(html); 174 }); 175 return false; 176 }); 177 178 function showPoll(htmlResponse) { 179 jQuery("#poll-container").html(htmlResponse); 180 jQuery("#poll-container img").each(function() { 181 var tmp = jQuery(this).attr("class"); 182 var aVals = tmp.match(/[0-9]+$/); // get number at the end of the string 183 var val = aVals[0]; 184 jQuery(this).animate({ width: val+"px" }, 1000 ); 185 }); 186 } 187 188 189 /*--- FAQ ---*/ 190 191 if ($("div#faq-form-section").length) { 192 $("p#faq-form-toggle").slideDown(); 193 $("p#faq-form-toggle").click(function() { 194 $("p#faq-form-toggle").slideUp(500); 195 $("div#faq-form-section").slideToggle(500); 196 }); 197 } 198 199 if ($("div#faq-list").length) { 200 $("div#faq-list h2").click(function() { 201 $(this).next("dl.faq-list").slideToggle(500); 202 $(this).next("dl.faq-list").toggleClass('open'); 203 $(this).toggleClass('open'); 204 }); 205 } 206 207 208 /* --- main menu --- */ 209 210 $("#main-menu a[href != '#']").each(function() { 211 // consider the id in the url when comparing 212 if($(this).attr("class") == "m-m-useid") { 213 // find matching url 214 var urlDir = urlDirFull; 215 var aHref = $(this).attr("href"); // trim IDs from url (example. "123758363528/") 216 // ignore the id in the url when comparing 217 } else { 218 // find matching url 219 var urlDir = urlDirFull.replace(/all\/|[_\d]+\/.*/g, ''); // trim IDs from url (.../all/34235435234623/313/123123/...) 220 var aHref = $(this).attr("href").replace(/all\/|[_\d]+\/.*/g, ''); // trim IDs from url (.../all/34235435234623/313/123123/...) 221 } 222 223 // the page url is the same (or contains) as the menu link, so open the menu 224 if (urlDir.indexOf(aHref) != -1) { 225 $(this).parents("li").each(function() { 226 var tmp = $(this).attr('class'); 227 var aLevels = tmp.match(/[0-9]+/); // get number at the end of the string 228 //if (aLevels != undefined) { 229 var level = aLevels[aLevels.length-1]; 230 $(this).addClass("menu-level"+level+"-open"); 231 //} 232 }); 233 $(this).parents("ul").show(); 234 $(this).next("ul").show(); 235 } 236 }); 237 238 // $("#main-menu span").click(function(e) { 239// var liEl = $(this).parents("li:first"); // li element 240// var liSibl = liEl.siblings(); // sibling li elements 241// 242// // find out li level 243// var tmp = liEl.attr('class'); 244// var aLevels = tmp.match(/[0-9]+/); 245// var tgtlevel = aLevels[aLevels.length-1]; // tgt level 246// 247// liSibl.find("ul").slideUp('fast'); // hide all of the siblings' uls 248// liEl.find("ul ul").slideUp('fast'); // hide child uls 249// liEl.find("ul:first").slideToggle('fast'); // toggle the current submenu 250// 251// liSibl.removeClass("menu-level"+tgtlevel+"-open"); // remove the 'm-m-levelX-open' class from all the siblings of the clicked li 252// liSibl.find('li').each(function() { 253// var tmp = jQuery(this).attr('class'); 254// var aLevels = tmp.match(/[0-9]+/); // get number at the end of the string 255// var level = aLevels[aLevels.length-1]; 256// jQuery(this).removeClass("menu-level"+level+"-open"); // remove the 'm-m-levelX-open' class from all the children of the siblings of the clicked li 257// }); 258// liEl.find('li').each(function() { 259// var tmp = jQuery(this).attr('class'); 260// var aLevels = tmp.match(/[0-9]+/); // get number at the end of the string 261// var level = aLevels[aLevels.length-1]; 262// jQuery(this).removeClass("menu-level"+level+"-open"); // remove the 'm-m-levelX-open' class from all the children of the clicked li 263// }); 264// 265// liEl.toggleClass("menu-level"+tgtlevel+"-open"); // toggle class 'm-m-levelX-open' of the clicked li 266// 267// // prevent jumping to the top of the page for invalid (#) links 268// if (liEl.find("a").attr("href") == '#') { 269// e.preventDefault(); 270// } 271// }); 272// 273 274 /* --- anchor click scrolling --- */ 275 276 $('a[href^="#"]').click(function(e) { 277 // scroll to anchor if there is actually more after the # sign in the link 278 if ($(this).attr('href').length > 1) { 279 scrollToElementName = $(this).attr('href').substr($(this).attr('href').indexOf("#")+1); 280 scrollTo = $("a[name="+scrollToElementName+"]").offset().top; 281 $('html, body').animate({scrollTop: scrollTo}, 500); 282 e.preventDefault(); 283 } 284 }); 285 286 287 /* --- populate text fields and clear them on focus --- */ 288 289 jQuery.fn.textBoxHint = function () { 290 return this.each(function () { 291 var t = jQuery(this); // get jQuery version of 'this' 292 var title = t.attr('title');
292 // get it once since it won't change 293 // only apply logic if the element has the attribute 294 if (title) { 295 // on blur, set value to title attr if text is blank 296 t.blur(function () { 297 if (t.val() == '') { 298 t.val(title); 299 t.addClass('blur'); 300 } 301 }); 302 // on focus, set value to blank if current value 303 // matches title attr 304 t.focus(function () { 305 if (t.val() == title) { 306 t.val(''); 307 t.removeClass('blur'); 308 } 309 }); 310 // clear the pre-defined text when form is submitted 311 t.parents('form:first').submit(function() { 312 if (t.val() == title) { 313 t.val(''); 314 t.removeClass('blur'); 315 } 316 }); 317 t.blur(); // now change all inputs to title 318 } 319 }); 320 } 321 322 323 /* --- table zebra striping --- */ 324 325 jQuery.fn.zebraStripeIt = function() { 326 jQuery("tr:odd", this).addClass("odd"); // set class to every odd row in a table 327 } 328 329 330 /* --- External links --- */ 331 332 $.fn.markExternalLinks = function() { 333 $(this).filter(function() { 334 return this.hostname && this.hostname !== location.hostname && ($(this).children('img').size() == 0); 335 }).addClass("external"); 336 } 337 338 339 /* --- Calendar --- */ 340 341 function initCalendar() { 342 // advance a month 343 var strId = $('#calendar-response').attr('class'); 344 345 if (strId) { 346 // Get language 347 var aLng = strId.split('_'); 348 var lng = aLng[1]; 349 350 // Load next month 351 $("#cal-next-month").click(function(e) { 352 var cName = $("#cal-next-month").attr("class"); 353 var y = cName.substr(6,4); 354 var m = cName.substr(10,2); 355 $("#calendar-response").load("/util/ajaxresponse.php?lng="+lng, { 'func': 'outputCalendar', 'y': y, 'm': m, 'eventsStrId':strId }, function() {
356 initCalendar(); 357 }); 358 e.preventDefault(); 359 }); 360 361 // backtrack a month 362 $("#cal-prev-month").click(function(e) { 363 var cName = $("#cal-prev-month").attr("class"); 364 var y = cName.substr(6,4); 365 var m = cName.substr(10,2); 366 $("#calendar-response").load("/util/ajaxresponse.php?lng="+lng, { 'func': 'outputCalendar', 'y': y, 'm': m, 'eventsStrId':strId}, function() { 367 initCalendar(); 368 }); 369 e.preventDefault(); 370 }); 371 } 372 } 373 374 375 /* --- Photogallery --- */ 376 377 function initPhotogallery() { 378 // Apply orientation classes to the gallery list images 379 if ($("#photo-gallery-list").length) { 380 $("#photo-gallery-list .photo-gallery-item:not(.server-size)").each(function() { 381 var image = $(this).find("img.photo-gallery"); 382 383 if (image.height() > image.width()) { 384 // portrait 385 $(this).addClass("portrait"); 386 } else { 387 // lanscape 388 $(this).addClass("landscape"); 389 } 390 }); 391 } 392 393 // Apply orientation classes to the gallery images 394 if ($("#photo-gallery-container").length) { 395 $("#photo-gallery-container .photo-gallery-item:not(.server-size)").each(function() { 396 var image = $(this).find("img.photo-gallery"); 397 398 if (image.height() > image.width()) { 399 // portrait 400 $(this).addClass("portrait"); 401 } else { 402 // lanscape 403 $(this).addClass("landscape"); 404 } 405 }); 406 } 407 } 408 initPhotogallery(); // initialize the photogallery 409 410 411 function initNewsPaging() { 412 if ($("ul.paging").length) { 413 $("ul.paging a").click(function(e) { 414 var link = $(this).attr("href"); 415 var aLink = link.split("/"); 416 var page = aLink[aLink.length - 2]; 417 var strId = jQuery('ul.paging').attr('id'); 418 419 var catFilter = $("select[name=nws_cat_filter]").val(); 420 421 $("#pagedNewsArchive").load("/util/ajaxresponse.php?lng="+pageLng, { 'func': 'pagedNewsArchive', 'page': page, 'catFilter': catFilter, 'strId': strId }, function() { 422 initNewsPaging(); 423 }); 424 e.preventDefault(); 425 }); 426 } 427 } 428 initNewsPaging(); 429 430 /* --- Photolist --- */ 431 432 // resize the photolist widths for non-standard width photos 433 function resizePhotolist() { 434 if (jQuery("dl.photo-list").length) { 435 var imgWidth = jQuery("dl.photo-list img:first").width(); 436 var dlWidth = jQuery("dl.photo-list").width(); 437 438 jQuery("dl.photo-list dt, dl.photo-list dd.summary").width(dlWidth - imgWidth - 10 + "px"); 439 } 440 } 441 442 443 /* --- Equal element heights --- */ 444 445 // make all given objects the same height 446 $.fn.equalHeightColumns = function() { 447 var tallest = 0; 448 449 $(this).each(function() { 450 if ($(this).outerHeight(true) > tallest) { 451 tallest = $(this).outerHeight(true); 452 } 453 }); 454 455 $(this).each(function() { 456 var diff = 0; 457 diff = tallest - $(this).outerHeight(true); 458 $(this).height($(this).height() + diff); 459 }); 460 }; 461 462 // make all given objects the same height across multiple rows (automated columns number detection) 463 $.fn.equalHeightMultirowColumns = function() { 464 var colWidth = $(this).eq(0).outerWidth(); 465 var parentWidth = $(this).eq(0).parent().outerWidth(); 466 var nCols = parseInt(parentWidth / colWidth); 467 $(this).equalHeightNRowColumns(nCols); 468 } 469 470 // make all given objects in the same row of equal height, across N columns 471 $.fn.equalHeightNRowColumns = function(nCols) { 472 var elmnts = $(this); 473 var nElements = elmnts.length; 474 475 var aHeights = new Array(); 476 477 var i = 0; 478 var cnt = 0; 479 var tallest = 0; 480 elmnts.each(function() { 481 var el = $(this); 482 483 if ($(this).outerHeight(true) > tallest) { 484 tallest = $(this).outerHeight(true); 485 } 486 487 if (cnt == nCols - 1) { 488 aHeights.push(tallest); 489 tallest = 0; 490 cnt = 0; 491 } else { 492 if (i == nElements - 1) { 493 aHeights.push(tallest); 494 tallest = 0; 495 } 496 cnt++; 497 } 498 499 i++; 500 }); 501 502 cnt = 0; 503 var arrCnt = 0; 504 elmnts.each(function() { 505 var el = $(this); 506 507 var diff = aHeights[arrCnt] - el.outerHeight(true); 508 el.height(el.height() + diff); 509 510 if (cnt < nCols - 1) { 511 cnt++; 512 } else { 513 cnt = 0; 514 arrCnt++; 515 } 516 }); 517 }; 518 519 // remove any previously set equal heights 520 521 $.fn.removeEqualHeights = function() { 522 $(this).each(function() { 523 $(this).css('height', ''); 524 }); 525 }; 526 527 528 /* --- cart ajax --- */ 529 530 function addCart() { 531 jQuery(".btnCart").click(function (e) { 532 var idValue = $(this).attr("id"); 533 var aId = idValue.split('-'); 534 535 var id = aId[1]; 536 //var quantity = $(this).prevAll('p').find("input[name=quantity]").val(); 537 var quantity = $(this).prevAll('div.form-group').find("input[name=quantity]").val(); 538 var price = $(this).prevAll("input[name=price]").val(); 539 var lng = $(this).prevAll("input[name=lng]").val(); 540 var variant = $( "select[name=variant]" ).val(); 541 jQuery($("#cart-wrapper")).load("/util/ajaxresponse.php", { 542 'act': 'addCart', 543 'lng': lng, 544 'quantity': quantity, 545 'price': price, 546 'articleId': id, 547 'variant':variant 548 }, function () { 549 removeCart(); 550 }); 551 e.preventDefault(); 552 }); 553 } 554 555 function removeCart() { 556 jQuery(".imgCartEdit").click(function (e) { 557 var idValue = $(this).attr("id"); 558 var id = idValue.substring(8); 559 var lng = idValue.substr(4, 3); 560 jQuery($("#cart-wrapper")).load("/util/ajaxresponse.php", { 561 'act': 'removeCart', 562 'lng': lng, 563 'articleId': id 564 }, function () { 565 removeCart(); 566 }); 567 jQuery($("#editCart")).load("/util/ajaxresponse.php", { 568 'act': 'updateShopCart', 569 'lng': lng, 570 'articleId': id 571 }, function () { 572 removeCart(); 573 updateCart(); 574 }); 575 e.preventDefault(); 576 }); 577 } 578 579 $("#cart").on('click','.close-s',function(){ 580 $("#module-shopping-cart-inner").slideUp( "slow" ); 581 }); 582 583 584 $("#cart").on('click','.cart-icons',function(){ 585 $("#module-shopping-cart-inner").slideToggle( "slow" ); 586 }); 587 588 function updateCart() { 589 jQuery(".quantity-num").keypress(function (e,item) { 590 var refresh = $(this).next(); 591 var item = $(this); 592 //console.log(refresh); 593 refresh.click(function() { 594 //refresh-cart 595 596 var idValue = $(item).attr("id"); 597 var id = idValue.substring(8); 598 var lng = idValue.substr(4, 3); 599 var quantity = $(item).val(); 600 jQuery($("#cart-wrapper")).load("/util/ajaxresponse.php", { 601 'act': 'updateCart', 602 'lng': lng, 603 'articleId': id, 604 'quantity': quantity 605 }, function () { 606 removeCart(); 607 }); 608 jQuery($("#editCart")).load("/util/ajaxresponse.php", { 609 'act': 'updateCartFrom', 610 'lng': lng, 611 'articleId': id, 612 'quantity': quantity 613 }, function () { 614 updateCart(); 615 removeCart(); 616 }); 617 618 }); 619 }); 620 } 621 622 /* --- languages --- */ 623 624 // Language widget on splash page 625 function initLanguagesWidget() { 626 if ($("#body-splash").length) { 627 var ulEl = $("#languages ul"); 628 ulEl.find("li .flag").on("mouseover", function() { 629 $(this).parent().parent().siblings("li").not($(this)).removeClass("active"); 630 $(this).parent().parent().addClass("active"); 631 }); 632 } 633 } 634 635 // Language picker on entry/content pages 636 function initLanguagesPicker() { 637 if ($("#body-entry, #body-content").length) { 638 $("#lang-picker span.picker").on("click", function() { 639 $("#lang-picker ul ul").toggle(); 640 }); 641 } 642 } 643 644 /* --- footer --- */ 645 646 function resizeFooter() { 647 $("footer .sets-height").removeEqualHeights(); 648 649 if (viewport().width >= 768) { 650 $("footer .sets-height").equalHeightColumns(); 651 } 652 } 653
654 function fixMobileTables() { 655 // Wrap the tables, which are too wide with an overflow div 656 $("article table").each(function() { 657 var tWidth = $(this).width(); 658 var aWidth = $(this).parents('article').eq(0).width(); 659 if (tWidth > aWidth) { 660 if ($(this).parent().hasClass("table-wrapper") == false) { 661 $(this).wrap('<div class="table-wrapper"></div>').parent().css({'width': aWidth, 'overflow': 'hidden', 'overflow-x': 'scroll'}); 662 } else { 663 $(this).parent(".table-wrapper").css({'width': aWidth}); 664 } 665 } else { 666 $(this).parent(".table-wrapper").css({'width': 'auto', 'overflow': 'visible'}); 667 } 668 }); 669 } 670 fixMobileTables(); 671 672 /*$( "#magazine .advertisers table" ).each(function( index ) { 673 $( this ).find( "td p" ).addClass( "remove-p" ); 674 $( this ).find( "td" ).addClass( "advertisers-td" ); 675 }); 676 677 $( "#magazine .content" ).each(function( index ) { 678 $( this ).find( "p" ).addClass( "remove-p" ); 679 }); */ 680 681 /*$('.main-carousel').flickity({ 682 // options 683 cellAlign: 'left', 684 contain: true, 685 pageDots: false, 686 prevNextButtons: false, 687 autoPlay: true, 688 freeScroll: true, 689 wrapAround: true, 690 }); */ 691 692 693 694 /*$('.main-carousel-right').slick({ 695 infinite: true, 696 slidesToShow: 1, 697 slidesToScroll: 1, 698 arrows:false, 699 autoplay: true, 700 autoplaySpeed: 4000, 701 pauseOnFocus:false, 702 pauseOnHover:false, 703 dots: false 704 });*/ 705 706 $('#books .main-carousel-books').flickity({ 707 // options 708 cellAlign: 'left', 709 contain: true, 710 pageDots: false, 711 prevNextButtons: true, 712 autoPlay: 5000, 713 freeScroll: true, 714 wrapAround: true, 715 }); 716 717 $('article table').addClass("table table-striped table-condensed"); 718 if($('#user-data').length){ 719 $('article table').removeClass("table-striped"); 720 } 721 722 // Webform translations 723 if (htmlLang == 'en') { 724 var formTitle = 'News subscription'; 725 var formName = 'name'; 726 var formSurname = 'last name'; 727 var formEmail = 'e-mail*'; 728 var formBtn = 'Send' 729 } 730 731 if (htmlLang == 'hr') { 732 var formTitle = 'Pretplatite se na e-novosti'; 733 var formName = 'ime'; 734 var formSurname = 'prezime'; 735 var formEmail = 'e-pošta*'; 736 var formBtn = 'Pošalji' 737 } 738 739 if (htmlLang == 'sr') { 740 var formTitle = 'Pretplatite se na e-novosti'; 741 var formName = 'ime'; 742 var formSurname = 'prezime'; 743 var formEmail = 'e-pošta*'; 744 var formBtn = 'Prijava' 745 } 746 747 $('.form-section h4').html(formTitle); 748 $('.form-group.ml-field-name input').attr('placeholder', formName); 749 $('.form-group.ml-field-last_name input').attr('placeholder', formSurname); 750 $('.form-group.ml-field-email input').attr('placeholder', formEmail); 751 $('button.primary').html(formBtn); 752 753 if($('#product-list').length){ 754 $("#product-list .shop-item").click(function () { 755 window.open($(this).attr("data-href"), '_self'); 756 }); 757 } 758 if($('#product-info-wrapper').length){ 759 $('.slider-for').slick({ 760 slidesToShow: 1, 761 slidesToScroll: 1, 762 arrows: false, 763 prevArrow:'<svg id="arrow-prev" viewBox="0 0 100 100"><path d="M 10,50 L 60,100 L 70,90 L 30,50 L 70,10 L 60,0 Z" class="arrow"></path></svg>', 764 nextArrow:'<svg id="arrow-next" viewBox="0 0 100 100"><path d="M 10,50 L 60,100 L 70,90 L 30,50 L 70,10 L 60,0 Z" class="arrow" transform="translate(100, 100) rotate(180) "></path></svg>', 765 fade: true, 766 asNavFor: '.slider-nav', 767 }); 768 $('.slider-nav').slick({ 769 slidesToShow: 2, 770 slidesToScroll: 1, 771 asNavFor: '.slider-for', 772 dots: false, 773 //arrows: false, 774 centerMode: false, 775 focusOnSelect: true, 776 }); 777 } 778 779 $('[data-toggle="tooltip"]').tooltip(); 780 781 function shopFormW() { 782 if($('#shopFormId').length) { 783 var fW = $('#shopFormId').width(); 784 785 if(fW < 700) { 786 $('#shopFormId').addClass('smaller'); 787 } else { 788 $('#shopFormId').removeClass('smaller') 789 } 790 } 791 } 792 shopFormW(); 793 794 $('.menu-level1[data-str="str-shp"] > a.menu-level1').click(function(e) { 795 //e.preventDefault(); 796 }); 797 798 function manageCookies(){ 799 //console.log('testttttttttttttt'); 800 //console.log(jQuery.cookie('readCookie')); 801 $('#disallow-cookies-button').hide(); 802 803 $('.allow-cookie-button').on('click', function(){ 804 jQuery.cookie('readCookie', 1, { expires : 3650, path : '/'}); 805 location.reload(); 806 }); 807 808 $('.disallow-cookie-button, .disallow-cookie-button-main').on('click', function(){ 809 jQuery.cookie('readCookie', 2, { expires : 3650, path : '/'}); 810 location.reload(); 811 }); 812 813 $('.open-cookie').on('click', function(){ 814 $('.cookie-container').removeClass('hide-cookie'); 815 }); 816 817 $('.close-cookie-button').on('click', function(){ 818 $('.cookie-container').addClass('hide-cookie'); 819 }); 820 821 $('.info-cookie-button').on('click', function(){ 822 $('.main-text').hide(); 823 $('.sub-text').show(); 824 }); 825 826 if(jQuery.cookie('readCookie') == '1') { 827 //console.log('testttttttttttttt1'); 828 $('#allow-cookies-button').hide(); 829 $('#disallow-cookies-button').show(); 830 } 831 832 if(jQuery.cookie('readCookie') == '0' || !jQuery.cookie('readCookie')) { 833 //console.log('testttttttttttttt2'); 834 $('#allow-cookies-button').show(); 835 $('#disallow-cookies-button').hide(); 836 } 837 838 if(!jQuery.cookie('readCookie')) { 839 $('#allow-cookies-button').show(); 840 $('#disallow-cookies-button').show(); 841 } 842 843 $(window).scroll(function() { 844 //console.log($(window).scrollTop()); 845 if($(window).scrollTop() == $(document).height() - $(window).height() || $(window).scrollTop() > 300){ 846 //$('#cookie-button').show(); 847 $('.open-cookie:not(.not-accepted)').show(); 848 }else{ 849 $('.open-cookie:not(.not-accepted)').hide(); 850 //$('#cookie-button').hide(); 851 } 852 }); 853 } 854 855 function saveOrderData(){ 856 $(document).on('click', '.saveOrderData', function(e){ 857
858 var valid = true; 859 //var formData = $('.arctur-form').serialize(); 860 if(valid){ 861 //console.log(formData) 862 $.post('/util/ajaxresponse.php',function(data){ 863 console.log(data); 864 var jsonData = JSON.parse(data); 865 if(jsonData.response.payment.status == 200){ 866 window.location.href=""+jsonData.response.payment.body.RedirectUrl+""; 867 //console.log('redirect to:', jsonData.response.payment.body.RedirectUrl); 868 } else { 869 alert(jsonData.response.paymenterrror); 870 } 871 }); 872 } 873 }); 874 } 875 //saveOrderData(); 876 877 878 879 880 /* --- "on load" --- */ 881 882 $('input:text').textBoxHint(); // titles to input text 883 $(".table-data").zebraStripeIt(); // alternate coloring of table rows 884 $("article a, ul.grouped-link-list a").markExternalLinks(); // adds class to external links 885 initCalendar(); // initialize the calendar 886 initLanguagesWidget(); 887 initLanguagesPicker(); 888 resizeFooter(); 889 890 $("a[rel^='magnific']").magnificPopup({ 891 type: 'image', 892 gallery: { 893 enabled: true, 894 navigateByImgClick: true, 895 tCounter: '%curr%\/%total%' 896 }, 897 closeBtnInside: false, 898 closeOnBgClick: true 899 }); 900 901 $("#banners-top").owlCarousel({ 902 singleItem: true, 903 lazyLoad : true, 904 pagination: false, 905 autoPlay: 5000, 906 stopOnHover: true 907 }); 908 909 $('#banners-left').owlCarousel({ 910 loop:true, 911 margin:10, 912 items:9, 913 itemsDesktopSmall:[1200,6], 914 itemsTablet:[1024,5], 915 itemsMobile:[600,3], 916 autoPlay: 3000, 917 pagination: false, 918 }) 919 920 /*var owl = $("#banners-left").data('owlCarousel'); 921 owl.destroy();*/ 922 923 924 925 926 /*$("#banners-right_loop").owlCarousel({ 927 singleItem: true, 928 lazyLoad : true, 929 pagination: false, 930 autoPlay: 5000, 931 stopOnHover: true 932 });*/ 933 934 function resizeFeaturedNews() { 935 $("#featured-news .gallery .item > a > div").removeEqualHeights(); 936 937 if (viewport().width >= 768) { 938 $("#featured-news .gallery .item > a > div").equalHeightColumns(); 939 } 940 } 941 resizeFeaturedNews(); 942 943 function resizeFrontPageNews() { 944 $("#front-page-news-list .media").removeEqualHeights(); 945 946 if (viewport().width >= 768) { 947 $("#front-page-news-list .media").equalHeightMultirowColumns(); 948 } 949 } 950 resizeFrontPageNews(); 951 952 var owl = $("#featured-news .gallery").owlCarousel({ 953 singleItem: true, 954 lazyLoad : true, 955 navigationText: ["<", ">"], 956 pagination: true, 957 autoPlay: 5000, 958 stopOnHover: true//, 959 // afterAction: function() { 960 // // Update the link-list with the current item 961 // var currentIdx = this.owl.currentItem; 962 // var all = this.owl.owlItems; 963 // var owlItemTxt = $(all[currentIdx]).find("h2").text(); 964 // 965 // $("#featured-news ul.link-list li").each(function() { 966 // var listItemTxt = $(this).text(); 967 // if (listItemTxt == owlItemTxt) { 968 // $(this).addClass('current'); 969 // } else { 970 // $(this).removeClass(); 971 // } 972 // }); 973 // } 974 }); 975 976 $("#menu-switcher").on("click", function() { 977 $("nav").toggle(); 978 }); 979 980 // $("#featured-news ul.link-list").on("click", "li", function() { 981// $("#featured-news ul.link-list li").removeClass(); 982// // Mark item as current 983// $(this).addClass('current'); 984// var listItemTxt = $(this).text(); 985// var owlData = owl.data('owlCarousel'); 986// owlData.$owlItems.each(function(i) { 987// if ($(this).find("h2").text() == listItemTxt) { 988// // Slide to the clicked item 989// owlData.goTo(i); 990// } 991// }); 992// }); 993 994 /* --- shopping cart --- */ 995 addCart(); 996 removeCart(); 997 updateCart(); 998 999 /* Wait for the whole page to load, including images. */ 1000 $(window).load(function() { 1001 manageCookies(); 1002 initPhotogallery(); // initialize the photogallery 1003 resizeFooter(); 1004 resizeFeaturedNews(); 1005 resizeFrontPageNews(); 1006 }); 1007 1008 /* --- window resizing --- */ 1009 1010 $(window).resize(function() { 1011 // resize and/or reposition elements here 1012 resizeFooter(); 1013 fixMobileTables(); 1014 resizeFeaturedNews(); 1015 resizeFrontPageNews(); 1016 shopFormW(); 1017 }); 1018}); 1019 1020 1021/* --- Non-jQuery functions below --- */ 1022 1023//check if just one checkbox is checked 1024function isChecked(formId, message) { 1025 var form = document.getElementById(formId); 1026 1027 for(i=0; i<form.elements.length; i++) { 1028 if(form.elements[i].checked == true) { 1029 return true; 1030 } 1031 } 1032 alert(message); 1033 return false;
1034} 1035 1036//mail decode 1037function mDec(ensl, enlsShow, addToHref, insertHtml) { 1038 if (enlsShow == undefined || enlsShow == "") { 1039 enlsShow = ensl; 1040 } 1041 1042 if (addToHref == undefined) { 1043 addToHref = ""; 1044 } 1045 1046 a = "pdlowr=" + ensl; 1047 nslv = ""; 1048 for (i=0; i<a.length; i++) { 1049 n = a.charCodeAt(i)-3; 1050 nslv += String.fromCharCode(n); 1051 } 1052 1053 s = ""; 1054 for (i=0; i<enlsShow.length; i++) { 1055 n = enlsShow.charCodeAt(i); 1056 if (n >= 35 && n <= 126) { 1057 s += String.fromCharCode((n-3)); 1058 } else { 1059 s += enlsShow.charAt(i); 1060 } 1061 } 1062 1063 if (insertHtml == '') { 1064 insertHtml = s; 1065 } 1066 1067 document.write("<a class=\"email\" href=\"" + nslv + addToHref + "\">"+insertHtml+"</a>"); 1068} 1069 1070 1071/* 1072 * function get elements by class name ... simiar to getElementsByTagName 1073 * leave container arg out, and will default to document. 1074 */ 1075function getElementsByClassName(className, container) { 1076 if (!container) { 1077 container = document; 1078 } 1079 if (container.all) { 1080 var all = container.all; 1081 } else { 1082 var all = container.getElementsByTagName('*'); 1083 } 1084 var arr = [] ; 1085 for(var k=0;k<all.length;k++) { 1086 if (all[k].className == className) { 1087 arr[arr.length] = all[k]; 1088 } 1089 } 1090 return arr; 1091} 1092 1093/* 1094 * Closes a tree of uls/lis (a menu for example) if scripts are enabled. Else leaves 1095 * the list open, so it is accessible to other users. 1096 * Note: this could be done in jQuery, but the list needs to close 1097 * as soon as it is loaded, so jQuery is not an option here. 1098 */ 1099function closeList(listId, sublevelsClassName, closeAtLevel) { 1100 var list = document.getElementById(listId); 1101 1102 for (i = closeAtLevel; i < 5; ++i) { 1103 var aUls = getElementsByClassName(sublevelsClassName+i, list); 1104 for (j = 0; j < aUls.length; ++j) { 1105 if (aUls[j].tagName == 'UL') { // only close ULs 1106 aUls[j].style.display = "none"; 1107 } 1108 } 1109 } 1110} 1111 1112/* 1113 * Closes any element by ID 1114 */ 1115function hideElementById(elId) { 1116 var el = document.getElementById(elId); 1117 el.style.display = "none"; 1118} 1119 1120 1121if (document.getElementsByTagName) { 1122 var inputElements = document.getElementsByTagName("input"); 1123 for (i=0; inputElements[i]; i++) { 1124 if (inputElements[i].className && (inputElements[i].className.indexOf("disableAutoComplete") != -1)) { 1125 inputElements[i].setAttribute("autocomplete","off"); 1126 } 1127 } 1128}
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.