forked from zachwlewis/projectcodename
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pc.js
84 lines (75 loc) · 2.39 KB
/
pc.js
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
var attributes = [
// Environ
"desert", "tundra", "mountain", "space", "field", "urban",
// Stealth and cunning
"hidden", "covert", "uncanny", "scheming", "decisive",
// Volitility
"rowdy", "dangerous", "explosive", "threatening", "warring",
// Needs correction
"bad", "unnecessary", "unknown", "unexpected", "waning",
// Organic Gems and materials
"amber", "bone", "coral", "ivory", "jet", "nacre", "pearl", "obsidian", "glass",
// Regular Gems
"agate", "beryl", "diamond", "opal", "ruby", "onyx", "sapphire", "emerald", "jade",
// Colors
"red", "orange", "yellow", "green", "blue", "violet",
]
var objects = [
// Large cats
"panther", "wildcat", "tiger", "lion", "cheetah", "cougar", "leopard",
// Snakes
"viper", "cottonmouth", "python", "boa", "sidewinder", "cobra",
// Other predators
"grizzly", "jackal", "falcon",
// Prey
"wildabeast", "gazelle", "zebra", "elk", "moose", "deer", "stag", "pony",
// HORSES!
"horse", "stallion", "foal", "colt", "mare", "yearling", "filly", "gelding",
// Occupations
"nomad", "wizard", "cleric", "pilot",
// Technology
"mainframe", "device", "motherboard", "network", "transistor", "packet", "robot", "android", "cyborg",
// Sea life
"octopus", "lobster", "crab", "barnacle", "hammerhead", "orca", "piranha",
// Weather
"storm", "thunder", "lightning", "rain", "hail", "sun", "drought", "snow",
// Other
"warning", "presence", "weapon"
]
var type = "PROJECT";
var codename = "CODENAME";
function createCodename()
{
var f = attributes[Math.floor(Math.random() * attributes.length)].toUpperCase();
var l = objects[Math.floor(Math.random() * objects.length)].toUpperCase();
codename = f + " " + l;
$('#codename').text(codename);
updateTwitterButton();
}
function switchType()
{
if (type == "PROJECT")
{
type = "OPERATION";
$('#switchType').text("It's a project.");
}
else
{
type = "PROJECT";
$('#switchType').text("It's an operation.");
}
$('#opType').text(type);
updateTwitterButton();
}
function updateTwitterButton()
{
$('#twitter').replaceWith("<a href=\"https://twitter.com/share\" id=\"twitter\" class=\"twitter-share-button\" data-via=\"zachwlewis\" data-url=\"http://projectcodename.com\">Tweet</a>");
$('#twitter').attr('data-text', type + ": " + codename + " is a go.");
if(typeof(twttr) !== 'undefined')
{
twttr.widgets.load();
}
}
createCodename();
$('#newProject').click(createCodename);
$('#switchType').click(switchType);