Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added in rap name for first or last name #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<link rel="shortcut icon" href="../ico/favicon.png">

<title>Wu-Tang Clan Rap Name Generator</title>


<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="css/animations.css">

</head>

<body>
Expand Down Expand Up @@ -42,18 +42,18 @@

<!--container -->
<div class="container">

<div class="welcome">
<div class='pulse'><img src="img/logo.png"></div>
<h1>Rap Name Generator</h1>
<p class='lead'>Do you want a crazy cool rap name like your favorite<br /> middle-aged rapper from the 90's supergroup Wu-Tang Clan?<br /><br />Enter your real first name below and click play!<p>
<h1>Rap Name Generator</h1>
<p class='lead'>Do you want a crazy cool rap name like your favorite<br /> middle-aged rapper from the 90's supergroup Wu-Tang Clan?<br /><br />Enter your real first name below and click play!<p>
</div>


<div class="input-group input-group-lg input-name">

<div class="input-group input-group-lg input-name" id="userInputDiv">
<span class="input-group-btn">
<button class="btn btn-default" id="enter" type="button">
<button class="btn btn-default" id="enter" type="button" value="Submit">
<span class="glyphicon glyphicon-play"></span>
</button>
</span>
Expand All @@ -63,15 +63,15 @@ <h1>Rap Name Generator</h1>

<!--response -->
<div class='messages'>
<div class="alert alert-success response"></div>
<div class="alert alert-danger error"><strong>Oh snap!</strong> You forgot to enter a name!</div>
<div id="res" class="alert alert-success response"></div>
<div id="err" class="alert alert-danger error"><strong>Oh snap!</strong> You forgot to enter a name!</div>
</div>


</div>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/google-code-prettify/prettify.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>
39 changes: 36 additions & 3 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


/**
/**
* RAP NAME GENERATOR
* The user will insert their first name and on click receive one of several
* possible outputs (i.e. Jill).
Expand All @@ -18,6 +18,21 @@ function Generator() {
this.last_names = ['the Chef', 'Digital', 'Wise', 'Knight', 'Wrecka', 'the Genius', 'the Zoo Keeper', 'the Monk', 'the Scientist', 'the Disciple', 'the Darkman', 'Pellegrino', 'the Ill Figure', 'Rocks The World', 'the Baptist',];
this.first_names = ['Inspectah', 'Masta', 'Poppa', 'Five Foot', 'Ghostface', 'Old Dirty'];

this.getName = function(arr) {
return arr[Math.floor(Math.random() * arr.length)];
};

this.getWrapName = function(name) {
var randValue = Math.round(Math.random());
if (randValue == 0) { //name is first name
var lastName = this.getName(this.last_names);
return name + " " + lastName;
} else { //name entered is last name
var firstName = this.getName(this.first_names);
return firstName + " " + name;
}
};

}


Expand All @@ -26,7 +41,25 @@ function Generator() {

$(document).ready(function() {

var engine = new Generator;
//Add your codez here
var engine = new Generator();

$('#enter').on('click', function(e) {
var name = $('#user-input').val();


$("#err").hide();
$("#res").hide();

if (name.length == 0) {
$("#err").show();
//$("#err").html(engine.getValue(name));
} else {
$("#res").show();
$("#res").html(engine.getWrapName(name));
}


});


});
1 change: 1 addition & 0 deletions node_modules/.bin/hs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/http-server

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions node_modules/http-server/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions node_modules/http-server/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions node_modules/http-server/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 77 additions & 0 deletions node_modules/http-server/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading