Refactor. JS time!

This commit is contained in:
2023-03-07 13:29:47 -06:00
parent 11d9ecb079
commit c9bb4ba5c5
621 changed files with 780 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"directory": "public_html/bower_components"
}

View File

@@ -0,0 +1,9 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/Gruntfile.js to edit this template
*/
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
});
};

View File

@@ -0,0 +1,13 @@
{
"name": "JavaScript_1",
"version": "1.0.0",
"main": "path/to/main.css",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
},
"devDependencies": {
}
}

View File

@@ -0,0 +1,10 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/gulpfile.js to edit this template
*/
var gulp = require('gulp');
gulp.task('default', function () {
// place code for your default task here
});

View File

@@ -0,0 +1 @@
browser=SL[/Browsers/FirefoxBrowser

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/bower.json</file>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/package.json</file>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/public_html/index.html</file>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/Gruntfile.js</file>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/.bowerrc</file>
<file>file:/home/caleb/ASDV-WebDev/Assignments/JavaScript_1/gulpfile.js</file>
</group>
</open-files>
</project-private>

View File

@@ -0,0 +1,5 @@
file.reference.JavaScript_1-public_html=public_html
file.reference.JavaScript_1-test=test
files.encoding=UTF-8
site.root.folder=${file.reference.JavaScript_1-public_html}
test.folder=${file.reference.JavaScript_1-test}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>JavaScript_1</name>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,8 @@
{
"name": "JavaScript_1",
"version": "1.0.0",
"keywords": ["util", "functional", "server", "client", "browser"],
"author": "caleb",
"contributors": [],
"dependencies": {}
}

Binary file not shown.

View File

@@ -0,0 +1,142 @@
body {
background-color: #FFFFFF;
background-image: url(background.gif);
color: #0000FF;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 14px;
}
#container { margin-left: auto;
margin-right: auto;
width:90%;
min-width:700px;
}
#logo {
text-align:center;
margin: 0;
font-family: Verdana, Arial, Helvetica, sans-serif;
padding-top: 30px;
padding-bottom: 20px;
}
#nav {
float: left;
width: 200px;
padding-top: 10px;
text-align:left;
color: #FF0000;
font-size: 14px;
}
#nav a {
text-decoration:none;
margin: 15px;
display: block;
color: #FF0000;
font-size: 14px;
font-weight: bold;
}
#content {
margin-left: 150px;
padding: 30px;
overflow:auto;
border: medium groove #0000FF;
line-height: 135%;
}
.floatright {padding-left:20px;
float:right;
}
.floatleft {
float:left;
padding: 2px 30px 20px;
}
#footer {
font-size: 16px;
font-style: normal;
text-align: justify;
border-top: thin none;
padding-top: 20px;
padding-bottom: 20px;
color: #FF0000;
font-family: Georgia, "Times New Roman", Times, serif;
font-weight: bold;
}
h2 { text-transform: uppercase;
color: #0000FF;
font-size: 36px;
border-bottom: 1px none;
margin-right: 20px;
}
h3 {
color: #0000FF;
font-size: 1em;
border-bottom: thin none;
margin-right: auto;
text-align: left;
padding-right: 150px;
padding-bottom: 20px;
padding-left: 150px;
line-height: 130%;
border-top-style: none;
border-right-style: none;
border-left-style: none;
}
.details { padding-left:20%;
padding-right:20%;
}
img {border:0 none; }
.content {
margin: 20px;
padding: 20px;
height: 3700px;
width: 500px;
}
a {
color: #FF0000;
text-decoration: none;
margin: 15px;
color: #FF0000;
font-size: 14px;
font-weight: bold;
}
a:hover {
color: #FFFF00;
background-color: #0000FF;
}
h4 {
line-height: 150%;
margin-right: 20%;
margin-left: 15%;
text-align: center;
}
h1 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 36pt;
text-align: center;
margin-right: 15%;
margin-left: 20%;
}
p {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 16px;
line-height: 130%;
font-weight: bold;
color: #0000FF;
}
.flt_img {
float: none;
padding-top: 3px;
padding-right: 20px;
padding-bottom: 3px;
padding-left: 20px;
}
specialh4 {
line-height: 150%;
margin-right: 20%;
margin-left: 15%;
text-align: center;
}

View File

@@ -0,0 +1,89 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Carla's Classroom | An Appetite for Spelling</title>
<link href="carla.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
//declare and initialize variables
var word1 = "avocado";
var word2 = "bananas";
var word3 = "celery";
var word4 = "lemonade";
var word5 = "onions";
var result = " ";
// Question 1
function show_prompt1()
{
word1 = prompt("Enter your answer");
result = (word1 == "avocado")? "You're right!" : "Sorry, that's incorrect";
}
function show_result1()
{ alert(result); }
//Question 2
function show_prompt2()
{
word2 = prompt("Enter your answer");
result = (word2 == "bananas")? "You're right!" : "Sorry, that's incorrect";
}
function show_result2()
{ alert(result); }
//Question 3
function show_prompt3()
{
word3 = prompt("Enter your answer");
result = (word3 == "celery")? "You're right!" : "Sorry, that's incorrect";
}
function show_result3()
{ alert(result); }
//Question 4
function show_prompt4()
{
word4 = prompt("Enter your answer");
result = (word4 == "lemonade")? "You're right!" : "Sorry,that's incorrect";
}
function show_result4()
{ alert(result); }
//Question 5
function show_prompt5()
{
word5 = prompt("Enter your answer");
result = (word5 == "onions")? "You're right!" : "Sorry, that's incorrect";
}
function show_result5()
{ alert(result); }
</script>
</head>
<body>
<div id="container">
<img src="images/writing_big.jpg" class="floatleft" />
<h1 id="logo"><em>An Appetite for Spelling </em></h1>
<div align="left">
<blockquote>
<p><a href="index.html"><img src="images/owl_button.jpg" width="50" height="50" />Home</a>
<a href="carla.html"><img src="images/carla_button.jpg" width="50" height="65" />Meet Carla </a>
<a href="reading.html"><img src="images/read_button.jpg" />Reading</a>
<a href="writing.html"><img src="images/write_button.jpg" width="50" height="50" />Writing</a>
<a href="math.html"><img src="images/arith_button.jpg" />Arithmetic</a>
<br /></p></blockquote> </div>
<div id="content">
<p>For this exercise you will be shown some pictures and, for each picture you will be asked to spell the word that describes the picture. Type your answers in all lowercase letters. </p>
<p>Question 1: What is this? <img src="images/avocado.jpg" width="100" height="67" /></p>
<input type="button" onclick="show_prompt1()" value="answer Q. 1" />
<input type="button" onclick="show_result1()" value="check answer" />
<p>Question 2: What's this? <img src="images/bananas.jpg" width="100" height="110" border="0"></p>
<input type="button" onclick="show_prompt2()" value="answer Q. 2" />
<input type="button" onclick="show_result2()" value="check answer" />
<p>Question 3: What's this? <img src="images/celery.jpg" border="0"> </p>
<input type="button" onclick="show_prompt3()" value="answer Q. 3" />
<input type="button" onclick="show_result3()" value="check answer" />
<p>Question 4: What's this? <img src="images/lemonade.jpg" width="100" height="93" border="0"> </p>
<input type="button" onclick="show_prompt4()" value="answer Q. 4" />
<input type="button" onclick="show_result4()" value="check answer" />
<p>Question 5: What's this? <img src="images/onions.jpg" width="100" height="72" border="0"></p>
<input type="button" onclick="show_prompt5()" value="answer Q. 5" />
<input type="button" onclick="show_result5()" value="check answer" />
</div>
<div id="footer"> <h3>*Carla's Motto: Never miss a chance to teach -- and to learn!</h3>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -0,0 +1,15 @@
<html>
<head>
<title>Example 2.11</title>
<script type="text/javascript">
var first = prompt("Enter your first name:", " ");
var middle = prompt("Enter your middle initial:", " ");
var last = prompt("Enter your last name:", " ");
document.write(first + "." + middle + "." + last + "<br />");
document.write(first + " " + middle + ". " + last);
</script>
</head>
<body>
<p>&nbsp;</p>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<html>
<head>
<title>Example 2.12</title>
<script type="text/javascript">
var num = prompt("Enter a number:", 0);
document.write(num + 2 + "<br />");
document.write((parseInt(num) + 2) + "<br />");
document.write((num * 3) + "<br />");
</script>
</head>
<body>
<p>&nbsp;</p>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<html>
<html>
<head>
<title>Example 2.13</title>
<script type="text/javascript">
var num = prompt("Enter a number:", 0);
document.write("parseInt(): "+ parseInt(num)+"<br />");
document.write("parseFloat(): " + (parseFloat(num)) + "<br />");
</script>
</head>
<body>
<p>&nbsp;</p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<html>
<head>
<title>Example 2.16</title>
<script type="text/javascript">
var yourNumber = 8;
var myNumber = 7;
var answer = myNumber + yourNumber;
document.write("the value of 'answer' is: " + answer + "<br />");
document.write("the value of 'answer > mynumber' is: " + (answer > myNumber) + "<br />");
</script>
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<html>
<head>
<title>Example 2.22</title>
<script type="text/javascript">
/*
var shipCode = prompt("Enter your access code:", " ");
var message = " ";
message = (shipCode == "FREESHIP")?"You are eligible for free shipping!":"invalid code";
document.write(message);
*/
alert("This is an alert message");
console.log("Bruh moment")
</script>
</head>
<body>
</body>
</html>

Binary file not shown.

View File

@@ -0,0 +1,119 @@
body { background-color: #000040;
background-image: url(background.gif);
color: #88ffff;
font-family: Verdana, Arial, sans-serif;
}
#container { margin-left: auto;
margin-right: auto;
width:80%;
min-width:700px;
}
#logo {
text-align:center;
margin: 0;
font-family: Geneva, Arial, Helvetica, sans-serif;
padding-top: 30px;
padding-bottom: 20px;
}
#nav {
float: left;
width: 200px;
padding-top: 10px;
text-align:left;
color: #88FFFF;
font-size: 12px;
}
#nav a {text-decoration:none;
margin: 15px;
display: block;
color: #88FFFF;
font-size: 12px;
}
#content {
margin-left: 150px;
padding: 30px;
overflow:auto;
border: medium groove #88FFFF;
line-height: 135%;
}
.floatright {padding-left:20px;
float:right;
}
.floatleft {
float:left;
padding: 30px 0px 20px;
}
#footer { font-size: .60em;
font-style: italic;
text-align: center;
border-top: 2px double #000040;
padding-top: 20px;
padding-bottom: 20px;
}
h2 { text-transform: uppercase;
color: #88ffff;
font-size: 1.2em;
border-bottom: 1px none;
margin-right: 20px;
}
h3 {
color: #88ffff;
font-size: 1em;
border-bottom: 1px solid #000000;
margin-right: auto;
text-align: left;
padding-top: 20px;
padding-right: 150px;
padding-bottom: 20px;
padding-left: 150px;
line-height: 130%;
}
.details { padding-left:20%;
padding-right:20%;
}
img {border:0; }
.content {
margin: 20px;
padding: 20px;
height: 3700px;
width: 500px;
}
a {text-decoration:none;
margin: 15px;
display: block;
color: #88FFFF;
font-size: 12px;
}
a:hover {
color: #000040;
background-color: #88ffff;
}
span {
font-size: 36px;
font-weight: bold;
font-family: "Courier New", Courier, mono;
color: #88ffff;
background-position: center center;
text-align: center;
vertical-align: middle;
}
table {
border-collapse: collapse
}
td {
border: 2px solid #88ffff;
width: 5em;
font-family: "Courier New", Courier, mono;
font-size: 14px;
color: #88ffff;
}

View File

@@ -0,0 +1,49 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Greg's Gambits | Greg's Tales</title>
<link href="greg.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function startGame()
{
var gender = "boy";
var city = " ";
var monster = " ";
var food = " ";
var drink = " ";
numYears = prompt("Enter a number greater than 0: ");
gender = prompt("Is the story about a boy or a girl? ");
letter = gender.charAt(0);
gender = (letter == "b" || letter == "B")?"boy":"girl";
pronoun = (gender == "boy")?"he":"she";
name = prompt("Enter the hero's name: ");
city = prompt("Enter the name of a city: ");
monster = prompt("Enter a type of monster: ");
food = prompt("Enter a food you like: ");
drink = prompt("Enter a drink you like: ");
document.getElementById("content").innerHTML =("Once upon a time, about " + numYears + " years ago, there was a "+ gender + " named " + name + ". " + name + " lived in a small cabin in the woods just outside " + city + " limits.</p> <p>" + name + " enjoyed walking in the woods every day until... One day " + pronoun + " came upon a " + monster + " sitting on a log eating a " + food + ".</p> <p>The " + monster + " jumped up, spilling his " + drink + ". " + name + " ran home as fast as " + pronoun + " could but the " + monster + " followed and ...</p><h3>What happened? You decide! </h3> <p>Ending 1: The " + monster + " and " + name + " became best friends and lived in " + name + "'s house happily ever after.</p> <p>Ending 2: The " + monster + " overpowered " + name + " and gobbled down all the " + food + " and " + drink + " in " + name + "'s refrigerator.</p> <p>Ending 3: " + name + " screamed mean things at the " + monster + ", causing the " + monster + " to turn and run back to the woods, never to be seen again.</p>");
}
</script>
</head>
<body>
<div id="container">
<img src="images/superhero.jpg" class="floatleft" />
<h1><em>Greg's Tales</em></h1>
<h3>For this game, you will create a story by entering words as prompted. The story will change each time you run this game, as you enter different words.</h3>
<div id="nav">
<p><a href="index.html">Home</a>
<a href="greg.html">About Greg</a>
<a href="play_games.html">Play a Game</a>
<a href="sign.html">Sign In</a>
<a href="contact.html">Contact Us</a></p>
</div>
<div id="content">
<p>&nbsp;</p>
<input type="button" value = "click to begin" onclick="startGame()" />
</div>
<div id="footer">Copyright &copy; 2013 Greg's Gambits<br />
<a href="mailto:yourfirstname@yourlastname.com"> yourfirstname@yourlastname.com</a>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -0,0 +1,24 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>test1</title>
<script type="text/javascript">
var num1 = 8;
//alert("1");
var num2 = 7;
//alert("2");
var answer = num1 + num2;
//alert("3");
console.log("The value of 'answer' is: " + answer + "<br/>");
console.log("The value of 'answer' > num1 is: " + (answer > num1) + "<br/>");
console.log(("John" > "abc") + "<br/>");
console.log(("John" > "John") + "<br/>");
console.log(("John" < "abc") + "<br/>");
</script>
</html>

BIN
Assignments/JavaScript/ch02/.DS_Store vendored Executable file

Binary file not shown.

View File

@@ -0,0 +1,3 @@
{
"directory": "public_html/bower_components"
}

View File

@@ -0,0 +1,9 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/Gruntfile.js to edit this template
*/
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
});
};

View File

@@ -0,0 +1,13 @@
{
"name": "chapter2LatBame",
"version": "1.0.0",
"main": "path/to/main.css",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
},
"devDependencies": {
}
}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/gulpfile.js to edit this template
*/
var gulp = require('gulp');
gulp.task('default', function () {
// place code for your default task here
});

View File

@@ -0,0 +1,5 @@
file.reference.chapter2LatBame-public_html=public_html
file.reference.chapter2LatBame-test=test
files.encoding=UTF-8
site.root.folder=${file.reference.chapter2LatBame-public_html}
test.folder=${file.reference.chapter2LatBame-test}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.web.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/clientside-project/1">
<name>chapter2LatBame</name>
</data>
</configuration>
</project>

View File

@@ -0,0 +1,8 @@
{
"name": "chapter2LatBame",
"version": "1.0.0",
"keywords": ["util", "functional", "server", "client", "browser"],
"author": "caleb",
"contributors": [],
"dependencies": {}
}

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var firstName = prompt("Please enter your first name");
var lastName = prompt("Please enter your last name");
var school = prompt("Please enter your school's name", "South Lousiana Community College");
var username = firstName.charAt(0) + lastName.charAt(0) + school.slice(0, school.indexOf(" "));
document.write("Your username is " + username);
</script>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var age = prompt("Please enter your age.");
document.write(age > 18?"You are old enough to vote":"You are not old enough to vote");
</script>
</html>

View File

@@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript">
var age = prompt("Please enter your age.");
if (age < 5 & ) {
document.write("Congratulations! Your ticket is free!");
} else if (age < 12) {
document.write("Your ticket costs $5.00.");
} else {
}
</script>
</head>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
-->
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div>TODO write content</div>
</body>
</html>