-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathscrounger_20180826.html
437 lines (436 loc) · 22.1 KB
/
scrounger_20180826.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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<!DOCTYPE html>
<html>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<title>Session History Scrounger for Firefox (with lz4 support) — Fx File Utilities</title>
<link rel="stylesheet" href="styles.css" type="text/css">
</head>
<body>
<nav>
<ul>
<li id="logo">Fx File Utilities</li>
<li><span id="current">Session History</span></li>
<li><a href="bookbackreader.html" title="Save JSON or Export HTML from bookmark backup files">Bookmark Backup</a></li>
<li><a href="searchjson.html" title="Read out search engine details">Search Engines</a></li>
</ul>
</nav>
<header>
<h1>Session History Scrounger for Firefox</h1>
</header>
<article>
<div id="main">
<p><em>Firefox creates various session history files as you browse, and then at shutdown creates sessionstore.jsonlz4. In Firefox 56+, the files are compressed using Mozilla's flavor of LZ4 compression (.jsonlz4 or .baklz4 file extension). The JSON data contains rich detail about your session, but this page is targeted toward extracting just the page URLs.</em></p>
<h2>Step 1: Load File</h2>
<p>Drag and drop one session history file onto the empty text box<span> (<button onclick="document.getElementById('sesshelp').style.display='block'; this.parentNode.style.display='none';">HELP</button>)</span>, or use the Browse... button on the right. This file is not sent to the network, it is only read within this page in Firefox.</p>
<div id="sesshelp" style="display:none; background-color:#ffc; padding:0 1em; border:1px solid #333; margin-bottom:1em;">
<p>This tool can read URLs out of the following types of session history files:</p>
<ul><li>Firefox 56+ compressed files such as recovery.jsonlz4 or previous.jsonlz4 from: [profile]\sessionstore-backups</li><li>Firefox 45-55 uncompressed files such as recovery.js or previous.js from: [profile]\sessionstore-backups</li><li>Session Manager 2.x .session files stored from: [profile]\sessions</li><li>Tab Session Manager "storage.js" file from: [profile]\browser-extension-data\Tab-Session-Manager@sienori (cannot be converted to a native Firefox sessionstore.js-format file)</li><li>Session Boss "storage.js" file from: [profile]\browser-extension-data\[email protected] (cannot be converted to a native Firefox sessionstore.js-format file)</li><li>OneTab "storage.js" file from: [profile]\browser-extension-data\[email protected] (cannot be converted to a native Firefox sessionstore.js-format file)</li></ul>
<p>If you are unfamiliar with how to locate your [profile] folder, please see: <a href="https://support.mozilla.org/kb/profiles-where-firefox-stores-user-data" target="_blank">Profiles - Where Firefox stores your bookmarks, passwords and other user data</a> on Mozilla Support.</p>
</div>
<div id="uploaddiv">
<textarea id="drop_zone" ondrop="drop_handler(event);" ondragover="dragover_handler(event);" ondragend="dragend_handler(event);" style="width:80%" autocomplete="false" placeholder="Drop file here"></textarea>
<div style="position:absolute; right:0; top:0; width:calc(20% - 18px); cursor: pointer;" onclick="document.querySelector('#btnBrowse').click();";>
<p style="margin-top:2em; text-align:center;">Or open using: <br><br><input type="file" id="btnBrowse" onchange="loadFile(this);" style="width: 80px"></p>
</div>
</div>
<p><em>Note: To scrounge a different file, reload this page (Windows: Ctrl+r. Mac: Command+r). Or click the reload button in the address bar.</em></p>
<h2>Step 2: Extract URLs / Save Session Links</h2>
<p><button onclick="parsejson()" id="btnScrounge" disabled>Scrounge URLs</button> <button onclick="SaveList()" id="btnSave" disabled>Save List (HTML with links)</button> <button onclick="SaveJSON()" id="btnJSON" disabled>Save Uncompressed JSON (sessionstore.js format)</button></p>
<div id="output" style="border-top:2px solid #000;">
<style type="text/css">
.bhtoggle {cursor:pointer;}
.bhtoggle:hover::after {content: " {click to toggle display}"; color: blue;}
.backhist > div {display:none;}
</style>
<script type="text/javascript">
function toggleBH(el){
var tgtdiv = el.nextElementSibling;
if (tgtdiv.style.display != 'block') tgtdiv.style.display = 'block';
else tgtdiv.style.display = '';
}
</script>
<p class="attrib">Extracted using <a href="https://www.jeffersonscher.com/res/scrounger.html">https://www.jeffersonscher.com/res/scrounger.html</a></p>
</div>
</div><!-- #main -->
</article>
<footer>
<p>Copyright © 2018 Jefferson Scher (<a href="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause License</a>). lz4.js © 2016 Pierre Curto (<a href="https://github.com/pierrec/node-lz4/blob/master/LICENSE">MIT License</a>; <a href="https://github.com/pierrec/node-lz4/tree/8b0027e08cb5d486e212b18b906d76a43f740f88/build">Sept. 1, 2016</a>). FileSaver.js © 2016 Eli Grey (<a href="https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md">MIT License</a>; <a href="https://github.com/eligrey/FileSaver.js/tree/1.3.2">v1.3.2</a>). MDN code samples © Mozilla Contributors or Public Domain (<a href="https://developer.mozilla.org/en-US/docs/MDN/About#Copyrights_and_licenses">License</a>). No claim to your data! Updated 2018-08-26. (<a href="/res/scrounger_json.html">Original Scrounger</a>)</p>
</footer>
<script type="text/javascript">
// Compatibility check
if (typeof(window.TextDecoder) !== 'function'){
var p1 = document.createElement('p');
p1.setAttribute('style', 'border:3px solid red; padding:12px 30px;');
p1.innerHTML = 'Unfortunately, this tool does not work in your current browser. Sorry. Please try Firefox, Chrome, Chromium or Opera instead. <br>' +
'(IE and Edge do not support <a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder#Browser_compatibility">TextDecoder</a>. ' +
'IE also does not support <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#Browser_compatibility">TypedArray.slice()</a>; unclear whether Edge or Safari supports it.)';
document.body.insertBefore(p1, document.body.firstChild);
}
/*
If you are reading this comment, perhaps you might want to polyfill the missing functionality? Here's a start:
https://github.com/inexorabletash/text-encoding/
*/
// Clean up form controls on reload (i.e., not bypassing cache)
document.getElementById('drop_zone').value = '';
document.getElementById('btnScrounge').setAttribute('disabled', 'disabled');
document.getElementById('btnSave').setAttribute('disabled', 'disabled');
document.getElementById('btnJSON').setAttribute('disabled', 'disabled');
// Functions used in the page
function parsejson(){
if (document.getElementById('scrounged')){
if(!confirm('Remove previous list of windows and tabs now?')) return;
document.getElementById('scrounged').remove();
if (document.getElementById('msgproc')) document.getElementById('msgproc').remove();
}
var txt = document.getElementById('drop_zone');
if (txt.value.length > 0){
document.getElementById('btnScrounge').setAttribute('disabled', 'disabled');
document.getElementById('btnScrounge').insertAdjacentHTML('afterend', ' <span id="msgproc" style="font-style:italic">Processing...</span> ');
if (txt.value.indexOf('{"sessions":') === 0 && txt.value.indexOf('{"tabs":[') < 0) buildTSMList(txt);
else if (txt.value.indexOf('{"backupSessionStore":') === 0) buildSBossList(txt);
else if (txt.value.indexOf('{"state":"{\\"tabGroups\\":') === 0) buildOneTabList(txt);
else buildList(txt);
}
else alert('Session history file contents could not be read?');
}
function scrub(t){
t=t.replace(/&/g,'&'); t=t.replace(/>/g,'>'); t=t.replace(/</g,'<');
return t;
}
function buildList(inp){
var out=new Array();
var inpval = inp.value;
if (inpval.indexOf('"lastSessionState":{"version":[') > -1) inpval = inpval.split('"lastSessionState":{"version":[')[1];
var sess=inpval.split('"_closedWindows":[');
for (var n=0; n < sess.length; n++){
var winds = sess[n].split('{"tabs":[');
if(n==0){
out.push('<h2>Open Windows</h2>');
} else {
if (winds.length > 1) out.push('<h2>Closed Windows</h2>');
}
for (var i=1; i < winds.length; i++) {
if (n==1) out.push('<h3 style=\'border-bottom:1px solid #000\'>Closed Window ' + i + '</h3>\n<div style=\'margin-left:2.25em\'>');
else out.push('<h3 style=\'border-bottom:1px solid #000\'>Open Window ' + i + '</h3>\n<div style=\'margin-left:2.25em\'>');
var wtabs = winds[i].split('"_closedTabs":[');
for (var m=0; m < wtabs.length; m++){
var tabs = wtabs[m].split('{"entries":[');
for (var j=1; j < tabs.length; j++) {
if (m==1 && j==1) out.push('<div style=\'margin-left:2.25em\'><h4 style=\'border-top:1px solid #888\'>(Closed Tabs)</h4>');
out.push('<h4>Tab ' + j + '</h4>\n<div class=\'urllist\'>');
var strTemp = tabs[j].split(',"children":[')[0]; // ignore children
var taburls = strTemp.split('{"url":"');
for (var k=taburls.length - 1; k >= 1; k--) {
var strURL = taburls[k].substr(0, taburls[k].indexOf('","'));
var strTitle = taburls[k].split('"title":"')[1] || '[Title Not Available]';
strTitle = strTitle.substr(0, strTitle.indexOf('","'));
if (strTitle.length == 0) strTitle = '[Title Not Available]';
if (k == taburls.length - 2) out.push('<div style=\'margin-left:2.25em\' class=\'backhist\'><span class=\'bhtoggle\' onclick=\'toggleBH(this);\'>← Back <em>(earlier pages visited in this tab)</em>:</span>\n<div>');
out.push('<p><strong>' + scrub(strTitle) + '</strong><br><a href=\'' + strURL + '\' target=\'_blank\'>' + scrub(strURL) + '</a></p>');
if (taburls.length > 2 && k == 1) out.push('</div></div>');
}
out.push('</div>');
}
out.push('</div>');
}
}
}
var elOut = document.getElementById('output');
var finfo = document.querySelectorAll('#fileinfo span');
elOut.insertAdjacentHTML('afterbegin', '\n<div id="scrounged"><h1 style="margin-bottom:0;">Session History</h1>\n<p style="margin-top:0;"><em>Extracted from</em> ' + finfo[0].textContent + ' <em>as of</em> '+ finfo[1].textContent + '.</p>\n' + out.join('\n') + '\n</div><!--hi-->');
document.getElementById('msgproc').insertAdjacentHTML('beforeend', '<span style="font-style:italic">done!</span> ');
document.getElementById('btnSave').removeAttribute('disabled');
}
function buildTSMList(inp){
var out=new Array();
var inpval = inp.value;
var sess=inpval.split('{"windows":');
for (var n=1; n < sess.length; n++){
var namesplit = sess[n].split(',"name":"');
if (namesplit.length === 2){
out.push('<h2>Session '+n+': '+ namesplit[1].substr(0, namesplit[1].indexOf('","'))+'</h2>');
} else {
out.push('<h2>Session '+n+'</h2>');
}
var tabs = namesplit[0].split(',"windowId":');
out.push('<div style=\'margin-left:2.25em\'>');
for (var j=1; j < tabs.length; j++) {
out.push('<h4>Tab ' + j + '</h4>\n<div class=\'urllist\'>');
var strTemp = tabs[j];
var taburl = strTemp.split(',"url":"');
if (taburl.length === 2){
strURL = taburl[1].substr(0, taburl[1].indexOf('","'));
var tabtitle = strTemp.split(',"title":"');
if (tabtitle.length === 2){
strTitle = tabtitle[1].substr(0, tabtitle[1].indexOf('","')) || tabtitle[1].substr(0, tabtitle[1].indexOf('"}}'));
} else {
strTitle = '[Title Not Available]';
}
out.push('<p><strong>' + scrub(strTitle) + '</strong><br><a href=\'' + strURL + '\' target=\'_blank\'>' + scrub(strURL) + '</a></p>');
} else {
out.push('<p>URL not found</p>');
}
out.push('</div>');
}
out.push('</div>');
}
var elOut = document.getElementById('output');
var finfo = document.querySelectorAll('#fileinfo span');
elOut.insertAdjacentHTML('afterbegin', '\n<div id="scrounged"><h1 style="margin-bottom:0;">Session Boss History</h1>\n<p style="margin-top:0;"><em>Extracted from</em> ' + finfo[0].textContent + ' <em>as of</em> '+ finfo[1].textContent + '.</p>\n' + out.join('\n') + '\n</div><!--hi-->');
document.getElementById('msgproc').insertAdjacentHTML('beforeend', '<span style="font-style:italic">done!</span> ');
document.getElementById('btnSave').removeAttribute('disabled');
}
function buildSBossList(inp){
var out = new Array();
var inpval = inp.value;
var types = inpval.split('{"userSessions":[');
for (var t=types.length - 1; t>=0; t--){
if (t==0) out.push('<h2>Automatic Backups</h2>');
if (t==1) out.push('<h2>User-Saved Sessions</h2>');
var sess = types[t].split('"sessionName":"');
for (var n=1; n < sess.length; n++){
var namesplit = sess[n].split('","windows":');
if (namesplit.length === 2){
out.push('<h3>Session '+n+': '+ namesplit[0]+'</h3>');
} else {
out.push('<h3>Session '+n+'</h3>');
}
var tabslists = sess[n].split('"tabsOfWindow":{')[1];
var pretabmap = tabslists.split('"tabMap":{')[0];
var tabs = pretabmap.split('"url":"');
out.push('<div style=\'margin-left:2.25em\'>');
for (var j=1; j < tabs.length; j++) {
out.push('<h4>Tab ' + j + '</h4>\n<div class=\'urllist\'>');
var strTemp = tabs[j];
var taburl = strTemp.split('","title":');
if (taburl.length === 2){
strURL = taburl[0];
var tabtitle = strTemp.split(',"title":"');
if (tabtitle.length === 2){
strTitle = tabtitle[1].substr(0, tabtitle[1].indexOf('","')) || tabtitle[1].substr(0, tabtitle[1].indexOf('"}}'));
} else {
strTitle = '[Title Not Available]';
}
out.push('<p><strong>' + scrub(strTitle) + '</strong><br><a href=\'' + strURL + '\' target=\'_blank\'>' + scrub(strURL) + '</a></p>');
} else {
out.push('<p>URL not found?</p>');
}
out.push('</div>');
}
out.push('</div>');
}
}
var elOut = document.getElementById('output');
var finfo = document.querySelectorAll('#fileinfo span');
elOut.insertAdjacentHTML('afterbegin', '\n<div id="scrounged"><h1 style="margin-bottom:0;">Tab Session Manager History</h1>\n<p style="margin-top:0;"><em>Extracted from</em> ' + finfo[0].textContent + ' <em>as of</em> '+ finfo[1].textContent + '.</p>\n' + out.join('\n') + '\n</div><!--hi-->');
document.getElementById('msgproc').insertAdjacentHTML('beforeend', '<span style="font-style:italic">done!</span> ');
document.getElementById('btnSave').removeAttribute('disabled');
}
function buildOneTabList(inp){
var out=new Array();
var inpval = inp.value;
var sess=inpval.split('\\"tabsMeta\\":');
for (var n=1; n < sess.length; n++){
var namesplit = sess[n-1].split(',\\"label\\":\\"');
if (namesplit.length === 2){
out.push('<h2>Tab Group '+n+': '+ namesplit[1].substr(0, namesplit[1].indexOf('\\"'))+'</h2>');
} else {
out.push('<h2>Tab Group '+n+'</h2>');
}
var tabs = sess[n].split(',\\"url\\":\\"');
out.push('<div style=\'margin-left:2.25em\'>');
for (var j=1; j < tabs.length; j++) {
out.push('<h4>Tab ' + j + '</h4>\n<div class=\'urllist\'>');
var strTemp = tabs[j];
var strURL = strTemp.substr(0, strTemp.indexOf('\\",'));
var tabtitle = strTemp.split(',\\"title\\":\\"');
if (tabtitle.length === 2){
strTitle = tabtitle[1].substr(0, tabtitle[1].indexOf('\\"}'));
} else {
strTitle = '[Title Not Available]';
}
out.push('<p><strong>' + scrub(strTitle) + '</strong><br><a href=\'' + strURL + '\' target=\'_blank\'>' + scrub(strURL) + '</a></p>');
out.push('</div>');
}
out.push('</div>');
}
var elOut = document.getElementById('output');
var finfo = document.querySelectorAll('#fileinfo span');
elOut.insertAdjacentHTML('afterbegin', '\n<div id="scrounged"><h1 style="margin-bottom:0;">OneTab Tab Gropus</h1>\n<p style="margin-top:0;"><em>Extracted from</em> ' + finfo[0].textContent + ' <em>as of</em> '+ finfo[1].textContent + '.</p>\n' + out.join('\n') + '\n</div><!--hi-->');
document.getElementById('msgproc').insertAdjacentHTML('beforeend', '<span style="font-style:italic">done!</span> ');
document.getElementById('btnSave').removeAttribute('disabled');
}
function SaveList(){
var fn = document.querySelectorAll('#fileinfo span')[0].textContent;
saveAs(
new Blob(
['<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Extracted Session History</title></head><body>'+document.getElementById('output').innerHTML+'</body></html>']
, {type: 'text/html;charset=UTF-8'}
)
, 'sessionhist('+fn.replace(/\./g,'_')+').html'
);
}
function CreateShortcut(){
saveAs(
new Blob(
['[InternetShortcut]\nURL='+location.href]
, {type: 'application/x-ms-shortcut'}
)
, document.title+'.url'
);
}
function readfile(f){
// Add notation below textarea
if (document.getElementById('fileinfo')) document.getElementById('fileinfo').remove();
document.getElementById('drop_zone').insertAdjacentHTML('afterend', '<p id="fileinfo">File name: <span>'+f.name+'</span>; Size: '+f.size+'; last modified <span>'+new Date(f.lastModified).toLocaleString()+'</span></p>');
// Use a FileReader to pull the contents out of the file and drop it into the textarea element
var reader = new FileReader();
reader.onload = function(evt) { // handle result of the file read
if (typeof evt.target.result == 'string') document.getElementById('drop_zone').value = evt.target.result;
else {
let utf8decoder = new TextDecoder('utf-8');
var jsontxt = utf8decoder.decode(decomp(evt.target.result));
document.getElementById('drop_zone').value = jsontxt;
}
};
// Assume anything without .jsonlz4 or .baklz4 in the name is uncompressed
if (f.name.indexOf('.jsonlz4') == -1 && f.name.indexOf('.baklz4') == -1) reader.readAsText(f);
else reader.readAsArrayBuffer(f);
}
function decomp(arrbuff){
// See: https://github.com/pierrec/node-lz4
// Create typed array from ArrayBuffer
var u8arrbuff = new Uint8Array(arrbuff);
// Is it a standard JSON file with jsonlz4 somewhere in its name?
if ('{' == String.fromCharCode(u8arrbuff[0])) {
return u8arrbuff;
}
// Compute uncompressed data size
var u8sz = u8arrbuff.slice(8, 12);
var origLen = u8sz[0] + (u8sz[1] * 256) + (u8sz[2] * 256 * 256) + (u8sz[3] * 256 * 256 * 256);
// Extract compressed data (past header)
jsonstart = 12;
var u8comp = u8arrbuff.slice(jsonstart);
// Create LZ4 buffer
var Buffer = require('buffer').Buffer;
var LZ4 = require('lz4');
var comp = new Buffer(u8comp);
var orig = new Buffer(origLen);
// Do the deed
var decomLen = LZ4.decodeBlock(comp, orig);
return orig.slice(0, decomLen);
}
function SaveJSON(){
// Check the JSON
var txt = document.getElementById('drop_zone').value;
if (txt.length === 0 || txt.indexOf('{') === -1){
alert('Contents of the box do not look like JSON');
return;
}
if (txt.indexOf('{"sessions":') === 0 && txt.indexOf('{"tabs":[') < 0){
alert('Contents of the box look like a Tab Session Manager storage.js file.\n\nCurrently unable to convert to Firefox\'s native format.');
return;
}
if (txt.indexOf('{"backupSessionStore":') === 0){
alert('Contents of the box look like a Session Boss storage.js file.\n\nCurrently unable to convert to Firefox\'s native format.');
return;
}
if (txt.indexOf('{"state":"{\\"tabGroups\\":') === 0){
alert('Contents of the box look like a OneTab storage.js file.\n\nCurrently unable to convert to Firefox\'s native format.');
return;
}
if (txt.indexOf('[SessionManager v2]') === 0){
txt = txt.substr(txt.indexOf('{'));
}
try {
oSess = JSON.parse(txt);
// Make blob and trigger save dialog
var fn = document.querySelectorAll('#fileinfo span')[0].textContent;
saveAs(
new Blob(
[JSON.stringify(oSess)]
, {type: 'application/json;charset=UTF-8'}
), 'sessionstore('+fn.replace(/\./g,'_')+').json'
);
} catch (err) {
alert('Not saving due to failure parsing JSON: ' + err.toString());
}
}
// copied/adapted from https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop
function drop_handler(ev) {
ev.preventDefault();
// Clear colors
dragleave_handler(ev);
// If dropped items aren't files, reject them
var dt = ev.dataTransfer;
if (dt.items) {
// Use DataTransferItemList interface to access the file(s) (break after first file opened)
for (var i=0; i < dt.items.length; i++) {
if (dt.items[i].kind == "file") {
readfile(dt.items[i].getAsFile());
document.getElementById('btnScrounge').removeAttribute('disabled');
document.getElementById('btnJSON').removeAttribute('disabled');
break;
}
}
} else { // ** NOT TESTED **
// Use DataTransfer interface to access the file(s) (break after first file opened)
for (var i=0; i < dt.files.length; i++) {
readfile(dt.files[i]);
document.getElementById('btnScrounge').removeAttribute('disabled');
document.getElementById('btnJSON').removeAttribute('disabled');
break;
}
}
}
function dragover_handler(ev) {
// Prevent default select and drag behavior
ev.preventDefault();
}
function dragend_handler(ev) {
console.log("dragEnd");
// Remove all of the drag data
var dt = ev.dataTransfer;
if (dt.items) {
// Use DataTransferItemList interface to remove the drag data
for (var i = 0; i < dt.items.length; i++) {
dt.items.remove(i);
}
} else {
// Use DataTransfer interface to remove the drag data
ev.dataTransfer.clearData();
}
}
function dragenter_handler(ev) {
// Color it up
var tgt = ev.target;
if (tgt.id == 'drop_zone') {
tgt.style.backgroundColor = '#ff8';
tgt.style.borderColor = 'blue';
}
}
function dragleave_handler(ev) {
// Default colors
var tgt = ev.target;
if (tgt.id == 'drop_zone') {
tgt.style.backgroundColor = '#fff';
tgt.style.borderColor = '#000';
}
}
function loadFile(inp){
if (inp.files.length == 0) return;
if (inp.files.length > 1){
inp.insertAdjacentHTML('afterend', '<br><em>First file used</em>');
}
readfile(inp.files[0]);
document.getElementById('btnScrounge').removeAttribute('disabled');
document.getElementById('btnJSON').removeAttribute('disabled');
}
</script>
<script type="text/javascript" src="ffu.js"></script>
<script type="text/javascript" src="FileSaver.min.js"></script>
<script type="text/javascript" src="lz4.js"></script>
<style>.attrib{display:none}</style>
</body>
</html>