-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfiles.js
65 lines (53 loc) · 2.14 KB
/
files.js
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
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js';
head.appendChild(script);
$('tr:contains("Anglais")');
function getPageDefs() {
var last = $('tr:contains("Anglais")').length - 1;
var ang = $($('tr:contains("Anglais")')[last]).next().children('.texte1').text(); //finds english word
last = $('tr:contains("Français")').length -1;
var fr = $($('tr:contains("Français")')[last]).next().children('.texte1').html(); //finds french trans
var def = $.trim($($('tr:contains("Français")')[last]).next().next().text()); //finds definition
last = $('tr:contains("Synonyme(s) :")').length -1;
if (last > 2) {
fr += ', ' + $($('tr:contains("Synonyme(s) :")')[last]).next().children('.texte1').html();
}
return '\t"' + ang + '": "' + fr + ' ' + def + '"';
}
// this will change the english word, french trans and definition into an object key value pair (still needs comma)
'\t"' + ang + '": "' + fr + ' ' + def + '"';
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
var fs = null;
function onInitFs(fs) {
fs.root.getFile('gdt.json', {create: true}, function(fileEntry){
fileEntry.createWriter(function(fileWriter){
fileWriter.onwriteend = function(e) {
append(fs, 'gdt.json', 5);
};
var blob = new Blob(['{\n'], {type: 'text/plain'});
fileWriter.write(blob);
});
});
}
function append(fs, filename, index) {
fs.root.getFile(filename, {create: false}, function(appendEntry){
appendEntry.createWriter(function(fileWriter){
fileWriter.onwriteend = function(e) {
if (index>0) append(fs, filename, --index);
else return;
}
fileWriter.seek(fileWriter.length);
var bleh = new Blob(['Hello\n'], {type: 'text/plain'});
fileWriter.write(bleh);
});
});
}
window.requestFileSystem(window.TEMPORARY, 1024*1024, onInitFs);
//traversing grab every letter. inside each letter
$('ol');
// grab each li and follow link
link = $($('ol').children()[0]).children().attr('href');
$.get(link);
// return as html object or page and traverse