This repository has been archived by the owner. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Updating for SSL (again)
Js files this time
- Loading branch information
Showing
2 changed files
with
178 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,178 +1,178 @@ | ||
jQuery(document).ready(function($) { | ||
|
||
$( ".social-vimeo > a" ).html( "DONATE" ); | ||
|
||
var search = ''; | ||
var active = false; | ||
$('.search').on('click',function(e){ | ||
if($(e.target).attr('id')=='s') return; | ||
active = true; | ||
search = $(e.target).parent().html(); | ||
$('.search').fadeOut(500,function(){ | ||
$(this).html('<form class="form-inline" role="form" method="get" action="http://ece.uconn.edu/"><input id="s" type="text" onfocus="this.value = \'\'" name="s" value="Search ECE"></form>').fadeIn(500); | ||
$(this).addClass('search-field'); | ||
}); | ||
}); | ||
|
||
$('body').on('click',function(e){ | ||
if($(e.target).attr('id')=='s') return; | ||
if($(e.target).parent().html()== search) return; | ||
if(!active) return; | ||
active = false; | ||
$('.search').fadeOut(500,function(){ | ||
$(this).html(search).fadeIn(500); | ||
$('.search').removeClass('search-field'); | ||
}); | ||
}); | ||
|
||
$( "#footers" ).before( "<div class='container'><div class='col-sm-12 footer-img'></div></div>" ); | ||
|
||
$('select[name="discipline"] option:eq(0)').prop("selected", true); | ||
$('select[name="major"] option:eq(0)').prop("selected", true); | ||
|
||
var isCourseSelectActive = false; | ||
var selectedDiscipline; | ||
$('select[name="discipline"]').change(function(e){ | ||
var discipline = $(this).find(":selected").text(); | ||
selectedDiscipline = discipline; | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_discipline_courses", | ||
discipline : discipline | ||
}, | ||
success: function(response){ | ||
if( isCourseSelectActive == true ){ | ||
$('.course-option').remove(); | ||
} | ||
$.each(response, function(i,v){ | ||
$('select[name="course"]').append( | ||
$('<option />', { | ||
'value': v, | ||
'text': v, | ||
'class': "course-option" | ||
}) | ||
); | ||
}); | ||
$('select[name="course"]').show(); | ||
isCourseSelectActive = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
var isCourseInfoVisible = false; | ||
$('select[name="course"]').change(function(e){ | ||
if( isCourseSelectActive == false || selectedDiscipline == undefined ){ | ||
return false; | ||
} | ||
var course = $(this).find(":selected").text(); | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_course_info", | ||
discipline: selectedDiscipline, | ||
course: course | ||
}, | ||
success: function(response){ | ||
if( isCourseInfoVisible == true ){ | ||
$('#ece-course-learnmore').empty(); | ||
$('.major-requiredcourses').remove(); | ||
} | ||
|
||
var courseInfo = response[0]; | ||
$('#ece-course-name').text(courseInfo.discipline + " " + courseInfo.course); | ||
$('#ece-course-learnmore').html( $('#ece-course-learnmore').text() + ' <a href="'+courseInfo.url+'">'+courseInfo.url+'</a>' ); | ||
$.each(courseInfo.majors, function(i,v){ | ||
$('#ece-course-required ul').append( | ||
$('<li />', { | ||
'text': v.major, | ||
'class': "major-requiredcourses" | ||
}) | ||
); | ||
}); | ||
$('#ece-course').show(); | ||
isCourseInfoVisible = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
var isListVisible = false; | ||
$('select[name="major"]').change(function(e){ | ||
var major = $(this).find(":selected").text(); | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_major_info", | ||
major: major, | ||
}, | ||
success: function(response){ | ||
if( isListVisible == true ){ | ||
$('.major-courses').remove(); | ||
} | ||
|
||
var majorInfo = response[0]; | ||
$('#ece-major-name').text(majorInfo.major); | ||
$('#ece-major-url').html('<a href="'+majorInfo.url+'">'+majorInfo.url+'</a>'); | ||
$('ece-major-text').text("UConn ECE offers the following courses which lead to a major in "+majorInfo.major); | ||
$.each(majorInfo.courses, function(i,v){ | ||
$('#ece-major-courses ul').append( | ||
$('<li />', { | ||
'text': v.discipline + " " + v.course, | ||
'class': "major-courses" | ||
}) | ||
); | ||
}); | ||
$('#ece-major').show(); | ||
isListVisible = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
// STICKY FOOTER | ||
// measures height of the page, and applies a class to absolute position the footer, or not. | ||
// on short pages, it sticks; on tall pages, it doesn't. | ||
|
||
function eceStickyFoot(){ | ||
if (document.getElementById('page')!=null && document.getElementById('footers') !=null){ | ||
var wrapperH = $('#page').outerHeight(); | ||
var footerImgH = $('.footer-img').parent().outerHeight(); | ||
var wpadminbarH = $('#wpadminbar').outerHeight(); | ||
var ucheaderH = $('#uc-header').outerHeight(); | ||
var footerH = $('#footers').outerHeight(); | ||
var windowH = window.innerHeight; | ||
var gformH = 0; | ||
$('.gform_wrapper').each(function(){ | ||
gformH = gformH + $(this).outerHeight(); | ||
}); | ||
windowH = windowH - wpadminbarH - ucheaderH; | ||
wrapperH = wrapperH + footerH + footerImgH; | ||
if(windowH>=wrapperH){ | ||
$('body').addClass('sticky'); | ||
} else { | ||
$('body').removeClass('sticky'); | ||
} | ||
} | ||
} | ||
$(document).ready(function(){ | ||
eceStickyFoot(); | ||
}); | ||
$(window).resize(function() { | ||
eceStickyFoot(); | ||
}); | ||
$(window).load(function() { | ||
eceStickyFoot(); | ||
}); | ||
|
||
$('.panel, .collapse').on('shown.bs.collapse', function (e) { | ||
eceStickyFoot(); | ||
}) | ||
$('.panel, .collapse').on('hidden.bs.collapse', function (e) { | ||
eceStickyFoot(); | ||
}) | ||
jQuery(document).ready(function($) { | ||
|
||
$( ".social-vimeo > a" ).html( "DONATE" ); | ||
|
||
var search = ''; | ||
var active = false; | ||
$('.search').on('click',function(e){ | ||
if($(e.target).attr('id')=='s') return; | ||
active = true; | ||
search = $(e.target).parent().html(); | ||
$('.search').fadeOut(500,function(){ | ||
$(this).html('<form class="form-inline" role="form" method="get" action="https://ece.uconn.edu/"><input id="s" type="text" onfocus="this.value = \'\'" name="s" value="Search ECE"></form>').fadeIn(500); | ||
$(this).addClass('search-field'); | ||
}); | ||
}); | ||
|
||
$('body').on('click',function(e){ | ||
if($(e.target).attr('id')=='s') return; | ||
if($(e.target).parent().html()== search) return; | ||
if(!active) return; | ||
active = false; | ||
$('.search').fadeOut(500,function(){ | ||
$(this).html(search).fadeIn(500); | ||
$('.search').removeClass('search-field'); | ||
}); | ||
}); | ||
|
||
$( "#footers" ).before( "<div class='container'><div class='col-sm-12 footer-img'></div></div>" ); | ||
|
||
$('select[name="discipline"] option:eq(0)').prop("selected", true); | ||
$('select[name="major"] option:eq(0)').prop("selected", true); | ||
|
||
var isCourseSelectActive = false; | ||
var selectedDiscipline; | ||
$('select[name="discipline"]').change(function(e){ | ||
var discipline = $(this).find(":selected").text(); | ||
selectedDiscipline = discipline; | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_discipline_courses", | ||
discipline : discipline | ||
}, | ||
success: function(response){ | ||
if( isCourseSelectActive == true ){ | ||
$('.course-option').remove(); | ||
} | ||
$.each(response, function(i,v){ | ||
$('select[name="course"]').append( | ||
$('<option />', { | ||
'value': v, | ||
'text': v, | ||
'class': "course-option" | ||
}) | ||
); | ||
}); | ||
$('select[name="course"]').show(); | ||
isCourseSelectActive = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
var isCourseInfoVisible = false; | ||
$('select[name="course"]').change(function(e){ | ||
if( isCourseSelectActive == false || selectedDiscipline == undefined ){ | ||
return false; | ||
} | ||
var course = $(this).find(":selected").text(); | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_course_info", | ||
discipline: selectedDiscipline, | ||
course: course | ||
}, | ||
success: function(response){ | ||
if( isCourseInfoVisible == true ){ | ||
$('#ece-course-learnmore').empty(); | ||
$('.major-requiredcourses').remove(); | ||
} | ||
|
||
var courseInfo = response[0]; | ||
$('#ece-course-name').text(courseInfo.discipline + " " + courseInfo.course); | ||
$('#ece-course-learnmore').html( $('#ece-course-learnmore').text() + ' <a href="'+courseInfo.url+'">'+courseInfo.url+'</a>' ); | ||
$.each(courseInfo.majors, function(i,v){ | ||
$('#ece-course-required ul').append( | ||
$('<li />', { | ||
'text': v.major, | ||
'class': "major-requiredcourses" | ||
}) | ||
); | ||
}); | ||
$('#ece-course').show(); | ||
isCourseInfoVisible = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
var isListVisible = false; | ||
$('select[name="major"]').change(function(e){ | ||
var major = $(this).find(":selected").text(); | ||
$.ajax({ | ||
type: "POST", | ||
url: ece_object.ajaxurl, | ||
data: { | ||
action: "ece_major_info", | ||
major: major, | ||
}, | ||
success: function(response){ | ||
if( isListVisible == true ){ | ||
$('.major-courses').remove(); | ||
} | ||
|
||
var majorInfo = response[0]; | ||
$('#ece-major-name').text(majorInfo.major); | ||
$('#ece-major-url').html('<a href="'+majorInfo.url+'">'+majorInfo.url+'</a>'); | ||
$('ece-major-text').text("UConn ECE offers the following courses which lead to a major in "+majorInfo.major); | ||
$.each(majorInfo.courses, function(i,v){ | ||
$('#ece-major-courses ul').append( | ||
$('<li />', { | ||
'text': v.discipline + " " + v.course, | ||
'class': "major-courses" | ||
}) | ||
); | ||
}); | ||
$('#ece-major').show(); | ||
isListVisible = true; | ||
eceStickyFoot(); | ||
}, dataType: "json" | ||
}); | ||
}); | ||
|
||
// STICKY FOOTER | ||
// measures height of the page, and applies a class to absolute position the footer, or not. | ||
// on short pages, it sticks; on tall pages, it doesn't. | ||
|
||
function eceStickyFoot(){ | ||
if (document.getElementById('page')!=null && document.getElementById('footers') !=null){ | ||
var wrapperH = $('#page').outerHeight(); | ||
var footerImgH = $('.footer-img').parent().outerHeight(); | ||
var wpadminbarH = $('#wpadminbar').outerHeight(); | ||
var ucheaderH = $('#uc-header').outerHeight(); | ||
var footerH = $('#footers').outerHeight(); | ||
var windowH = window.innerHeight; | ||
var gformH = 0; | ||
$('.gform_wrapper').each(function(){ | ||
gformH = gformH + $(this).outerHeight(); | ||
}); | ||
windowH = windowH - wpadminbarH - ucheaderH; | ||
wrapperH = wrapperH + footerH + footerImgH; | ||
if(windowH>=wrapperH){ | ||
$('body').addClass('sticky'); | ||
} else { | ||
$('body').removeClass('sticky'); | ||
} | ||
} | ||
} | ||
$(document).ready(function(){ | ||
eceStickyFoot(); | ||
}); | ||
$(window).resize(function() { | ||
eceStickyFoot(); | ||
}); | ||
$(window).load(function() { | ||
eceStickyFoot(); | ||
}); | ||
|
||
$('.panel, .collapse').on('shown.bs.collapse', function (e) { | ||
eceStickyFoot(); | ||
}) | ||
$('.panel, .collapse').on('hidden.bs.collapse', function (e) { | ||
eceStickyFoot(); | ||
}) | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.