Skip to content
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
16 changes: 8 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Wu Rap Name Generator</a>
<a class="navbar-brand" href="#">Wu-Tang Rap Name Generator</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
Expand Down Expand Up @@ -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 class="alert alert-success" id="response-name" style="display: none"></div>
<div class="alert alert-danger" id="no-input" style="display: none">
<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 type="text/javascript" src="js/script.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>
57 changes: 48 additions & 9 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


/**
* RAP NAME GENERATOR
* The user will insert their first name and on click receive one of several
Expand All @@ -13,20 +11,61 @@
**/

function Generator() {

/* Name Arrays: Customize names to change possible output */
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.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 ', 'Chief ', ''];
}

function random_item(array) {
return array[Math.floor(array.length * Math.random())];
}

function adjust_name(name) {
var random_num = Math.ceil(4 * Math.random());
switch (random_num) {
case 1:
return name.toUpperCase().split("").join(".");
break;
case 2:
return name[0].toUpperCase();
break;
case 3:
return name[0].toUpperCase() + "ZA";
break;
default:
return name;
}
}

//Add your codez here
$(document).ready(function() {
var engine = new Generator;

$("#enter").click(function(){

$(document).ready(function() {
var input = $("#user-input").val();

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

var rap_name = generateRapName(input);
$("#response-name").html(rap_name);

$("#no-input").css('display', 'none');
$("#response-name").css('display', 'block');

} else {

$("#no-input").css('display', 'block');
$("#response-name").css('display', 'none');

}

});

function generateRapName(input) {
var first_name = random_item(engine.first_names);
var last_name = random_item(engine.last_names);
var adjusted_input = adjust_name(input)

return first_name + adjusted_input + last_name;
}
});