$.fn.waypoint.defaults = { context: window, continuous: true, enabled: true, horizontal: false, offset: '70%', triggerOnce: true } $('.timeline').waypoint(function() { $(function() { options = { responsive: true, maintainAspectRatio: true, animationSteps: 100, animationEasing: "easeInQuart", legendTemplate : "" }; var data = { labels: ["January", "February", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"], datasets: [ { label: "Ambient", fillColor: "rgba(254, 254, 51,0.2)", strokeColor: "rgba(254, 254, 51,1)", pointColor: "rgba(254, 254, 51,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(220,220,220,1)", data: [115, 91, 47, 31, 26, 55, 60, 70, 85, 94, 100, 63] }, { label: "Blues", fillColor: "rgba(250, 188, 2,0.2)", strokeColor: "rgba(250, 188, 2,1)", pointColor: "rgba(250, 188, 2,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [83, 91, 104, 79, 56, 27, 52, 35, 33, 25, 22, 86] }, { label: "Classical", fillColor: "RGBA(251, 153, 2, .3)", strokeColor: "rgba(251, 153, 2,1)", pointColor: "rgba(251, 153, 2,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [118, 78, 30, 9, 16, 37, 50, 41, 34, 50, 99, 200] }, { label: "Country", fillColor: "RGBA(253, 83, 8, .3)", strokeColor: "rgba(253, 83, 8,1)", pointColor: "rgba(253, 83, 8,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [46, 85, 91, 79, 26, 37, 50, 41, 34, 50, 49, 81] }, { label: "Electronic", fillColor: "RGBA(254, 39, 18, .3)", strokeColor: "rgba(254, 39, 18,1)", pointColor: "rgba(254, 39, 18,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [28, 42, 34, 59, 86, 77, 50, 41, 34, 67, 70, 81] }, { label: "Folk", fillColor: "RGBA(167, 25, 75, .3)", strokeColor: "rgba(167, 25, 75,1)", pointColor: "rgba(167, 25, 75,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [38, 31, 70, 39, 56, 117, 50, 41, 34, 50, 90, 121] }, { label: "Hip Hop", fillColor: "RGBA(134, 1, 175, .3)", strokeColor: "rgba(134, 1, 175,1)", pointColor: "rgba(134, 1, 175,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [21, 17, 31, 89, 86, 77, 50, 41, 34, 50, 90, 81] }, { label: "Jazz", fillColor: "RGBA(61, 1, 164, .3)", strokeColor: "rgba(61, 1, 164,1)", pointColor: "rgba(61, 1, 164,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [51, 38, 33, 19, 26, 57, 50, 81, 170, 200, 195, 172] }, { label: "Pop", fillColor: "RGBA(2, 71, 254, .3)", strokeColor: "rgba(2, 71, 254,1)", pointColor: "rgba(2, 71, 254,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [48, 53, 63, 107, 191, 177, 118, 91, 74, 60, 51, 123] }, { label: "R&B", fillColor: "RGBA(3, 146, 206, .3)", strokeColor: "rgba(3, 146, 206,1)", pointColor: "rgba(3, 146, 206,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [73, 43, 52, 29, 56, 73, 24, 33, 37, 14, 26, 41] }, { label: "Rock", fillColor: "RGBA(102, 176, 50, .3)", strokeColor: "rgba(102, 176, 50,1)", pointColor: "rgba(102, 176, 50,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [28, 37, 30, 59, 146, 157, 200, 105, 94, 40, 36, 89] }, { label: "World", fillColor: "RGBA(208, 234, 43, .3)", strokeColor: "rgba(208, 234, 43,1)", pointColor: "rgba(208, 234, 43,1)", pointStrokeColor: "#fff", pointHighlightFill: "#fff", pointHighlightStroke: "rgba(151,187,205,1)", data: [36, 41, 23, 34, 94, 85, 87, 71, 44, 39, 30, 11] } ] }; ctx = $("#timechart").get(0).getContext("2d"); LineChart = new Chart(ctx).Line(data, options); }); }); $('.music-types').waypoint(function() { $(function() { options = { responsive: true, scaleShowLabelBackdrop: true, scaleBackdropColor: "rgba(255,255,255,0.75)", scaleBeginAtZero: true, scaleBackdropPaddingY: 2, scaleBackdropPaddingX: 2, scaleShowLine: true, segmentShowStroke: true, segmentStrokeColor: "#fff", segmentStrokeWidth: 2, animationSteps: 100, animationEasing: "easeInCirc", animateRotate: true, animateScale: false, legendTemplate: "" }; data = [ { value: 440, color: "RGBA(254, 254, 51, .7)", highlight: "RGBA(254, 254, 51, .3)", label: "Ambient" }, { value: 510, color: "RGBA(250, 188, 2, .7)", highlight: "RGBA(250, 188, 2, .3)", label: "Blues" }, { value: 410, color: "RGBA(251, 153, 2, .7)", highlight: "RGBA(251, 153, 2, .3)", label: "Classical" }, { value: 510, color: "RGBA(253, 83, 8, .7)", highlight: "RGBA(253, 83, 8, .3)", label: "Country" }, { value: 548, color: "RGBA(254, 39, 18, .7)", highlight: "RGBA(254, 39, 18, .3)", label: "Electronic" }, { value: 460, color: "RGBA(167, 25, 75, .7)", highlight: "RGBA(167, 25, 75, .3)", label: "Folk" }, { value: 261, color: "RGBA(134, 1, 175, .7)", highlight: "RGBA(134, 1, 175, .3)", label: "Hip Hop" }, { value: 1038, color: "RGBA(61, 1, 164, .7)", highlight: "RGBA(61, 1, 164, .3)", label: "Jazz" }, { value: 970, color: "RGBA(2, 71, 254, .7)", highlight: "RGBA(2, 71, 254, .3)", label: "Pop" }, { value: 777, color: "RGBA(3, 146, 206, .7)", highlight: "RGBA(3, 146, 206, .3)", label: "R&B" }, { value: 712, color: "RGBA(102, 176, 50, .7)", highlight: "RGBA(102, 176, 50, .3)", label: "Rock" }, { value: 625, color: "RGBA(208, 234, 43, .7)", highlight: "RGBA(208, 234, 43, .3)", label: "World" } ]; ctx = $("#typechart").get(0).getContext("2d"); styles = new Chart(ctx).Doughnut(data, options); document.getElementById('key').innerHTML = styles.generateLegend(); }); }); $('.music-typed').waypoint(function() { $(function() { options = { responsive: true, scaleShowLabelBackdrop: true, scaleBackdropColor: "rgba(255,255,255,0.75)", scaleBeginAtZero: true, scaleBackdropPaddingY: 2, scaleBackdropPaddingX: 2, scaleShowLine: true, segmentShowStroke: true, segmentStrokeColor: "#fff", segmentStrokeWidth: 2, animationSteps: 100, animationEasing: "easeOutQuart", animateRotate: true, animateScale: false, legendTemplate: "" }; data = [ { value: 440, color: "RGBA(254, 254, 51, .7)", highlight: "RGBA(254, 254, 51, .3)", label: "Ambient" }, { value: 510, color: "RGBA(250, 188, 2, .7)", highlight: "RGBA(250, 188, 2, .3)", label: "Blues" }, { value: 410, color: "RGBA(251, 153, 2, .7)", highlight: "RGBA(251, 153, 2, .3)", label: "Classical" }, { value: 510, color: "RGBA(253, 83, 8, .7)", highlight: "RGBA(253, 83, 8, .3)", label: "Country" }, { value: 548, color: "RGBA(254, 39, 18, .7)", highlight: "RGBA(254, 39, 18, .3)", label: "Electronic" }, { value: 460, color: "RGBA(167, 25, 75, .7)", highlight: "RGBA(167, 25, 75, .3)", label: "Folk" }, { value: 261, color: "RGBA(134, 1, 175, .7)", highlight: "RGBA(134, 1, 175, .3)", label: "Hip Hop" }, { value: 1000, color: "RGBA(61, 1, 164, .7)", highlight: "RGBA(61, 1, 164, .3)", label: "Jazz" }, { value: 970, color: "RGBA(2, 71, 254, .7)", highlight: "RGBA(2, 71, 254, .3)", label: "Pop" }, { value: 777, color: "RGBA(3, 146, 206, .7)", highlight: "RGBA(3, 146, 206, .3)", label: "R&B" }, { value: 712, color: "RGBA(102, 176, 50, .7)", highlight: "RGBA(102, 176, 50, .3)", label: "Rock" }, { value: 625, color: "RGBA(208, 234, 43, .7)", highlight: "RGBA(208, 234, 43, .3)", label: "World" } ]; ctx = $("#artchart").get(0).getContext("2d"); myNewChart = new Chart(ctx).PolarArea(data, options); }); }); (function( $ ) { $.fn.lfmr = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&format=json&limit=50"; var tracks = []; function isLoadedr (recentElement) { for (var i = 0; i < tracks.length; i++){ var markup = $("
  • " + tracks[i].artist + " - " + tracks[i].title + " : " + tracks[i].album + "
  • "); recentElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.recenttracks.track).each(function(){ tracks.push ({ artist: this.artist["#text"], title: this.name, album: this.album["#text"] }); }); isLoadedr($this); }); }); }; $('.recent').lfmr(); $.fn.lfmtw = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=7day&format=json&limit=25"; var tracks = []; function isLoadedt (tracksElement) { for (var i = 0; i < tracks.length; i++){ var markup = $("
  • " + tracks[i].artist + " - " + tracks[i].title + "" + tracks[i].played + "
  • "); tracksElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.toptracks.track).each(function(){ tracks.push ({ title: this.name, artist: this.artist.name, played: this.playcount, }); }); isLoadedt($this); }); }); }; $.fn.lfmaw = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=7day&format=json&limit=25"; var artists = []; function isLoadeda (artistElement) { for (var i = 0; i < artists.length; i++){ var markup = $("
  • " + artists[i].aname + "" + artists[i].played + "
  • "); artistElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.topartists.artist).each(function(){ artists.push ({ aname: this.name, played: this.playcount }); }); isLoadeda($this); }); }); }; $('.wtracks').lfmtw(); $('.wartists').lfmaw(); $.fn.lfmtm = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=3month&format=json&limit=45"; var tracks = []; function isLoadedt (tracksElement) { for (var i = 0; i < tracks.length; i++){ var markup = $("
  • " + tracks[i].artist + " - " + tracks[i].title + "" + tracks[i].played + "
  • "); tracksElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.toptracks.track).each(function(){ tracks.push ({ title: this.name, artist: this.artist.name, played: this.playcount, }); }); isLoadedt($this); }); }); }; $.fn.lfmam = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=3month&format=json&limit=45"; var artists = []; function isLoadeda (artistElement) { for (var i = 0; i < artists.length; i++){ var markup = $("
  • " + artists[i].aname + "" + artists[i].played + "
  • "); artistElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.topartists.artist).each(function(){ artists.push ({ aname: this.name, played: this.playcount }); }); isLoadeda($this); }); }); }; $('.mtracks').lfmtm(); $('.martists').lfmam(); $.fn.lfma = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettopartists&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=6month&format=json&limit=50"; var artists = []; function isLoadeda (artistElement) { for (var i = 0; i < artists.length; i++){ var markup = $("
  • " + artists[i].aname + "" + artists[i].played + "
  • "); artistElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.topartists.artist).each(function(){ artists.push ({ aname: this.name, played: this.playcount }); }); isLoadeda($this); }); }); }; $.fn.lfmt = function(options){ var urla = "https://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=6month&format=json&limit=50"; var tracks = []; function isLoadedt (tracksElement) { for (var i = 0; i < tracks.length; i++){ var markup = $("
  • " + tracks[i].artist + " - " + tracks[i].title + "" + tracks[i].played + "
  • "); tracksElement.append(markup); } } return this.each(function(){ var $this = $(this); $.getJSON( urla, function(data){ $(data.toptracks.track).each(function(){ tracks.push ({ title: this.name, artist: this.artist.name, played: this.playcount, }); }); isLoadedt($this); }); }); }; $('.artists').lfma(); $('.tracks').lfmt(); $.fn.lfm = function(options){ var url = "https://ws.audioscrobbler.com/2.0/?method=user.gettopalbums&user=windhamdavid&api_key=e12ea1d0253898ee9a93edfe42ffdeab&period=12month&format=json&limit=200"; var albums = []; function isLoaded (albumElement) { for (var i = 0; i < albums.length; i++){ var markup = $("

    " + albums[i].artist + "

    " + albums[i].name + "

    " + albums[i].played + " tracks played

    "); albumElement.append(markup); } albumElement.find('.album').hover(function(){ $(this).addClass('flip'); },function(){ $(this).removeClass('flip'); }); } return this.each(function(){ var $this = $(this); $.getJSON( url, function(data){ $(data.topalbums.album).each(function(){ albums.push ({ name: this.name, artist: this.artist.name, played: this.playcount, art: this.image[this.image.length-1]["#text"] }); }); isLoaded($this); }); }); }; $('.albums').lfm(); })( jQuery ); /* ======= SAVE FOR LATER Icecast 2.4 upgrade to fix CORs headers @ http://64.207.154.37:8008/status2.xsl ======== (function($){ $.fn.icecast = function(options){ $.ajaxSetup({ cache:true, scriptCharset:"utf-8", contentType:"text/json;charset=utf-8" }); var defaults = { server:"", stationlogo:"" }; var options = $.extend(defaults,options); return this.each(function(){var icecast = $(this); $.getJSON('http://'+options.server+'/status2.xsl', function(data){$.each(data.mounts,function(i,mount){ $(icecast).append('
  • '+mount.title+'
    Listeners: '+mount.listeners+' at '+mount.bitrate+'kbps
  • '); }); }); }); };})(jQuery); $(function(){ $('.mounts').icecast({server:"64.207.154.37:8008"}); }); */ amplitude_config = { "amplitude_songs": [ { "url": "http://code.davidawindham.com:8008/stream", "live": true } ], "amplitude_volume": 90 } function get_radio_tower() { return '../../wp-content/themes/dw/img/radio.gif'; } function get_radio_none() { return '../../wp-content/themes/dw/img/none.svg'; } function get_radio_eq() { return '../../wp-content/themes/dw/img/eq.gif'; } function get_radio_eq_none() { return '../../wp-content/themes/dw/img/1.png'; } function radioTitle() { $('#radio').attr('src', get_radio_none()).fadeIn(300); $('#eq').attr('src', get_radio_eq_none()).fadeIn(300); var url = 'http://code.davidawindham.com:8008/status2.xsl'; var mountpoint = '/stream'; $.ajax({ type: 'GET', url: url, async: true, jsonpCallback: 'parseMusic', contentType: "application/json", dataType: 'jsonp', success: function (json) { $('#track').text(json[mountpoint].title); $('#listeners').text(json[mountpoint].listeners); $('#peak-listeners').text(json[mountpoint].peak_listeners); $('#bitrate').text(json[mountpoint].bitrate); $('#radio').attr('src', get_radio_tower()).fadeIn(300); $('#eq').attr('src', get_radio_eq()).fadeIn(300); }, error: function (e) { console.log(e.message); $('#radio').attr('src', get_radio_none()).fadeIn(300); $('#eq').attr('src', get_radio_eq_none()).fadeIn(300); } }); } $(document).ready(function () { setTimeout(function () {radioTitle();}, 2000); setInterval(function () {radioTitle();}, 30000); // update every 30 seconds }); $('.nav-toggle').on('touchstart click', function(e) { e.preventDefault(); $( this ).toggleClass( 'active' ); }); $(function dw_hidenav() { var headerHeight = $('.navbar').height(); $(window).on('scroll', { previousTop: 0 }, function() { var currentTop = $(window).scrollTop(); if (currentTop < this.previousTop) { if (currentTop > 0 && $('.navbar').hasClass('fixed')) { $('.navbar').addClass('visible'); } else { $('.navbar').removeClass('visible fixed'); } } else { $('.navbar').removeClass('visible'); if (currentTop > headerHeight && !$('.navbar').hasClass('fixed')) $('.navbar').addClass('fixed'); } this.previousTop = currentTop; } ); });