1$(document).ready(function(){ 2 3 /// -------------------------------------------------------------------------- 4 // Mobile nav 5 // -------------------------------------------------------------------------- 6 7 var siteOverlay = '<div class="site-overlay"></div>'; 8 9 10 $('body').prepend(siteOverlay); 11 12 $(".open-nav").click(function(){ 13 $("html").addClass("openNav"); 14 }); 15 16 $(".close-panel").click(function(){ 17 $("html").removeClass("openNav"); 18 }); 19 20 $('.site-overlay').click(function(event) { 21 if ($('html').hasClass('openNav')) { 22 event.stopPropagation(); 23 $('html').removeClass('openNav'); 24 event.preventDefault(); 25 } 26 27 }); 28 29 // -------------------------------------------------------------------------- 30 // Accordion 31 // -------------------------------------------------------------------------- 32 33 $('.js-accordion-trigger').bind('click', function(){ 34 jQuery(this).parent().find('.item').slideToggle('fast'); // apply the toggle to the ul 35 jQuery(this).parent().toggleClass('is-expanded'); 36 event.preventDefault(); 37 return false; 38 }); 39 40 41 // -------------------------------------------------------------------------- 42 // Smooth scroll to anchor 43 // -------------------------------------------------------------------------- 44 45 $('a[href*=#]:not([href=#])').click(function() { 46 if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') || location.hostname === this.hostname) { 47 48 var target = $(this.hash); 49 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 50 if (target.length) { 51 $('html,body').animate({ 52 scrollTop: target.offset().top 53 }, 1500, 'easeInOutExpo'); 54 return false; 55 } 56 } 57 }); 58 59 // -------------------------------------------------------------------------- 60 // Video Popup 61 // -------------------------------------------------------------------------- 62 63 $('.popup-video').magnificPopup({ 64 type: 'iframe' 65 }); 66 67 // -------------------------------------------------------------------------- 68 // Infield label 69 // -------------------------------------------------------------------------- 70 71 $(".contact label").inFieldLabels(); 72 73 // -------------------------------------------------------------------------- 74 // Gallery 75 // -------------------------------------------------------------------------- 76 77 $('.gallery-images a').magnificPopup({ 78 type: 'image', 79 gallery: { 80 enabled: true 81 } 82 }); 83 84 // -------------------------------------------------------------------------- 85 // Contact Form Validation 86 // -------------------------------------------------------------------------- 87 88 var ajax_form_options = { 89 focusInvalid: false, 90 submitHandler: function(form){ 91 92 $('.notification.fail').remove(); 93 $('#contactForm button').hide(); 94 95 var vars = $(form).serialize(); 96 97 $.ajax({ 98 url: '/wp-admin/admin-ajax.php', 99 type: 'post', 100 data: { 101 action: 'process-forms', 102 data: vars 103 }, 104 dataType: 'json' 105 }).done(function(data, textStatus, jqXHR){ 106 if (data.status === true) { 107 $('#contactForm').hide(); 108 $('#contactForm').parent().prepend('<p class="notification success">Your message has been sent</p>'); 109 110 } 111 else { 112 $('#contactForm').parent().prepend('<p class="notification fail">There was an error with your form</p>'); 113 $('#contactForm button').show(); 114 // Fail 115 } 116 }); 117 118 return false; 119 120 } 121 }; 122 123 $('#contactForm').validate(ajax_form_options); 124 125 // -------------------------------------------------------------------------- 126 // Instagram Feed 127 // -------------------------------------------------------------------------- 128 129 if ($('.instragram-feed').length !== 0) { 130 131 var current_count = 0; 132 var count = 8; 133 134 $.ajax({ 135 url: '/wp-admin/admin-ajax.php', 136 type: 'post', 137 data: { 138 action: 'get-instagram', 139 data: {} 140 }, 141 dataType: 'json' 142 }).done(function(data, textStatus, jqXHR){ 143 if (data.status === true) { 144 145 if (data.content != '') { 146 147 $('.instragram-feed').append(data.content); 148 149 $('.instragram-feed img').each(function(){ 150 151 var self = $(this); 152 var src = $(this).data('src'); 153 154 if (src) { 155 var img = new Image(); 156 img.style.display = 'none'; 157 img.onload = function() { 158 self.attr('src', src); 159 current_count++; 160 if (current_count == 8) { 161 $('.instragram-feed .loading').fadeOut(1000); 162 } 163 }; 164 img.src = src; 165 } 166 167 }); 168 169 $('.instragram-feed a').magnificPopup({ 170 type: 'image', 171 gallery: { 172 enabled: true 173 } 174 }); 175 176 } else { 177
178 $('.instragram-feed').slideUp(500); 179 180 } 181 182 } 183 else { 184 // Fail 185 $('.instragram-feed').slideUp(500); 186 } 187 }); 188 189 } 190 191 // -------------------------------------------------------------------------- 192 // Facebook and Twitter Feed 193 // -------------------------------------------------------------------------- 194 195 FB.init( { 196 //appId: 1536806386531359, 197 appId: 329353641161701, 198 status: true, 199 cookie: true 200 }); 201 202 if ($('.social-feed').length !== 0) { 203 204 $.ajax({ 205 url: '/wp-admin/admin-ajax.php', 206 type: 'post', 207 data: { 208 action: 'get-facebook-twitter', 209 data: {} 210 }, 211 dataType: 'json' 212 }).done(function(data, textStatus, jqXHR){ 213 if (data.status === true) { 214 215 $('.social-feed').html(data.content); 216 $('.social-feed article').slideDown(); 217 218 $.ajax( {url: 'https://platform.twitter.com/widgets.js', dataType: 'script', cache:true} ); 219 220 $('.facebook-btn').each(function(index, element){ 221 $(this).unbind('click').click(function(){ 222 postToFacebook($(this).attr('data-content')); 223 return false; 224 }); 225 }); 226 227 } 228 else { 229 // Fail 230 } 231 }); 232 233 } 234 235 236}); 237 238function postToFacebook(content) { 239 240 var request = { 241 method: 'feed', 242 link: 'https://fb.me/ecoadventures', 243 name: 'Eco Adventures', 244 caption: '#ecoadventures', 245 description: 'Eco Adventures - ' + content 246 }; 247 248 function callback( response ) { 249 250 // Do something 251 } 252 253 FB.ui( request, callback ); 254}
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.