-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
preview.html
197 lines (161 loc) · 5.33 KB
/
preview.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
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
<html>
<head>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
@font-face {
font-family: xkcd-script;
src: url('xkcd-script/font/xkcd-script.woff') format('woff');
}
.xkcd-script {
font-family: xkcd-script;
color: black;
line-height: 150%;
}
.container {
margins: 0px;
padding: 0px;
}
h3, .summary {
padding: 15px 0 0 15;
margin: 0;
font-size: 2em;
font-weight: bold;
}
.summary {
padding: 0 0 0 15;
font-size: 1.5em;
max-width: calc(100% - 150px);
}
.header {
width: 100%;
min-height: 10%;
background-color: #96A8C8;
display: inline-block;
padding-bottom: 1em;
overflow: hidden;
}
.font-input-container {
text-align: center;
width: 100%;
display: block;
flex-direction: column;
display: flex;
background-color: yellow;
}
.font-input-container > #font-input {
resize: none;
white-space: pre;
font-size: 1.25em;
min-height: 65vh;
padding: 15px;
width: 100%;
}
.footer {
padding-top: 1em;
}
</style>
</head>
<body>
<div id="container" class="container">
<a href="https://github.com/ipython/xkcd-font">
<img id="forkme-ribbon" style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<div>
<div class="header">
<h3 class="xkcd-script">The xkcd font</h3>
<p class="summary xkcd-script">brought to you by the <a href="https://github.com/ipython/xkcd-font">ipython/xkcd-font</a> team</p>
</div>
<div class="font-input-container">
<textarea id="font-input" class="xkcd-script" oninput="UpdateQuerystringFromInput();" spellcheck="false" autofocus>
a b c d e f g h i j k l m n o p q r s t u v w x y z
unauthoritativeness leatherbark intracolic microcheilia offsider
glassweed rottolo albertite hermatorrhachis organometallic
segregationist unevangelic campstool
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z I-pronoun
UNAUTHORITATIVENESS LEATHERBARK INTRACOLIC MICROCHELIA
OFFSIDER GLASSWEED ROTTOLO ALBERTITE HERMATORRHACHIS
ORGANOMETALLIC SEGREGATIONIST UNEVANGELIC CAMPSTOOL
+ - x * ! ? # @ $ % ¦ & ^ _ - - - ( ) [ ] { } / \ < > ÷ ± √ Σ
1 2 3 4 5 6 7 8 9 0 ∫ = ≈ ≠ ~ ≤ ≥ |> <| 🎂 . , ; : “HI” ’ ‘ CAN'T ' "
É Ò Å Ü ≪ ≫ ‽ Ē Ő “ ”
This is a live preview of xkcd-script - type whatever you like!
</textarea>
</div>
<div class="footer">
<form action="javascript: null">
<div class="form-group row">
<label for="share-url-input" class="col-xs-3 col-sm-2 col-form-label" style="padding-top: 5px;"><a href="#">Share URL:</a></label>
<div class="col-xs-9 col-sm-10">
<input type="text" class="form-control" id="share-url-input" readonly>
</div>
</div>
</form>
</div>
</div>
<script>
var urlParams;
function fetchUrlParams() {
var match,
pl = /\+/g, // Regex for replacing addition symbol with a space
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
urlParams = {};
while (match = search.exec(query))
urlParams[decode(match[1])] = decode(match[2]);
};
function UpdateQueryString(key, value, url) {
if (!url) url = window.location.href;
var re = new RegExp("([?&])" + key + "=.*?(&|#|$)(.*)", "gi"),
hash;
if (re.test(url)) {
if (typeof value !== 'undefined' && value !== null)
return url.replace(re, '$1' + key + "=" + value + '$2$3');
else {
hash = url.split('#');
url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
if (typeof hash[1] !== 'undefined' && hash[1] !== null)
url += '#' + hash[1];
return url;
}
}
else {
if (typeof value !== 'undefined' && value !== null) {
var separator = url.indexOf('?') !== -1 ? '&' : '?';
hash = url.split('#');
url = hash[0] + separator + key + '=' + value;
if (typeof hash[1] !== 'undefined' && hash[1] !== null)
url += '#' + hash[1];
return url;
}
else
return url;
}
}
function UpdateQuerystringFromInput() {
url = UpdateQueryString("text", encodeURIComponent(document.getElementById("font-input").value));
history.pushState({}, null, url);
document.getElementById("share-url-input").value = url
}
document.getElementById("share-url-input").value = window.location.href
function renderText(content) {
if (typeof content !== "undefined" && content != "")
{
document.getElementById("font-input").value = content;
};
}
(window.onpopstate = function () {
fetchUrlParams();
renderText(urlParams["text"]);
move_ribbon();
})();
function move_ribbon () {
container = document.getElementById("container");
var rect = container.getBoundingClientRect();
ribbon = document.getElementById("forkme-ribbon");
ribbon.style.left = rect.right - 149;
ribbon.style.right = null;
};
window.onresize = move_ribbon;
</script>
</body>
</html>