2024-05-02 17:50:43 +00:00
|
|
|
let psshs=chrome.extension.getBackgroundPage().psshs;
|
2024-04-24 18:41:58 +00:00
|
|
|
function showHistory(){
|
|
|
|
chrome.storage.local.get(null, ((data) => {
|
2024-04-24 19:11:11 +00:00
|
|
|
let tree=jsonview.renderJSON(JSON.stringify(data), document.getElementById('histDisp'));
|
|
|
|
jsonview.toggleNode(tree);
|
2024-04-24 18:41:58 +00:00
|
|
|
}));
|
|
|
|
document.getElementById('home').style.display='none';
|
2024-05-02 17:50:43 +00:00
|
|
|
document.getElementById('noEME').style.display='none';
|
2024-04-24 18:41:58 +00:00
|
|
|
document.getElementById('history').style.display='block';
|
2024-05-02 17:50:43 +00:00
|
|
|
document.getElementById('toggleHistory').style.display='none';
|
2024-04-24 18:41:58 +00:00
|
|
|
}
|
|
|
|
|
2024-04-24 18:37:31 +00:00
|
|
|
function backHistory(){
|
|
|
|
document.getElementById('histDisp').innerHTML="";
|
|
|
|
document.getElementById('history').style.display='none';
|
2024-05-02 17:50:43 +00:00
|
|
|
document.getElementById('toggleHistory').style.display='block';
|
|
|
|
if(psshs.length != 0){
|
|
|
|
document.getElementById('home').style.display='block';
|
|
|
|
} else {
|
|
|
|
document.getElementById('noEME').style.display='block';
|
|
|
|
}
|
2024-04-24 18:37:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function saveHistory(){
|
|
|
|
chrome.storage.local.get(null, ((data) => {
|
|
|
|
let blob = new Blob([JSON.stringify(data, null, "\t")], {type: "text/plain"});
|
|
|
|
let blobLink = URL.createObjectURL(blob);
|
|
|
|
let a = document.createElement('a');
|
|
|
|
a.download = 'wvgHistory.json';
|
|
|
|
a.href = blobLink
|
|
|
|
document.body.appendChild(a);
|
|
|
|
a.click();
|
|
|
|
document.body.removeChild(a);
|
|
|
|
URL.revokeObjectURL(blobLink);
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearHistory(){
|
|
|
|
if(confirm("Do you really want to clear history?")){
|
|
|
|
chrome.storage.local.clear();
|
|
|
|
document.getElementById('histDisp').innerHTML="";
|
|
|
|
}
|
|
|
|
}
|
2024-04-24 18:41:58 +00:00
|
|
|
document.getElementById('historyButton').addEventListener("click", showHistory);
|
|
|
|
document.getElementById('backHistory').addEventListener("click", backHistory);
|
|
|
|
document.getElementById('saveHistory').addEventListener("click", saveHistory);
|
|
|
|
document.getElementById('clearHistory').addEventListener("click", clearHistory);
|