6 changed files with 73 additions and 7 deletions
@ -0,0 +1,27 @@
|
||||
<html> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<style> |
||||
input[type=text], select { |
||||
width: 70%; |
||||
} |
||||
.buttons { |
||||
display: inline-block; |
||||
} |
||||
</style> |
||||
</head> |
||||
<div class="buttons"> |
||||
<a href="https://git.virtit.fr/VirtIT/wext-httpspluschecker"><button>Source of the Extension</button></a> |
||||
<a href="https://git.virtit.fr/VirtIT/wext-httpspluschecker_api"><button>Source of the API</button></a> |
||||
</div> |
||||
<form> |
||||
<label>API URL :<br><input type="text" id="API" ></label> |
||||
<br> |
||||
<button type="submit">Save</button> |
||||
</form> |
||||
|
||||
<script src="options.js"></script> |
||||
|
||||
</body> |
||||
|
||||
</html> |
@ -0,0 +1,23 @@
|
||||
function saveOptions(e) { |
||||
e.preventDefault(); |
||||
browser.storage.local.set({ |
||||
API: document.querySelector("#API").value |
||||
}); |
||||
} |
||||
|
||||
function restoreOptions() { |
||||
|
||||
function setCurrentChoice(result) { |
||||
document.querySelector("#API").value = result.API || "http://httpspluschecker.virtit.fr/?domain=" ; |
||||
} |
||||
|
||||
function onError(error) { |
||||
console.log(`Error: ${error}`); |
||||
} |
||||
|
||||
var getting = browser.storage.local.get("API"); |
||||
getting.then(setCurrentChoice, onError); |
||||
} |
||||
|
||||
document.addEventListener("DOMContentLoaded", restoreOptions); |
||||
document.querySelector("form").addEventListener("submit", saveOptions); |
Loading…
Reference in new issue