mirror of
https://github.com/medialab-prado/datamad2017.git
synced 2024-12-26 12:41:23 +01:00
1 line
No EOL
11 KiB
JavaScript
1 line
No EOL
11 KiB
JavaScript
(function(f){f(document).ready(function(){f("body").css("overflow","hidden");f(window).load(function(){var u=350,s=800;function t(){var w=f("#loading-animation"),v=f("#preloader");w.fadeOut();v.delay(u).fadeOut(s)}f("body").css("overflow","auto");t();q()});if(f(window).width()>1500){f(".team-item-wrapper").each(function(){f(this).addClass("col-lg-3")})}if(f(window).width()<768){f(".animated").removeClass("animated").removeClass("hiding");f(".stat span").removeClass("timer")}if(f(window).height()<512){f("#bottom-navlinks").removeClass("bottom-navlinks").addClass("bottom-navlinks-small")}if(f(window).scrollTop()>=100){f("#top-header").addClass("after-scroll");f("#logo-header").removeClass("logo-light").addClass("logo-dark")}f(window).scroll(function(){var s=f(this).scrollTop();var w=f("#top-header");var u=f("#logo-header");var v=u.attr("src");var t=f("#buy-tickets-button");if(s>=100){w.addClass("after-scroll");u.removeClass("logo-light").addClass("logo-dark")}else{w.removeClass("after-scroll");if(!w.hasClass("dark-header")){u.removeClass("logo-dark").addClass("logo-light")}}if(s>=f(window).height()){t.fadeIn(400);t.removeClass("hidden")}else{t.fadeOut(400,function(){t.addClass("hidden")})}});f(function(){var t=[];f(".rockstar-speakers-item").each(function(){t[t.length]=f(this).attr("data-id")});t=p(t);for(var s=0;s<4;s++){f("#rockstar-speaker-"+t[s]).removeClass("hidden")}});function p(v){for(var t,s,u=v.length;u;t=parseInt(Math.random()*u),s=v[--u],v[u]=v[t],v[t]=s){}return v}var m=parseInt(f(".increment-animation").attr("data-delay"));f(".increment-animation").not("hidden").each(function(s){f(this).attr("data-delay",s*m)});f(".animated").appear(function(){var t=f(this);var u=t.data("animation");var s=t.data("delay");if(s){setTimeout(function(){t.addClass(u+" visible");t.removeClass("hiding");if(t.hasClass("counter")){t.find(".timer").countTo()}},s)}else{t.addClass(u+" visible");t.removeClass("hiding");if(t.hasClass("counter")){t.find(".timer").countTo()}}},{accY:-150});f(function(){f("a[href*=#]:not([href=#])").click(function(){if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var s=f(this.hash);s=s.length?s:f("[name="+this.hash.slice(1)+"]");if(s.length){f("html,body").animate({scrollTop:s.offset().top},1000);return false}}})});f(function(){f("a[href=#]").click(function(){event.preventDefault()})});function q(){if(f(window).width()>767){f(".same-height-wrapper").each(function(){var s=0;f(".same-height").each(function(){var t=f(this).height();if(t>s){s=t}});f(".same-height").each(function(){f(this).height(s)})})}}f("#post-section .post-body p").each(function(){if(f(this).find(".feature-image").length){var s=f(this).find(".feature-image").prop("src");f("#top-section").css("background-image","url("+s+")").addClass("enable-overlay")}});f(".slider").each(function(){f(this).find(".slider-item").first().addClass("slider-current-item").removeClass("hidden");if(f(this).find(".slider-item").length>1){f(this).closest(".speaker-item").find(".slider-next-item").removeClass("hidden")}});f(".slider-next-item").click(function(){var s=f(this).closest(".speaker-item");var t=s.find(".slider-current-item").next();if(t.length){t.addClass("slider-current-item").removeClass("hidden");s.find(".slider-current-item").first().removeClass("slider-current-item").addClass("hidden")}else{s.find(".slider-item").first().addClass("slider-current-item").removeClass("hidden");s.find(".slider-current-item").last().removeClass("slider-current-item").addClass("hidden")}});var l=f(".st-container");f("#menu-trigger").click(function(t){t.stopPropagation();var v=f(window).scrollTop();var u=f(window).scrollLeft();var s=f(this).attr("data-effect");if(!l.hasClass("st-menu-open")){l.addClass(s).delay(25).addClass("st-menu-open");f("body").css("overflow","hidden")}else{l.removeClass("st-menu-open");f("body").css("overflow","auto")}});f(".st-pusher").click(function(){if(l.hasClass("st-menu-open")){l.removeClass("st-menu-open");f("body").css("overflow","auto")}});f(window).resize(function(){if(f(window).width()>1500){f(".team-item-wrapper").each(function(){f(this).addClass("col-lg-3")})}else{f(".team-item-wrapper").each(function(){f(this).removeClass("col-lg-3")})}if(f(window).width()>767){if(l.hasClass("st-menu-open")){l.removeClass("st-menu-open");f("body").css("overflow","auto")}q()}var s=f("#bottom-navlinks");if(f(window).height()<512){s.removeClass("bottom-navlinks").addClass("bottom-navlinks-small")}else{s.removeClass("bottom-navlinks-small").addClass("bottom-navlinks")}if(f(window).width()<768){f(".same-height").css("height","100%")}});f(".modal").on("show.bs.modal",function(){f("body").css("overflow","hidden")});f(".modal").on("hide.bs.modal",function(){f("body").css("overflow","auto")});if(typeof twitterFeedUrl!=="undefined"){var o="http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent('select * from json where url="'+twitterFeedUrl+'"')+"&format=json&callback=?";f.getJSON(o,function(s){f.each(s.query.results.json.json,function(u,t){var v='<div class="tweet animated fadeInUp hidden"><p class="tweet-text">'+n(t.text)+'</p><p class="tweet-meta">by <a href="https://twitter.com/'+t.user.screen_name+' target="_blank">@'+t.user.screen_name+"</a></p></div>";f("#tweets").append(v)});r()});function n(x){var s,w,v,u,t;w=/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;s=x.replace(w,'<a href="$1" target="_blank">$1</a>');v=/(^|[^\/])(www\.[\S]+(\b|$))/gim;s=s.replace(v,'$1<a href="http://$2" target="_blank">$2</a>');u=/#(\S*)/g;s=s.replace(u,'<a href="https://twitter.com/search?q=%23$1" target="_blank">#$1</a>');t=/\B@([\w-]+)/gm;s=s.replace(t,'<a href="https://twitter.com/$1" target="_blank">@$1</a>');return s}function r(){var s=f("#tweets").find(".tweet"),u=0;f(s.get(0)).removeClass("hidden");function v(){var w=(++u%s.length);f(s.get(w-1)).addClass("hidden");f(s.get(w)).removeClass("hidden")}var t=setInterval(v,5000)}}});(function(){var l=document.createElement("script");l.type="text/javascript";l.async=true;l.src="https://apis.google.com/js/platform.js";var m=document.getElementsByTagName("script")[0];m.parentNode.insertBefore(l,m)})();if(typeof googleMaps!=="undefined"){var a,b,k,c,i,j;var d=[];var h=new google.maps.DirectionsService();var g="custom_style";function e(){k=new google.maps.DirectionsRenderer({suppressMarkers:true});c=new google.maps.Geocoder();i=new google.maps.Polyline({strokeColor:"#03a9f4",strokeOpacity:1,strokeWeight:2});var w=[{stylers:[{lightness:40},{visibility:"on"},{gamma:0.9},{weight:0.4}]},{elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"water",stylers:[{color:"#5dc7ff"}]},{featureType:"road",stylers:[{visibility:"off"}]}];var x=[{stylers:[{lightness:40},{visibility:"on"},{gamma:1.1},{weight:0.9}]},{elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"water",stylers:[{color:"#5dc7ff"}]},{featureType:"road",stylers:[{visibility:"on"}]},{featureType:"road",elementType:"labels",stylers:[{saturation:-30}]}];var m={zoom:17,minZoom:2,scrollwheel:false,panControl:false,draggable:true,zoomControl:false,zoomControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP},scaleControl:false,mapTypeControl:false,streetViewControl:false,center:centerMap,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,g]},mapTypeId:g};if(f(window).width()<768){m.center=mobileCenterMap}if(googleMaps=="logistics"){m.zoom=5;m.zoomControl=true}a=new google.maps.Map(document.getElementById("canvas-map"),m);var n=new google.maps.Marker({position:eventPlace,animation:google.maps.Animation.DROP,icon:icon,map:a});d.push(n);var o={name:"Default Style"};var r={name:"Zoomed Style"};var q=new google.maps.StyledMapType(w,o);var p=new google.maps.StyledMapType(x,r);a.mapTypes.set("default",q);a.mapTypes.set("zoomed",p);if(googleMaps==="logistics"){a.setMapTypeId("default");var v=(document.getElementById("location-input"));b=new google.maps.places.Autocomplete(v);google.maps.event.addListener(b,"place_changed",function(){n.setVisible(false);var B=b.getPlace();if(B.geometry=="undefined"||!B.geometry){return}var A="";if(B.address_components){A=[(B.address_components[0]&&B.address_components[0].short_name||""),(B.address_components[1]&&B.address_components[1].short_name||""),(B.address_components[2]&&B.address_components[2].short_name||"")].join(" ")}c.geocode({address:A},function(D,C){if(C==google.maps.GeocoderStatus.OK){j=D[0].geometry.location;z(j,"TRANSIT")}else{alert("Geocode was not successful for the following reason: "+C)}})})}else{a.setMapTypeId("zoomed")}function z(A,C){var B={origin:A,destination:eventPlace,travelMode:google.maps.TravelMode[C]};h.route(B,function(E,D){if(D==google.maps.DirectionsStatus.OK){a.setMapTypeId("zoomed");k.setMap(a);k.setDirections(E);var H=E.routes[0].legs[0];l(H.start_location);l(H.end_location);f("#distance").text(H.distance.text);f("#estimateTime").text(H.duration.text);f("#mode-select").val(C);f("#mode").removeClass("hidden");var G=f("#mode-icon use").attr("xlink:href");G=G.substring(0,G.indexOf("#")+1)+"icon-"+C.toLowerCase();f("#mode-icon use").attr("xlink:href",G)}else{if(D!=google.maps.DirectionsStatus.OK&&C!="DRIVING"){z(A,"DRIVING")}else{var I=i.getPath();I.push(A);I.push(eventPlace);l(A);l(eventPlace);var F=new google.maps.LatLngBounds();F.extend(A);F.extend(eventPlace);a.fitBounds(F);i.setMap(a);var J=Math.round(google.maps.geometry.spherical.computeDistanceBetween(A,eventPlace)/1000);f("#distance").text(J+" km");f("#estimateTime").text("");f("#find-flight").removeClass("hidden");f("#mode").addClass("hidden")}}});y();f("#find-way").addClass("location-active");t(A);f("#find-way h3").removeClass("fadeInUp").addClass("fadeOutDown")}function l(A){var B=new google.maps.Marker({position:A,map:a,icon:icon});d.push(B)}function u(B){var A=new google.maps.Marker({position:B,map:a});d.push(A)}function y(){for(var A=0;A<d.length;A++){d[A].setMap(null)}d=[]}function s(F){var C=a.getZoom(),E=50;var A=Math.abs(F-C);var D=(F>C)?1:-1;for(var B=0;B<A;B++){setTimeout(function(){C+=D;a.setZoom(C)},(B+1)*E)}}function t(A){c.geocode({latLng:A},function(D,C){if(C==google.maps.GeocoderStatus.OK&&D[1]){var B=D[1].address_components;f.each(B,function(E,F){if(F.types[0]=="locality"){f("#result-name").text(F.long_name);return false}})}})}f("#mode-select").change(function(){var A=f(this).val();z(j,A)});f("#direction-locate").click(function(){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(A){j=new google.maps.LatLng(A.coords.latitude,A.coords.longitude);z(j,"TRANSIT")})}});f("#direction-cancel").click(function(){f("#find-way").removeClass("location-active");f("#location-input").val("");f("#find-flight").addClass("hidden");y();k.setMap(null);i.setMap(null);a.setMapTypeId("default");a.panTo(eventPlace);if(f(window).width()<768){a.setCenter(mobileCenterMap)}else{a.setCenter(centerMap)}l(eventPlace);s(5);f("#find-way h3").removeClass("fadeOutDown").addClass("fadeInUp")})}google.maps.event.addDomListener(window,"load",e)}})(jQuery); |