1/* ----------------------------------------------------------------------------- 2 * Document ready 3 * -------------------------------------------------------------------------- */ 4;(function( $, window, document, undefined ){ 5 "use strict"; 6 7 $( document ).ready( function ($) { 8 9 // Open external sites in new window 10 $("a[href*='http://']:not([href*='"+location.hostname+"']), a[href*='https://']:not([href*='"+location.hostname+"'])").attr("target","_blank"); 11 12 // Add swipe box into gallery 13 $(".swipebox, .custom-gallery a, div[id^=attachment_] a, .post-content a[href$=jpg], .post-content a[href$=png], .post-content a[href$=jpeg]").swipebox(); 14 15 // Wordpress gallery grid 16 $( '.custom-gallery' ).each( function ( i, el ) { 17 var $gallery = $( el ); 18 var layout = $gallery.attr( 'data-gallery-layout' ); 19 if ( ! ( parseInt( layout, 10 ) > 0 ) ) { 20 layout = '213'; // Default layout 21 } 22 23 layout = layout.split(''); 24 var columnLayout = []; 25 for (var i in layout ) { 26 var columnCount = parseInt( layout[i], 10 ); 27 var columnWidth = 100.0 / columnCount; 28 for ( var j = 1; j <= columnCount; j++ ) { 29 columnLayout.push( columnWidth ); 30 } 31 } 32 33 $gallery.find( '> figure' ).each( function( i, el ) { 34 var $el = $( el ); 35 var layoutIndex = i % columnLayout.length; 36 $el.css( 'width', columnLayout[ layoutIndex ] - 1 + '%' ); 37 } ); 38 } ); 39 40 // Fit images 41 $( '.vw-imgliquid' ).imgLiquid(); 42 43 // Show circle graph for review box 44 $(".dial").knob(); 45 46 // Instant search 47 $(".instant-search-icon").instant_search(); 48 49 // Sticky top bar 50 $(".top-bar").sticky(); 51 52 // carouFredSel 53 $(".top-posts .top-posts-inner").carouFredSel({ 54 auto: { 55 play: true, 56 timeoutDuration: 6000 57 }, 58 swipe: true, 59 mousewheel: true, 60 align: 'left', 61 width: '100%', 62 items: { 63 start: -1, 64 width: 'auto', 65 visible: function( visibleItems ) { 66 var viewportWidth = document.documentElement.clientWidth; 67 68 /* md device */ if ( viewportWidth >= 992 ) return 4; 69 /* sm device */if ( viewportWidth >= 768 ) return 3; 70 return 2; 71 }, 72 }, 73 scroll: { 74 items: 1, 75 easing: "quadratic", 76 duration: 500, 77 pauseOnHover: true, 78 onAfter: function() { 79 $.force_appear(); 80 } 81 }, 82 prev: ".carousel-nav-prev", 83 next: ".carousel-nav-next", 84 onCreate: function( data ) { 85 var $this = $(this) 86 setTimeout( function() { 87 $this.trigger("slideTo", 0); 88 }, 250 ); 89 } 90 }); 91 92 $(window).resize(function() { 93 $(".top-posts .top-posts-inner").trigger('configuration', ['debug', false, true]); 94 }); 95 96 // ----------------------------------------------------------------------------- 97 // Mobile navigation 98 // 99 var $body = $('body'); 100 101 $('#open-mobile-nav').click( function( e ) { 102 $body.toggleClass('mobile-nav-open'); 103 $( 'body,html' ).scrollTop( 0 ); 104 return false; 105 } ); 106 107 var defaultWindowWidth = $(window).width(); 108 $(window).resize(function() { 109 if ( defaultWindowWidth != $(window).width() ) { 110 $body.removeClass('mobile-nav-open'); 111 } 112 }); 113 114 var $mobile_nav = $('#mobile-nav-wrapper'); 115 116 var $clone_main_nav = $('#main-nav-wrapper').children().clone(); 117 $clone_main_nav.find( '.sub-posts' ).remove(); 118 $clone_main_nav = $clone_main_nav.removeAttr('id').removeClass('main-nav').addClass('mobile-nav'); 119 120 var $clone_top_nav = $('#top-nav-wrapper').children().clone(); 121 $clone_top_nav.find( '.sub-posts' ).remove(); 122 $clone_top_nav = $clone_top_nav.removeAttr('id').removeClass('top-nav').addClass('mobile-nav'); 123 124 $mobile_nav.append( $clone_main_nav, $( '<hr>' ), $clone_top_nav ); 125 126 // ----------------------------------------------------------------------------- 127 // Navigation Sub-menu 128 // 129 $( '.main-nav .menu-item' ).hover( 130 function() { 131 $( '> .sub-menu' , this ) 132 .stop( true, true ) 133 .fadeIn( { duration: 250 } ); 134 135 }, function() { 136 $( '> .sub-menu' , this ) 137 .stop( true, true ) 138 .fadeOut( { duration: 250 } ); 139 } ); 140 141 // ----------------------------------------------------------------------------- 142 // Fitvids - keep video ratio 143 // 144 $( '.post-audio-wrapper, .post-video-wrapper, .flxmap-container, .comment-body, .post-content, #footer' ).fitVids( { customSelector: "iframe[src*='maps.google.']", ignore: '.vw-ignore-fitvids' }); 145 146 // ----------------------------------------------------------------------------- 147 // Isotope - Mansonry grid 148 // 149 var $isotope_list = $('.vw-isotope'); 150 $isotope_list.imagesLoaded( function () { 151 var options = {}; 152 if ( $( 'body' ).hasClass( 'rtl' ) ) { 153 options.isOriginLeft = false;
154 } 155 156 $isotope_list.isotope( options ); 157 158 $(window).resize(function() { 159 $isotope_list.isotope('layout'); 160 }); 161 }); 162 163 // ----------------------------------------------------------------------------- 164 // Back to top 165 // 166 $( '.back-to-top' ).click( function() { 167 $( 'body,html' ).animate( { scrollTop: 0 } ); 168 return false; 169 } ); 170 171 // ----------------------------------------------------------------------------- 172 // Appear 173 // 174 $( 'body.site-enable-post-box-effects .post-box.animated-content' ).data( 'appear-top-offset', 100 ).on( 'appear', function( event, $all_appeared_elements ) { 175 $all_appeared_elements.removeClass( 'animated-content' ).addClass( 'appeared' ); 176 } ).appear( { force_process: false } ); 177 178 if ( $( 'html' ).hasClass( 'no-touch' ) ) { 179 $( document ).scrollTop( 1 ); 180 } 181 182 $("#event-filter").change(function() { 183 window.location = "?"+$(this).attr('data-target')+encodeURIComponent($(this).val()); 184 }); 185 186 if ($('#event-map')[0]) { 187 map_it($('#v-lat').val(), $('#v-lng').val(), $('#v-html').val()); 188 } 189 190 var map; 191 var markers = []; 192 var gwindow; 193 var radius = 25; 194 195 function event_map(v) { 196 if (v == 'Enter your city, address or zip.') v = ''; 197 search_locations(v); 198 load_map(); 199 return false; 200 } 201 202 function load_map() { 203 map = new google.maps.Map(document.getElementById("event_map"), { 204 center: new google.maps.LatLng(40, -100), 205 zoom: 4, 206 mapTypeId: 'roadmap', 207 mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU} 208 }); 209 210 gwindow = new google.maps.InfoWindow(); 211 212 if (navigator.geolocation) { 213 navigator.geolocation.getCurrentPosition(function(position) { 214 var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); 215 // console.log(pos); 216 }); 217 } 218 } 219 220 function search_locations(address) { 221 if (typeof address == 'undefined' || address.length < 2) return false; 222 var geocoder = new google.maps.Geocoder(); 223 geocoder.geocode({address: address}, function(results, status) { 224 if (status == google.maps.GeocoderStatus.OK) locations_near(results[0].geometry.location); 225 else alert(address + ' not found'); 226 }); 227 } 228 229 function clear_locations() { 230 if (gwindow) gwindow.close(); 231 for (var i = 0; i < markers.length; i++) markers[i].setMap(null); 232 markers.length = 0; 233 jQuery('#event_list').html('<ul></ul>'); 234 } 235 236 function locations_near(center) { 237 clear_locations(); 238 $('#event-loader').show(); 239 var search_url = '/map.php?lat=' + center.lat() + '&lng=' + center.lng() + '&radius=' + radius; 240 241 download_data(search_url, function(data) { 242 var xml = parse_xml(data); 243 var marker_nodes = xml.documentElement.getElementsByTagName("marker"); 244 var bounds = new google.maps.LatLngBounds(); 245 for (var i = 0; i < marker_nodes.length; i++) { 246 var latlng = new google.maps.LatLng( 247 parseFloat(marker_nodes[i].getAttribute("lat")), 248 parseFloat(marker_nodes[i].getAttribute("lng")) 249 ); 250 create_marker(latlng, marker_nodes[i], i); 251 bounds.extend(latlng); 252 } 253 jQuery('#event_list ul li').click(function(e){ 254 google.maps.event.trigger(markers[this.id.substr(7)], 'click'); 255 return false; 256 }); 257 map.fitBounds(bounds); 258 google.maps.event.trigger(markers[0], 'click'); 259 $('#event-loader').hide(); 260 }); 261 } 262 263 function create_marker(latlng, node, i) { 264 var name = node.getAttribute("name"); 265 var blah = node.getAttribute("blah"); 266 267 var html = '<div class="sl_item_l">'+blah+'</div>'; 268 269 jQuery('#event_list ul').append(jQuery('<li id="marker_'+i+'">').append(html)); 270 jQuery('#event_list ul a').click(function(e){ 271 e.stopImmediatePropagation(); 272 e.stopPropagation(); 273 }); 274 275 var marker = new google.maps.Marker({ 276 map: map, 277 position: latlng 278 }); 279 google.maps.event.addListener(marker, 'click', function() { 280 gwindow.setContent(html); 281 gwindow.open(map, marker); 282 }); 283 markers.push(marker); 284 } 285 286 function download_data(url, callback) { 287 var request = window.ActiveXObject ? 288 new ActiveXObject('Microsoft.XMLHTTP') : 289 new XMLHttpRequest; 290 291 request.onreadystatechange = function() { 292 if (request.readyState == 4) { 293 request.onreadystatechange = do_nothing; 294 callback(request.responseText, request.status); 295 } 296 }; 297 298 request.open('GET', url, true); 299 request.send(null); 300 } 301
302 function parse_xml(str) { 303 if (window.ActiveXObject) { 304 var doc = new ActiveXObject('Microsoft.XMLDOM'); 305 doc.loadXML(str); 306 return doc; 307 } else if (window.DOMParser) { 308 return (new DOMParser).parseFromString(str, 'text/xml'); 309 } 310 } 311 312 function map_it(lat, lng, html) { 313 var latlng = new google.maps.LatLng(lat, lng); 314 var mapOptions = { 315 zoom: 13, 316 center: latlng, 317 mapTypeId: google.maps.MapTypeId.ROADMAP 318 }; 319 map = new google.maps.Map(document.getElementById('event-map'), mapOptions); 320 gwindow = new google.maps.InfoWindow(); 321 322 var marker = new google.maps.Marker({ 323 map: map, 324 position: latlng 325 }); 326 327 gwindow.setContent($('#venue-deets').html()); 328 gwindow.open(map, marker); 329 } 330 331 function do_nothing() {} 332 333 } ); 334})( jQuery, window , document ); 335 336/** 337 * No-touch detection 338 */ 339if (!("ontouchstart" in document.documentElement)){ 340 document.documentElement.className += " no-touch"; 341}
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.