Last active
March 1, 2019 18:51
-
-
Save bunlongheng/2a96861f6674240f5f4c to your computer and use it in GitHub Desktop.
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
'use strict'; | |
define(['jquery'], function($) { | |
$(function() { | |
/*================================= | |
= Variables = | |
=================================*/ | |
var $progressionBenchmark = $('#progression-benchmark'); | |
var $courseBenchmark = $('.course-benchmark'); | |
var $chapter = $('.chapter'); | |
var $student = $('.student'); | |
var $classView = $('#class-view'); | |
var $pbImage = $('#pb-image'); | |
var $cbImage = $('#cb-image'); | |
var $chImage = $('#ch-image'); | |
var $cbBtns = $('.cb-btns'); | |
var $chBtns = $('.ch-btns'); | |
var $pbSection = $('.pb'); | |
var $cbSection = $('.cb'); | |
var $chSection = $('.ch'); | |
var $chBtnsRow = $('.ch-btns-row'); | |
var $btnTime = $('#btn-time'); | |
var $btnRemediation = $('#btn-remediation'); | |
var $btnStandard = $('#btn-standard'); | |
var $btnAssignment = $('#btn-assignment'); | |
var $btnBiDefault = $('.btn-bi-default'); | |
var $btnSectionExercise = $('#btn-section-exercise'); | |
var $btnChTest = $('#btn-chapter-test'); | |
var $btnPrTest = $('#btn-practice-test'); | |
var $btnQuiz = $('#btn-quiz'); | |
var basePath = '/BIM/resources/images/monitorprogress/reports/'; | |
/*======================================== | |
= Helper Functions = | |
========================================*/ | |
function imgLoader(object) { | |
if (typeof object.btn !== "undefined") { | |
$btnBiDefault.removeClass('btn-bi-default-clicked'); | |
object.btn.addClass('btn-bi-default-clicked'); | |
} | |
object.img.finish().fadeIn('fast'); | |
object.img.attr('src', object.imgPath).fadeIn('fast'); | |
} | |
function classViewReset() { | |
$classView.show(); | |
$student.removeClass('active'); | |
$classView.removeClass('active'); | |
$('#dd').find('span').text('Class View'); | |
} | |
//-------------------------------------------------------------------------------------------------------- [ Init ] | |
function pbInit() { | |
$classView.removeClass('active'); | |
$student.addClass('active'); | |
$('#dd').find('span').text($student.text()); | |
$classView.hide(); | |
$cbSection.add($chSection).add($cbBtns).add($chBtns).add($chBtnsRow).css("display", "none"); | |
$pbSection.fadeIn('fast'); | |
imgLoader({ | |
img: $pbImage, | |
imgPath: basePath + 'Progression Benchmark/Student.png' | |
}); | |
} | |
function cbInit() { | |
classViewReset(); | |
$btnStandard.fadeIn('fast'); | |
$pbSection.add($chSection).add($chBtns).add($chBtnsRow).add($btnTime).add($btnRemediation).css("display", "none"); | |
$cbSection.add($cbBtns).fadeIn('fast'); | |
imgLoader({ | |
img: $cbImage, | |
btn: $btnAssignment, | |
imgPath: basePath + 'Course Benchmark/Assignment.png' | |
}); | |
} | |
function chInit() { | |
classViewReset(); | |
$btnStandard.css("display", "none"); | |
$pbSection.add($cbSection).add($cbBtns).css("display", "none"); | |
$chSection.add($chBtns).add($chBtnsRow).fadeIn('fast'); | |
$btnBiDefault.removeClass('btn-ch-default-clicked'); | |
$btnBiDefault.removeClass('btn-bi-default-clicked'); | |
$chImage.attr('src', basePath + 'white.png'); | |
} | |
function seInit() { | |
classViewReset(); | |
$btnStandard.css("display", "none"); | |
$chBtns.add($cbBtns).add($btnTime).add($btnRemediation).fadeIn('fast'); | |
// Highlight SE | |
$btnBiDefault.removeClass('btn-ch-default-clicked'); | |
$btnSectionExercise.addClass('btn-ch-default-clicked'); | |
// Greyout TA | |
$btnBiDefault.removeClass('btn-bi-default-disabled'); | |
$btnTime.addClass('btn-bi-default-disabled'); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnAssignment, | |
imgPath: basePath + 'Section Exercise/Assignment.png' | |
}); | |
} | |
function quizInit() { | |
[$chBtns, $cbBtns, $btnTime, $btnRemediation].forEach(function($item) { | |
$item.fadeIn('fast'); | |
}); | |
classViewReset(); | |
$btnStandard.css("display", "none"); | |
// Highlight Quiz | |
$btnBiDefault.removeClass('btn-ch-default-clicked'); | |
$btnQuiz.addClass('btn-ch-default-clicked'); | |
// Highlight AP | |
$btnBiDefault.removeClass('btn-bi-default-clicked'); | |
$btnAssignment.addClass('btn-bi-default-clicked'); | |
// Greyout TA, R | |
$btnBiDefault.removeClass('btn-bi-default-disabled'); | |
$btnTime.addClass('btn-bi-default-disabled'); | |
$btnRemediation.addClass('btn-bi-default-disabled'); | |
$btnRemediation.attr('disabled', 'disabled'); | |
imgLoader({ | |
btn: $btnAssignment, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Quiz/Assignment.png' | |
}); | |
} | |
function practiceTestInit() { | |
classViewReset(); | |
$btnStandard.css("display", "none"); | |
[$chBtns, $cbBtns, $btnTime, $btnRemediation].forEach(function($item) { | |
$item.fadeIn('fast'); | |
}); | |
// Highlight PT | |
$btnBiDefault.removeClass('btn-ch-default-clicked'); | |
$btnPrTest.addClass('btn-ch-default-clicked'); | |
// Highlight AP | |
$btnBiDefault.removeClass('btn-bi-default-clicked'); | |
$btnAssignment.addClass('btn-bi-default-clicked'); | |
// Greyout TA, R | |
$btnBiDefault.removeClass('btn-bi-default-disabled'); | |
$btnTime.addClass('btn-bi-default-disabled'); | |
$btnRemediation.addClass('btn-bi-default-disabled'); | |
$btnRemediation.attr('disabled', 'disabled'); | |
imgLoader({ | |
img: $chImage, | |
imgPath: basePath + 'Chapter Practice Test/Assignment.png' | |
}); | |
} | |
function chapterTestInit() { | |
classViewReset(); | |
$btnStandard.css("display", "none"); | |
[$chBtns, $cbBtns, $btnTime, $btnRemediation].forEach(function($item) { | |
$item.fadeIn('fast'); | |
}); | |
// Highlight CT | |
$btnBiDefault.removeClass('btn-ch-default-clicked'); | |
$btnChTest.addClass('btn-ch-default-clicked'); | |
// Highlight AP | |
$btnBiDefault.removeClass('btn-bi-default-clicked'); | |
$btnAssignment.addClass('btn-bi-default-clicked'); | |
// Un Greyout everything | |
$btnBiDefault.removeClass('btn-bi-default-disabled'); | |
imgLoader({ | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Assignment.png' | |
}); | |
} | |
//-------------------------------------------------------------------------------------------------------- [ Click ] | |
/*============================================= | |
= Progression Benchmark = | |
=============================================*/ | |
function pbClick() { | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
$classView.off().click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
$student.off().click(function(e) { | |
e.preventDefault(); | |
$btnStandard.css("display", "none"); | |
$cbBtns.add($chBtns).css("display", "none"); | |
imgLoader({ | |
img: $pbImage, | |
imgPath: basePath + 'Progression Benchmark/Student.png' | |
}); | |
}); | |
}); | |
} | |
/*================================================ | |
= Course Benchmark Pretest = | |
================================================*/ | |
function cbClick() { | |
$courseBenchmark.off().click(function(e) { | |
e.preventDefault(); | |
cbInit(); | |
$student.off().click(function(e) { | |
e.preventDefault(); | |
$btnStandard.css("display", "none"); | |
imgLoader({ | |
btn: $btnAssignment, | |
img: $cbImage, | |
imgPath: basePath + 'Course Benchmark/Student.png', | |
}); | |
}); | |
$btnAssignment.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnAssignment, | |
img: $cbImage, | |
imgPath: basePath + 'Course Benchmark/Assignment.png' | |
}); | |
}); | |
$btnStandard.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnStandard, | |
img: $cbImage, | |
imgPath: basePath + 'Course Benchmark/Standards.png' | |
}); | |
}); | |
$classView.off().click(function(e) { | |
e.preventDefault(); | |
cbInit(); | |
}); | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
}); | |
} | |
/*======================================== | |
= Section Exercise = | |
========================================*/ | |
function seClick() { | |
$btnSectionExercise.click(function(e) { | |
e.preventDefault(); | |
seInit(); | |
$btnStandard.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnStandard, | |
imgPath: basePath + 'Section Exercise/Standards.png' | |
}); | |
}); | |
$btnRemediation.off().click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnRemediation, | |
imgPath: basePath + 'Section Exercise/Remediation.png' | |
}); | |
}); | |
$btnAssignment.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnAssignment, | |
imgPath: basePath + 'Section Exercise/Assignment.png' | |
}); | |
}); | |
$student.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnSectionExercise, | |
img: $chImage, | |
imgPath: basePath + 'Section Exercise/Student.png' | |
}); | |
}); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
seInit(); | |
}); | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
}); | |
} | |
/*============================ | |
= Quiz = | |
============================*/ | |
function quizClick() { | |
$btnQuiz.click(function(e) { | |
e.preventDefault(); | |
quizInit(); | |
$btnRemediation.off().click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
imgPath: basePath + 'Chapter Quiz/Assignment.png' | |
}); | |
}); | |
$btnStandard.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnStandard, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Quiz/Standards.png' | |
}); | |
}); | |
$btnAssignment.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnAssignment, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Quiz/Assignment.png' | |
}); | |
}); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
quizInit(); | |
}); | |
$student.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnQuiz, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Quiz/Student.png' | |
}); | |
}); | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
}); | |
} | |
/*===================================== | |
= Practice Test = | |
=====================================*/ | |
function prTestClick() { | |
$btnPrTest.click(function(e) { | |
e.preventDefault(); | |
practiceTestInit(); | |
$btnRemediation.off().click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
imgPath: basePath + 'Chapter Practice Test/Assignment.png' | |
}); | |
}); | |
$btnStandard.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnStandard, | |
imgPath: basePath + 'Chapter Practice Test/Standards.png' | |
}); | |
}); | |
$btnAssignment.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
btn: $btnAssignment, | |
imgPath: basePath + 'Chapter Practice Test/Assignment.png' | |
}); | |
}); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
practiceTestInit(); | |
}); | |
$student.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnPrTest, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Practice Test/Student.png' | |
}); | |
}); | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
}); | |
} | |
/*==================================== | |
= Chapter Test = | |
====================================*/ | |
function chTestClick() { | |
$btnChTest.click(function(e) { | |
e.preventDefault(); | |
chapterTestInit(); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
chapterTestInit(); | |
}); | |
$student.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnChTest, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Student.png' | |
}); | |
}); | |
$btnStandard.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnStandard, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Standards.png' | |
}); | |
}); | |
$btnAssignment.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Assignment.png' | |
}); | |
}); | |
$btnTime.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnTime, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Time.png' | |
}); | |
}); | |
$btnRemediation.off().click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
btn: $btnRemediation, | |
img: $chImage, | |
imgPath: basePath + 'Chapter Test/Remediation.png' | |
}); | |
}); | |
$progressionBenchmark.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
}); | |
} | |
//-------------------------------------------------------------------------------------------------------- [ Start ] | |
/*============================= | |
= Start = | |
=============================*/ | |
pbInit(); | |
$student.click(function(e) { | |
e.preventDefault(); | |
imgLoader({ | |
img: $pbImage, | |
imgPath: basePath + 'Progression Benchmark/Student.png' | |
}); | |
}); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
pbInit(); | |
}); | |
pbClick(); | |
cbClick(); | |
/*===================================== | |
= Chapter Boxes = | |
=====================================*/ | |
$chapter.click(function(e) { | |
e.preventDefault(); | |
chInit(); | |
$student.click(function(e) { | |
e.preventDefault(); | |
chInit(); | |
}); | |
$classView.click(function(e) { | |
e.preventDefault(); | |
chInit(); | |
}); | |
// All possible click options. | |
pbClick(); | |
cbClick(); | |
seClick(); | |
quizClick(); | |
prTestClick(); | |
chTestClick(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment