-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathyaffh.html
333 lines (286 loc) · 10.2 KB
/
yaffh.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
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>YAFFH</title>
<!--
YAFFH: Yet Another Fake File Host
X11/MIT Licensed
Copyright (c) 2009 Elijah Grey, http://eligrey.com
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Ignore the trade and service marks, they are just there to make it look legit.
-->
<style type="text/css">
html {
margin-left: 25%;
margin-right: 25%;
}
fieldset {
border-radius : 5px;
-moz-border-radius : 5px;
-webkit-border-radius : 5px;
}
fieldset input[type="text"] {
width: 70%;
}
dt {
font-size: larger;
font-weight: bold;
}
kbd {
background-color: lightgray;
}
[readonly] {
user-modify: read-only;
-moz-user-modify: read-only;
}
input[type="text"].permalink {
color: blue;
text-decoration: underline;
}
dd.lie:hover:after {
opacity: 0.18;
filter: alpha(opacity=18);
content: " (Lie)";
}
#addremove {
text-align: center;
}
</style>
</head>
<body>
<h1>YAFFH: Yet Another Free File Host</h1>
<p><a href="/yaffh.html" rel="self">YAFFH</a> is a free file host that stores your files forever.</p>
<p>The permalinks returned by YAFFH will never expire and will still work even if we go out of business trying to host your files.</p>
<p>Currently, only <a href='http://www.mozilla.com/?from=sfx&uid=252568&t=315'>Mozilla Firefox</a> supports the YAFFH uploading interface but the permalinks work in all standards-compliant browsers.</p>
<fieldset>
<legend><label for="addfile">Upload Files</label></legend>
<div id="addremove">
<input id="removefile" type="button" value="-" title="Remove last file"/>
<input id="addfile" type="button" value="+" title="Add a new file"/>
</div>
<div id="files">
</div>
</fieldset>
<fieldset>
<legend><label for="permalinks">Permalinks</label></legend>
<div id="permalinks">
</div>
</fieldset>
<h2 id="faq"><abbr title="Frequently Asked Questions">FAQ</abbr></h2>
<dl>
<dt>What file formats are supported?</dt>
<dd>All of them and then some.</dd>
<dt>Is there a maximum file size limit?</dt>
<dd>No. You may upload files of any file size.</dd>
<dt>What are the shortcuts?</dt>
<dd>
<dl>
<dt><kbd>+</kbd></dt>
<dd>Add a new file.</dd>
<dt><kbd>-</kbd></dt>
<dd>Remove last file.</dd>
<dt><kbd>p</kbd></dt>
<dd>Skip to a specified permalink.</dd>
<dt><kbd>f</kbd></dt>
<dd>Skip to a specified file.</dd>
</dl>
</dd>
<dt>How are the files instantly uploaded with <abbr title="Asynchronous JavaScript and XML">Ajax</abbr>?</dt>
<dd class="lie">Advanced Instajax™ technology developed by <a href="http://eligrey.com/">Elijah Grey</a> hacks your browser and pre-uploads files that are determined to be most likely to be uploaded by you. It determines this based on your most recently modified files.</dd>
<dt>How are the files instantly downloaded by my browser?</dt>
<dd class="lie">YAFFH hacks your browser to download and cache the files before they are even requested.</dd>
</dl>
<script type="text/javascript">
//<![CDATA[
(function () {
var doc = document,
addFileButton = doc.getElementById("addfile"),
removeFileButton = doc.getElementById("removefile"),
filesContainer = doc.getElementById("files"),
files = [],
permalinks = doc.getElementById("permalinks"),
formatTests = { // contact me (http://purl.eligrey.com/contact) to request adding more formats
// Text/document formats
"text/plain" : /^(?:te?xt$|readme)$/, // txt, text, readme
"text/html" : /^html?$/, // html, htm
"application/xhtml+xml" : /^xht(?:ml|l)?$/, // xhtml, xhtm, xht
"application/xml" : "xml",
"text/rtf" : "rtf",
"application/pdf" : "pdf",
"application/x-shockwave-flash" : "swf", // no idea where this would go
// Image formats
"image/png" : /^a?png$/, // png, apng
"image/jpeg" : /^jpe?g$/, // jpeg, jpg
"image/gif" : "gif",
"image/svg+xml" : /^svgz?$/, // svg, svgz
"image/x-ms-bmp" : /^(?:bmp|dib)$/, // bmp, dib
"image/xbm" : "xbm",
"image/vnd.microsoft.icon" : "ico",
// Video formats
"video/ogg" : "ogv",
"video/mp4" : /^(?:mp4|m4v|f4[vp])$/, // mp4, m4v, f4v, f4p
"video/x-flv" : "flv",
"video/divx" : "divx",
"video/x-matroska" : /^mk[vas]$/, // mkv, mka, mks
"video/3gpp" : "3gp",
"video/3gpp2" : "3g2",
// Audio formats
"audio/ogg" : /^og[ga]$/, // ogg, oga
"audio/x-flac" : "flac",
"audio/x-speex" : "spx",
"audio/mp4" : /^(?:m4a|f4[ab])$/, // m4a, f4a, f4b
// OpenDocument formats
"application/vnd.oasis.opendoc.text" : "odt",
"application/vnd.oasis.opendoc.presentation" : "odp",
"application/vnd.oasis.opendoc.spreadsheet" : "ods",
"application/vnd.oasis.opendoc.graphics" : "odg",
// Microsoft formats
"application/msword" : /^do[ct]$/, // doc, dot
"application/vnd.ms-excel" : /^xl[tas]$/, // xlt, xla, xls
"application/vnd.ms-powerpoint" : /^p(?:p[tsa]|ot)$/, // ppt, pot, pps, ppa
"application/vnd.openxmlformats-officedoc.wordprocessingml.document" : /^doc[xm]$/, // docx, docm
"application/vnd.openxmlformats-officedoc.presentationml.presentation" : "pptx",
"application/vnd.openxmlformats-officedoc.spreadsheetml.sheet" : "xlsx",
"application/vnd.openxmlformats-officedoc.wordprocessingml.template" : "dotx",
"application/vnd.openxmlformats-officedoc.spreadsheetml.template" : "xltx",
"application/vnd.openxmlformats-officedoc.presentationml.template" : "potx",
"application/vnd.openxmlformats-officedoc.presentationml.slideshow" : "ppsx"
}, formats = [];
for (formatTest in formatTests) {
if (formatTests.hasOwnProperty(formatTest)) {
formats.unshift(formatTest);
}
}
function guessType(ext) {
var guessedType = "application/octet-stream",
i = formats.length, test;
while (i--) {
test = formatTests[formats[i]];
if ((typeof test === "string" && ext === test) ||
(test instanceof RegExp && test.test(ext)))
{
guessedType = formats[i];
break;
}
}
return guessedType;
}
function fileInputChange() {
if (this.files.length > 0) {
var id = "permalink" + this.getAttribute("id").substr("file".length),
permalink = doc.getElementById(id);
if (permalink) {
var file = this.files.item(0),
fileName = file.name || file.fileName, // FileAPI: name, non-standard: fileName
dataURI = file.getAsDataURL().split(","),
meta = dataURI[0].substr("data:".length).split(";"),
mediaType = file.mediaType || meta[0];
meta = ["application/octet-stream", "base64"];
mediaType = meta[0];
if (!mediaType || mediaType === "application/octet-stream") {
meta[0] = guessType(
fileName.substr(
fileName.lastIndexOf(".") + 1
).toLowerCase()
);
}
permalink.value = ["data:", meta.join(";"), ",", dataURI[1]].join("");
location.hash = "#" + id;
permalink.focus();
}
}
}
function removeLastFile() {
if (files.length > 0) { // files left
var containers = files[files.length - 1];
containers.file.parentNode.removeChild(containers.file);
containers.permalink.parentNode.removeChild(containers.permalink);
files.pop();
}
};
function addNewFile() {
var fileContainer = doc.createElement("p"),
outputContainer = doc.createElement("p");
fileInput = doc.createElement("input"),
permalink = doc.createElement("input"),
inputLabel = doc.createElement("label"),
outputLabel = doc.createElement("label"),
id = files.length + 1;
fileInput.type = "file";
fileInput.id = "file" + id;
fileInput.addEventListener("change", fileInputChange, false);
inputLabel.setAttribute("for", "file" + id);
inputLabel.innerHTML = "File " + id + ": ";
fileContainer.appendChild(inputLabel);
fileContainer.appendChild(fileInput);
permalink.type = "text";
permalink.setAttribute("readonly", "readonly");
permalink.id = "permalink" + id;
permalink.className = "permalink";
permalink.addEventListener("focus", permalinkSelect, false);
outputLabel.setAttribute("for", "permalink" + id);
outputLabel.innerHTML = "Permalink for file " + id + ": ";
outputContainer.appendChild(outputLabel);
outputContainer.appendChild(permalink);
filesContainer.appendChild(fileContainer);
permalinks.appendChild(outputContainer);
files.push({file:fileContainer, permalink:outputContainer});
};
addFileButton.addEventListener("click", addNewFile, false);
removeFileButton.addEventListener("click", removeLastFile, false);
doc.addEventListener("keydown", function(evt) {
if (evt.keyCode === 61) // pressed "+", add new file
addNewFile();
else if (evt.keyCode === 109) // pressed "-", remove last file
removeLastFile();
else if (evt.keyCode === 80) { // pressed "p", focus specified permalink
var id = "permalink" + prompt("Enter the permalink number to skip to."),
permalink = doc.getElementById(id);
if (permalink) {
location.hash = "#" + id;
permalink.focus();
}
} else if (evt.keyCode === 70) { // pressed "f", focus specified file
var id = "file" + prompt("Enter file number to skip to."),
fileInput = doc.getElementById(id);
if (fileInput) {
location.hash = "#" + id;
fileInput.focus();
}
}
}, false);
function permalinkSelect() {
this.select();
};
addNewFile();
addFileButton.focus();
}());
//]]>
</script>
<script type="text/javascript" src ="http://www.google-analytics.com/ga.js"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-4364432-7");
pageTracker._trackPageview();
} catch(err) {}
</script>
</body>
</html>