55
56
57
58
59
60
61
62
63
64
65
66
67
68
| document.getElementById(sElemId).style.display = "none";
} else {
document.getElementById(sElemId).style.display = sDisplay;
}
}
}
const oTabulations = {
lPage: ["lexicon_page", "add_page", "search_page", "info_page"],
showPage: function (sRequestedPage) {
for (let sPage of this.lPage) {
|
>
>
>
>
| 55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
| document.getElementById(sElemId).style.display = "none";
} else {
document.getElementById(sElemId).style.display = sDisplay;
}
}
}
function showMessage (sMessage) {
console.log(sMessage);
}
const oTabulations = {
lPage: ["lexicon_page", "add_page", "search_page", "info_page"],
showPage: function (sRequestedPage) {
for (let sPage of this.lPage) {
|
500
501
502
503
504
505
506
507
508
509
510
511
512
513
| this.cMainTag = "";
}
catch (e) {
showError(e);
}
}
}
const oDictHandler = {
oDictionaries: {},
oPersonalDictionary: null,
lCreatedDictionaries: [],
xDicSelector: document.getElementById("dic_selector"),
|
>
| 504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
| this.cMainTag = "";
}
catch (e) {
showError(e);
}
}
}
const oDictHandler = {
oDictionaries: {},
oPersonalDictionary: null,
lCreatedDictionaries: [],
xDicSelector: document.getElementById("dic_selector"),
|
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
| }
else {
this.oDictionaries[sName] = oJSON;
if (oJSON === null) {
delete this.oDictionaries[sName];
}
browser.storage.local.set({ "shared_dictionaries": this.oDictionaries });
}
}
}
const oBinaryDict = {
oIBDAWG: null,
sName: "",
sDescription: "",
|
>
>
|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
| 594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
| }
else {
this.oDictionaries[sName] = oJSON;
if (oJSON === null) {
delete this.oDictionaries[sName];
}
browser.storage.local.set({ "shared_dictionaries": this.oDictionaries });
this.sendDictionaryOnline(oJSON);
}
},
sendDictionaryOnline: function (oJSON) {
let sJSON = "";
try {
sJSON = JSON.stringify(oJSON);
}
catch (e) {
showError(e);
return e.message;
}
console.log("Send online dictionary: " + oJSON.sDicName);
fetch("http://localhost/receive/", {
method: "POST", // *GET, POST, PUT, DELETE, etc.
//mode: "cors", // no-cors, cors, *same-origin
//cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
credentials: "include", // include, *same-origin, omit
headers: {
"Content-Type": "application/json", // text/plain, application/json
"Content-Length": sJSON.length
},
redirect: "follow", // manual, *follow, error
referrer: "no-referrer", // no-referrer, *client
body: sJSON, // body data type must match "Content-Type" header
})
.then((response) => {
if (response.ok) {
for (let param in response) {
console.log(param, response[param]);
}
console.log(response);
return response.json();
} else {
console.log("Error: dictionary not sent: " + oJSON.sDicName);
return null;
}
})
.then((response) => {
if (response) {
console.log(response);
} else {
//
}
})
.catch((e) => {
showError(e);
});
}
}
const oBinaryDict = {
oIBDAWG: null,
sName: "",
sDescription: "",
|