1/** 2 * Reviews JS 3 */ 4if (typeof (jQuery) != 'undefined') { 5 6 (function ($) { 7 "use strict"; 8 9 $(function () { 10 11 12 var LSOW_Frontend = { 13 14 init: function () { 15 this.output_custom_css(); 16 this.carousel(); 17 this.setup_parallax(); 18 this.setup_ytp(); 19 this.setup_animations(); 20 }, 21 22 setup_animations: function () { 23 24 /* Hide the elements if required to prepare for animation */ 25 $(".lsow-visible-on-scroll:not(.animated)").css('opacity', 0); 26 27 "function" != typeof window.lsow_animate_widgets && (window.lsow_animate_widgets = function () { 28 "undefined" != typeof $.fn.livemeshWaypoint && $(".lsow-animate-on-scroll:not(.animated)").livemeshWaypoint(function () { 29 var animateClass = $(this.element).data("animation"); 30 $(this.element).addClass("animated " + animateClass).css('opacity', 1); 31 }, { 32 offset: "85%" 33 }) 34 }); 35 36 window.setTimeout(lsow_animate_widgets, 500) 37 }, 38 39 output_custom_css: function () { 40 41 var custom_css = lsow_settings['custom_css']; 42 if (custom_css !== undefined && custom_css != '') { 43 custom_css = '<style type="text/css">' + custom_css + '</style>'; 44 $('head').append(custom_css); 45 } 46 }, 47 48 isMobile: function () { 49 "use strict"; 50 if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 51 return true; 52 } 53 return false; 54 }, 55 56 vendor_prefix: function () { 57 58 var prefix; 59 60 function prefix() { 61 var styles = window.getComputedStyle(document.documentElement, ''); 62 prefix = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || (styles.OLink === '' && ['', 'o']))[1]; 63 64 return prefix; 65 } 66 67 prefix(); 68 69 return prefix; 70 }, 71 72 carousel: function () { 73 74 if ($().slick === undefined) { 75 return; 76 } 77 78 var carousel_elements = $('.lsow-carousel, .lsow-posts-carousel,.lsow-gallery-carousel'); 79 80 carousel_elements.each(function () { 81 82 var carousel_elem = $(this); 83 84 var rtl = carousel_elem.attr( 'dir' ) === 'rtl'; 85 86 var settings = carousel_elem.data('settings'); 87 88 var arrows = settings['arrows']; 89 90 var dots = settings['dots']; 91 92 var autoplay = settings['autoplay']; 93 94 var adaptive_height = settings['adaptive_height']; 95 96 var autoplay_speed = parseInt(settings['autoplay_speed']) || 3000; 97 98 var animation_speed = parseInt(settings['animation_speed']) || 300; 99 100 var fade = ( 'fade' in settings && ( settings['fade'] === true ) ); 101 102 var vertical = ( 'vertical' in settings && ( settings['vertical'] === true ) ); 103 104 var pause_on_hover = settings['pause_on_hover']; 105 106 var pause_on_focus = ( 'pause_on_focus' in settings && ( settings['pause_on_focus'] == true ) ); 107 108 var display_columns = parseInt(settings['display_columns']) || 4; 109 110 var scroll_columns = parseInt(settings['scroll_columns']) || 4; 111 112 var tablet_width = parseInt(settings['tablet_width']) || 800; 113 114 var tablet_display_columns = parseInt(settings['tablet_display_columns']) || 2; 115 116 var tablet_scroll_columns = parseInt(settings['tablet_scroll_columns']) || 2; 117 118 var mobile_width = parseInt(settings['mobile_width']) || 480; 119 120 var mobile_display_columns = parseInt(settings['mobile_display_columns']) || 1; 121 122 var mobile_scroll_columns = parseInt(settings['mobile_scroll_columns']) || 1; 123 124 carousel_elem.slick({ 125 arrows: arrows, 126 dots: dots, 127 infinite: true, 128 autoplay: autoplay,
129 autoplaySpeed: autoplay_speed, 130 speed: animation_speed, 131 fade: false, 132 vertical: vertical, 133 pauseOnHover: pause_on_hover, 134 pauseOnFocus: pause_on_focus, 135 adaptiveHeight: adaptive_height, 136 slidesToShow: display_columns, 137 slidesToScroll: scroll_columns, 138 rtl: rtl, 139 responsive: [ 140 { 141 breakpoint: tablet_width, 142 settings: { 143 slidesToShow: tablet_display_columns, 144 slidesToScroll: tablet_scroll_columns 145 } 146 }, 147 { 148 breakpoint: mobile_width, 149 settings: { 150 slidesToShow: mobile_display_columns, 151 slidesToScroll: mobile_scroll_columns 152 } 153 } 154 ] 155 }); 156 }); 157 }, 158 159 setup_parallax: function () { 160 161 var scroll = window.requestAnimationFrame || 162 window.webkitRequestAnimationFrame || 163 window.mozRequestAnimationFrame || 164 window.msRequestAnimationFrame || 165 window.oRequestAnimationFrame || 166 function (callback) { 167 window.setTimeout(callback, 1000 / 600); 168 }; 169 170 function init_parallax() { 171 172 if (LSOW_Frontend.isMobile() === false) { 173 var windowHeight = $(window).height(); 174 $('.lsow-section-bg-parallax').each(function () { 175 var segment = $(this); 176 var elementHeight = segment.outerHeight(true); 177 178 /* Apply transform only when the element is in the viewport */ 179 var boundingRect = segment[0].getBoundingClientRect(); 180 if (boundingRect.bottom >= 0 && boundingRect.top <= windowHeight) { 181 var distanceToCover = windowHeight + elementHeight; 182 var pixelsMoved = windowHeight - boundingRect.top; 183 var toTransform = 50; // only 50% of the image height is available for transforming 184 var transformPercent = toTransform * Math.abs(pixelsMoved / distanceToCover); 185 transformPercent = -transformPercent.toFixed(2); // not more than 2 decimal places for performance reasons 186 187 segment.find('.lsow-parallax-bg').css('-' + LSOW_Frontend.vendor_prefix() + '-transform', 'translate3d(0px, ' + transformPercent + '%, 0px)'); 188 } 189 }); 190 } 191 192 } 193 194 if (this.isMobile() === false) { 195 196 // Call once to initialize parallax and then call on each scroll 197 scroll(init_parallax); 198 $(window).on('scroll', function () { 199 scroll(init_parallax); 200 }); 201 } 202 203 }, 204 205 setup_ytp: function () { 206 207 // Do not initialize YouTube backgrounds in mobile devices 208 if (this.isMobile() || $().youtube_background === undefined) { 209 return; 210 } 211 212 jQuery('[data-vbg]').youtube_background(); 213 214 }, 215 } 216 217 LSOW_Frontend.init(); 218 219 }); 220 221 }(jQuery)); 222 223}
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.