1(function( $ ) { 2 'use strict'; 3 4 /** 5 * All of the code for your public-facing JavaScript source 6 * should reside in this file. 7 * 8 * Note: It has been assumed you will write jQuery code here, so the 9 * $ function reference has been prepared for usage within the scope 10 * of this function. 11 * 12 * This enables you to define handlers, for when the DOM is ready: 13 * 14 * $(function() { 15 * 16 * }); 17 * 18 * When the window is loaded: 19 * 20 * $( window ).load(function() { 21 * 22 * }); 23 * 24 * ...and/or other possibilities. 25 * 26 * Ideally, it is not considered best practise to attach more than a 27 * single DOM-ready or window-load handler for a particular page. 28 * Although scripts in the WordPress core, Plugins and Themes may be 29 * practising this, we should strive to set a better example in our own work. 30 */ 31 //document ready 32 $(function(){ 33 34 35 //only show one review per a slide on mobile 36 //get the attribute if it is set and this is in fact a slider 37 $(".wprev-slider").each(function(){ 38 var oneonmobile = $(this).attr( "data-onemobil" ); 39 if(oneonmobile=='yes'){ 40 if (/Mobi|Android/i.test(navigator.userAgent) || $(window).width()<600) { 41 /* this is a mobile device, continue */ 42 //get all the slider li elements, each li is a slide 43 var li_elements_old = $(this).children('ul'); 44 console.log(li_elements_old); 45 if(li_elements_old.length>0){ 46 //get array of all the divs containing the individual slide 47 var divrevs = li_elements_old.find('.w3_wprs-col'); 48 var divrevarray = divrevs.get(); 49 //get the classes of the 2 divs under the li 50 var div1class = divrevs.parent().attr('class'); 51 var div2class = divrevs.attr('class'); 52 console.log("div2class: "+div2class); 53 //only continue if finding the divs 54 if(typeof div2class !== "undefined"){ 55 //remove the l2, l3, l4, l5 , l6 56 div2class = div2class.replace(/[a-z]\d\b/g, 'l12'); 57 //use the divrevarray to make new li elements with one review in each 58 var newulhtml = ''; 59 var i; 60 for (i = 0; i < divrevarray.length; i++) { 61 if(i==0){ 62 newulhtml += '<li class="wprs_unslider-active"><div class="'+div1class+'"><div class="'+div2class+'">'+divrevarray[i].innerHTML + '</div></div></li>'; 63 } else { 64 newulhtml += '<li><div class="'+div1class+'"><div class="'+div2class+'">'+divrevarray[i].innerHTML + '</div></div></li>'; 65 } 66 } 67 //add the load more button if found 68 if($(this).find('.wprevpro_load_more_div')[0]!== undefined){ 69 newulhtml += '<li>'+$(this).find('.wprevpro_load_more_div')[0].outerHTML+'</li>'; 70 } 71 newulhtml +=''; 72 //replace the old li with the new 73 li_elements_old.html(newulhtml); 74 //re-initialize the slider if we need to 75 } 76 } 77 } 78 } 79 }); 80 //} 81 //---------------------- 82 83 84 $( ".wprs_rd_more" ).click(function() { 85 $(this ).hide(); 86 $(this ).next("span").show(0, function() { 87 // Animation complete. 88 $(this ).css('opacity', '1.0'); 89 }); 90 //$(this ).next("span").css('opacity', '1.0'); 91 92 //change height of wprev-slider-widget 93 $(this ).closest( ".wprev-slider-widget" ).css( "height", "auto" ); 94 95 //change height of wprev-slider 96 $(this ).closest( ".wprev-slider" ).css( "height", "auto" ); 97 98 }); 99 100 101 //check to see if we need to create slider; 102 $( ".wprev-slider" ).each(function( index ) { 103 createaslider(this,'shortcode'); 104 }); 105 $( ".wprev-slider-widget" ).each(function( index ) { 106 createaslider(this,'widget'); 107 }); 108 function createaslider(thissliderdiv,type){ 109 110 var sliderhideprevnext = $(thissliderdiv).attr( "data-sliderhideprevnext" ); 111 var sliderhidedots = $(thissliderdiv).attr( "data-sliderhidedots" ); 112 var sliderautoplay = $(thissliderdiv).attr( "data-sliderautoplay" ); 113 var slidespeed = $(thissliderdiv).attr( "data-slidespeed" ); 114 var slideautodelay = $(thissliderdiv).attr( "data-slideautodelay" ); 115 var sliderfixedheight = $(thissliderdiv).attr( "data-sliderfixedheight" );
116 var revsameheight = $(thissliderdiv).attr( "data-revsameheight" ); 117 118 var showarrows = true; 119 if(sliderhideprevnext=="yes"){ 120 var showarrows = false; 121 } 122 var shownav = true; 123 if(sliderhidedots=="yes"){ 124 var shownav = false; 125 } 126 var sautoplay = false; 127 if(sliderautoplay=="yes"){ 128 var sautoplay = true; 129 } 130 var sspeed = parseFloat(slidespeed) * 1000; 131 var sdelay = parseFloat(slideautodelay) * 1000; 132 if(sdelay<sspeed){ 133 sdelay = sspeed; 134 } 135 var sanimate = true; 136 if(sliderfixedheight=="yes"){ 137 sanimate = false; 138 } 139 //unhide other rows. 140 $( thissliderdiv ).find('li').show(); 141 $( thissliderdiv ).wprs_unslider( 142 { 143 autoplay:false, 144 infinite:false, 145 delay: '3000', 146 speed: '750', 147 animation: 'horizontal', 148 arrows: showarrows, 149 animateHeight: true, 150 activeClass: 'wprs_unslider-active', 151 } 152 ); 153 154 setTimeout(function(){ 155 //height of active slide 156 var firstheight = $(thissliderdiv).find('.wprs_unslider-active').height(); 157 $(thissliderdiv).css( 'height', firstheight ); 158 $(thissliderdiv).find("li.wprevnextslide").removeClass('wprevnextslide'); 159 }, 500); 160 161 if(sautoplay==true){ 162 slider.on('mouseover', function() {slider.data('wprs_unslider').stop();}).on('mouseout', function() {slider.data('wprs_unslider').start();}); 163 } 164 165 //force height if set 166 if(revsameheight=='yes'){ 167 var maxheights = $(thissliderdiv).find(".indrevdiv").map(function (){return $(this).outerHeight();}).get(); 168 var maxHeightofslide = Math.max.apply(null, maxheights);if(maxHeightofslide>0){$(thissliderdiv).find(".indrevdiv").css( "min-height", maxHeightofslide );} 169 } 170 171 }; 172 173 //simple tooltip for added elements and mobile devices 174 $(".wprevpro_t1_outer_div").on('mouseenter touchstart', '.wprevtooltip', function(e) { 175 var titleText = $(this).attr('data-wprevtooltip'); 176 $(this).data('tiptext', titleText).removeAttr('data-wprevtooltip'); 177 $('<p class="wprevpro_tooltip"></p>').text(titleText).appendTo('body').css('top', (e.pageY - 15) + 'px').css('left', (e.pageX + 10) + 'px').fadeIn('slow'); 178 }); 179 $(".wprevpro_t1_outer_div").on('mouseleave touchend', '.wprevtooltip', function(e) { 180 $(this).attr('data-wprevtooltip', $(this).data('tiptext')); 181 $('.wprevpro_tooltip').remove(); 182 }); 183 $(".wprevpro_t1_outer_div").on('mousemove', '.wprevtooltip', function(e) { 184 $('.wprevpro_tooltip').css('top', (e.pageY - 15) + 'px').css('left', (e.pageX + 10) + 'px'); 185 }); 186 187 }); 188 189})( jQuery );
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.