4
Inside the "options.html" file I know exactly how to make a tagging work to enable some set of javascript like...
<label>
<input type="checkbox" id="test">
Habilitar
</label>
That will run some following codes within options.js:
var test = document.getElementById('test').checked;
test: test
test: false
document.getElementById('test').checked = items.test;
Then the final result will be activated within an example.js:
var storage = chrome.storage.sync;
var info = 0;
var total_requests = 0;
var processed_requests = 0;
var cookie = document.cookie;
storage.get(function(settings) {
if (settings.test === undefined) {
settings.test = false;
storage.set({'test': settings.test});
}
if (settings.test) {
\\alguma coisa aqui
}
});
If you understood what I meant, now comes my doubt; I’m wondering how to do this with some value from a setting that is being set in a <select>
.
<select id="exemplo">
<option value="exemplofoi">Padrão</option>
<option value="exemplofoi2">Extra</option>
</select>
In case you don’t understand, I’m wanting to use Storage.get to enable a javascript only when this value is active in the extension settings page.
Answer:
storage.get(function(settings) {
if (settings.exemplo === undefined) {
settings.exemplo = false;
storage.set({'exemplo': settings.exemplo});
}
if (settings.exemplo == 'exemplofoi') {
\\alguma coisa aqui
}
});
Just give an improved on your question to make it as simple as possible to understand
– SneepS NinjA
I did an update improving a little more the details of the question.
– Jasmin Dreasond