Compare commits
1 Commits
master
...
feature/ex
Author | SHA1 | Date | |
---|---|---|---|
fad8af07a7 |
@ -51,16 +51,10 @@ The following tasks can be used when you want to start developing the extension
|
|||||||
|
|
||||||
Run `npm run dist` to create a zipped, production-ready extension for each browser. You can then upload that to the appstore.
|
Run `npm run dist` to create a zipped, production-ready extension for each browser. You can then upload that to the appstore.
|
||||||
|
|
||||||
#### Firefox
|
|
||||||
|
|
||||||
Run `npm run sourcezip` for firefox submission
|
Run `npm run sourcezip` for firefox submission
|
||||||
|
|
||||||
Update <https://addons.mozilla.org/fr/developers/addon/shikiryu-readlater/versions/submit/>
|
Update <https://addons.mozilla.org/fr/developers/addon/shikiryu-readlater/versions/submit/>
|
||||||
|
|
||||||
#### Opera
|
|
||||||
|
|
||||||
Update <https://addons.opera.com/developer/package/250537/?tab=versions>
|
|
||||||
|
|
||||||
## :sparkles: Features
|
## :sparkles: Features
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "Read Later by Email",
|
"name": "Shikiryu Read Later",
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "__MSG_extensionDescription__",
|
"description": "__MSG_extensionDescription__",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"background": {
|
"background": {
|
||||||
"scripts": ["scripts/background.js"]
|
"scripts": ["scripts/background.js"]
|
||||||
},
|
},
|
||||||
"permissions": ["activeTab", "storage"],
|
"permissions": ["activeTab", "storage", "contextMenus"],
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options.html"
|
"page": "options.html"
|
||||||
},
|
},
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*"],
|
||||||
"js": ["scripts/contentscript.js"],
|
"js": ["scripts/contentscript.js"],
|
||||||
"run_at": "document_end",
|
"run_at": "document_end",
|
||||||
"all_frames": false
|
"all_frames": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
@ -29,7 +29,7 @@
|
|||||||
"32": "icons/favicon-32x32.png",
|
"32": "icons/favicon-32x32.png",
|
||||||
"96": "icons/favicon-96x96.png"
|
"96": "icons/favicon-96x96.png"
|
||||||
},
|
},
|
||||||
"default_title": "Read Later by Email",
|
"default_title": "Shikiryu Bookmarklet",
|
||||||
"default_popup": "popup.html"
|
"default_popup": "popup.html"
|
||||||
},
|
},
|
||||||
"applications": {
|
"applications": {
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
#English
|
|
||||||
This extension collect the instance URL you'll be sending your page to and the token used to identify yourself on this instance.
|
|
||||||
This will be saved on your browser local storage.
|
|
||||||
|
|
||||||
The following elements are sent to the instance:
|
|
||||||
|
|
||||||
- title
|
|
||||||
- description
|
|
||||||
- image
|
|
||||||
|
|
||||||
They are automatically generated with the current tab content. With your current token, you can also send a comment which will reach the instance.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# French
|
|
||||||
|
|
||||||
Cette extension collecte l'URL de l'instance vers laquelle vous allez envoyer les informations and le jeton vous permettant de vous identifier sur cette instance.
|
|
||||||
Ces deux données sont enregistrées localement dans le local storage de votre navigateur.
|
|
||||||
|
|
||||||
Les éléments suivant seront envoyés à l'instance :
|
|
||||||
|
|
||||||
- titre
|
|
||||||
- description
|
|
||||||
- image
|
|
||||||
|
|
||||||
Ils seront générés automatiquement à partir des mêmes informations utilisées sur l'onglet actuellement ouvert.
|
|
||||||
Avec votre jeton en cours, vous pourrez aussi envoyer un commentaire de cet onglet vers l'instance.
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extensionName": {
|
"extensionName": {
|
||||||
"message": "Read Later by Email",
|
"message": "Shikiryu Read Later",
|
||||||
"description": "The name of the extension."
|
"description": "The name of the extension."
|
||||||
},
|
},
|
||||||
"extensionDescription": {
|
"extensionDescription": {
|
||||||
@ -58,5 +58,9 @@
|
|||||||
"excerpt": {
|
"excerpt": {
|
||||||
"message": "Add content",
|
"message": "Add content",
|
||||||
"description": "Option to add the webpage content into the email"
|
"description": "Option to add the webpage content into the email"
|
||||||
|
},
|
||||||
|
"selectDomToSend": {
|
||||||
|
"message": "Select DOM To Send",
|
||||||
|
"description": "Select DOM To Send"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extensionName": {
|
"extensionName": {
|
||||||
"message": "Read Later by Email",
|
"message": "Shikiryu Read Later",
|
||||||
"description": "The name of the extension."
|
"description": "The name of the extension."
|
||||||
},
|
},
|
||||||
"extensionDescription": {
|
"extensionDescription": {
|
||||||
@ -58,5 +58,9 @@
|
|||||||
"excerpt": {
|
"excerpt": {
|
||||||
"message": "Ajouter le contenu",
|
"message": "Ajouter le contenu",
|
||||||
"description": "Option to add the webpage content into the email"
|
"description": "Option to add the webpage content into the email"
|
||||||
|
},
|
||||||
|
"selectDomToSend": {
|
||||||
|
"message": "Partie à envoyer par email",
|
||||||
|
"description": "Select DOM To Send"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="unit whole center-on-mobiles">
|
<div class="unit whole center-on-mobiles">
|
||||||
<p class="text-center text-muted">
|
<p class="text-center text-muted">
|
||||||
© <a href="https://readlater.shikiryu.com">ReadLaterByEmail</a>
|
© <a href="https://readlater.shikiryu.com">Shikiryu</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -30,8 +30,7 @@
|
|||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="unit whole center-on-mobiles">
|
<div class="unit whole center-on-mobiles">
|
||||||
<p class="text-center text-muted">
|
<p class="text-center text-muted">
|
||||||
©
|
© <a href="https://readlater.shikiryu.com">Shikiryu</a>
|
||||||
<a href="https://readlater.shikiryu.com">ReadLaterByEmail</a>
|
|
||||||
</p>
|
</p>
|
||||||
<p class="js-options" data-message="optionsAndSettings"></p>
|
<p class="js-options" data-message="optionsAndSettings"></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,46 @@
|
|||||||
import ext from "./utils/ext";
|
import ext from "./utils/ext";
|
||||||
import storage from "./utils/storage";
|
import storage from "./utils/storage";
|
||||||
|
|
||||||
|
let onMenuAdded = function() {
|
||||||
|
if (ext.browser.runtime.lastError) {
|
||||||
|
console.log(`Error: ${ext.browser.runtime.lastError}`);
|
||||||
|
} else {
|
||||||
|
console.log("Readlater menu created successfully");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ext.contextMenus.create(
|
||||||
|
{
|
||||||
|
id: "dom-selection",
|
||||||
|
title: ext.i18n.getMessage("selectDomToSend"),
|
||||||
|
contexts: ["all"]
|
||||||
|
},
|
||||||
|
onMenuAdded
|
||||||
|
);
|
||||||
|
|
||||||
|
ext.contextMenus.onClicked.addListener(function(info, tab) {
|
||||||
|
if ("dom-selection" === info.menuItemId) {
|
||||||
|
var page_data = {
|
||||||
|
title: "",
|
||||||
|
description: "",
|
||||||
|
image: "",
|
||||||
|
comment: "",
|
||||||
|
url: document.location.href
|
||||||
|
};
|
||||||
|
ext.tabs.sendMessage(tab.id, { action: "process-page" }, function(data) {
|
||||||
|
ext.tabs.sendMessage(tab.id, { action: "DOM", data: data }, function(
|
||||||
|
response
|
||||||
|
) {
|
||||||
|
if (response && response.action === "saved") {
|
||||||
|
console.log(ext.i18n.getMessage("savedSuccessfully"));
|
||||||
|
} else {
|
||||||
|
console.log(response.error + " (" + response.status + ")");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ext.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
ext.runtime.onMessage.addListener(function(request, sender, sendResponse) {
|
||||||
if (request.action === "perform-save") {
|
if (request.action === "perform-save") {
|
||||||
var data = request.data;
|
var data = request.data;
|
||||||
|
@ -1,35 +1,67 @@
|
|||||||
import ext from "./utils/ext";
|
import ext from "./utils/ext";
|
||||||
import storage from "./utils/storage";
|
|
||||||
|
|
||||||
var extractTags = () => {
|
let extractDOM = () => {
|
||||||
var url = document.location.href;
|
let indexInParent = node => {
|
||||||
|
let children = node.parentNode.childNodes;
|
||||||
|
let num = 0;
|
||||||
|
for (let i = 0; i < children.length; i++) {
|
||||||
|
if (children[i] === node) return num;
|
||||||
|
if (children[i].nodeType === 1) num++;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
let gx = el => {
|
||||||
|
let xp = "";
|
||||||
|
for (; el && el.nodeType === 1; el = el.parentNode) {
|
||||||
|
let id = indexInParent(el) + 1; // jQuery(el.parentNode).children(el.tagName).index(el)+1;
|
||||||
|
id = id > 1 ? "[" + id + "]" : "";
|
||||||
|
xp = "/" + el.tagName.toLowerCase() + id + xp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return xp;
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("click", function(evt) {
|
||||||
|
let tar = evt.target;
|
||||||
|
while (tar && tar !== this) {
|
||||||
|
if (tar.matches(".shikihover")) {
|
||||||
|
let data = extractTags();
|
||||||
|
data.xpath = gx(tar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let extractTags = () => {
|
||||||
|
let url = document.location.href;
|
||||||
if (!url || !url.match(/^http/)) {
|
if (!url || !url.match(/^http/)) {
|
||||||
console.error("Invalid URL : " + url);
|
console.error("Invalid URL : " + url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {
|
let data = {
|
||||||
title: "",
|
title: "",
|
||||||
description: "",
|
description: "",
|
||||||
image: "",
|
image: "",
|
||||||
url: url
|
url: url
|
||||||
};
|
};
|
||||||
|
|
||||||
var ogTitle = document.querySelector("meta[property='og:title']");
|
let ogTitle = document.querySelector("meta[property='og:title']");
|
||||||
if (ogTitle) {
|
if (ogTitle) {
|
||||||
data.title = ogTitle.getAttribute("content");
|
data.title = ogTitle.getAttribute("content");
|
||||||
} else {
|
} else {
|
||||||
data.title = document.title;
|
data.title = document.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
var descriptionTag =
|
let descriptionTag =
|
||||||
document.querySelector("meta[property='og:description']") ||
|
document.querySelector("meta[property='og:description']") ||
|
||||||
document.querySelector("meta[name='description']");
|
document.querySelector("meta[name='description']");
|
||||||
if (descriptionTag) {
|
if (descriptionTag) {
|
||||||
data.description = descriptionTag.getAttribute("content");
|
data.description = descriptionTag.getAttribute("content");
|
||||||
}
|
}
|
||||||
|
|
||||||
var imgTag =
|
let imgTag =
|
||||||
document.querySelector("meta[property='og:image']") ||
|
document.querySelector("meta[property='og:image']") ||
|
||||||
document.querySelector("meta[property='twitter-image']");
|
document.querySelector("meta[property='twitter-image']");
|
||||||
if (imgTag) {
|
if (imgTag) {
|
||||||
@ -50,6 +82,10 @@ function onRequest(request, sender, sendResponse) {
|
|||||||
if (request.action === "process-page") {
|
if (request.action === "process-page") {
|
||||||
sendResponse(extractTags());
|
sendResponse(extractTags());
|
||||||
}
|
}
|
||||||
|
if (request.action === "DOM") {
|
||||||
|
console.log("DOM");
|
||||||
|
sendResponse(extractDOM());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.runtime.onMessage.addListener(onRequest);
|
ext.runtime.onMessage.addListener(onRequest);
|
||||||
|
@ -19,9 +19,6 @@ storage.get("extract", function(resp) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
urlInput.addEventListener("blur", function(e) {
|
urlInput.addEventListener("blur", function(e) {
|
||||||
if (this.value.endsWith("/")) {
|
|
||||||
this.value = this.value.substring(0, this.value.length - 1);
|
|
||||||
}
|
|
||||||
var value = this.value;
|
var value = this.value;
|
||||||
storage.set({ url: value }, function() {
|
storage.set({ url: value }, function() {
|
||||||
message.textContent = ext.i18n.getMessage("URLChanged");
|
message.textContent = ext.i18n.getMessage("URLChanged");
|
||||||
|
@ -20,8 +20,7 @@ storage.get("extract", function(resp) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var renderMessage = message => {
|
var renderMessage = message => {
|
||||||
var displayContainer = document.getElementById("display-container");
|
document.getElementById("display-container").textContent = message;
|
||||||
displayContainer.textContent = message;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var renderBookmark = data => {
|
var renderBookmark = data => {
|
||||||
|
9
src/styles/contentstyle.css
Normal file
9
src/styles/contentstyle.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
div:hover,
|
||||||
|
section:hover {
|
||||||
|
border: 3px solid yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
div,
|
||||||
|
section {
|
||||||
|
border: none;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user