Complete rewrite to add likes
This commit replaces the icon with a SVG and adds the possibility to like pages too. To do this the whole structure was rewritten which makes it in the future easier to add new functions.
This commit is contained in:
parent
760adf4d85
commit
6ca1f57d1c
9 changed files with 220 additions and 26 deletions
|
@ -1,13 +0,0 @@
|
|||
function openPage(url) {
|
||||
browser.tabs.create({
|
||||
url: "https://jeena.net/notes/new?in_reply_to=" + url
|
||||
});
|
||||
}
|
||||
|
||||
async function buttonClicked() {
|
||||
const [tab] = await browser.tabs.query({currentWindow: true, active:true});
|
||||
console.log(tab)
|
||||
openPage(tab.url);
|
||||
}
|
||||
|
||||
browser.browserAction.onClicked.addListener(buttonClicked);
|
11
button.js
Normal file
11
button.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
async function buttonClicked(e) {
|
||||
const [tab] = await browser.tabs.query({currentWindow: true, active:true});
|
||||
|
||||
browser.tabs.create({
|
||||
url: e.target.parentNode.dataset.href + tab.url
|
||||
});
|
||||
|
||||
window.close()
|
||||
}
|
||||
|
||||
document.addEventListener("click", buttonClicked)
|
Binary file not shown.
Before Width: | Height: | Size: 257 B |
Binary file not shown.
Before Width: | Height: | Size: 434 B |
60
icons/icon.svg
Normal file
60
icons/icon.svg
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 55 55"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="icon.svg"
|
||||
width="55"
|
||||
height="55"
|
||||
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||
id="metadata19"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs17" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1025"
|
||||
id="namedview15"
|
||||
showgrid="false"
|
||||
inkscape:zoom="8.6041667"
|
||||
inkscape:cx="38.702179"
|
||||
inkscape:cy="24.755448"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<style
|
||||
type="text/css"
|
||||
id="style10">
|
||||
.st0{fill:#333333;}
|
||||
</style>
|
||||
<g
|
||||
id="XMLID_2_"
|
||||
transform="translate(-20.455206,-19.566586)">
|
||||
<path
|
||||
id="XMLID_4_"
|
||||
class="st0"
|
||||
d="m 75.5,44.1 c 0,3.6 -1.2,6.8 -3.7,9.9 -2.5,3 -5.8,5.4 -10,7.2 -4.2,1.7 -8.8,2.6 -13.8,2.6 -1.4,0 -2.9,-0.1 -4.5,-0.2 -4.1,3.6 -8.8,6.1 -14.1,7.4 -1,0.3 -2.2,0.5 -3.5,0.7 -0.3,0 -0.7,-0.1 -0.9,-0.3 -0.2,-0.2 -0.5,-0.5 -0.5,-0.9 v 0 c -0.1,-0.1 -0.1,-0.2 0,-0.4 0.1,-0.2 0.1,-0.3 0.1,-0.3 0,0 0,-0.1 0.1,-0.3 l 0.2,-0.3 0.2,-0.3 0.2,-0.3 c 0.1,-0.2 0.5,-0.5 1,-1.1 0.5,-0.5 0.8,-0.9 1.1,-1.2 0.3,-0.3 0.5,-0.6 1,-1.2 0.4,-0.6 0.8,-1.1 1,-1.6 0.2,-0.5 0.5,-1.1 0.8,-1.8 C 30.5,61 30.8,60.2 31,59.4 27.8,57.6 25.3,55.3 23.4,52.6 21.5,49.9 20.6,47 20.6,44 c 0,-2.7 0.7,-5.2 2.2,-7.6 1.5,-2.4 3.4,-4.5 5.9,-6.3 2.5,-1.8 5.4,-3.2 8.8,-4.2 3.4,-1 7,-1.5 10.7,-1.5 5,0 9.6,0.9 13.8,2.6 4.2,1.7 7.6,4.1 10,7.2 2.3,3 3.5,6.3 3.5,9.9 z"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
60
icons/like.svg
Normal file
60
icons/like.svg
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 55 55"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="like.svg"
|
||||
width="55"
|
||||
height="55"
|
||||
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||
id="metadata3837"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs3835" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1025"
|
||||
id="namedview3833"
|
||||
showgrid="false"
|
||||
inkscape:zoom="8.0168655"
|
||||
inkscape:cx="48"
|
||||
inkscape:cy="38.021038"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<style
|
||||
type="text/css"
|
||||
id="style3828">
|
||||
.st0{fill:#333333;}
|
||||
</style>
|
||||
<g
|
||||
id="XMLID_4_"
|
||||
transform="matrix(0.79167778,0,0,0.79167778,-10.801423,-11.053899)">
|
||||
<path
|
||||
id="XMLID_6_"
|
||||
class="st0"
|
||||
d="M 48,75.3 43.8,71.4 C 28.8,57.8 18.9,48.8 18.9,37.8 c 0,-9 7.1,-16 16,-16 5.1,0 9.9,2.4 13.1,6.1 3.2,-3.7 8,-6.1 13.1,-6.1 9,0 16,7.1 16,16 0,11 -9.9,20 -24.9,33.7 z"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
60
icons/reply.svg
Normal file
60
icons/reply.svg
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 55 55"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="reply.svg"
|
||||
width="55"
|
||||
height="55"
|
||||
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||
id="metadata86"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs84" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1025"
|
||||
id="namedview82"
|
||||
showgrid="false"
|
||||
inkscape:zoom="6.98"
|
||||
inkscape:cx="48"
|
||||
inkscape:cy="36.538682"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<style
|
||||
type="text/css"
|
||||
id="style77">
|
||||
.st0{fill:#333333;}
|
||||
</style>
|
||||
<g
|
||||
id="XMLID_2_"
|
||||
transform="translate(-20.241756,-19.440678)">
|
||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0.3 -0.2,0.5 -0.4,0.7 -0.2,0.2 -0.4,0.2 -0.7,0.2 -1,-0.1 -1.9,-0.3 -2.6,-0.5 -3.2,-0.8 -6,-2.1 -8.5,-3.9 -1.8,0.3 -3.6,0.5 -5.4,0.5 -5.5,0 -10.4,-1.4 -14.5,-4.1 1.2,0.1 2.1,0.1 2.7,0.1 3.3,0 6.5,-0.5 9.5,-1.4 3,-0.9 5.7,-2.2 8.1,-4 2.6,-1.9 4.5,-4.1 5.9,-6.5 1.4,-2.5 2.1,-5.1 2.1,-7.8 0,-1.6 -0.2,-3.1 -0.7,-4.7 2.6,1.5 4.7,3.3 6.3,5.5 1.6,2.2 2.2,4.3 2.2,6.9 z"
|
||||
inkscape:connector-curvature="0"
|
||||
style="fill:#333333" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3 KiB |
|
@ -1,21 +1,17 @@
|
|||
{
|
||||
|
||||
"description": "Indie Reply Button",
|
||||
"description": "Button to like and reply",
|
||||
"manifest_version": 2,
|
||||
"name": "indie-reply-button",
|
||||
"version": "1.0",
|
||||
|
||||
"background": {
|
||||
"scripts": ["background.js"]
|
||||
"name": "Indie Reply Button",
|
||||
"version": "2.0",
|
||||
"icons": {
|
||||
"48": "icons/icon.svg"
|
||||
},
|
||||
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"16": "icons/icon-16.png",
|
||||
"32": "icons/icon-32.png"
|
||||
}
|
||||
"default_icon": "icons/icon.svg",
|
||||
"default_title": "IndieButton",
|
||||
"default_popup": "popup.html",
|
||||
"browser_style": false
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"tabs"
|
||||
]
|
||||
|
|
20
popup.html
Normal file
20
popup.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Indie Buttons</title>
|
||||
<style>
|
||||
body { line-height: 0; vertical-align: middle; }
|
||||
img { width: 20px; height: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a data-href="https://jeena.net/notes/new?in_reply_to=">
|
||||
<img src="icons/reply.svg" alt="reply">
|
||||
</a>
|
||||
<a data-href="https://jeena.net/likes/new?url=">
|
||||
<img src="icons/like.svg" alt="like">
|
||||
</a>
|
||||
<script src="button.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue