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 $( ".wprs_rd_more" ).click(function() { 35 $(this ).hide(); 36 $(this ).next("span").show(0, function() { 37 // Animation complete. 38 $(this ).css('opacity', '1.0'); 39 }); 40 //$(this ).next("span").css('opacity', '1.0'); 41 42 //change height of wprev-slider-widget 43 $(this ).closest( ".wprev-slider-widget" ).css( "height", "auto" ); 44 45 //change height of wprev-slider 46 $(this ).closest( ".wprev-slider" ).css( "height", "auto" ); 47 48 49 }); 50 51 //check to see if we need to create slider; 52 $( ".wprev-slider" ).each(function( index ) { 53 createaslider(this,'shortcode'); 54 }); 55 $( ".wprev-slider-widget" ).each(function( index ) { 56 createaslider(this,'widget'); 57 }); 58 function createaslider(thissliderdiv,type){ 59 //unhide other rows. 60 var showarrows = true; 61 if(type=='widget'){ 62 showarrows = false; 63 } 64 $( thissliderdiv ).find('li').show(); 65 var slider = $( thissliderdiv ).wprs_unslider( 66 { 67 autoplay:false, 68 infinite:false, 69 delay: '5000', 70 speed: '750', 71 animation: 'horizontal', 72 arrows: showarrows, 73 animateHeight: true, 74 activeClass: 'wprs_unslider-active', 75 } 76 ); 77 78 setTimeout(function(){ 79 //height of active slide 80 var firstheight = $(thissliderdiv).find('.wprs_unslider-active').height(); 81 $(thissliderdiv).css( 'height', firstheight ); 82 }, 500); 83 84 //slider.on('mouseover', function() {slider.data('wprs_unslider').stop();}).on('mouseout', function() {slider.data('wprs_unslider').start();}); 85 86 }; 87 88 //simple tooltip for added elements and mobile devices 89 $(".wptripadvisor_t1_outer_div").on('mouseenter touchstart', '.wprevtooltip', function(e) { 90 var titleText = $(this).attr('data-wprevtooltip'); 91 $(this).data('tiptext', titleText).removeAttr('data-wprevtooltip'); 92 $('<p class="wprevpro_tooltip"></p>').text(titleText).appendTo('body').css('top', (e.pageY - 15) + 'px').css('left', (e.pageX + 10) + 'px').fadeIn('slow'); 93 }); 94 $(".wptripadvisor_t1_outer_div").on('mouseleave touchend', '.wprevtooltip', function(e) { 95 $(this).attr('data-wprevtooltip', $(this).data('tiptext')); 96 $('.wprevpro_tooltip').remove(); 97 }); 98 $(".wptripadvisor_t1_outer_div").on('mousemove', '.wprevtooltip', function(e) { 99 $('.wprevpro_tooltip').css('top', (e.pageY - 15) + 'px').css('left', (e.pageX + 10) + 'px'); 100 }); 101 102 //going to search for media added to reviews and load lity if we find them. 103 setTimeout(function(){ mediareviewpopup(); }, 500); 104 function mediareviewpopup(){ 105 var mediadiv = $(".wprev_media_div"); 106 if(mediadiv.length){ 107 //make sure lity isn't loaded already in free google version. 108 if(!isScriptAlreadyIncluded('wp-google-places-review-slider/public/js/wprev-public-com-min.js')){ 109 //load js and css files. 110 $('<link/>', { 111 rel: 'stylesheet', 112 type: 'text/css', 113 href: wprevpublicjs_script_vars.wprevpluginsurl+"/public/css/lity.min.css" 114 }).appendTo('head'); 115 $.getScript(wprevpublicjs_script_vars.wprevpluginsurl+"/public/js/lity.min.js", function() { 116 //script is loaded and ran on document root. 117 }); 118 } 119 } 120 } 121 122 function isScriptAlreadyIncluded(src){ 123 var scripts = document.getElementsByTagName("script"); 124 var tempscriptname; 125 for(var i = 0; i < scripts.length; i++){ 126 if(scripts[i].getAttribute('src')) { 127 tempscriptname = scripts[i].getAttribute('src'); 128 if(tempscriptname.includes(src)){ 129 return true; 130 } 131 } 132 } 133 return false;
134 } 135 136 137 }); 138 139})( 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.