-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
146 lines (138 loc) · 3.73 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CENDERATOR</title>
<meta name="description" content="CENDE BAND NAME GENERATOR">
<link rel="stylesheet" href="cende.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<div class="flex-container">
<div class="box">
<div class="flex-item">
<h1><a href="https://cende.bandcamp.com/">CENDE</a> BAND NAME GENERATOR</h1>
<form name="myForm" >
<input id="textfield" name="textfield" type="text" placeholder="type a band name" />
<input type="button" value="Submit" onclick="return validateForm()">
<input type="button" value="Just do it for me!" onclick="return justDoIt()">
</form>
<h1 class="result"></h1>
</div>
</div>
</div>
<script>
$('#textfield').keydown( function( event ) {
if ( event.which === 13 ) {
// Do something
// Disable sending the related form
event.preventDefault();
validateForm();
return false;
}
});
var validateForm = function(){
var originalBand = $("#textfield").val();
doIt(originalBand);
}
var doIt = function(originalBand) {
var wordArray = originalBand.split(" ");
var longestWord = "";
wordArray.forEach(function(word) {
if (word.length > longestWord.length) {
longestWord = word;
}
});
var newBand = longestWord;
while (newBand.length > 5) {
newBand = newBand.substring(1, newBand.length - 1);
}
$(".result").text(newBand);
};
var justDoIt = function() {
var min = 0;
var max = listOfBands.length;
bandName = listOfBands[Math.floor(Math.random() * (max - min) + min)];
$("#textfield").val('');
$("#textfield").attr("placeholder", bandName);
doIt(bandName);
};
var listOfBands = [
"The Clash",
"Green Day",
"Ramones",
"The Offspring",
"Sex Pistols",
"Bad Religion",
"blink-182",
"NOFX",
"Dead Kennedys",
"Rise Against",
"Misfits",
"Sum 41",
"Rancid",
"Anti-Flag",
"Dropkick Murphys",
"Iggy Pop",
"Screeching Weasel",
"Lagwagon",
"My Chemical Romance",
"Billy Talent",
"Propagandhi",
"The Bouncing Souls",
"Fall Out Boy",
"Flogging Molly",
"Black Flag",
"Pennywise",
"The Stooges",
"Buzzcocks",
"Fugazi",
"Gogol Bordello",
"The Distillers",
"Die Ärzte",
"The Exploited",
"Alkaline Trio",
"The Hives",
"Good Charlotte",
"Nirvana",
"Sublime",
"Patti Smith",
"Mindless Self Indulgence",
"Social Distortion",
"Bloodhound Gang",
"Against Me!",
"Yellowcard",
"Millencolin",
"Simple Plan",
"Bad Brains",
"Minor Threat",
"The Damned",
"Descendents",
"The Used",
"Die Toten Hosen",
"Goldfinger",
"Lagwagon",
"Operation Ivy",
"Refused",
"The All-American Rejects",
"The Adicts",
"Taking Back Sunday",
"Less Than Jake",
"New Found Glory",
"Red Hot Chili Peppers",
"The Casualties",
"Hüsker Dü",
"Pulley",
"The Vandals",
"Teenage Bottlerocket",
"Satanic Surfers",
"Bad Religion",
"Black Flag",
"The Queers",
"Masked Intruder",
"Operation Ivy",
"Jawbreaker",
"Circle Jerks"];
</script>
</body>
</html>