// TODO: see why you can not seek soundcloud player // TODO: make all file i/o rest independent // TODO: ditch restheart completely??? // Userlist data array for filling in info box upcomingCount = 0 upcomingLoadedCount = 0; // DOM Ready ============================================================= $(document).ready(function() { if (window.location.href.split('/').pop().split('.').pop() != "pdf") { populatePieces('primary'); populatePieces('secondary'); populatePublications(); populateReleases(); populatePerformances(2021, 'composer', true); populateTalks(2021, true); populateAbout(); populateGallerySelector(); if (window.location.href.split('/').pop().substring(0,3) != "#lg") { window.history.replaceState("object or string", "Title", "/"); } } $( window ).resize(function() { resetDivHeights(); }); $(function() { $( document ).tooltip(); }); $(document).on('click','.scroll-to-div', function(event) { event.preventDefault(); var target = "#" + this.getAttribute('data-target'); $('html, body').animate({ scrollTop: $(target).offset().top - 210 }, 500); //window.history.pushState("object or string", "Title", this.getAttribute('data-target')); }); $(window).scroll(function(event) { $(".header").css("margin-left", 0 - $(document).scrollLeft()); }); $('ul#piecesmiscworkslist').hide(); $('#pieces .btn_less').hide(); $('#pieces .btn_more').click(function(){ $('ul#piecesmiscworkslist').show(); $('#pieces .btn_more').hide(); $('#pieces .btn_less').show(); resetDivHeights(); }); $('#pieces .btn_less').click(function(){ $('ul#piecesmiscworkslist').hide(); $('#pieces .btn_less').hide(); $('#pieces .btn_more').show(); resetDivHeights(); }); embedAudioGallery(false); for (i = new Date().getFullYear(); i > 2000; i--){ $('#yearpicker').append($('').val(i).html(i)); } $('#yearpicker').on('change', function() { $("#performanceeventslist").empty(); //populatePerformances(parseInt(this.value), $('#eventtypepicker').val(), false); populatePerformances(parseInt(this.value), 'composer', false); }); /* $('#eventtypepicker').append($('').val('composer').html('as composer/artist')); $('#eventtypepicker').append($('').val('performer').html('as performer/guest')); $('#eventtypepicker').on('change', function() { $("#performanceeventslist").empty(); populatePerformances(parseInt($('#yearpicker').val()), this.value, false); }); */ $("img").load(function() { alert($(this).height()); alert($(this).width()); }); }); // Functions ============================================================= BASE_URL='https://restheart.unboundedpress.org'; //BASE_URL='https://dev2.unboundedpress.org'; //BASE_URL='http://127.0.0.1:8080'; function resetDivHeights(){ //$('#pieces').height($('#writings').height() + 100); //$('#pieces').height($('#releases').height()); //$('#releases').height($('#writings').height()); $('#pieces').css('height', '2400px'); //if($('#writings').height() >= $('#releases').height()){ // $('#pieces').height($('#writings').height()); //} else { // $('#pieces').height($('#releases').height()); //} $('#talks').css('height', 'auto'); $('#performances').css('height', 'auto'); if($('#talks').height() >= $('#performances').height()){ $('#events').height($('#talks').height()); $('#performances').css('height', '100%'); } else { $('#events').height($('#performances').height()); $('#talks').css('height', '100%'); } } function openAudioPlayer(data){ $('#galleryPlayer').css('background-color', '#FDFDFD') if (data.soundcloud_secret){ $('#galleryPlayer').html(""); } else { $('#galleryPlayer').html(""); } var widget = SC.Widget('sc_gallery'); widget.bind(SC.Widget.Events.FINISH, function() { embedAudioGallery(true); }); } function embedAudioGallery(autoplay) { $('#galleryPlayer').css('background-color', '#FDFDFD') var uniqueRandoms = []; var numRandoms = 15; function makeUniqueRandom() { // refill the array if needed if (!uniqueRandoms.length) { for (var i = 0; i < numRandoms; i++) { uniqueRandoms.push(i); } } var index = Math.floor(Math.random() * uniqueRandoms.length); var val = uniqueRandoms[index]; // now remove that value from the array uniqueRandoms.splice(index, 1); return val; } $('#galleryPlayer').html(""); var widget = SC.Widget('sc_gallery'); widget.bind(SC.Widget.Events.READY, function() { widget.skip(makeUniqueRandom()); if(!autoplay){ widget.pause(); widget.seekTo(0); } }); widget.bind(SC.Widget.Events.FINISH, function() { widget.skip(makeUniqueRandom()); }); } function embedVideoGallery() { $.getScript('https://vimeo.com/api/v2/mwinter/videos.json?callback=embedVideoGallerySlider'); } function embedVideoGallerySlider(videos) { $('#galleryPlayer').css('background-color', 'black') $('#galleryPlayer').html(""); $('#galleryPlayer').append("