diff --git a/case1/mpl_links_txt.html b/case1/mpl_links.html similarity index 97% rename from case1/mpl_links_txt.html rename to case1/mpl_links.html index 956d056..5d2893c 100644 --- a/case1/mpl_links_txt.html +++ b/case1/mpl_links.html @@ -7,8 +7,8 @@ Case Problem 1 Monroe Public Library Government Links - Author: - Date: + Author: Cameron Odom + Date: 04/10/2019 Filename: mpl_links.html --> @@ -17,6 +17,7 @@ +
diff --git a/case1/mpl_links.js b/case1/mpl_links.js new file mode 100644 index 0000000..da98a17 --- /dev/null +++ b/case1/mpl_links.js @@ -0,0 +1,24 @@ +"use strict"; + +/* + New Perspectives on HTML5, CSS3, and JavaScript 6th Edition + Tutorial 13 + Case Problem 1 + + Author: Denise Kruschev + Date: 2018-03-01 + + Filename: mpl_links.js + +*/ + + +window.addEventListener("load", function() { + var allSelect = document.querySelectorAll("form#govLinks select"); + + for (var i = 0; i < allSelect.length; i++) { + allSelect[i].onchange = function(e) { + location.href = e.target.value; + } + } +}); \ No newline at end of file diff --git a/case1/mpl_links_txt.js b/case1/mpl_links_txt.js deleted file mode 100644 index fe21beb..0000000 --- a/case1/mpl_links_txt.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -/* - New Perspectives on HTML5, CSS3, and JavaScript 6th Edition - Tutorial 13 - Case Problem 1 - - Author: - Date: - - Filename: mpl_links.js - -*/ - - diff --git a/case2/dl_expense_txt.html b/case2/dl_expense.html similarity index 90% rename from case2/dl_expense_txt.html rename to case2/dl_expense.html index 48fadef..4748fdc 100644 --- a/case2/dl_expense_txt.html +++ b/case2/dl_expense.html @@ -17,7 +17,7 @@ - + @@ -46,7 +46,7 @@
diff --git a/case3/mas_register.js b/case3/mas_register.js
new file mode 100644
index 0000000..4beadaf
--- /dev/null
+++ b/case3/mas_register.js
@@ -0,0 +1,99 @@
+"use strict";
+/*
+ New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
+ Tutorial 13
+ Case Problem 3
+
+
+ Filename: mas_register.js
+
+ Author: Gary Unwin
+ Date: 2018-03-01
+
+ Function List
+ =============
+
+ formTest()
+ Performs a validation test on the selection of the conference
+ session package and the conference discount number
+
+ calcCart()
+ Calculates the cost of the registration and saves data
+ in session storage
+
+ writeSessionValues()
+ Writes data values from session storage in to the
+ registration summary form
+
+*/
+
+
+window.addEventListener("load", function() {
+ calcCart();
+ document.getElementById("regSubmit").onclick = sessionTest;
+ document.getElementById("fnBox").onblur = calcCart;
+ document.getElementById("lnBox").onblur = calcCart;
+ document.getElementById("groupBox").onblur = calcCart;
+ document.getElementById("mailBox").onblur = calcCart;
+ document.getElementById("phoneBox").onblur = calcCart;
+ document.getElementById("sessionBox").onchange = calcCart;
+ document.getElementById("banquetBox").onblur = calcCart;
+ document.getElementById("mediaCB").onclick = calcCart;
+});
+
+function sessionTest() {
+ var confSession = document.getElementById("sessionBox");
+ if (confSession.selectedIndex === -1) {
+ confSession.setCustomValidity("Select a Session Package");
+ } else {
+ confSession.setCustomValidity("");
+ }
+}
+
+
+function calcCart() {
+ sessionStorage.confName = document.forms.regForm.elements.firstName.value + " " + document.forms.regForm.elements.lastName.value;
+ sessionStorage.confGroup = document.forms.regForm.elements.group.value;
+ sessionStorage.confMail = document.forms.regForm.elements.email.value;
+ sessionStorage.confPhone = document.forms.regForm.elements.phoneNumber.value;
+ sessionStorage.confBanquet = document.forms.regForm.elements.banquetGuests.value;
+
+ sessionStorage.confBanquetCost = document.forms.regForm.elements.banquetGuests.value*55;
+
+ var selectedSession = document.getElementById("sessionBox").selectedIndex;
+ if (selectedSession !== -1) {
+ sessionStorage.confSession = document.forms.regForm.elements.sessionBox[selectedSession].text;
+ sessionStorage.confSessionCost = document.forms.regForm.elements.sessionBox[selectedSession].value;
+ } else {
+ sessionStorage.confSession = "";
+ sessionStorage.confSessionCost = 0;
+ }
+
+ if (document.forms.regForm.elements.mediaCB.checked) {
+ sessionStorage.confPack = "yes";
+ sessionStorage.confPackCost = 115;
+ } else {
+ sessionStorage.confPack = "no";
+ sessionStorage.confPackCost = 0;
+ }
+
+
+ sessionStorage.confTotal = parseFloat(sessionStorage.confSessionCost) +
+ parseFloat(sessionStorage.confBanquetCost) +
+ parseFloat(sessionStorage.confPackCost);
+
+ writeSessionValues();
+}
+
+function writeSessionValues() {
+
+ document.getElementById("regName").textContent = sessionStorage.confName;
+ document.getElementById("regGroup").textContent = sessionStorage.confGroup;
+ document.getElementById("regEmail").textContent = sessionStorage.confMail;
+ document.getElementById("regPhone").textContent = sessionStorage.confPhone;
+ document.getElementById("regSession").textContent = sessionStorage.confSession;
+ document.getElementById("regBanquet").textContent = sessionStorage.confBanquet;
+ document.getElementById("regPack").textContent = sessionStorage.confPack;
+ document.getElementById("regTotal").textContent = "$" + sessionStorage.confTotal;
+}
+
diff --git a/case3/mas_register_txt.js b/case3/mas_register_txt.js
deleted file mode 100644
index cbad7cc..0000000
--- a/case3/mas_register_txt.js
+++ /dev/null
@@ -1,30 +0,0 @@
-"use strict";
-/*
- New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
- Tutorial 13
- Case Problem 3
-
-
- Filename: mas_register.js
-
- Author:
- Date:
-
- Function List
- =============
-
- formTest()
- Performs a validation test on the selection of the conference
- session package and the conference discount number
-
- calcCart()
- Calculates the cost of the registration and saves data
- in session storage
-
- writeSessionValues()
- Writes data values from session storage in to the
- registration summary form
-
-
-*/
-
diff --git a/case4/ws_cloud.js b/case4/ws_cloud.js
new file mode 100644
index 0000000..52dc98d
--- /dev/null
+++ b/case4/ws_cloud.js
@@ -0,0 +1,135 @@
+"use strict";
+/*
+ New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
+ Tutorial 13
+ Case Problem 4
+
+
+ Filename: ws_cloud.js
+
+ Author: Annie Cho
+ Date: 2018-03-01
+
+ Function List
+ =============
+
+ findUnique(arr)
+ Returns the unique values in the "arr" array in the form of
+ a two-dimension array
+ array[i][j]
+ where i is the ith unique entry, array[i][0] provides the
+ value of the entry and array[i][1] provides the number
+ of repetitons of that value
+
+ sortByCount(a,b)
+ Compare function used in a two-dimensional arrays to be sorted
+ in descending order of the values in the array's 2nd column
+
+ sortByWord(a, b)
+ Compare function used in a two-dimensional array to be sorted
+ in ascending alphabetical order of the vlaues in the array's
+ first column
+
+ randomValue(minVal, maxVal)
+ Returns a randome integer between minVal and maxVal
+
+*/
+
+
+window.addEventListener("load", function() {
+ // Retrieve only the text of the speech
+ var wordContent = document.getElementById("speech").textContent;
+
+ // Change all characters to lowercase letters
+ wordContent = wordContent.toLowerCase();
+
+ // Remove all punctuation marks from the text
+ wordContent = wordContent.replace(/[!\.,:;\?\'"\(\)\{\}\d\-]/g,"");
+
+ // Remove all stop words from the text
+ for (var i = 0; i < stopWords.length; i++) {
+ var stopWordsRE = new RegExp("\\b"+stopWords[i]+"\\b", "g");
+ wordContent = wordContent.replace(stopWordsRE, "");
+ }
+
+ // Remove all leading and trailing white space characters
+ wordContent = wordContent.trim();
+
+ // Split the text at every occurence of 1 or more white space characters
+ var wordArray = wordContent.split(/\s+/g);
+
+ // Generate a 2-D array of unique words and their counts
+ var uniqueWords = findUnique(wordArray);
+
+ // Sort the array in descending order of count
+ uniqueWords.sort(sortByCount);
+
+ // Limit the array to the top 100 words
+ uniqueWords.length = 100;
+
+ // Determine the count of the least-used word in the array
+ var minimumCount = uniqueWords[99][1];
+
+ // Determine the count of the 3rd most-used word in the array
+ var top3Count = uniqueWords[2][1];
+
+ // Sort the array in alphabetical order
+ uniqueWords.sort(sortByWord);
+
+
+ // Loop through the unique words and format them according to their usage
+ for (var i = 0; i < uniqueWords.length; i++) {
+ var cloudWord = document.createElement("span");
+ cloudWord.textContent = uniqueWords[i][0];
+ var wordSize = Math.min(6, 0.45*uniqueWords[i][1]/minimumCount);
+ cloudWord.style.fontSize = wordSize + "em";
+ cloudWord.style.transform = "rotate(" + randomValue(-30, 30) + "deg)";
+ if (uniqueWords[i][1] >= top3Count) {
+ cloudWord.style.color = "rgb(251, 191, 191)";
+ cloudWord.style.textShadow = "2px 2px 5px rgb(51, 51, 51)";
+ }
+ document.getElementById("cloud").appendChild(cloudWord);
+ }
+});
+
+
+
+function findUnique(arr) {
+ var prevWord;
+ var unique = [];
+ var listNum = -1;
+ arr.sort();
+ for ( var i = 0; i < arr.length; i++ ) {
+ if ( arr[i] !== prevWord ) {
+ listNum++;
+ unique[listNum] = [];
+ unique[listNum][0] = arr[i];
+ unique[listNum][1] = 1;
+ } else {
+ unique[listNum][1] = unique[listNum][1]+1;
+ }
+ prevWord = arr[i];
+ }
+
+ return unique;
+}
+
+function sortByCount(a,b) {
+ return b[1]-a[1];
+}
+
+function sortByWord(a, b) {
+ if (a[0] < b[0]) {
+ return -1;
+ } else if (a[0] > b[0]) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+function randomValue(minVal, maxVal) {
+ var interval = maxVal - minVal;
+ return Math.floor(minVal + interval*Math.random());
+}
+
diff --git a/case4/ws_cloud_txt.js b/case4/ws_cloud_txt.js
deleted file mode 100644
index de4da75..0000000
--- a/case4/ws_cloud_txt.js
+++ /dev/null
@@ -1,84 +0,0 @@
-"use strict";
-/*
- New Perspectives on HTML5, CSS3, and JavaScript 6th Edition
- Tutorial 13
- Case Problem 4
-
-
- Filename: ws_cloud.js
-
- Author:
- Date:
-
- Function List
- =============
-
- findUnique(arr)
- Returns the unique values in the "arr" array in the form of
- a two-dimension array
- array[i][j]
- where i is the ith unique entry, array[i][0] provides the
- value of the entry and array[i][1] provides the number
- of repetitons of that value
-
- sortByCount(a,b)
- Compare function used in a two-dimensional arrays to be sorted
- in descending order of the values in the array's 2nd column
-
- sortByWord(a, b)
- Compare function used in a two-dimensional array to be sorted
- in ascending alphabetical order of the vlaues in the array's
- first column
-
- randomValue(minVal, maxVal)
- Returns a randome integer between minVal and maxVal
-
-*/
-
-
-
-
-
-
-
-
-
-function findUnique(arr) {
- var prevWord;
- var unique = [];
- var listNum = -1;
- arr.sort();
- for ( var i = 0; i < arr.length; i++ ) {
- if ( arr[i] !== prevWord ) {
- listNum++;
- unique[listNum] = [];
- unique[listNum][0] = arr[i];
- unique[listNum][1] = 1;
- } else {
- unique[listNum][1] = unique[listNum][1]+1;
- }
- prevWord = arr[i];
- }
-
- return unique;
-}
-
-function sortByCount(a,b) {
- return b[1]-a[1];
-}
-
-function sortByWord(a, b) {
- if (a[0] < b[0]) {
- return -1;
- } else if (a[0] > b[0]) {
- return 1;
- } else {
- return 0;
- }
-}
-
-function randomValue(minVal, maxVal) {
- var interval = maxVal - minVal;
- return Math.floor(minVal + interval*Math.random());
-}
-
diff --git a/case4/ws_lincoln_txt.html b/case4/ws_lincoln.html
similarity index 100%
rename from case4/ws_lincoln_txt.html
rename to case4/ws_lincoln.html
diff --git a/case4/ws_styles.css b/case4/ws_styles.css
index e7623d0..3b8050d 100644
--- a/case4/ws_styles.css
+++ b/case4/ws_styles.css
@@ -15,7 +15,7 @@
/* HTML and Body styles */
html {
- background: rgb(221,128,160);
+ background: black;
font-family: Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", serif;
color: rgb(101, 101, 101);
}
diff --git a/review/co_cart_txt.html b/review/co_cart.html
similarity index 94%
rename from review/co_cart_txt.html
rename to review/co_cart.html
index f2fe302..2eddc65 100644
--- a/review/co_cart_txt.html
+++ b/review/co_cart.html
@@ -7,8 +7,8 @@
Review Assignment
Coctura Cart Page
- Author:
- Date:
+ Author: Cameron Odom & Jeremy Snider
+ Date: 04/12/2019
Filename: co_cart.html
-->
@@ -17,6 +17,7 @@
+
@@ -66,7 +67,7 @@ 