Skip to content

Commit

Permalink
Imported new logo in
Browse files Browse the repository at this point in the history
  • Loading branch information
Feni committed Nov 8, 2012
1 parent 7b22751 commit f53a8dd
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 45 deletions.
113 changes: 102 additions & 11 deletions GradeBook.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,123 @@
</head>

<body onload="init()">
<div id = "Header">
<img src = "Logo2.png" id = "Logo"></img>
</div>
<div id = "Content">
<!--Insert Template Selection Here-->

<div id = "Category">
<div id = "Header">
<img src="Logo3.png" id ="Logo"></img>
<h3 id ="Title">GradeBook</h3>
</div>

<div id = "Homework" class = "Category">
<div id = "CatHeader">
<h2>Homeworks</h2>
<input type="text" name="field" id="HomeworkPercentage" class = "Percentage" value ="10"/>
</div>
<hr>

<!-- --------------------------------------------------------------------- -->
<hr>
<ol id="HomeworkGrades">
<p onclick="addGradeField('Homework');" class = "CatNav"> Add Grades </p>
</ol>

<!-- Option here to drop lowest ___ grades -->
<hr>
<h3 id="Total">Total:</h3>
<h2 id="HomeworkTotal" class = "Total">0/0</h2>
</div>

<div id = "Quiz" class = "Category">
<div id = "CatHeader">
<h2>Quizes</h2>
<input type="text" name="field" id="QuizPercentage" class = "Percentage" value ="15"/>
</div>
<hr>
<ol id="QuizGrades">
<p onclick="addGradeField('Quiz');" class = "CatNav"> Add Grades </p>
</ol>
<hr>
<h3 id="Total">Total:</h3>
<h2 id="QuizTotal" class = "Total">0/0</h2>
</div>

<div id = "Test" class = "Category">
<div id = "CatHeader">
<h2>Tests</h2>
<input type="text" name="field" id="TestPercentage" class = "Percentage" value ="25"/>
</div>
<hr>
<ol id="TestGrades">
<p onclick="addGradeField('Test');" class = "CatNav"> Add Grades </p>
</ol>
<hr>
<h3 id="Total">Total:</h3>
<h2 id="HomeworkTotal">0/0</h2>

<h2 id="TestTotal" class = "Total">0/0</h2>
</div>

<div id = "Project" class = "Category">
<div id = "CatHeader">
<h2>Projects</h2>
<input type="text" name="field" id="ProjectPercentage" class = "Percentage" value ="20"/>
</div>
<hr>
<ol id="ProjectGrades">
<p onclick="addGradeField('Project');" class = "CatNav"> Add Grades </p>
</ol>
<hr>
<h3 id="Total">Total:</h3>
<h2 id="ProjectTotal" class = "Total">0/0</h2>
</div>

<div id = "Other" class = "Category">
<div id = "CatHeader">
<h2>Other</h2>
<input type="text" name="field" id="OtherPercentage" class = "Percentage" value ="5"/>
</div>
<hr>
<ol id="OtherGrades">
<p onclick="addGradeField('Other');" class = "CatNav"> Add Grades </p>
</ol>
<hr>
<h3 id="Total">Total:</h3>
<h2 id="OtherTotal" class = "Total">0/0</h2>
</div>

<div id = "Final" class = "Category">
<div id = "CatHeader">
<h2>Final Exam</h2>
<input type="text" name="field" id="FinalPercentage" class = "Percentage" value ="25"/>
</div>
<ol id="FinalGrades">
<input type = "checkbox" id ="FinalGradeMarker1" class = "ActiveMarker" checked="True">
<input type="text" id="FinalGradeValue1" value = "100"/>
</ol>

<h3 id="Total">Total:</h3>
<h2 id="FinalTotal" class = "Total">0/0</h2>
</div>

<div id="Summary">
<h2 class="CategoryName" id="HomeworkSummary">Homeworks</h2> <!-- todo: show ( 0.0% ) -->
<h2 class="CategoryTotal" id="HomeworkTotalSummary">0</h2>

<h2 class="CategoryName" id="QuizSummary">Quizes</h2>
<h2 class="CategoryTotal" id="QuizTotalSummary">0</h2>

<h2 class="CategoryName" id="TestSummary">Tests</h2>
<h2 class="CategoryTotal" id="TestTotalSummary">0</h2>

<h2 class="CategoryName" id="ProjectSummary">Projects</h2>
<h2 class="CategoryTotal" id="ProjectTotalSummary">0</h2>

<h2 class="CategoryName" id="OtherSummary">Other</h2>
<h2 class="CategoryTotal" id="OtherTotalSummary">0</h2>

<h2 class="CategoryName" id="FinalSummary">Final Exam</h2>
<h2 class="CategoryTotal" id="FinalTotalSummary">0</h2>

<hr>
<!-- Possible name conflict bug if, for the future custom categories, someone names a category "Total".
For now, this works... -->
<h2 class="CategoryName" id="TotalSummary">Total</h2> <!-- Todo: show total percentage -->
<h2 class ="CategoryTotal" id ="TotalTotalSummary">0</h2>
</div>
</div>


Expand Down
42 changes: 29 additions & 13 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
function addGradeField() {
var gradesList = document.getElementById("HomeworkGrades");
function addGradeField(category) {
var gradesList = document.getElementById(category+"Grades");
var newGrade = document.createElement("li");
var idCode = gradesList.childNodes.length - 2;

/// A little quick fix to fix IDs. It messes up because the active marker throws off the count for everything after the first one...
if(idCode > 1)
idCode = idCode-1;
idCode = (idCode+1)/2;

newGrade.setAttribute("id","Grade"+idCode);
newGrade.setAttribute("id",category+"Grade"+idCode);
newGrade.setAttribute("class", "Grade");
newGrade.innerHTML = '<input type="text"class="GradeName" value="Homework #"/><input type="text" class="GradeValue" id="GradeValue'+idCode+'" value = "100" />';
newGrade.innerHTML = '<input type="text"class="GradeName" value="'+category+' #"/><input type="text" class="GradeValue" id="'+category+'GradeValue'+idCode+'" value = "100" />';

var activeMarker = document.createElement('input');
activeMarker.type = "checkbox";
activeMarker.id = "GradeMarker"+idCode;
activeMarker.id = ""+category+"GradeMarker"+idCode;
activeMarker.setAttribute("class", "ActiveMarker");
activeMarker.setAttribute("Checked", "True");
gradesList.appendChild(activeMarker);
Expand All @@ -22,34 +22,50 @@ function addGradeField() {
}

function init(){
setInterval('calculateGrade()', 1000);
setInterval('calculateTotal()', 3000);
}

function calculateGrade()
function calculateTotal()
{
// This could be converted into a for loop, sure... but too much code overhead... This is cleaner and more efficient.
var homeworkGrade = calculateGrade("Homework") * parseFloat(document.getElementById("HomeworkPercentage").value)/100.0;
var quizGrade = calculateGrade("Quiz") * parseFloat(document.getElementById("QuizPercentage").value)/100.0;
var testGrade = calculateGrade("Test") * parseFloat(document.getElementById("TestPercentage").value)/100.0;
var projectGrade = calculateGrade("Project") * parseFloat(document.getElementById("ProjectPercentage").value)/100.0;
var otherGrade = calculateGrade("Other") * parseFloat(document.getElementById("OtherPercentage").value)/100.0;
var finalGrade = calculateGrade("Final") * parseFloat(document.getElementById("FinalPercentage").value)/100.0;

var total = ( homeworkGrade + quizGrade + testGrade + projectGrade ) * 100.0;

document.getElementById("TotalTotalSummary").innerHTML = total;
}

function calculateGrade(category)
{
// Todo: add grade/total field, instead of assuming it's out of 100...
// var gradeValue = document.getElementById('myText');
// myTextField.value != ""

var i = 1;

var gradeValue = document.getElementById("GradeValue"+i);
var gradeValue = document.getElementById(category+"GradeValue"+i);

var grade = 0;
var total = 0;

while( gradeValue != null){
// Do stuff with the grade value.

var activeCheck = document.getElementById("GradeMarker"+i);
var activeCheck = document.getElementById(category+"GradeMarker"+i);
if(activeCheck.checked){ // Check if we shoudl include that grade in...
grade+=parseFloat(gradeValue.value); // Note: Do parseInt here instead?
total+=100;
}
i++;
gradeValue = document.getElementById("GradeValue"+i);
gradeValue = document.getElementById(category+"GradeValue"+i);
}

document.getElementById("HomeworkTotal").innerHTML = ""+grade+"/"+total;
document.getElementById(category+"Total").innerHTML = ""+grade+"/"+total;
document.getElementById(category+"TotalSummary").innerHTML = ""+grade+"/"+total;
return grade/total;
}

112 changes: 91 additions & 21 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,54 @@
body{
background-color:#333333;
/* background-color:#EFF1F1; */


padding:0px 0px 0px 0px;
font: normal 1em/1.5 Georgia, serif;
}


#Content
{
padding-top:150px;
background-color:#8b6840;
background-image:url("recycled-paper-texture.jpg");
border: 2px solid gray;
padding-bottom:102px;
-moz-border-radius:8px;
-webkit-border-radius:8px;

-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 3px;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 3px;
}


#Title
{
font:normal Sans, Comics;
text-align:center;
color:white;
}

#Header
{
background-color:#333333;
border-width:0px;
width:450px;
height:60px;
position:absolute;
display:inline-block;
left:0px;
top:70px;
}

#Logo
{
position:absolute;
left:15px;
top:-25px;
}

.ActiveMarker
{
display:inline;
Expand All @@ -25,27 +69,18 @@ body{
opacity:1;
}

#Content
{
padding-top:70px;
background-color:#FFFFFF;
border: 2px solid gray;
padding-bottom:102px;
/* -moz-border-radius:8px;
-webkit-border-radius:8px; */

-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 3px;
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 3px;
}

#Category
.Category
{
display: block;
width:800px;
min-height:75px;
background:white;
margin-left: auto;
margin-right: auto;

margin-top:30px;
margin-bottom:30px;

border: 1px solid gray;
padding:10px 20px 10px 20px;
-moz-border-radius:8px;
Expand All @@ -54,6 +89,29 @@ body{
-moz-box-shadow: rgba(0, 0, 0, 0.3) 0px 1px 3px;
}

#Summary
{
display: block;
width:800px;
min-height:75px;
margin-left:auto;
margin-right:auto;
margin-top:30px;
margin-bottom:80px;
}

.CategoryName
{
display:block;
}
.CategoryTotal
{
display:block;
text-align:right;
color:black;
clear:right;
}

#Logo
{
display:block;
Expand Down Expand Up @@ -101,13 +159,6 @@ body{
border: 1px solid #aaaaaa;
}

#HomeworkTotal
{
color:black;
font-size:32px;
padding:0 0 0 0;
}

.GradeValue
{
float:right;
Expand All @@ -116,6 +167,17 @@ body{
border:0px solid #ffffff;
}

#FinalGradeValue1
{
display:block;
width:50px;
height:50px;

margin-left:auto;
margin-right:auto;
text-align:center;
}

.GradeName
{
width:300px;
Expand Down Expand Up @@ -162,3 +224,11 @@ hr{
font-size:16px;
display:inline;
}


.Total
{
color:black;
font-size:32px;
padding:0 0 0 0;
}

0 comments on commit f53a8dd

Please sign in to comment.