-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.html
114 lines (88 loc) · 4.77 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>localFont - Implement localStorage web font caching in seconds</title>
<meta name="description" content="Implement localStorage web font caching in seconds">
<link rel="canonical" href="https://jaicab.com/localFont/">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="localFont - Implement localStorage web font caching in seconds">
<meta name="twitter:description" content="localFont creates a base64 version of your font files and builds the CSS and JavaScript necessary to implement it.">
<meta name="twitter:creator" content="@jaicab_">
<meta property="og:title" content="localFont - Implement localStorage web font caching in seconds" />
<meta property="og:url" content="http://jaicab.com/localFont/" />
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="core.min.js"></script>
</head>
<body>
<header class="header">
<div class="lc">
<div class="logo">localFont</div>
<h1 class="header__intro">Implement localStorage web font caching in seconds</h1>
</div>
</header>
<section class="section">
<div class="lc">
<form id="upload" action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" id="MAX_FILE_SIZE" name="MAX_FILE_SIZE" value="300000" />
<div>
<input type="hidden" id="fileselect" name="fileselect[]" multiple="multiple" />
<div id="filedrag" class="droparea">Drop your font family files here (*.woff, *.woff2 or *.ttf)</div>
</div>
</form>
<div class="fontform">
<button id="clearAll">Clear all</button>
<p>
Now please set your font family name as well as the font weights and styles corresponding to each file.
<br/>
Your CSS and demos will be updated on the fly. Please use one font family at a time.
</p>
<div class="font familyname">
<div>
Family name
</div>
<div id="font_family">
</div>
</div>
<div id="font_list">
</div>
</div>
<div class="output-wrap">
<div class="output">
<h2><b>Boom</b>. Set up your fonts on the left. Then, use this code.</h2>
</div>
<div class="dontminify">
<input type="checkbox" id="nominifycss">Don't minify CSS
</div>
<div class="output output--css">
<h3>CSS <span id="csssize"></span></h3>
<p>Put this code in a CSS file and specify its absolute path (should be accessible via domain.com/<span id="pathspan">font.css</span>).</p>
<input type="text" id="css_path" placeholder="Absolute path to CSS file" value="font.css">
<textarea id="outputcss" placeholder="Base64 will appear here"></textarea>
</div>
<div class="output output--js">
<h3>JavaScript</h3>
<p>Paste this chunk of JS right before your <code>body</code> opening tag.</p>
<textarea id="outputjs"><script type="text/javascript">!function(){"use strict";function e(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function t(e){return window.localStorage&&localStorage.font_css_cache&&localStorage.font_css_cache_file===e}function n(){if(window.localStorage&&window.XMLHttpRequest)if(t(o))c(localStorage.font_css_cache);else{var n=new XMLHttpRequest;n.open("GET",o,!0),e(n,"load",function(){4===n.readyState&&(c(n.responseText),localStorage.font_css_cache=n.responseText,localStorage.font_css_cache_file=o)}),n.send()}else{var a=document.createElement("link");a.href=o,a.rel="stylesheet",a.type="text/css",document.getElementsByTagName("head")[0].appendChild(a),document.cookie="font_css_cache"}}function c(e){var t=document.createElement("style");t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t)}var o="/font.css";window.localStorage&&localStorage.font_css_cache||document.cookie.indexOf("font_css_cache")>-1?n():e(window,"load",n)}();</script><noscript><link rel="stylesheet" href="/font.css"></noscript></textarea>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="lc">
<div class="content">
Made with ♥ by <a rel="author" href="https://jaicab.com">Jaime Caballero</a> - Check out <a href="https://github.com/jaicab/localFont">localFont on GitHub</a>.
</div>
</div>
</footer>
<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-17212759-15', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>