/* $This file is distributed under the terms of the license in /doc/license.txt$ */ $(document).ready(function(){ $.extend(this, urlsBase); $.extend(this, facultyMemberCount); $.extend(this, i18nStrings); var retryCount = 0; // this will ensure that the hidden classgroup input is cleared if the back button is used // to return to th ehome page from the search results $('input[name="classgroup"]').val(""); getFacultyMembers(); buildAcademicDepartments(); if ( $('section#home-geo-focus').length == 0 ) { $('section#home-stats').css("display","inline-block").css("margin-top","20px"); } function getFacultyMembers() { var individualList = ""; if ( facultyMemberCount > 0 ) { // determine the row at which to start the solr query var rowStart = Math.floor((Math.random()*facultyMemberCount)); var diff; var pageSize = 4; // the number of faculty to display on the home page // could have fewer than 4 in a test or dev environment if ( facultyMemberCount < pageSize ) { pageSize = facultyMemberCount; } // in case the random number is equal to or within 3 of the facultyMemberCount // subtract 1 from the facultyMemberCount because the Solr rows begin at 0, not 1 if ( (rowStart + (pageSize-1)) > (facultyMemberCount-1) ) { diff = (rowStart + (pageSize-1)) - (facultyMemberCount-1); if ( diff == 0 ) { rowStart = rowStart - (pageSize-1); } else { rowStart = rowStart - diff; } } if ( rowStart < 0 ) { rowStart = 0; } 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) { if ( results == null || results.individuals.length == 0 ) { if ( retryCount < 3 ) { retryCount = retryCount + 1; getFacultyMembers(); } else { individualList = "