-
Notifications
You must be signed in to change notification settings - Fork 0
/
ski_name.js
116 lines (109 loc) · 2.5 KB
/
ski_name.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
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
$(function() {
var $initials = $('#initials');
var NAMES = [
{ 'A': 'Sketchy',
'B': 'Dodgy',
'C': 'Sick',
'D': 'Crazy',
'E': 'Fugly',
'F': 'Steep',
'G': 'Craggy',
'H': 'Fatty',
'I': 'Bumpy',
'J': 'Rad',
'K': 'Manky',
'L': 'Slushy',
'M': 'Snowy',
'N': 'Wobbly',
'O': 'Iffy',
'P': 'Dank',
'Q': 'Dreamy',
'R': 'Krunky',
'S': 'Gnarly',
'T': 'Deep',
'U': 'Fresh',
'V': 'Buttery',
'W': 'Creamy',
'X': 'Steezy',
'Y': 'Powdery',
'Z': 'Fluffy' },
{ 'A': 'Glade',
'B': 'Brah',
'C': 'Crud',
'D': 'Gaper',
'E': 'Kicker',
'F': 'Stash',
'G': 'Bowl',
'H': 'Crust',
'I': 'Run',
'J': 'Poser',
'K': 'Pole',
'L': 'Ass',
'M': 'Snotsicle',
'N': 'Quiver',
'O': 'Toe',
'P': 'Leg',
'Q': 'Stick',
'R': 'Turn',
'S': 'Roll',
'T': 'Chatter',
'U': 'Bum',
'V': 'Foot',
'W': 'Scraper',
'X': 'Drop',
'Y': 'Plank',
'Z': 'Faceshot' },
{ 'A': 'McFaceplant',
'B': 'don Planketti',
'C': 'von Biffer',
'D': 'McCruiser',
'E': 'Powderson',
'F': 'LaFlex',
'G': 'Slamsky',
'H': 'van Yardsale',
'I': 'Edgegrinder',
'J': 'Dupree',
'K': 'Vandensproing',
'L': 'de la Gnar Gnar',
'M': 'du Chute',
'N': 'Camberson',
'O': 'McChickenhead',
'P': 'Phatterson',
'Q': 'Huckowitz',
'R': 'Smearez',
'S': 'de la Pow Pow',
'T': 'Rockerson',
'U': 'McFakie',
'V': 'McFreshy',
'W': "O'Christie",
'X': 'Mogulberg',
'Y': 'Chowderston',
'Z': 'Mac Deathcookie'}];
var get_name_for = function(letters) {
if (letters.length > 3 || letters.length < 0) {
throw 'Initials must be between 0 and 3 letters';
}
letters = letters.split('');
var full_name = "";
for (var i=0; i<letters.length; i++) {
var this_name = NAMES[i][letters[i].toUpperCase()];
if (this_name) {
full_name += this_name + ' ';
}
}
return full_name.slice(0, full_name.length-1);
};
var update_ski_name = function() {
if ($initials.val().length > 0 && $initials.val().length < 4) {
$('.name-container').show();
$('.header-container').hide();
$('#the-name').text(get_name_for($initials.val()));
} else {
$('.name-container').hide();
$('.header-container').show();
}
};
// use interval instead of keyup to fix android issues
setInterval(update_ski_name, 100);
$.backstretch('http://www.tspike.com/pictures/flatirons.jpg');
});