Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
bf97b8204b
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
137 lines (123 sloc) 3.77 KB
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;
}, 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;
}, 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;
}, dataType: "json"
});
});
});