From 8d51934f395b0246d727c3631f04d08d050d7b97 Mon Sep 17 00:00:00 2001 From: MorganButryn Date: Wed, 10 Apr 2019 10:16:51 -0500 Subject: [PATCH 1/2] new file: case1/mpl_links.html new file: case2/dl_expense.html new file: review/co_cart.html new file: review/co_cart.js deleted: review/co_cart_txt.js new file: review/co_credit.html renamed: review/co_credit_txt.js -> review/co_credit.js --- case1/mpl_links.html | 195 ++++++++++++++++ case2/dl_expense.html | 257 ++++++++++++++++++++++ review/co_cart.html | 161 ++++++++++++++ review/co_cart.js | 85 +++++++ review/co_cart_txt.js | 47 ---- review/co_credit.html | 188 ++++++++++++++++ review/{co_credit_txt.js => co_credit.js} | 50 ++++- 7 files changed, 931 insertions(+), 52 deletions(-) create mode 100644 case1/mpl_links.html create mode 100644 case2/dl_expense.html create mode 100644 review/co_cart.html create mode 100644 review/co_cart.js delete mode 100644 review/co_cart_txt.js create mode 100644 review/co_credit.html rename review/{co_credit_txt.js => co_credit.js} (62%) diff --git a/case1/mpl_links.html b/case1/mpl_links.html new file mode 100644 index 0000000..3ac4072 --- /dev/null +++ b/case1/mpl_links.html @@ -0,0 +1,195 @@ + + + + + + Monroe Public Library List of Government Sites + + + + + + + +
+ Monroe Public Library + + +
+ +
+ + +
+ +
+ +
+ + + + diff --git a/case2/dl_expense.html b/case2/dl_expense.html new file mode 100644 index 0000000..6368383 --- /dev/null +++ b/case2/dl_expense.html @@ -0,0 +1,257 @@ + + + + + + DeLong Enterprises Expense Report + + + + + + + + +
+ + DeLong Enterprises +
+ +
+
+ + + + + + + + +
Trip Summary*
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Last Name*First Name*M.I.Account*
Department*
Social Security Number*Project*
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Travel DateAir & TransLodgingMeals & TipsOtherTOTAL
SUMMARY
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + diff --git a/review/co_cart.html b/review/co_cart.html new file mode 100644 index 0000000..0620a8a --- /dev/null +++ b/review/co_cart.html @@ -0,0 +1,161 @@ + + + + + + Coctura Shopping Chart + + + + + + + + + +
+
+
+ + + + +
+
+ + Coctura + +
+
+

EC115 Pump Espresso Machine

+

by Baxter Coffee

+

Customer Rating (903 votes): 4 stars

+ +

Prepare espresso drinks at home with EC115 Pump Espresso Machine by Baxter + Coffee. The EC115 creates delicious cappuccinos with rich foam using + our patented nozzle system. You can enjoy your espresso almost immmediately + thanks to the thermolink® technology. With self-priming, the + EC115 is always ready to go. The EC115 is easily customizable with filters + that support single and double shots.

+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Shopping Cart
+ + + + + + + + +
+ +
+ Shipping + + + +
+
+ +
Subtotal + +
Tax (5%) + +
TOTAL + +
+ + +
+
+ + + diff --git a/review/co_cart.js b/review/co_cart.js new file mode 100644 index 0000000..d56385f --- /dev/null +++ b/review/co_cart.js @@ -0,0 +1,85 @@ +"use strict"; + +/* + New Perspectives on HTML5, CSS3, and JavaScript 6th Edition + Tutorial 13 + Review Assigment + + Shopping Cart Form Script + + Author: + Date: + + Filename: co_cart.js + + Function List + ============= + + calcCart() + Calculates the cost of the customer order + + formatNumber(val, decimals) + Format a numeric value, val, using the local + numeric format to the number of decimal + places specified by decimals + + formatUSACurrency(val) + Formats val as U.S.A. currency + +*/ + +window.addEventListener("load", function() { + + //initial cost of the order + calcCart(); + + //form event handlers + cartForm.elements.modelQty.onchange = calcCart; + + var shippingOptions = document.querySelectorAll('input[name="shipping"]'); + for (var i = 0; i < shippingOptions.length; i++) { + shippingOptions[i].onclick = calcCart; + } +}); + +function calcCart() { + var cartForm = document.forms.cart; + + // inital cost of the order + var mCost = cartForm.elements.modelCost.value; + var qIndex = cartForm.elements.modelQty.selectedIndex; + var quantity = cartForm.elements.modelQty[qIndex].value; + + // Initial cost = model cost x quantity + var orderCost = mCost*quantity; + cartForm.elements.orderCost.value = formatUSCurrency(orderCost); + + // cost of shipping + var shipCost = document.querySelector('input[name="shipping"]:checked').value*quantity; + cartForm.elements.shippingCost.value = formatNumber(shipCost, 2); + + // order subtotal + cartForm.elements.subTotal.value = formatNumber(orderCost + shipCost, 2); + + // sales tax + var salesTax = 0.05*(orderCost + shipCost); + cartForm.elements.salesTax.value = formatNumber(salesTax, 2); + + // total order + var cartTotal = orderCost + shipCost + salesTax; + cartForm.elements.cartTotal.value = formatUSCurrency(cartTotal); + + // store the order details + cartForm.elements.shippingType.value = + document.querySelector('input[name="shipping"]:checked').nextSibling.nodeValue; +} + + +function formatNumber(val, decimals) { + return val.toLocaleString(undefined, {minimumFractionDigits: decimals, + maximumFractionDigits: decimals}); +} + +function formatUSCurrency(val) { + return val.toLocaleString('en-US', {style: "currency", currency: "USD"} ); +} diff --git a/review/co_cart_txt.js b/review/co_cart_txt.js deleted file mode 100644 index 4a0ee57..0000000 --- a/review/co_cart_txt.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; - -/* - New Perspectives on HTML5, CSS3, and JavaScript 6th Edition - Tutorial 13 - Review Assigment - - Shopping Cart Form Script - - Author: - Date: - - Filename: co_cart.js - - Function List - ============= - - calcCart() - Calculates the cost of the customer order - - formatNumber(val, decimals) - Format a numeric value, val, using the local - numeric format to the number of decimal - places specified by decimals - - formatUSACurrency(val) - Formats val as U.S.A. currency - -*/ - - - - - - - - - - -function formatNumber(val, decimals) { - return val.toLocaleString(undefined, {minimumFractionDigits: decimals, - maximumFractionDigits: decimals}); -} - -function formatUSCurrency(val) { - return val.toLocaleString('en-US', {style: "currency", currency: "USD"} ); -} diff --git a/review/co_credit.html b/review/co_credit.html new file mode 100644 index 0000000..24157d9 --- /dev/null +++ b/review/co_credit.html @@ -0,0 +1,188 @@ + + + + + + Coctura Payment Form + + + + + + + +
+
+
+ + + + +
+
+ + Coctura + +
+ + +
+

Payment Form

+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + X + + + +
+ + + +
Subtotal + +
Tax (5%) + +
TOTAL + +
+
+ +
+
+ Credit Information + + + + +
+ + + + + +
+ + + + + + + + + +
+ +

* - Required Item

+ +
+ +
+ + + + diff --git a/review/co_credit_txt.js b/review/co_credit.js similarity index 62% rename from review/co_credit_txt.js rename to review/co_credit.js index 85bcbde..5eb4a3b 100644 --- a/review/co_credit_txt.js +++ b/review/co_credit.js @@ -7,8 +7,8 @@ Credit Card Form Script - Author: - Date: + Author: Aisha Jahlan + Date: 2018-03-01 Filename: co_credit.js @@ -44,10 +44,50 @@ */ +window.addEventListener("load", function(){ + // Retrieve the field/value pairs from the URL + var orderData = location.search.slice(1); + orderData = orderData.replace(/\+/g," "); + orderData = decodeURIComponent(orderData); + var orderFields = orderData.split(/[&=]/g); + + // Write the field values to the order form + document.forms.order.elements.modelName.value = orderFields[3]; + document.forms.order.elements.modelQty.value = orderFields[5]; + document.forms.order.elements.orderCost.value = orderFields[7]; + document.forms.order.elements.shippingType.value = orderFields[9]; + document.forms.order.elements.shippingCost.value = orderFields[13]; + document.forms.order.elements.subTotal.value = orderFields[15]; + document.forms.order.elements.salesTax.value = orderFields[17]; + document.forms.order.elements.cartTotal.value = orderFields[19]; +} ); + +window.addEventListener("load", function() { + document.getElementById("subButton").onclick = runSubmit; + document.getElementById("cardHolder").oninput = validateName; + document.getElementById("cardNumber").oninput = validateNumber; + document.getElementById("expDate").oninput = validateDate; + document.getElementById("cvc").oninput = validateCVC; +}); + +function runSubmit() { + validateName(); + validateCredit(); + validateNumber(); + validateDate(); + validateCVC(); +} - - - +function validateDate() { + var cardDate = document.getElementById("expDate"); + if (cardDate.validity.valueMissing) { + cardDate.setCustomValidity("Enter the expiration date"); + } else if (/^(0[1-9]|1[0-2])\/20[12]\d$/.test(cardDate.value) === false) { + cardDate.setCustomValidity("Enter a valid expiration date"); + } else { + cardDate.setCustomValidity(""); + } +} From 17acdb98da9ab77aa774f7d0c94b61643087370b Mon Sep 17 00:00:00 2001 From: MorganButryn Date: Thu, 11 Apr 2019 08:24:21 -0500 Subject: [PATCH 2/2] new file: case1/mpl_links.js modified: case2/dl_expense.html new file: case2/dl_expense.js new file: case3/mas_reg2.html new file: case3/mas_reg2.js new file: case3/mas_register.html new file: case3/mas_register.js new file: case4/ws_cloud.js new file: case4/ws_lincoln.html --- case1/mpl_links.js | 24 ++++ case2/dl_expense.html | 8 +- case2/dl_expense.js | 95 +++++++++++++ case3/mas_reg2.html | 142 +++++++++++++++++++ case3/mas_reg2.js | 36 +++++ case3/mas_register.html | 144 ++++++++++++++++++++ case3/mas_register.js | 99 ++++++++++++++ case4/ws_cloud.js | 135 ++++++++++++++++++ case4/ws_lincoln.html | 293 ++++++++++++++++++++++++++++++++++++++++ 9 files changed, 972 insertions(+), 4 deletions(-) create mode 100644 case1/mpl_links.js create mode 100644 case2/dl_expense.js create mode 100644 case3/mas_reg2.html create mode 100644 case3/mas_reg2.js create mode 100644 case3/mas_register.html create mode 100644 case3/mas_register.js create mode 100644 case4/ws_cloud.js create mode 100644 case4/ws_lincoln.html 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/case2/dl_expense.html b/case2/dl_expense.html index 6368383..c6b5cc3 100644 --- a/case2/dl_expense.html +++ b/case2/dl_expense.html @@ -73,17 +73,17 @@

Expense Report

- + Department* - + Social Security Number* - + Project* - + diff --git a/case2/dl_expense.js b/case2/dl_expense.js new file mode 100644 index 0000000..5d1bee8 --- /dev/null +++ b/case2/dl_expense.js @@ -0,0 +1,95 @@ +"use strict"; + +/* + New Perspectives on HTML5, CSS3, and JavaScript 6th Edition + Tutorial 13 + Case Problem 2 + + Author: Kay Ramirez + Date: 2018-03-01 + + Filename: dl_expense.js + + Function List + ============= + + validateSummary() + Validates the data entry in the summary field. + + calcClass(sumClass) + Sums up all of the data values for elements of the sumClass class. + + calcExp() + Calculates the travel expenses from all categories and dates. + + formatNumber(val, decimals) + Formats the value, "val" to the number of decimals indicated + by "decimals", adding thousands separators. + + formatUSCurrency(val) + Formats the value, "val", as U.S. currency. + +*/ + +window.addEventListener("load", function() { + var changingCells = document.querySelectorAll("table#travelExp input.sum"); + + for (var i = 0; i < changingCells.length; i++) { + changingCells[i].onchange = calcExp; + } + + document.getElementById("submitButton").onclick = function() { + validateSummary(); + }; +}); + +function validateSummary() { + var summary = document.getElementById("summary"); + if (summary.validity.valueMissing) { + summary.setCustomValidity("You must include a summary of the trip in your report."); + } else { + summary.setCustomValidity(""); + } +} + +function calcClass(sumClass) { + var sumFields = document.getElementsByClassName(sumClass); + var sumTotal = 0; + + for (var i=0; i < sumFields.length; i++) { + var itemValue = parseFloat(sumFields[i].value); + if (!isNaN(itemValue)) { + sumTotal += itemValue; + } + } + return sumTotal; +} + + +function calcExp() { + + var expTable = document.querySelectorAll("table#travelExp tbody tr"); + + for (var i = 0; i < expTable.length; i++) { + document.getElementById("subtotal"+i).value = formatNumber(calcClass("date"+i), 2); + } + + document.getElementById("transTotal").value = formatNumber(calcClass("trans"), 2); + document.getElementById("lodgeTotal").value = formatNumber(calcClass("lodge"), 2); + document.getElementById("mealTotal").value = formatNumber(calcClass("meal"), 2); + document.getElementById("otherTotal").value = formatNumber(calcClass("other"), 2); + document.getElementById("expTotal").value = formatUSCurrency(calcClass("sum")); +} + + + + + +function formatNumber(val, decimals) { + return val.toLocaleString(undefined, {minimumFractionDigits: decimals, + maximumFractionDigits: decimals}); +} + +function formatUSCurrency(val) { + return val.toLocaleString('en-US', {style: "currency", currency: "USD"} ); +} \ No newline at end of file diff --git a/case3/mas_reg2.html b/case3/mas_reg2.html new file mode 100644 index 0000000..81edb58 --- /dev/null +++ b/case3/mas_reg2.html @@ -0,0 +1,142 @@ + + + + + + + + MAS Registration Payment Form + + + + + + +
+ Media Arts Society + +
+ + + +
+

MAS22 Payment Form

+
+
+ Credit Information + + + + + +
+ + + + + +
+ + + + + + + + + +
+ +

* - Required Item

+ +
+
+ + + +
+ Media Arts Society © 2018 All Rights Reserved +
+ + + \ No newline at end of file diff --git a/case3/mas_reg2.js b/case3/mas_reg2.js new file mode 100644 index 0000000..e62fd46 --- /dev/null +++ b/case3/mas_reg2.js @@ -0,0 +1,36 @@ +"use strict"; +/* + New Perspectives on HTML5, CSS3, and JavaScript 6th Edition + Tutorial 13 + Case Problem 3 + + + Filename: mas_reg2.js + + Author: Gary Unwin + Date: 2018-03-01 + + + Function List + ============= + + writeSessionValues() + Writes data values from session storage in to the + registration summary form + + +*/ + +window.addEventListener("load", 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; +} \ No newline at end of file diff --git a/case3/mas_register.html b/case3/mas_register.html new file mode 100644 index 0000000..7fa6e39 --- /dev/null +++ b/case3/mas_register.html @@ -0,0 +1,144 @@ + + + + + + + + MAS Registration Form + + + + + + + +
+ Media Arts Society + +
+ +
+

MAS Annual Conference

+

MAS 22
+ Sierra Vegas Resort
+ Las Vegas, Nevada
+ April 16 — April 19, 2018

+

The premier conference for multimedia technlogy celebrates its + 22nd anniversay with extensive coverage of new and exciting + developments in media and entertainment.

+

Please join us by filling out your registration information below. Go + to the Accommodation Page to reserve lodging at the + conference center.

+

Email mas22@example.com for questions related to + accommodation, traveling to the conference, or submitting presentation + proposals.

+
+ +
+
+

MAS22 Registration Form

+ + +
+ + + + + + + + + + + + + + +
+ +
+ + + + attendees + + + + +
+ +
+
+ + + + + + + + +
+ Media Arts Society © 2018 All Rights Reserved +
+ + + \ No newline at end of file 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/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_lincoln.html b/case4/ws_lincoln.html new file mode 100644 index 0000000..6b74cfb --- /dev/null +++ b/case4/ws_lincoln.html @@ -0,0 +1,293 @@ + + + + + + + + Rhetoric in the United States Word Cloud + + + + + + + +
+ White Sands College + American Rhetoric + +

Rhetoric in the United States

+
+ +
+
+

Abraham Lincoln's 1st Inaugural Address

+
+

In compliance with a custom as old as the Government itself, I appear before you to address you briefly and to take in your + presence the + oath prescribed by the + Constitution of the United States to be taken by the President + before he enters on the execution of this office.

+

I do not consider it necessary at present for me to discuss those matters of administration about which there is no special + anxiety or excitement.

+

Apprehension seems to exist among the people of the Southern States that by the accession of a Republican Administration + their property and their peace and personal security are to be endangered. There has never been any reasonable cause for such + apprehension. Indeed, the most ample evidence to the contrary has all the while existed and been open to their inspection. It + is found in nearly all the published speeches of him who now addresses you. I do but quote from one of those speeches when I + declare that--

+

I have no purpose, directly or indirectly, to interfere with the institution of slavery in the States where it exists. I + believe I have no lawful right to do so, and I have no inclination to do so.

+

Those who nominated and elected me did so with full knowledge that I had made this and many similar declarations and had + never recanted them; and more than this, they placed in the platform for my acceptance, and as a law to themselves and to me, + the clear and emphatic resolution which I now read:

+

Resolved, That the maintenance inviolate of the + rights of the States, and especially the right of each State to order and control + its own domestic institutions according to its own judgment exclusively, is essential to that balance of power on which the + perfection and endurance of our political fabric depend; and we denounce the lawless invasion by armed force of the soil of any + State or Territory, no matter what pretext, as among the gravest of crimes.

+

I now reiterate these sentiments, and in doing so I only press upon the public attention the most conclusive evidence of + which the case is susceptible that the property, peace, and security of no section are to be in any wise endangered by the now + incoming Administration. I add, too, that all the protection which, consistently with the + Constitution and the laws, can be given will be cheerfully given to all the States + when lawfully demanded, for whatever cause--as cheerfully to one section as to another.

+

There is much controversy about the delivering up of fugitives from service or labor. The clause I now read is as plainly + written in the + Constitution as any other of its provisions:

+

+ No person held to service or labor in one State, under the laws thereof, escaping into + another, shall in consequence of any law or regulation therein be discharged from such service or labor, but shall be + delivered up on claim of the party to whom such service or labor may be due. +

+

It is scarcely questioned that this provision was intended by those who made it for the reclaiming of what we call fugitive + slaves; and the intention of the lawgiver is the law. All members of Congress swear their support to the whole Constitution--to + this provision as much as to any other. To the proposition, then, that slaves whose cases come within the terms of this clause + shall be delivered up their oaths are unanimous. Now, if they would make the + effort in good temper, could they not with nearly equal unanimity frame and pass a law by means of which to keep good that + unanimous oath?

+

There is some difference of opinion whether this clause should be enforced by national or by State authority, but surely + that difference is not a very material one. If the slave is to be surrendered, it can be of but little consequence to him or to + others by which authority it is done. And should anyone in any case be content that his oath shall go unkept on a merely + unsubstantial controversy as to how it shall be kept?

+

Again: In any law upon this subject ought not all the safeguards of liberty known in civilized and humane jurisprudence to + be introduced, so that a free man be not in any case surrendered as a slave? And might it not be well at the same time to + provide by law for the enforcement of that clause in the + Constitution which guarantees that the citizens of each State shall be entitled + to all privileges and immunities of citizens in the several States?

+

I take the official oath to-day with no mental reservations and with no purpose to construe the + Constitution or laws by any hypercritical rules; and while I do not choose now to + specify particular acts of Congress as proper to be enforced, I do suggest that it will be much safer for all, both in official + and private stations, to conform to and abide by all those acts which stand unrepealed than to violate any of them trusting to + find impunity in having them held to be unconstitutional.

+

It is seventy-two years since the first inauguration of a President under our National Constitution. During that period + fifteen different and greatly distinguished citizens have in succession administered the executive branch of the Government. + They have conducted it through many perils, and generally with great success. Yet, with all this scope of precedent, I now + enter upon the same task for the brief constitutional term of four years under great and peculiar difficulty. A disruption of + the Federal Union, heretofore only menaced, is now formidably attempted.

+

I hold that in contemplation of universal law and of the + Constitution the Union of these States is perpetual. Perpetuity is implied, if not + expressed, in the fundamental law of all national governments. It is safe to assert that no government proper ever had a + provision in its organic law for its own termination. Continue to execute all the express provisions of our National + Constitution, and the Union will endure forever, it being impossible to destroy it except by some action not provided for in + the instrument itself.

+

Again: If the United States be not a government proper, but an association of States in the nature of contract merely, can + it, as acontract, be peaceably unmade by less than all the parties who made it? One party to a contract may violate it--break + it, so to speak--but does it not require all to lawfully rescind it?

+

Descending from these general principles, we find the proposition that in legal contemplation the Union is perpetual + confirmed by the history of the Union itself. The Union is much older than the Constitution. It was formed, in fact, by the + Articles of Association in 1774. It was matured and continued by the + Declaration of Independence in 1776. It was further matured, and the faith of all the then + thirteen States expressly plighted and engaged that it should be perpetual, by the + Articles of Confederation in 1778. And finally, in 1787, one of the declared objects + for ordaining and establishing the + Constitution was + to form a more perfect Union.

+

But if destruction of the Union by one or by a part only of the States be lawfully possible, the Union is less perfect than + before the + Constitution, having lost the vital element of perpetuity.

+

It follows from these views that no State upon its own mere motion can lawfully get out of the Union; that resolves and + ordinances to that effect are legally void, and that acts of violence within any State or States against the authority of the + United States are insurrectionary or revolutionary, according to circumstances.

+

I therefore consider that in view of the + Constitution and the laws the Union is unbroken, and to the extent of my ability, I + shall take care, as the + Constitution itself expressly enjoins upon me, that the laws of the Union be + faithfully executed in all the States. Doing this I deem to be only a simple duty on my part, and Ishall perform it so far as + practicable unless my rightful masters, the American people, shall withhold the requisite means or in some authoritative manner + direct the contrary. I trust this will not be regarded as a menace, but only as the declared purpose of the Union that it will + constitutionally defend and maintain itself.

+

In doing this there needs to be no bloodshed or violence, and there shall be none unless it be forced upon the national + authority. The power confided to me will be used to hold, occupy, and possess the property and places belonging to the + Government and to collect the duties and imposts; but beyond what may be necessary for these objects, there will be no + invasion, no using of force against or among the people anywhere. Where hostility to the United States in any interior locality + shall be so great and universal as to prevent competent resident citizens from holding the Federal offices, there will be no + attempt to force obnoxious strangers among the people for that object. While the strict legal right may exist in the Government + to enforce the exercise of these offices, the attempt to do so would be so irritating and so nearly impracticable withal that I + deem it better to forego for the time the uses of such offices.

+

The mails, unless repelled, will continue to be furnished in all parts of the Union. So far as possible the people + everywhere shall have that sense of perfect security which is most favorable to calm thought and reflection. The course here + indicated will be followed unless current events and experience shall show a modification or change to be proper, and in every + case and exigency my best discretion will be exercised, according to circumstances actually existing and with a view and a hope + of a peaceful solution of the national troubles and the restoration of fraternal sympathies and affections.

+

That there are persons in one section or another who seek to destroy the Union at all events and are glad of any pretext to + do it I will neither affirm nor deny; but if there be such, I need address no word to them. To those, however, who really love + the Union may I not speak?

+

Before entering upon so grave a matter as the destruction of our national fabric, with all its benefits, its memories, and + its hopes, would it not be wise to ascertain precisely why we do it? Will you hazard so desperate a step while there is any + possibility that any portion of the ills you fly from have no real existence? Will you, while the certain ills you fly to are + greater than all the real ones you fly from, will you risk the commission of so fearful a mistake?

+

All profess to be content in the Union if all constitutional rights can be maintained. Is it true, then, that any right + plainly written in the + Constitution has been denied? I think not. Happily, the human mind is so constituted + that no party can reach to the audacity of doing this. Think, if you can, of a single instance in which a plainly written + provision of the + Constitution has ever been denied. If by the mere force of numbers a majority should + deprive a minority of any clearly written constitutional right, it might in a moral point of view justify revolution; certainly + would if such right were a vital one. But such is not our case. All the vital rights of minorities and of individuals are so + plainly assured to them by affirmations and negations, guaranties and prohibitions, in the + Constitution that controversies never arise concerning them. But no organic law can + ever be framed with a provision specifically applicable to every question which may occur in practical administration. No + foresight can anticipate nor any document of reasonable length contain express provisions for all possible questions. Shall + fugitives from labor be surrendered by national or by State authority? The + Constitution does not expressly say. May Congress prohibit slavery in the + Territories? The + Constitution does not expressly say. Must Congress protect slavery in the + Territories? The + Constitution does not expressly say.

+

From questions of this class spring all our constitutional controversies, and we divide upon them into majorities and + minorities. If the minority will not acquiesce, the majority must, or the Government must cease. There is no other alternative, + for continuing the Government is acquiescence on one side or the other. If a minority in such case will secede rather than + acquiesce, they make a precedent which in turn will divide and ruin them, for a minority of their own will secede from them + whenever a majority refuses to be controlled by such minority. For instance, why may not any portion of a new confederacy a + year or two hence arbitrarily secede again, precisely as portions of the present Union now claim to secede from it? All who + cherish disunion sentiments are now being educated to the exact temper of doing this.

+

Is there such perfect identity of interests among the States to compose a new union as to produce harmony only and prevent + renewed secession?

+

Plainly the central idea of secession is the essence of anarchy. A majority held in restraint by constitutional checks and + limitations, and always changing easily with deliberate changes of popular opinions and sentiments, is the only true sovereign + of a free people. Whoever rejects it does of necessity fly to anarchy or to despotism. Unanimity is impossible. The rule of a + minority, as a permanent arrangement, is wholly inadmissible; so that, rejecting the majority principle, anarchy or despotism + in some form is all that is left.

+

I do not forget the position assumed by some that constitutional questions are to be decided by the Supreme Court, nor do I + deny that such decisions must be binding in any case upon the parties to a suit as to the object of that suit, while they are + also entitled to very high respect and consideration in all parallel cases by all other departments of the Government. And + while it is obviously possible that such decision may be erroneous in any given case, still the evil effect following it, being + limited to that particular case, with the chance that it may be overruled and never become a precedent for other cases, can + better be borne than could the evils of a different practice. At the same time, the candid citizen must confess that if the + policy of the Government upon vital questions affecting the whole people is to be irrevocably fixed by decisions of the Supreme + Court, the instant they are made in ordinary litigation between parties in personal actions the people will have ceased to be + their own rulers, having to that extent practically resigned their Government into the hands of that eminent tribunal. Nor is + there in this view any assault upon the court or the judges. It is a duty from which they may not shrink to decide cases + properly brought before them, and it is no fault of theirs if others seek to turn their decisions to political purposes.

+

One section of our country believes slavery is right and ought to be extended, while the other believes it is wrong and + ought not to be extended. This is the only substantial dispute. The fugitive- slave clause of the + Constitution and the law for the suppression of the foreign slave trade are each as + well enforced, perhaps, as any law can ever be in a community where the moral sense of the people imperfectly supports the law + itself. The great body of the people abide by the dry legal obligation in both cases, and a few break over in each. This, I + think, can not be perfectly cured, and it would be worse in both cases after the separation of the sections than before. The + foreign slave trade, now imperfectly suppressed, would be ultimately revived without restriction in one section, while fugitive + slaves, now only partially surrendered, would not be surrendered at all by the other.

+

Physically speaking, we can not separate. We can not remove our respective sections from each other nor build an impassable + wall between them. A husband and wife may be divorced and go out of the presence and beyond the reach of each other, but the + different parts of our country can not do this. They can not but remain face to face, and intercourse, either amicable or + hostile, must continue between them. Is it possible, then, to make that intercourse more advantageous or more satisfactory + after separation than before? Can aliens make treaties easier than friends can make laws? Can treaties be more faithfully + enforced between aliens than laws can among friends? Suppose you go to war, you can not fight always; and when, after much loss + on both sides and no gain on either, you cease fighting, the identical old questions, as to terms of intercourse, are again + upon you.

+

This country, with its institutions, belongs to the people who inhabit it. Whenever they shall grow weary of the existing + Government, they can exercise their constitutional right of + amending it or their revolutionary right to dismember or overthrow it. I can not be + ignorant of the fact that many worthy and patriotic citizens are desirous of having the National + Constitution amended. While I make no recommendation of amendments, I fully recognize + the rightful authority of the people over the whole subject, to be exercised in either of the modes prescribed in the + instrument itself; and I should, under existing circumstances, favor rather than oppose a fair opportunity being afforded the + people to act upon it. I will venture to add that to me the convention mode seems preferable, in that it allows amendments to + originate with the people themselves, instead of only permitting them to take or reject propositions originated by others, not + especially chosen for the purpose, and which might not be precisely such as they would wish to either accept or refuse. I + understand a proposed amendment to the + Constitution--which amendment, however, I have not seen--has passed Congress, to the + effect that the Federal Government shall never interfere with the domestic institutions of the States, including that of + persons held to service. To avoid misconstruction of what I have said, I depart from my purpose not to speak of particular + amendments so far as to say that, holding such a provision to now be implied constitutional law, I have no objection to its + being made express and irrevocable.

+

The Chief Magistrate derives all his authority from the people, and they have referred none upon him to fix terms for the + separation of the States. The people themselves can do this if also they choose, but the Executive as such has nothing to do + with it. His duty is to administer the present Government as it came to his hands and to transmit it unimpaired by him to his + successor.

+

Why should there not be a patient confidence in the ultimate justice of the people? Is there any better or equal hope in the + world? In our present differences, is either party without faith of being in the right? If the Almighty Ruler of Nations, with + His eternal truth and justice, be on your side of the North, or on yours of the South, that truth and that justice will surely + prevail by the judgment of this great tribunal of the American people.

+

By the frame of the Government under which we live this same people have wisely given their public servants but little power + for mischief, and have with equal wisdom provided for the return of that little to their own hands at very short intervals. + While the people retain their virtue and vigilance no Administration by any extreme of wickedness or folly can very seriously + injure the Government in the short space of four years.

+

My countrymen, one and all, think calmly and well upon this whole subject. Nothing valuable can be lost by taking time. If + there be an object to hurry any of you in hot haste to a step which you would never take deliberately, that object will be + frustrated by taking time; but no good object can be frustrated by it. Such of you as are now dissatisfied still have the old + Constitution unimpaired, and, on the sensitive point, the laws of your own framing + under it; while the new Administration will have no immediate power, if it would, to change either. If it were admitted that + you who are dissatisfied hold the right side in the dispute, there still is no single good reason for precipitate action. + Intelligence, patriotism, Christianity, and a firm reliance on Him who has never yet forsaken this favored land are still + competent to adjust in the best way all our present difficulty.

+

In your hands, my dissatisfied fellow-countrymen, and not in mine, is the momentous issue of civil war. The Government will + not assail you. You can have no conflict without being yourselves the aggressors. You have no oath registered in heaven to + destroy the Government, while I shall have the most solemn one to preserve, protect, and defend it.

+

I am loath to close. We are not enemies, but friends. We must not be enemies. Though passion may have strained it must not + break our bonds of affection. The mystic chords of memory, stretching from every battlefield and patriot grave to every living + heart and hearthstone all over this broad land, will yet swell the chorus of the Union, when again touched, as surely they will + be, by the better angels of our nature.

+
+
+ + + + + +
+ + + + \ No newline at end of file