Merge pull request '✨ Allows to add the page content into the email, server-side' (#5) from feature/extract/1 into master
Fix #4 Reviewed-on: #5
This commit is contained in:
commit
45cf59be52
@ -23,6 +23,10 @@
|
||||
"message": "Token:",
|
||||
"description": "Token label"
|
||||
},
|
||||
"optionsExtract": {
|
||||
"message": "Send page content into the email:",
|
||||
"description": "Extract label"
|
||||
},
|
||||
"URLChanged": {
|
||||
"message": "URL changed!",
|
||||
"description": "Message when URL is changed."
|
||||
@ -31,6 +35,10 @@
|
||||
"message": "Token saved!",
|
||||
"description": "Message when token is changed."
|
||||
},
|
||||
"optionSaved": {
|
||||
"message": "Option saved!",
|
||||
"description": "Message when option is changed."
|
||||
},
|
||||
"cantExtractTitle": {
|
||||
"message": "Sorry, could not extract this page's title and URL",
|
||||
"description": "Message when we could not extract the page's title and URL"
|
||||
@ -46,5 +54,9 @@
|
||||
"defaultURL": {
|
||||
"message": "https://app.readlater.shikiryu.com",
|
||||
"description": "Default URL"
|
||||
},
|
||||
"excerpt": {
|
||||
"message": "Add content",
|
||||
"description": "Option to add the webpage content into the email"
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,22 @@
|
||||
"message": "Jeton :",
|
||||
"description": "Token label"
|
||||
},
|
||||
"optionsExtract": {
|
||||
"message": "Envoyer le contenu de la page dans le mail:",
|
||||
"description": "Extract label"
|
||||
},
|
||||
"URLChanged": {
|
||||
"message": "URL changed!",
|
||||
"message": "URL enregistrée !",
|
||||
"description": "Message when URL is changed."
|
||||
},
|
||||
"tokenSaved": {
|
||||
"message": "Token saved!",
|
||||
"message": "Jeton enregistré !",
|
||||
"description": "Message when token is changed."
|
||||
},
|
||||
"optionSaved": {
|
||||
"message": "Option enregistrée !",
|
||||
"description": "Message when option is changed."
|
||||
},
|
||||
"cantExtractTitle": {
|
||||
"message": "Sorry, could not extract this page's title and URL",
|
||||
"description": "Message when we could not extract the page's title and URL"
|
||||
@ -46,5 +54,9 @@
|
||||
"defaultURL": {
|
||||
"message": "https://app.readlater.shikiryu.com",
|
||||
"description": "Default URL"
|
||||
},
|
||||
"excerpt": {
|
||||
"message": "Ajouter le contenu",
|
||||
"description": "Option to add the webpage content into the email"
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="styles/options.css" rel="stylesheet">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link href="styles/options.css" rel="stylesheet" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
<title data-message="optionsAndSettings"></title>
|
||||
</head>
|
||||
<body class="wrap">
|
||||
</head>
|
||||
<body class="wrap">
|
||||
<div class="grid">
|
||||
<div class="unit whole center-on-mobiles">
|
||||
<div class="heading">
|
||||
@ -29,7 +29,11 @@
|
||||
<div class="unit whole center-on-mobiles">
|
||||
<div class="option">
|
||||
<h5 data-message="optionsURL"></h5>
|
||||
<input type="text" name="url" value="https://app.readlater.shikiryu.com" />
|
||||
<input
|
||||
type="text"
|
||||
name="url"
|
||||
value="https://app.readlater.shikiryu.com"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="option">
|
||||
@ -37,11 +41,14 @@
|
||||
<input type="text" name="token" value="" />
|
||||
</div>
|
||||
|
||||
<div class="option">
|
||||
<h5 data-message="optionsExtract"></h5>
|
||||
<input type="checkbox" name="extract" value="1" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="grid">
|
||||
<div class="unit whole center-on-mobiles">
|
||||
@ -50,8 +57,7 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
<script src="scripts/options.js"></script>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link href="styles/popup.css" rel="stylesheet">
|
||||
<meta charset="utf-8" />
|
||||
<link href="styles/popup.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" class="popup-content">
|
||||
@ -20,6 +20,8 @@
|
||||
<a href="" target="_blank" class="url" data-template="url"></a>
|
||||
</div>
|
||||
<div class="action-container">
|
||||
<label for="save-content" data-message="excerpt"></label>
|
||||
<input type="checkbox" id="save-content" name="save-content" />
|
||||
<button id="save-btn" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -18,6 +18,9 @@ ext.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||
i: encodeURIComponent(data.image),
|
||||
c: encodeURIComponent(data.comment)
|
||||
};
|
||||
if (data.extract) {
|
||||
params["e"] = true;
|
||||
}
|
||||
var queryString = Object.keys(params)
|
||||
.map(key => {
|
||||
return key + "=" + params[key];
|
||||
|
@ -3,6 +3,7 @@ import storage from "./utils/storage";
|
||||
|
||||
var urlInput = document.querySelector("[name=url]");
|
||||
var tokenInput = document.querySelector("[name=token]");
|
||||
var extractInput = document.querySelector("[name=extract]");
|
||||
var message = document.getElementById("msg");
|
||||
|
||||
storage.get("url", function(resp) {
|
||||
@ -13,6 +14,10 @@ storage.get("token", function(resp) {
|
||||
tokenInput.value = resp.token;
|
||||
});
|
||||
|
||||
storage.get("extract", function(resp) {
|
||||
extractInput.value = resp.extract;
|
||||
});
|
||||
|
||||
urlInput.addEventListener("blur", function(e) {
|
||||
var value = this.value;
|
||||
storage.set({ url: value }, function() {
|
||||
@ -27,6 +32,13 @@ tokenInput.addEventListener("blur", function(e) {
|
||||
});
|
||||
});
|
||||
|
||||
extractInput.addEventListener("change", function(e) {
|
||||
var value = this.value;
|
||||
storage.set({ extract: value }, function() {
|
||||
message.textContent = ext.i18n.getMessage("optionSaved");
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll("[data-message]").forEach(function(elt) {
|
||||
elt.textContent = ext.i18n.getMessage(elt.dataset.message);
|
||||
});
|
||||
|
@ -10,10 +10,12 @@ var page_data = {
|
||||
};
|
||||
|
||||
var popup = document.getElementById("app");
|
||||
storage.get("color", function(resp) {
|
||||
var color = resp.color;
|
||||
if (color) {
|
||||
popup.style.backgroundColor = color;
|
||||
storage.get("extract", function(resp) {
|
||||
var extract = resp.extract;
|
||||
if (extract) {
|
||||
document.getElementById("save-content").checked = extract
|
||||
? "checked"
|
||||
: false;
|
||||
}
|
||||
});
|
||||
|
||||
@ -45,7 +47,7 @@ var renderBookmark = data => {
|
||||
|
||||
ext.tabs.query({ active: true, currentWindow: true }, function(tabs) {
|
||||
var activeTab = tabs[0];
|
||||
chrome.tabs.sendMessage(
|
||||
ext.tabs.sendMessage(
|
||||
activeTab.id,
|
||||
{ action: "process-page" },
|
||||
renderBookmark
|
||||
@ -56,6 +58,7 @@ popup.addEventListener("click", function(e) {
|
||||
if (e.target && e.target.matches("#save-btn")) {
|
||||
e.preventDefault();
|
||||
page_data.comment = document.getElementById("comment").value;
|
||||
page_data.extract = document.getElementById("save-content").checked;
|
||||
ext.runtime.sendMessage(
|
||||
{ action: "perform-save", data: page_data },
|
||||
function(response) {
|
||||
|
Loading…
Reference in New Issue
Block a user