-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
192 lines (164 loc) · 6.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>In A Gif!</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- reset browser styles -->
<link rel="assets/stylesheet" type="text/css" media="screen" href="styles/reset.css" />
<!-- bootstrap links -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp"
crossorigin="anonymous">
<link rel="stylesheet" type="text/css" media="screen" href="styles/main.css" />
<!-- liking into some common/popular google fonts, because -->
<link href="https://fonts.googleapis.com/css?family=Audiowide|Orbitron" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Oleo+Script" rel="stylesheet">
<!-- <link href="https://fonts.googleapis.com/css?family=Abril+Fatface|Audiowide|Comfortaa|Dancing+Script|Great+Vibes|Kaushan+Script|Lato|Lobster|Lobster+Two|Marck+Script|Monoton|Open+Sans|Playfair+Display|Roboto|Roboto+Mono|Roboto+Slab|Rozha+One|Sacramento|Shrikhand|Slabo+27px|Source+Code+Pro"
rel="stylesheet"> -->
<!-- adding jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="scripts/main.js"></script>
</head>
<body>
<header>
<div id="logo"><p>in a gif <span id="logo-name">Star Trek</span></p></div>
<navbar id="the-navbar"><p id="ratings-menu-label">Maximum Rating:</p>
<select id="ratings-menu">
<option value="PG">PG</option>
<option value="G">G</option>
<option value="PG-13">PG-13</option>
<option value="R">R</option>
<option value="X">X</option>
</select>
<p id = "color-menu-label">Color Scheme:</p>
<select id="color-menu">
<option value="slateTheme">Vulcan</option>
<option value="klingonTheme">Klingon</option>
<option value="wowMan">Eden</option>
</select>
</navbar>
</header>
<div id="everything" class="container-fluid">
<div id="row-main" class="row">
<div id="gif-holder" class="col-md-9 col-sm-9 ">
<h2 id="instructions">Your gifs will appear here<span id="explainer">click on a button in the right side bar to reveal gifs</span></h2>
</div>
<div id="sidebar-right" class="col-md-3 col-sm-3 col-border">
<div id="add-your-own" class=row>
<form id="add-character">
<h3 id="form-label">Add your own!</h3>
<p><input id="name-box" type="text" value="character name"></p>
<p><input id="phrase-box" type="text" value="button phrase"></p>
<button id="submit-button" class="btn-submit" type="submit">Add</button>
</form>
</div>
<div id="buttons-holder" class="row">
<h3 id="banner">Click button to display gifs</h3>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$("#name-box").on('click', function() {
if (dummyName) {
$(this).val('');
$(this).css('color', 'black');
$(this).css('background-color', 'white');
dummyName = false;
}
});
$("#name-box").on('blur', function() {
$(this).css('background-color', '#C6E3FF');
if ($(this).val().trim() == '') {
$(this).css("color", "#3D5D7F");
$(this).val("character name");
dummyName = true;
}
});
$("#name-box").on('focus', function() {
$(this).css('background-color', 'white');
});
$("#name-box").on('keyup', function() {
dummyName = false;
})
$("#phrase-box").on('click', function() {
if (dummyPhrase) {
$(this).val('');
$(this).css('color', 'black');
$(this).css('background-color', 'white');
dummyPhrase = false;
console.log("in phrase box dummyPhrase is"+dummyPhrase);
}
});
$("#phrase-box").on('keyup', function() {
dummyPhrase = false;
})
$("#phrase-box").on('blur', function() {
var $input = $("#phrase-box");
var newPhrase = $(this).val().trim();
// console.log("newPhrass is "+newPhrase);
$(this).css('background-color', '#C6E3FF');
if (newPhrase.length > 0) {
// console.log("trimmed phrase is "+$(this).val().trim())
$(this).css("color", "#3D5D7F");
// $(this).val("button phrase");
dummyPhrase = false;
} else {
console.log("the program thinks the phrase has no length")
$(this).val("button phrase");
$(this).css('color', '#3D5D7F');
dummyPhrase = true;
}
});
$("#phrase-box").on('focus', function() {
$(this).css('background-color', 'white');
});
$("#add-character").submit(function( event ) {
event.preventDefault();
var $inputs = $('#add-character :input');
if (dummyName || dummyPhrase) {
if (dummyName && dummyPhrase) {
alert("Please enter a character name and a slogan to put on the button.");
} else if (dummyName && !dummyPhrase) {
alert("Please enter a character name.")
} else if (!dummyName && dummyPhrase) {
alert("Please enter a phrase to put on the button")
}
}
characterName = $("#add-character :input[id=name-box]").val();
characterPhrase = $("#add-character :input[id=phrase-box]").val();
addCharacter(characterName, characterPhrase, charactersAll);
getCharacterGifs(characterName);
makeBtn(characterName, characterPhrase);
resetTextFields();
});
// Event listener for all button elements
$(".btn-gif").on("click", function () {
handleBtnClick($(this));
console.log("got event");
});
$('#gif-holder').on('click', function(event) {
toggleMotion(event);
});
$(document).on('click', '.btn-gif', function () {
handleBtnClick($(this));
})
$("#ratings-menu").on('change', function() {
maxLevel = $("#ratings-menu").val();
// console.log(maxLevel);
});
$("#color-menu").on('change', function() {
colorTheme = $("#color-menu").val();
changeColorScheme(colorTheme);
console.log(colorTheme);
console.log("hello");
});
initialize(charactersAll);
</script>
</body>
</html>