🌐 Modify i18n
This commit is contained in:
parent
a9ad1533c9
commit
0f449be68d
@ -16,17 +16,17 @@ storage.get('token', function(resp) {
|
|||||||
urlInput.addEventListener("blur", function(e) {
|
urlInput.addEventListener("blur", function(e) {
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
storage.set({ url: value }, function() {
|
storage.set({ url: value }, function() {
|
||||||
message.innerHTML = ext.browser.i18n.getMessage("URLChanged");
|
message.innerHTML = ext.i18n.getMessage("URLChanged");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tokenInput.addEventListener("blur", function(e) {
|
tokenInput.addEventListener("blur", function(e) {
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
storage.set({ token: value }, function() {
|
storage.set({ token: value }, function() {
|
||||||
message.innerHTML = ext.browser.i18n.getMessage("tokenSaved");
|
message.innerHTML = ext.i18n.getMessage("tokenSaved");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelectorAll("[data-message]").forEach(function(elt) {
|
document.querySelectorAll("[data-message]").forEach(function(elt) {
|
||||||
elt.innerHTML = ext.browser.i18n.getMessage(elt.dataset.message);
|
elt.innerHTML = ext.i18n.getMessage(elt.dataset.message);
|
||||||
});
|
});
|
||||||
|
@ -40,12 +40,12 @@ var renderMessage = (message) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var renderBookmark = (data) => {
|
var renderBookmark = (data) => {
|
||||||
var displayContainer = document.getElementById("display-container")
|
var displayContainer = document.getElementById("display-container");
|
||||||
if(data) {
|
if(data) {
|
||||||
page_data = data;
|
page_data = data;
|
||||||
displayContainer.innerHTML = template(data);
|
displayContainer.innerHTML = template(data);
|
||||||
} else {
|
} else {
|
||||||
renderMessage(ext.browser.i18n.getMessage("cantExtractTitle"));
|
renderMessage(ext.i18n.getMessage("cantExtractTitle"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,13 +57,12 @@ ext.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
|||||||
popup.addEventListener("click", function(e) {
|
popup.addEventListener("click", function(e) {
|
||||||
if(e.target && e.target.matches("#save-btn")) {
|
if(e.target && e.target.matches("#save-btn")) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
page_data.comment = document.getElementById("comment").innerText;
|
page_data.comment = document.getElementById("comment").value;
|
||||||
// var data = e.target.getAttribute("data-bookmark");
|
|
||||||
ext.runtime.sendMessage({action: "perform-save", data: page_data}, function (response) {
|
ext.runtime.sendMessage({action: "perform-save", data: page_data}, function (response) {
|
||||||
if (response && response.action === "saved") {
|
if (response && response.action === "saved") {
|
||||||
renderMessage(ext.browser.i18n.getMessage("savedSuccessfully"));
|
renderMessage(ext.i18n.getMessage("savedSuccessfully"));
|
||||||
} else {
|
} else {
|
||||||
renderMessage(ext.browser.i18n.getMessage("unknownError"));
|
renderMessage(ext.i18n.getMessage("unknownError"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -72,7 +71,7 @@ popup.addEventListener("click", function(e) {
|
|||||||
var dataMessages = document.querySelectorAll("[data-message]");
|
var dataMessages = document.querySelectorAll("[data-message]");
|
||||||
[].forEach.call(dataMessages, function(elt) {
|
[].forEach.call(dataMessages, function(elt) {
|
||||||
console.log(elt.dataset.message);
|
console.log(elt.dataset.message);
|
||||||
elt.innerHTML = ext.browser.i18n.getMessage(elt.dataset.message);
|
elt.innerHTML = ext.i18n.getMessage(elt.dataset.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
var optionsLink = document.querySelector(".js-options");
|
var optionsLink = document.querySelector(".js-options");
|
||||||
|
Loading…
Reference in New Issue
Block a user