-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfont-flipper.html
More file actions
298 lines (267 loc) · 14.5 KB
/
font-flipper.html
File metadata and controls
298 lines (267 loc) · 14.5 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
<!DOCTYPE html>
<html>
<head>
<!-- For old IEs -->
<link rel="shortcut icon" href="favicon.ico" />
<!-- For new browsers - multisize ico -->
<link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="favicon.ico">
<!-- For iPad with high-resolution Retina display running iOS ≥ 7: -->
<link rel="apple-touch-icon" sizes="152x152" href="favicon-152-precomposed.png">
<!-- For iPad with high-resolution Retina display running iOS ≤ 6: -->
<link rel="apple-touch-icon" sizes="144x144" href="favicon-144-precomposed.png">
<!-- For iPhone with high-resolution Retina display running iOS ≥ 7: -->
<link rel="apple-touch-icon" sizes="120x120" href="favicon-120-precomposed.png">
<!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->
<link rel="apple-touch-icon" sizes="114x114" href="favicon-114-precomposed.png">
<!-- For iPhone 6+ -->
<link rel="apple-touch-icon" sizes="180x180" href="favicon-180-precomposed.png">
<!-- For first- and second-generation iPad: -->
<link rel="apple-touch-icon" sizes="72x72" href="favicon-72-precomposed.png">
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon" sizes="57x57" href="favicon-57.png">
<!-- For Old Chrome -->
<link rel="icon" sizes="32x32" href="favicon-32.png" >
<!-- For IE10 Metro -->
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="favicon-144.png">
<meta name="theme-color" content="#ffffff">
<!-- Chrome for Android -->
<link rel="manifest" href="manifest.json">
<link rel="icon" sizes="192x192" href="favicon-192.png">
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-44743958-1', 'notsteve.com');
ga('send', 'pageview');
</script>
<meta name="viewport" content="witph=device-witph, initial-scale=1.0">
<title>Font Flipper - Flip through your fonts</title>
<meta name="description" content="Simple little website to get to know the fonts installed on your computer better.">
<meta name="autho" content="Steven Lewis">
<meta property="og:title" content="Font Flipper">
<meta property="og:url" content="http://notsteve.com/font-flipper">
<meta property="og:type" content="website">
<meta property="og:image" content="http://notsteve.com/img/Fontflip-screenshot.png">
<meta property="og:description" content="Simple little website to get to know the fonts installed on your computer better. Get a closer look at letters, and compare fonts side-by-side.">
<meta name="twitter:card" content="Simple little website to get to know the fonts installed on your computer better.">
<meta name="twitter:url" content="http://notsteve.com/font-flipper">
<meta name="twitter:title" content="Font Flipper">
<meta name="twitter:description" content="Simple little website to get to know the fonts installed on your computer better.">
<meta name="twitter:image" content="http://notsteve.com/img/Fontflip-screenshot.png">
<link rel="stylesheet" href="./css/font-flipper.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,700', rel='stylesheet', type='text/css">
<!-- script(src='//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js')-->
<script src="js/jquery.js"></script>
<script src="js/jquery.fittext.js"></script>
</head>
<body>
<div id="welcome-mobile">
<div class="text-container">
<h2>Flip through your fonts with the</h2>
<h1>Font Flipper</h1>
<h2>This site requires flash to get the list of your fonts. Unfortunately, this means it does not work on mobile :(</h2></div>
</div>
<div id="welcome">
<div class="text-container">
<h2>Flip through your fonts with the</h2>
<h1>Font Flipper</h1>
<h2>A simple little website to get to know the fonts installed on your computer better. Try typing to see different letters, compare paragraphs of text as well as each character, and invert colors. </h2><a id="welcome-dismiss" href="#">Loading...</a></div>
</div>
<div class="toggle-buttons"><a id="color-toggle" href="#" title=""><i class="fa fa-adjust"></i></a><a id="paragraph-toggle" href="#" title=""><i class="fa fa-align-left"></i></a>
<a id="facebook-share" href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=http://notsteve.com/font-flipper&p[images][0]=http://notsteve.com/img/Fontflip-screenshot.png&p[title]=Font%20Flipper&p[summary]=Simple%20little%20website%20to%20get%20to%20know%20the%20fonts%20installed%20on%20your%20computer%20better.%20Get%20a%20closer%20look%20at%20letters,%20and%20compare%20fonts%20side-by-side."><i class="fa fa-facebook-square"></i></a><a id="twitter-share" href="http://twitter.com/home?status=Get%20to%20know%20your%20computer's%20fonts%20with%20Font%20Flipper%20http://goo.gl/YUrK3D"><i class="fa fa-twitter-square"></i></a><a id="google-share"
href="https://plus.google.com/share?url=http://notsteve.com/font-flipper"><i class="fa fa-google-plus-square"></i></a></div>
<div id="author-link"><a href="http://notsteve.com" title="">Created by Steven Lewis</a></div>
<div id="flash-warning">
<p>*requires Flash</p>
</div>
<div id="filters-dropdown">
<div id="dropdown-toggle"><a href="#">Show Filters</a></div>
<div id="filter1box" class="filter">
<input id="list1filter">
<button id="filter1go">Filter A</button>
</div>
<div id="filter2box" class="filter">
<input id="list2filter">
<button id="filter2go">Filter B</button>
</div>
</div>
<div id="fontList1"></div>
<div id="fontList2"></div>
<script type="text/javascript">
// WELCOME FITTEXT SETUP
$('#welcome').find('h1').fitText(7, {
minFontSize: '50px'
});
//- GETTING FONTS FROM USER
function populateFontList(fontArr) {
var allFontsCounter = 0;
var regularFontsCounter = 0;
var allFontsHTML = '<ul>';
var regularFontsHTML = allFontsHTML;
for (var key in fontArr) {
var fontName = fontArr[key];
// trim
fontName = fontName.replace(/^\\s\s*/, '').replace(/\s\s*$/, '');
if (fontName.match(/[_\\-\s]Italic$/) ||
fontName.match(/[_\\-\s](Demi)?[Bb]old$/) ||
fontName.match(/[_\\-\s]Medium$/) ||
fontName.match(/[_\\-\s](Ultra)?[Ll]ight$/) ||
fontName.match(/[_\\-\s]Condensed$/)
)
allFontsHTML += '<li>' + fontName + '</li>';
else {
allFontsHTML += '<li class="font-item ' + fontName + '" data-value="' + fontName + '"></li>';
fontName = fontName.replace(/\\s*Regular$/, '');
regularFontsHTML += '<li class="font-item ' + fontName + '" data-value="' + fontName + '"><h2 class="font-name">' + fontName + '</h2><h1>&</h1></li>';
regularFontsCounter++;
}
allFontsCounter++;
}
regularFontsHTML += '</ul>';
allFontsHTML += '</ul>';
// allFontsHTML = allFontsCounter+' fonts altogether:'+allFontsHTML;
// regularFontsHTML = regularFontsCounter+' "regular" fonts:'+regularFontsHTML;
document.getElementById('fontList1').innerHTML = allFontsHTML;
document.getElementById('fontList1').innerHTML = regularFontsHTML;
document.getElementById('fontList2').innerHTML = regularFontsHTML;
$('.font-item').append(
"<p>Every year, I took a holiday. I went to Florence, this cafe on the banks of the Arno. Every fine evening, I would sit there and order a Fernet Branca. I had this fantasy, that I would look across the tables and I would see you there with a wife maybe a couple of kids. You wouldn't say anything to me, nor me to you. But we would both know that you've made it, that you were happy. I never wanted you to come back to Gotham. I always knew there was nothing here for you except pain and tragedy and I wanted something more for you than that. I still do.</p>"
);
changeFonts();
}
//- STUFF PAT HELPED ME WRITE
function changeFonts() {
$(window).on('keypress', function(evt) {
$('#fontList1').find('li').find('h1').text(String.fromCharCode(evt.which));
$('#fontList2').find('li').find('h1').text(String.fromCharCode(evt.which));
})
// SET ITEM FONTS
$('.font-item').find('h1').each(function() {
$(this).css('font-family', $(this).attr('data-value'));
});
$('.font-item').each(function() {
var fontName = $(this).attr('data-value');
$(this).find('h1').css('font-family', fontName);
$(this).find('p').css('font-family', fontName);
});
//- SETTING UP FITTEXT
$('.font-item').find('h1').fitText(1, {
minFontSize: '80px'
});
//- WELCOME PAGE BEHAVIOR (AUTO TYPING)
$('#welcome-dismiss').text('Flip!').css('opacity', 1);
$('#welcome-dismiss').click(function() {
$("#welcome").slideUp("slow", function() {
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 97;
event.keyCode = 97;
$('body').trigger(event);
}, 0);
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 98;
event.keyCode = 98;
$('body').trigger(event);
}, 20);
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 99;
event.keyCode = 99;
$('body').trigger(event);
}, 50);
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 100;
event.keyCode = 100;
$('body').trigger(event);
}, 80);
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 101;
event.keyCode = 101;
$('body').trigger(event);
}, 120);
window.setTimeout(function() {
var event = jQuery.Event('keypress');
event.which = 102;
event.keyCode = 102;
$('body').trigger(event);
}, 170);
});
});
//- INVERT COLOR TOGGLE
$('#color-toggle').click(function() {
$('#fontList1,#fontList2,#color-toggle,#filters-dropdown').toggleClass('color-flip');
});
//- PARAGRAPH/SINGLE LETTER TOGGLE
$('#paragraph-toggle').click(function() {
$('#fontList1 ul li h1').toggle();
$('#fontList1 ul li p').toggle();
$('#fontList2 ul li h1').toggle();
$('#fontList2 ul li p').toggle();
$(this).find('i').toggleClass("fa-align-left fa-font")
});
//- SHOW/HIDE FILTERS TOGGLE
$('#dropdown-toggle').click(function() {
$(this).find('a').text(function(i, v) {
return v === 'Show Filters' ? 'Hide Filters' : 'Show Filters'
});
$("#filters-dropdown,.toggle-buttons,#fontList1 ul,#fontList2 ul").toggleClass('dropdown-shown');
});
//- FILTERING
(function($) {
//- setting up case-insensitive contains
jQuery.expr[':'].Contains = function(a, i, m) {
return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};
//- the actual filtering part
function listFilter(list) {
$('#filter1go').mouseup(function() {
var filter = $('#list1filter').val();
if (filter) {
$(list).find("h2:not(:Contains(" + filter + "))").parent().slideUp();
$(list).find("h2:Contains(" + filter + ")").parent().slideDown();
} else {
$(list).find("li").slideDown();
}
return false;
});
}
//- filter for list two
function listFilter2(list) {
$('#filter2go').mouseup(function() {
var filter = $('#list2filter').val();
if (filter) {
$(list).find("h2:not(:Contains(" + filter + "))").parent().slideUp();
$(list).find("h2:Contains(" + filter + ")").parent().slideDown();
} else {
$(list).find("li").slideDown();
}
return false;
});
}
//ondomready
$(function() {
listFilter($("#fontList1 ul"));
listFilter2($("#fontList2 ul"));
});
}(jQuery));
};
</script>
<object id="fontListSWF" name="fontListSWF" type="application/x-shockwave-flash" data="FontList.swf" witph="1" height="1">
<param name="movie" value="FontList.swf"></param>
<embed src="FontList.swf" witph="1" height="1"></embed>
</object>
</body>
</html>