/* $This file is distributed under the terms of the license in /doc/license.txt$ */ $(document).ready(function(){ $.extend(this, urlsBase); // $.extend(this, facultyMemberCount); getFacultyMembers(); buildAcademicDepartments(); if ( $('section#home-geo-focus').length == 0 ) { $('section#home-stats').css("display","inline-block").css("margin-top","20px"); } function getFacultyMembers() { // determine the row at which to start the solr query var rowStart = Math.floor((Math.random()*facultyMemberCount)+1)-1; var diff; var pageSize = 4; // the number of faculty to display on the home page // in case the random number is equal to or within 3 of the facultyMemberCount if ( (rowStart + (pageSize-1)) > facultyMemberCount ) { diff = (rowStart + (pageSize-1)) - facultyMemberCount; if ( diff == 0 ) { rowStart = rowStart - (pageSize-1); } else { rowStart = rowStart - diff; } } var dataServiceUrl = urlsBase + "/dataservice?getRandomSolrIndividualsByVClass=1&vclassId="; var url = dataServiceUrl + encodeURIComponent("http://vivoweb.org/ontology/core#FacultyMember"); url += "&page=" + rowStart + "&pageSize=" + pageSize; $.getJSON(url, function(results) { var individualList = ""; if ( results == null || results.individuals.length == 0 ) { individualList = "

  • No faculty records found.
  • "; $('div#tempSpacing').hide(); $('div#research-faculty-mbrs ul#facultyThumbs').append(individualList); } else { var vclassName = results.vclass.name; $.each(results.individuals, function(i, item) { var individual = results.individuals[i]; individualList += individual.shortViewHtml; }); $('div#tempSpacing').hide(); $('div#research-faculty-mbrs ul#facultyThumbs').append(individualList); $.each($('div#research-faculty-mbrs ul#facultyThumbs li.individual'), function() { if ( $(this).children('img').length == 0 ) { var imgHtml = "placeholder image"; $(this).prepend(imgHtml); } else { $(this).children('img').load( function() { adjustImageHeight($(this)); }); } }); var viewMore = ""; } $('div#academic-depts').html(html); } });