-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpopup.js
More file actions
26 lines (21 loc) · 774 Bytes
/
popup.js
File metadata and controls
26 lines (21 loc) · 774 Bytes
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
let latexInput = document.getElementById('latexInput');
let latexOutput = document.getElementById('latexOutput');
document.addEventListener('DOMContentLoaded', function() {
loadLastInputValue();
});
latexInput.oninput = function(element) {
let val = element.target.value;
setLastInputValue(val);
latexOutput.src = val ? 'https://latex.codecogs.com/svg.image?' + val : '';
}
function loadLastInputValue() {
chrome.storage.local.get(['ccLastValue'], function(val) {
if (val.ccLastValue) {
latexInput.value = val.ccLastValue;
latexInput.dispatchEvent(new Event("input"))
}
});
}
function setLastInputValue(val) {
chrome.storage.local.set({'ccLastValue': val }, function(){});
}