function setup_home_video() { var video = ''; $('.videoImage').click(function(){ document.getElementById('homeVideo').innerHTML = video; }); } // HOVER SYNCHING function setup_hover_sync() { var hlID; $(".widerightcolumn .highlight").hover(function(){ hlID = ($(this).attr("id")); hlID = "#" + hlID.replace("rsynch", "lsynch"); $(this).addClass("hlON"); $(hlID).addClass("hlON"); }, function(){ $(".highlight").removeClass("hlON"); }); $(".leftsidebar .highlight").hover(function(){ hlID = ($(this).attr("id")); hlID = "#" + hlID.replace("lsynch", "rsynch"); $(this).addClass("hlON"); $(hlID).addClass("hlON"); }, function(){ $(".highlight").removeClass("hlON"); }); } function setup_search_columns() { // Search Width Expanding and Collapsing var notebookWidth = $("#notebook-results").css("width"); var photoWidth = $("#photo-results").css("width"); var wpWidth = $("#wp-results").css("width"); $(".zero").closest(".search-results-container").addClass("none"); $(".toggleWidth").click(function() { if($(this).hasClass("expand")){ $(".collapse").removeClass("collapse").addClass("expand").html("Expand"); $(this).prev().animate({"width": 682}); $(this).parent().siblings().find(".search-results").animate({"width": 80}, {duration:"fast"}); $(this).parent().siblings().find(".extra").hide(); $(this).parent().find(".extra").show(); $(this).html("Collapse").removeClass("expand").addClass("collapse"); } else { $("#notebook-results").animate({ "width": notebookWidth }); $("#photo-results").animate({ "width": photoWidth }); $("#wp-results").animate({ "width": wpWidth }); $(this).parent().parent().find(".extra").show(); $(this).html("Expand").removeClass("collapse").addClass("expand"); } }); } // Vertical Resizing of Search function resizeVSearch () { var otherHeight = 365; // If we go through the trouble of clearing divs, we can calculate this based on div heights. var winHeight = $(window).height(); $('.wrap .search-results').height(winHeight - otherHeight); } function setup_vertical_resizing() { // Trigger on load resizeVSearch(); // Trigger on resize $(window).resize(function(){ resizeVSearch(); // Note, we may want to recheck height for dynamic loading of content if size increased. }); } function setup_imagebox() { Shadowbox.setup('.notebook-thumb a'); Shadowbox.setup('.photo-thumb a'); } function top_rotate_image(e) { current = $('.top-photo-candidate.show'); next = $('.top-photo-candidate.show').next(); if (!next.length) next = $('.top-photo-candidate').eq(0); current.fadeOut(); next.fadeIn(); current.removeClass('show') next.addClass('show'); e.preventDefault(); } function setup_resizeable_textareas() { $('textarea').autoResize({ // Quite slow animation: animateDuration : 300, // More extra space: extraSpace : 40 }); } function setup_nav_menu() { $('ul.sf-menu').superfish({ onHide: function(){ $(this).prev().removeClass("active"); } // callback function fires after a sub-menu has closed – 'this' is the ul that just closed }); $('ul.sf-menu li ul').hover(function(){ $(this).prev().addClass("active"); }); } function setup_nav_clicking() { $('#nav li').click(click_closest); $('.leftsidebar li').click(click_closest); } function click_closest() { if ($(this).children("a").length) location.href = $(this).children("a").attr('href'); } function loadNotebooks(query) { $.post('/wp-admin/admin-ajax.php', {action: 'notebook_search', query: searchquery, limit: 1000, offset: 0}, loadNotebooksCallback, 'json'); } function loadNotebooksCallback(json) { $('#notebook-results-container .total').text(json.num); if (json.num == 0) { $('#notebook-results').append($("

No notebook pages found.

")); } else { for (var i in json.results){ var nb = json.results[i]; var html = "
TITLE
" .replace(/UPPER/g,nb.id) .replace(/LOWER/g,nb.id.toLowerCase()) .replace(/PREFIX/g,nb.prefix) .replace(/TITLE/g,nb.title); $('#notebook-results .height').append($(html)); } setup_imagebox(); $("#notebook-results img").lazyload({ threshold : 200, container: $("#notebook-results"), placeholder : "/wp-content/themes/edgerton-beta/js/images/less-trans-white.png" }); } open_hashpage(); } function loadPhotos() { $.post('/wp-admin/admin-ajax.php', {action: 'photo_search', query: searchquery, limit: 1000, offset: 0}, loadPhotosCallback, 'json'); } function loadPhotosCallback(json) { $('#photo-results-container .total').text(json.num); if (json.num == 0) { $('#photo-results').append($("

No photos found.

")); } else { for (var i in json.results){ var photo = json.results[i]; var odd = (photo.id.replace(/[^\d]/g,'')) % 2; var id = photo.id.toLowerCase(); var ID = photo.id.toUpperCase() /*var html = "
IDENTIFIER
" .replace(/IDENTIFIER/g,ID) .replace(/identifier/g,id) .replace(/TITLE/g,photo.title) .replace(/PARITY/g,(odd?'odds':'evens'));*/ var html = $("
IDENTIFIER
"); html .find('a') .attr('data-alt','http://webmuseum.mit.edu/images/DIAmed/' + ID + '.L.jpg') .attr('href','/galleries/museum/' + id + '?nowrap') .attr('title',photo.title) .attr('id',id) .end() .find('img') .attr('alt',ID) .attr('src','/museumthumbs/' + (odd?'odds':'evens') + '/' + id +'.T.jpg'); $('#photo-results .height').append(html); } $("#photo-results img").lazyload({ threshold : 200, container: $("#photo-results"), placeholder : "/wp-content/themes/edgerton-beta/js/images/less-trans-white.png" }); setup_imagebox(); } open_hashpage(); } function setup_result_scrollers() { $('#photo-results').scroll(function(){ $(window).scroll(); }); $('#notebook-results').scroll(function(){ $(window).scroll(); }); }