1var prettyphoto_mobile = prettyphoto_mobile || '1'; 2var jaw_blog_order = jaw_blog_order || 'desc'; 3 4jQuery(document).ready(function($) { 5 var $doc = $(document); 6 7 8 /* Use this js doc for all application specific JS */ 9 10 /* TABS --------------------------------- */ 11 /* Remove if you don't need :) */ 12 13 $.fn.foundationTabs ? $doc.foundationTabs({callback: $.foundation.customForms.appendCustomMarkup}) : null; 14 15 16 17 18 /* ALERT BOXES ------------ */ 19 $(".alert-box").delegate("a.close", "click", function(event) { 20 event.preventDefault(); 21 $(this).closest(".alert-box").fadeOut(function(event) { 22 $(this).remove(); 23 }); 24 }); 25 26 /* PLACEHOLDER FOR FORMS ------------- */ 27 /* Remove this and jquery.placeholder.min.js if you don't need :) */ 28 $('input, textarea').placeholder(); 29 30 /* TOOLTIPS ------------ */ 31 $(this).tooltips(); 32 33 /* UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE6/7/8 SUPPORT AND ARE USING .block-grids */ 34 // $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'left'}); 35 // $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'left'}); 36 // $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'left'}); 37 // $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'left'}); 38 39 40 /* DROPDOWN NAV ------------- */ 41 42 var lockNavBar = false; 43 /* Windows Phone, sadly, does not register touch events :( */ 44 if (Modernizr.touch || navigator.userAgent.match(/Windows Phone/i)) { 45 $('.nav-bar a.flyout-toggle').on('click.fndtn touchstart.fndtn', function(e) { 46 e.preventDefault(); 47 var flyout = $(this).siblings('.flyout').first(); 48 if (lockNavBar === false) { 49 $('.nav-bar .flyout').not(flyout).slideUp(500); 50 flyout.slideToggle(500, function() { 51 lockNavBar = false; 52 }); 53 } 54 lockNavBar = true; 55 }); 56 $('.nav-bar>li.has-flyout').addClass('is-touch'); 57 } else { 58 $('.nav-bar>li.has-flyout').hover(function() { 59 $(this).children('.flyout').show(); 60 }, function() { 61 $(this).children('.flyout').hide(); 62 }); 63 } 64 65 /* DISABLED BUTTONS ------------- */ 66 /* Gives elements with a class of 'disabled' a return: false; */ 67 68 /* SPLIT BUTTONS/DROPDOWNS */ 69 $('.button.dropdown > ul').addClass('no-hover'); 70 71 $('.button.dropdown').on('click.fndtn touchstart.fndtn', function(e) { 72 e.stopPropagation(); 73 }); 74 $('.button.dropdown.split span').on('click.fndtn touchstart.fndtn', function(e) { 75 e.preventDefault(); 76 $('.button.dropdown').not($(this).parent()).children('ul').removeClass('show-dropdown'); 77 $(this).siblings('ul').toggleClass('show-dropdown'); 78 }); 79 $('.button.dropdown').not('.split').on('click.fndtn touchstart.fndtn', function(e) { 80 e.preventDefault(); 81 $('.button.dropdown').not(this).children('ul').removeClass('show-dropdown'); 82 $(this).children('ul').toggleClass('show-dropdown'); 83 }); 84 $('body, html').on('click.fndtn touchstart.fndtn', function() { 85 $('.button.dropdown ul').removeClass('show-dropdown'); 86 }); 87 88 // Positioning the Flyout List 89 var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)').outerHeight() - 1, 90 largeButtonHeight = $('.button.large.dropdown').outerHeight() - 1, 91 smallButtonHeight = $('.button.small.dropdown').outerHeight() - 1, 92 tinyButtonHeight = $('.button.tiny.dropdown').outerHeight() - 1; 93 94 $('.button.dropdown:not(.large):not(.small):not(.tiny) > ul').css('top', normalButtonHeight); 95 $('.button.dropdown.large > ul').css('top', largeButtonHeight); 96 $('.button.dropdown.small > ul').css('top', smallButtonHeight); 97 $('.button.dropdown.tiny > ul').css('top', tinyButtonHeight); 98 99 100 /* ISOTOPE*/ 101 102 103 104 105 var $container = $('#elements'); 106 107 if ($container.width() < 500) { 108 $colnum = 2; 109 } else { 110 $colnum = 3; 111 } 112 113 114 115 116 $container.isotope({ 117 itemSelector: '.element', 118 animationEngine: 'best-available', 119 resizable: true, 120 layoutMode: 'masonry' 121 122 });
123 124 125 jQuery(window).resize(function() { 126 /* Find out container size and do columns accordingly */ 127 if ($container.width() < 500) { 128 $colnum = 2; 129 } else { 130 $colnum = 2; 131 } 132 133 /* Resize Isotope Container */ 134 $container.isotope({ 135 // update columnWidth to a percentage of container width 136 itemSelector: '.element', 137 layoutMode: 'masonry' 138 139 }); 140 141 jQuery('.jaw-keep-ratio').find('.post.format-video').find('iframe').height(jQuery('.post.format-video').find('iframe').width() / 1.78); 142 jQuery('.jaw-keep-ratio').find('.video_frame').find('iframe').height(jQuery('.video_frame').find('iframe').width() / 1.78); 143 jQuery('.jaw-keep-ratio').find('.wp-video').height(jQuery('.wp-video').width() / 1.78); 144 145 }); 146 147 /* ShortCodes *************************************************************/ 148 149 // TopBar 150 $(document).foundationTopBar() 151 152 // ShortCode Accordion; 153 $(document).foundationAccordion(); 154 155 // ShortCode Toggle 156 $(document).toggleChange(); 157 158 // ShortCode Divider Back to Top 159 $('.divider_to_top').click(function() { 160 $('body,html').animate({ 161 scrollTop: 0 162 }, 300); 163 return false; 164 }); 165 166 /* ShortCodes *************************************************************/ 167 168 169 /* Menu ***************************************************************** */ 170 171 $('.top-bar-jw li.has-dropdown').hover(function() { 172 if ($(this).find('.menu-info').length > 0) { 173 var w = 0; 174 $(this).find('.sub-menu').find('li').each(function() { 175 if (w < parseInt($(this).outerWidth(true))) { 176 w = parseInt($(this).outerWidth(true)); 177 } 178 }); 179 $(this).find('.menu-box').css({width: $(this).find('.menu-info').outerWidth(true) + w + 1 + 'px'}); 180 } 181 182 if ($(this).position().left > 480) { 183 $(this).css({ 184 width: $(this).css('width') 185 }); 186 var liWidth = ($(this).outerWidth()); 187 var left = "-" + ($(this).find('.dropdown').outerWidth() + 1 - liWidth) + "px"; 188 $(this).find('.dropdown').css({ 189 left: left 190 }); 191 } 192 }, function() { 193 194 }); 195 196 /* Menu ***************************************************************** */ 197 198 199 200 201 //GALLERY**************************************************************** 202 $('#content').delegate('.orbit-wrapper', 'hover', function(e) { 203 204 if (e.type == 'mouseenter') 205 { 206 $(this).find('.right').stop().fadeIn(500); 207 $(this).find('.left').stop().fadeIn(500); 208 } else { 209 $(this).find('.right').stop().fadeOut(200); 210 $(this).find('.left').stop().fadeOut(200); 211 } 212 }); 213 214 215 216 //PORTFOLIO************************************************************** 217 $('.portfolio-item-image').hover(function() { 218 $(this).find('.image_overlay').stop(); 219 $(this).find('.image_overlay').animate({ 220 opacity: 0.8 221 }); 222 223 }, function() { 224 $(this).find('.image_overlay').stop(); 225 $(this).find('.image_overlay').animate({ 226 opacity: 0 227 }, 400); 228 229 }); 230 231 232 var sortAscending = false; 233 234 //ISOtope - filtrovánà portfolii------------------------------------------- 235 // initialize isotope 236 //$('#elements').isotope({ 237 // options... 238 // }); 239 240 // filter items when filter link is clicked 241 $('.blog-items-sortby-list a, .portfolio_categories_item a').click(function() { 242 var selector = $(this).attr('data-filter'); 243 if (jaw_blog_order == 'desc') { 244 sortAscending = true; 245 } else { 246 sortAscending = false; 247 } 248 $('#elements_iso').isotope({ 249 filter: selector, 250 sortAscending: sortAscending 251 }); 252 return false; 253 }); 254 255 //Filter categories 256 $('#js-filter-categories').change(function() { 257 var selector = $(this).find('option:selected').attr('data-filter'); 258 if (jaw_blog_order == 'desc') { 259 sortAscending = false; 260 } else { 261 sortAscending = true; 262 } 263 console.log(sortAscending); 264 $('#elements_iso').isotope({ 265 filter: selector, 266 sortAscending: sortAscending 267 }); 268 return false; 269 });
270 271 272 273 // Åazenà postů na hlavnà stranÄ ****************************************** 274 275 276 if (rtl == '1' || $.cookie("rtl_support") == '1') { 277 $.Isotope.prototype._positionAbs = function(x, y) { 278 return {right: x, top: y}; 279 }; 280 } 281 282 283 284 var $container = $('#elements_iso'); 285 286 var sortName = 'date'; 287 288 289 //Když je IE 8 nebo (RTL /$.cookie("rtl_support")- pro demo panel) 290 291 if ($.browser.msie == true && parseInt($.browser.version, 10) === 8 && $.cookie("rtl_support") != '1') { 292 var transformsEnabled = false; 293 var animationEngine = 'css'; 294 } else if (rtl == '1' || $.cookie("rtl_support") == '1') { 295 var transformsEnabled = false; 296 var animationEngine = 'best-available'; 297 } else { 298 var transformsEnabled = true; 299 var animationEngine = 'best-available'; 300 } 301 302 $container.isotope({ 303 animationEngine: animationEngine, 304 transformsEnabled: transformsEnabled, 305 itemSelector: '.element', 306 getSortData: { 307 name: function($elem) { 308 return $elem.attr('sort_name'); 309 }, 310 date: function($elem) { 311 return $elem.attr('sort_date'); 312 }, 313 rating: function($elem) { 314 return parseFloat($elem.attr('sort_rating')); 315 }, 316 popular: function($elem) { 317 return parseFloat($elem.attr('sort_popular')); 318 }, 319 price: function($elem) { 320 return parseFloat($elem.attr('sort_price')); 321 }, 322 sales: function($elem) { 323 return parseFloat($elem.attr('sort_sales')); 324 }, 325 category: function($elem) { 326 return $elem.attr('sort_category'); 327 }, 328 custom1: function($elem) { 329 return parseFloat($elem.attr('sort_custom1')); 330 }, 331 custom2: function($elem) { 332 return parseFloat($elem.attr('sort_custom2')); 333 } 334 } 335 }); 336 337 $('.blog-items-sortby-list a').click(function() { 338 339 sortName = $(this).attr('href').slice(1); 340 341 if (jaw_blog_order == 'desc') { 342 sortAscending = true; 343 } else { 344 sortAscending = false; 345 } 346 if (sortName != 'name' && sortName != 'price' && sortName != '') { 347 sortAscending = false; 348 } 349 350 $container.isotope({ 351 sortBy: sortName, 352 sortAscending: sortAscending 353 }); 354 355 356 return false; 357 }); 358 359 360 361 362 363 // ========= INFINITY LIST =========================================== 364 var count_page = 0; 365 var num_page_on_page = 2; // <<--- Nuber of ajax section on page 366 if (typeof infinite_scroll != 'undefined') { 367 368 369 370 $(infinite_scroll.contentSelector).infinitescroll(infinite_scroll, function(newElements) { 371 $container.isotope("appended", $(newElements)); //>>>>> Speed gallery slider (on the main page) for next pages in infinite list<<<<< 372 $(newElements).find("#featured_gellery").orbit({animation: 'fade', animationSpeed: 800, pauseOnHover: true, startClockOnMouseOut: true, 373 startClockOnMouseOutAfter: 100, directionalNav: true, fluid: true, timer: true, resetTimerOnClick: false, advanceSpeed: Math.round(Math.random() * 4000) + 1000}); 374 $('.morebutton').slideDown(); 375 if (type == 'ajax') { 376 count_page++; 377 if (count_page >= (num_page_on_page - 1)) { 378 $(infinite_scroll.contentSelector).infinitescroll({state: {isDone: true}}); 379 380 $("#infinite_load").append(window.next_page); 381 $("#infinite_load").append($('#post-nav-infinite .post-next-infinite').html()); 382 383 } 384 } 385 386 if (!(prettyphoto_mobile === '0' && jQuery(document).width() < 768)) { 387 jQuery(".gallery").find('a').attr('rel', 'prettyPhoto[gal1]'); 388 jQuery(".gallery_slider").find('a').attr('rel', 'prettyPhoto[gal1]'); 389 jQuery("a[rel^='prettyPhoto']").prettyPhoto({social_tools: false, default_width: 800, default_height: 500, show_title: false}); 390 391 } 392 if (prettyphoto_mobile === '0' && jQuery(document).width() < 768) { 393 jQuery('.element').each(function(key, element) { 394 var mobile_href = jQuery(element).find('.data-mobile-href').data('mobile-href'); 395 if (mobile_href != '') { 396 jQuery(element).find('.data-mobile-href').attr('href', mobile_href); 397 } 398 }); 399 } 400 401 }); 402 if (type == 'infinitemore') { 403 $('#post-nav-infinite').hide(); 404 $("#infinite_load").append(more); 405 $(infinite_scroll.contentSelector).infinitescroll('pause'); 406 407 $('.morebutton').click(function() { 408 $(infinite_scroll.contentSelector).infinitescroll('retrieve');
409 $('.morebutton').slideUp(); 410 }); 411 } else if (type == 'infinite') { 412 $('#post-nav-infinite').hide(); 413 } 414 415 } 416 417 /*************************************************************************** 418 * BANNERS - Skyscrapper 419 * ************************************************************************/ 420 $('.skyscrapper').css({ 421 top: $('#header').height() + "px" 422 }); 423 424 /*************************************************************************** 425 * TO TOP 426 ***************************************************************************/ 427 $(window).scroll(function() { 428 var offset = $(window).scrollTop(); 429 430 if (offset >= 50 && $(window).width() > 959) { 431 $('#totop').show(250); 432 } else { 433 $('#totop').hide(250); 434 } 435 436 if (offset > $('#header').height()) { 437 $("#skyscrapper-left").css({ 438 "top": offset + 3 + "px" 439 }); 440 $("#skyscrapper-right").css({ 441 "top": offset + 3 + "px" 442 }); 443 } else { 444 $("#skyscrapper-left").css({ 445 "top": $('#header').height() + 3 + "px" 446 }); 447 $("#skyscrapper-right").css({ 448 "top": $('#header').height() + 3 + "px" 449 }); 450 } 451 452 }); 453 454 $('#totop').hover(function() { 455 $(this).animate({'opacity': '1'}, 150); 456 }, function() { 457 $(this).animate({'opacity': '0.8'}, 150); 458 }); 459 460 $('#totop').click(function() { 461 $('html, body').animate({ 462 scrollTop: 0 463 }, 350); 464 }); 465 466 /*************************************************************************** 467 * SEARCH BOX 468 ***************************************************************************/ 469 $('#search_button').click(function() { 470 if ($(window).width() > 767) { 471 var parent = $(this).parent().find('#s'); 472 var right = parent.innerWidth(); 473 if (right > 1) { 474 parent.stop().animate({'width': "0px", "paddingLeft": "0px", "paddingRight": "0px", "marginRight": "-5px"}, 300, function() { 475 $('.blog-items-search').css({'width': '0px'}); 476 }); 477 } else { 478 parent.css({"marginRight": "6px"}); 479 parent.stop().animate({'width': "180px", "paddingLeft": "6px", "paddingRight": "6px"}, 250, function() { 480 $('.blog-items-search').css({'width': 'auto'}); 481 }); 482 parent.focus(); 483 } 484 } 485 }); 486 /**************************************************************************** 487 * END SEARCH BOX 488 ***************************************************************************/ 489 490 /**************************************************************************** 491 * CAPTION FADE EFFECT 492 * *************************************************************************/ 493 $('#elements_iso').delegate('.box', 'hover', function(e) { 494 if (e.type == 'mouseenter') 495 { 496 $(this).find('.caption_fadeeffect').stop().fadeIn(500); 497 } 498 else 499 { 500 $(this).find('.caption_fadeeffect').stop().fadeOut(200); 501 } 502 }); 503 /* CAPTION FADE EFFECT *****************************************************/ 504 505 /* SELECT BOX MENU */ 506 $(".mobile-selectbox").change( 507 function() { 508 window.location = $(this).find("option:selected").val(); 509 } 510 ); 511 512 /* FIX BACKGROUND SIZE ****************************************************/ 513 $(window).resize(function() { 514 var w = $(window).width(); 515 $('.template-back-image img').css({width: w + "px"}); 516 }); 517 518 /* ADD LAST CHILD CLASS IF IE 8 *******************************************/ 519 if ($("html").hasClass("ie8")) { 520 $('*:last-child').addClass('last-child'); 521 $('#sidebar #searchform #searchsubmit').val(' '); 522 } 523 524 /* PLACE HOLDER FOR TEXTAREA **********************************************/ 525 var standard_message = $('textarea').val(); 526 $('textarea').focus( 527 function() { 528 if ($(this).val() == standard_message) 529 $(this).val(""); 530 } 531 ); 532 $('textarea').blur( 533 function() { 534 if ($(this).val() == "") 535 $(this).val(standard_message); 536 } 537 ); 538 539 /* ACTIVE CONTACT FORM BUTTON */ 540 $(".contact_submit, .user-submit").hover(function() { 541 $(this).parent().parent().addClass('active'); 542 }, function() { 543 $(this).parent().parent().removeClass('active'); 544 });
545 $('#commentform .form-submit #submit').hover(function() { 546 $(this).parent().addClass('active'); 547 }, function() { 548 $(this).parent().removeClass('active'); 549 }); 550 $('#commentform .form-submit').append('<div class="contact_form_arrow"></div>'); 551 552 553 554 /* CONTACT FORM SUBMIT ****************************************************/ 555 $('.jw_contact_form').submit(function() { 556 name = $(this).find('.jw_contact_name').val(); 557 email = $(this).find('.jw_contact_email').val(); 558 mess = $(this).find('.jw_contact_message').val(); 559 mess = $(this).find('.jw_contact_message').val(); 560 answer = $(this).find('.jw_contact_capcha_answer').val(); 561 562 error = ''; 563 564 if (name.length <= 0) { 565 $(this).find('.jw_contact_name').addClass('required'); 566 error += '<li>' + $(this).find('.short_contact_error_name').val() + '</li>'; 567 } else { 568 $(this).find('.jw_contact_name').removeClass('required'); 569 } 570 571 if (email.length <= 0 || validateEmail(email) == false) { 572 $(this).find('.jw_contact_email').addClass('required'); 573 error += '<li>' + $(this).find('.short_contact_error_email').val() + '</li>'; 574 } else { 575 $(this).find('.jw_contact_email').removeClass('required'); 576 } 577 578 if (mess.length <= 0 || mess === 'Message') { 579 $(this).find('.jw_contact_message').addClass('required'); 580 error += '<li>' + $(this).find('.short_contact_error_message').val() + '</li>'; 581 } else { 582 $(this).find('.jw_contact_message').removeClass('required'); 583 } 584 585 if (answer.length <= 0) { 586 $(this).find('.jw_contact_capcha_answer').addClass('required'); 587 error += '<li>' + $(this).find('.short_contact_error_capcha').val() + '</li>'; 588 } else { 589 $(this).find('.jw_contact_capcha_answer').removeClass('required'); 590 } 591 592 if (error.length > 0) { 593 $(this).find('.jw_contact_error').empty(); 594 $(this).find('.jw_contact_error').append('<ol>' + error + '</ol>'); 595 $(this).find('.jw_contact_error').addClass('active_log'); 596 } else { 597 return true; 598 } 599 return false; 600 }); 601 602 /* SLIDER *****************************************************************/ 603 $slider = $('#slider_home'); 604 $arrowTop = $slider.find('.arrow_top'); 605 $arrowBottom = $slider.find('.arrow_bottom'); 606 $sliderArea = $slider.find('.slider_area'); 607 $sliderList = $sliderArea.find('.slider_list'); 608 $sliderSpeed = parseInt($sliderArea.attr('speed')); 609 if (isNaN($sliderSpeed)) { 610 $sliderSpeed = 3500; 611 } 612 $navigationArea = $slider.find('.navigation_area'); 613 $navigationList = $navigationArea.find('.slides_list'); 614 var refreshId = setInterval(moveSlide, $sliderSpeed); 615 616 617 618 /* Kontrola jestli jsem na Ipadu/iPhonu - nezastavuj na hover 619 * var device = navigator.userAgent.toLowerCase(); 620 var ios = device.match(/(iphone|ipod|ipad)/); 621 */ 622 623 624 $slider.hover(function() { 625 clearInterval(refreshId); 626 }, function() { 627 refreshId = setInterval(moveSlide, $sliderSpeed); 628 }); 629 630 631 function moveSlide() { 632 if ($('#slider_home').attr('class') == "up") { 633 moveSliderUp(); 634 moveNavigationDown(); 635 } else { 636 moveSliderDown(); 637 moveNavigationUp(); 638 } 639 640 } 641 642 $arrowTop.click(function() { 643 if ($slider.data('data-animating') == 'true') { 644 return; 645 } 646 $slider.data('data-animating', 'true'); 647 moveSliderUp(); 648 moveNavigationDown(); 649 }); 650 651 $arrowBottom.click(function() { 652 if ($slider.data('data-animating') == 'true') { 653 return; 654 } 655 $slider.data('data-animating', 'true'); 656 moveSliderDown(); 657 moveNavigationUp(); 658 }) 659 660 661 662 var moveSliderUp = function() { 663 var step = $sliderList.children('li').outerHeight(); 664 665 $sliderList.animate({ 666 marginTop: -step 667 }, 700, function() { 668 $firstSlide = $sliderList.find('li').eq(0); 669 $firstSlideClone = $firstSlide.clone(); 670 $sliderList.append($firstSlideClone); 671 672 $firstSlide.remove(); 673 $sliderList.css('margin-top', 0); 674 $slider.data('data-animating', 'false'); 675 }); 676 677 }; 678 679 var moveSliderDown = function() { 680 var step = $sliderList.children('li').outerHeight(); 681 $firstSlide = $sliderList.find('li').last(); 682 $firstSlideClone = $firstSlide.clone(); 683 $sliderList.prepend($firstSlideClone); 684 685 $firstSlide.remove(); 686 $sliderList.css('margin-top', -step); 687 688 $sliderList.animate({ 689 marginTop: 0 690 }, 700, function() { 691 $slider.data('data-animating', 'false'); 692 }); 693 }; 694 695 var moveNavigationUp = function() { 696 var step = $navigationList.children('li').outerHeight(); 697 698 $navigationList.animate({ 699 marginTop: -step 700 }, 700, function() { 701 $firstSlide = $navigationList.find('li').first(); 702 $firstSlideClone = $firstSlide.clone(); 703 $navigationList.append($firstSlideClone); 704 705 $firstSlide.remove(); 706 $navigationList.css('margin-top', 0); 707 }); 708 709 }; 710 711 var moveNavigationDown = function() { 712 var step = $navigationList.children('li').outerHeight(); 713 $firstSlide = $navigationList.find('li').last(); 714 $firstSlideClone = $firstSlide.clone(); 715 $navigationList.prepend($firstSlideClone); 716 717 $firstSlide.remove(); 718 $navigationList.css('margin-top', -step); 719 720 $navigationList.animate({ 721 marginTop: 0 722 }, 700, function() { 723 724 }); 725 }; 726 727 728 function validateEmail($email) { 729 var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; 730 if (!emailReg.test($email)) { 731 return false; 732 } else { 733 return true; 734 } 735 } 736 737 738 /* STARS RATING *******************************************************/ 739 $('.ratig-background-stars').mousemove(function(e) { 740 $jw_rating_id = $(this).find(".jw_rating_id").val(); 741 $jw_rating_post_id = $(this).find(".jw_rating_post_id").val(); 742 cookieName = "jw_user_rating_" + $jw_rating_post_id + "_" + $jw_rating_id; 743 744 if ($.cookie(cookieName) == 1) { 745 $(this).find(".rating-top-stars").removeClass("user_editable"); 746 } 747 748 if ($(this).find('.rating-top-stars').hasClass("user_editable")) { 749 750 $('.jw-rating-userrating-name').text($('.jw-rating-userrating-name').attr('data-rel') + ':'); 751 752 userRating = (e.pageX - $(this).offset().left); 753 754 if ($('body').hasClass('rtl')) 755 userRating = -(e.pageX - $(this).offset().left - $(this).width()); 756 757 if (userRating > 100) { 758 userRating = 100; 759 } 760 761 762 //$('#rating-top-stars').css({width:Math.round(userRating)+"px"}); 763 switch (true) { 764 case (userRating < 9): 765 $(this).find('.rating-top-stars').css({width: "0px"}); 766 $('.jw-rating-userrating-score').text(0); 767 $(this).find('.jw_rating_user_value').val(0); 768 break; 769 case (userRating >= 9 && userRating < 20): 770 $(this).find('.rating-top-stars').css({width: "9px"}); 771 $('.jw-rating-userrating-score').text(0.5); 772 $(this).find('.jw_rating_user_value').val(0.1); 773 break; 774 case (userRating >= 20 && userRating < 29): 775 $(this).find('.rating-top-stars').css({width: "20p
775x"}); 776 $('.jw-rating-userrating-score').text(1); 777 $(this).find('.jw_rating_user_value').val(0.2); 778 break; 779 case (userRating >= 29 && userRating < 40): 780 $(this).find('.rating-top-stars').css({width: "29px"}); 781 $('.jw-rating-userrating-score').text(1.5); 782 $(this).find('.jw_rating_user_value').val(0.3); 783 break; 784 case (userRating >= 40 && userRating < 49): 785 $(this).find('.rating-top-stars').css({width: "40px"}); 786 $('.jw-rating-userrating-score').text(2); 787 $(this).find('.jw_rating_user_value').val(0.4); 788 break; 789 case (userRating >= 49 && userRating < 60): 790 $(this).find('.rating-top-stars').css({width: "49px"}); 791 $('.jw-rating-userrating-score').text(2.5); 792 $(this).find('.jw_rating_user_value').val(0.5); 793 break; 794 case (userRating >= 60 && userRating < 69): 795 $(this).find('.rating-top-stars').css({width: "60px"}); 796 $('.jw-rating-userrating-score').text(3); 797 $(this).find('.jw_rating_user_value').val(0.6); 798 break; 799 case (userRating >= 69 && userRating < 80): 800 $(this).find('.rating-top-stars').css({width: "69px"}); 801 $('.jw-rating-userrating-score').text(3.5); 802 $(this).find('.jw_rating_user_value').val(0.7); 803 break; 804 case (userRating >= 80 && userRating < 89): 805 $(this).find('.rating-top-stars').css({width: "80px"}); 806 $('.jw-rating-userrating-score').text(4); 807 $(this).find('.jw_rating_user_value').val(0.8); 808 break; 809 case (userRating >= 89 && userRating < 100): 810 $(this).find('.rating-top-stars').css({width: "89px"}); 811 $('.jw-rating-userrating-score').text(4.5); 812 $(this).find('.jw_rating_user_value').val(0.9); 813 break; 814 case (userRating >= 100): 815 $(this).find('.rating-top-stars').css({width: "100px"}); 816 $('.jw-rating-userrating-score').text(5); 817 $(this).find('.jw_rating_user_value').val(1); 818 break; 819 } 820 } 821 }); 822 823 $('.jw-rating-area-percent-user-rating').find('.ratig-background-stars').mouseleave(function() { 824 ratingScore = Math.round($(this).find(".jw_rating_value").val() * 100); 825 $(this).find('.rating-top-stars').css({width: ratingScore + "px"}); 826 $('.jw-rating-userrating-name').text($(this).find(".jw_rating_name").val() + ":"); 827 828 if ($(this).find('.rating-top-stars').hasClass("user_editable")) { 829 $('.jw-rating-userrating-score').text((Math.round(ratingScore) / 100 * 5).toFixed(1)); 830 } 831 }); 832 833 $('.ratig-background-stars').click(function() { 834 var ratingBg = $(this); 835 jw_rating_id = ratingBg.find(".jw_rating_id").val(); 836 jw_rating_post_id = ratingBg.find(".jw_rating_post_id").val(); 837 var cookieName = "jw_user_rating_" + jw_rating_post_id + "_" + jw_rating_id; 838 if (ratingBg.find('.rating-top-stars').hasClass("user_editable")) { 839 var data = { 840 postId: ratingBg.find(".jw_rating_post_id").val(), 841 ratingId: ratingBg.find(".jw_rating_id").val(), 842 score: ratingBg.find(".jw_rating_user_value").val() 843 } 844 $.post( 845 site_url + '/wp-admin/admin-ajax.php', 846 { 847 'action': 'jwrating_vote', // nebo jwrating_get 848 'data': data 849 }, 850 function(response) { 851 var resp = jQuery.parseJSON(response); 852 ratingBg.find(".jw_rating_value").val(resp.score); 853 var label = $('.jw-rating-userrating-votes').attr('data-rel'); 854 $('.jw-rating-userrating-votes').text("(" + resp.voted + ": " + label + ")"); 855 $('.jw-rating-userrating-score').text(Math.round((resp.score * 100) / 2) / 10); 856 857 ratingBg.find('.rating-top-stars').css({width: Math.round(resp.score * 100) + "px"}); 858 ratingBg.find('.rating-top-stars').removeClass('user_editable'); 859 $.cookie(cookieName, 1, { 860 expires: 1, 861 path: '/' 862 }); 863 }); 864 } 865 });
866 /* END STARS RATING ***************************************************/ 867 868 /* PERCENT RATING *****************************************************/ 869 $('.ratig-background-percent').mousemove(function(e) { 870 jw_rating_id = $(this).find(".jw_rating_id").val(); 871 jw_rating_post_id = $(this).find(".jw_rating_post_id").val(); 872 cookieName = "jw_user_rating_" + jw_rating_post_id + "_" + jw_rating_id; 873 874 if ($.cookie(cookieName) == 1) { 875 $(this).find(".rating-top-percent").removeClass("user_editable"); 876 } 877 878 if ($(this).find('.rating-top-percent').hasClass("user_editable")) { 879 880 $('.jw-rating-userrating-name').text($('.jw-rating-userrating-name').attr('data-rel') + ':'); 881 882 userRating = e.pageX - $(this).offset().left; 883 if (userRating > 99.5) { 884 userRating = 100; 885 } else if (userRating < 1) { 886 userRating = 0; 887 } 888 889 $(this).find('.rating-top-percent').css({width: Math.round(userRating) + "px"}); 890 $(this).find('.rating-top-percent-value').text(Math.round(userRating) + " %"); 891 $('.jw-rating-userrating-score').text(Math.round(userRating) + " %"); 892 } 893 }); 894 895 $('.jw-rating-area-percent-user-rating').find('.ratig-background-percent').mouseleave(function() { 896 ratingScore = Math.round($(this).find(".jw_rating_value").val() * 100); 897 //alert(ratingScore); 898 $(this).find('.rating-top-percent').css({width: ratingScore + "px"}); 899 $('.jw-rating-userrating-name').text($(this).find(".jw_rating_name").val() + ":"); 900 901 if ($(this).find('.rating-top-percent').hasClass("user_editable")) { 902 $('.rating-top-percent-user-value, .jw-rating-userrating-score').text(ratingScore + " %"); 903 } 904 }); 905 906 $('.ratig-background-percent').click(function() { 907 908 var ratingBg = $(this); 909 jw_rating_id = ratingBg.find(".jw_rating_id").val(); 910 jw_rating_post_id = ratingBg.find(".jw_rating_post_id").val(); 911 var cookieName = "jw_user_rating_" + jw_rating_post_id + "_" + jw_rating_id; 912 913 if (ratingBg.find('.rating-top-percent').hasClass("user_editable")) { 914 var data = { 915 postId: ratingBg.find(".jw_rating_post_id").val(), 916 ratingId: ratingBg.find(".jw_rating_id").val(), 917 score: (userRating / 100) 918 } 919 $.post( 920 site_url + '/wp-admin/admin-ajax.php', 921 { 922 'action': 'jwrating_vote', // nebo jwrating_get 923 'data': data 924 }, 925 function(response) { 926 var resp = jQuery.parseJSON(response); 927 ratingBg.find(".jw_rating_value").val(resp.score); 928 $('.rating-top-percent-user-value, .jw-rating-userrating-score').text(Math.round(Math.round(resp.score * 100)) + " %"); 929 var label = $('.jw-rating-userrating-votes').attr('data-rel'); 930 $('.jw-rating-userrating-votes').text("(" + resp.voted + ": " + label + ")"); 931 932 ratingBg.find('.rating-top-percent').css({width: Math.round(resp.score * 100) + "px"}); 933 ratingBg.find('.rating-top-percent').removeClass('user_editable'); 934 $.cookie(cookieName, 1, { 935 expires: 1, 936 path: '/' 937 }); 938 }); 939 } 940 }); 941 /* END PERCENT RATING *************************************************/ 942 943 944 945 946 947 var jaw_dropdown = document.getElementById("cat"); 948 949 function onCatChange() { 950 if (jaw_dropdown.options[jaw_dropdown.selectedIndex].value > 0) { 951 /// LOCATION dodelat!!, 952 //alert(site_url); 953 954 location.href = site_url + "/?cat=" + jaw_dropdown.options[jaw_dropdown.selectedIndex].value; 955 } 956 } 957 if (document.getElementById("cat") !== null && jaw_dropdown.length > 0) { 958 jaw_dropdown.onchange = onCatChange; 959 } 960 961 962 963 jQuery('.jaw-keep-ratio').find('.post.format-video').find('iframe').height(jQuery('.post.format-video').find('iframe').width() / 1.78); 964 jQuery('.jaw-keep-ratio').find('.video_frame').find('iframe').height(jQuery('.video_frame').find('iframe').width() / 1.78); 965 jQuery('.jaw-keep-ratio').find('.wp-video').height(jQuery('.wp-video').width() / 1.78); 966 967 if (prettyphoto_mobile === '0' && jQuery(document).width() < 768) { 968 jQuery('.element').each(function(key, element) { 969 var mobile_href = jQuery(element).find('.data-mobile-href').data('mobile-href'); 970 if (mobile_href != '') { 971 jQuery(element).find('.data-mobile-href').attr('href', mobile_href); 972 } 973 }); 974 } 975});
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.