Initial commit
This commit is contained in:
commit
97389199f5
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
let EXT_SWITCH = true;
|
||||||
|
|
||||||
|
chrome.storage.onChanged.addListener((changes, _) => {
|
||||||
|
for (let [key, { oldValue, newValue }] of Object.entries(changes)) {
|
||||||
|
if (key === 'globalOnOffSwitch') {
|
||||||
|
EXT_SWITCH = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* CONNECTION */
|
||||||
|
|
||||||
|
const WS_IP = 'localhost';
|
||||||
|
const WS_PORT = 40022;
|
||||||
|
|
||||||
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
|
||||||
|
const makeWSConnection = async () => {
|
||||||
|
const ws = new WebSocket(`ws://${WS_IP}:${WS_PORT}/`);
|
||||||
|
ws.onopen = e => console.log(`Connected to ${e.target.url}`);
|
||||||
|
ws.onclose = e => console.log(`Disconnected from ${e.target.url}`);
|
||||||
|
|
||||||
|
while (ws.readyState != WebSocket.OPEN)
|
||||||
|
await sleep(5);
|
||||||
|
|
||||||
|
return ws
|
||||||
|
}
|
||||||
|
|
||||||
|
let WS = (async () => await makeWSConnection())();
|
||||||
|
|
||||||
|
const sendToOpener = async cmd => {
|
||||||
|
if (WS.readystate != WebSocket.OPEN)
|
||||||
|
WS = await makeWSConnection();
|
||||||
|
WS.send(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* URL INTERCEPTION */
|
||||||
|
|
||||||
|
const URLS = [
|
||||||
|
"*://*.youtube.com/watch*"
|
||||||
|
];
|
||||||
|
|
||||||
|
const interceptLink = details => {
|
||||||
|
if (!EXT_SWITCH)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
try {
|
||||||
|
console.log(details);
|
||||||
|
sendToOpener(`mpv '${details.url}'`);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
return {redirectUrl: 'javascript:'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.webRequest.onBeforeRequest.addListener(
|
||||||
|
interceptLink,
|
||||||
|
{
|
||||||
|
urls: URLS,
|
||||||
|
types: ['main_frame']
|
||||||
|
},
|
||||||
|
["blocking", "requestBody"]
|
||||||
|
);
|
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
|
@ -0,0 +1,166 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="40mm"
|
||||||
|
height="40mm"
|
||||||
|
viewBox="0 0 40.000001 40"
|
||||||
|
version="1.1"
|
||||||
|
id="svg5"
|
||||||
|
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
|
||||||
|
sodipodi:docname="icon.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview7"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#ffffff"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:object-paths="true"
|
||||||
|
inkscape:snap-smooth-nodes="true"
|
||||||
|
inkscape:zoom="4"
|
||||||
|
inkscape:cx="76.875"
|
||||||
|
inkscape:cy="91.875"
|
||||||
|
inkscape:window-width="1914"
|
||||||
|
inkscape:window-height="1048"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="26"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
width="30.087069mm"
|
||||||
|
fit-margin-bottom="1"
|
||||||
|
fit-margin-top="1"
|
||||||
|
fit-margin-left="3.3"
|
||||||
|
fit-margin-right="3.3"
|
||||||
|
lock-margins="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid48124" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs2">
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="powermask"
|
||||||
|
id="path-effect48049"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
uri="#mask-powermask-path-effect48049"
|
||||||
|
invert="false"
|
||||||
|
hide_mask="false"
|
||||||
|
background="true"
|
||||||
|
background_color="#ffffffff" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-3" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-8" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-6" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-60" />
|
||||||
|
<mask
|
||||||
|
maskUnits="userSpaceOnUse"
|
||||||
|
id="mask-powermask-path-effect48049">
|
||||||
|
<path
|
||||||
|
id="mask-powermask-path-effect48049_box"
|
||||||
|
style="fill:#ffffff;fill-opacity:1"
|
||||||
|
d="m 81.2388,98.259103 h 32.08707 V 134.9555 H 81.2388 Z" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:0.264856px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 82.225713,99.258464 c 6.090188,0.34762 12.270359,0.265287 18.488827,0"
|
||||||
|
id="path48047"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
</mask>
|
||||||
|
<filter
|
||||||
|
id="mask-powermask-path-effect48049_inverse"
|
||||||
|
inkscape:label="filtermask-powermask-path-effect48049"
|
||||||
|
style="color-interpolation-filters:sRGB"
|
||||||
|
height="100"
|
||||||
|
width="100"
|
||||||
|
x="-50"
|
||||||
|
y="-50">
|
||||||
|
<feColorMatrix
|
||||||
|
id="mask-powermask-path-effect48049_primitive1"
|
||||||
|
values="1"
|
||||||
|
type="saturate"
|
||||||
|
result="fbSourceGraphic" />
|
||||||
|
<feColorMatrix
|
||||||
|
id="mask-powermask-path-effect48049_primitive2"
|
||||||
|
values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 "
|
||||||
|
in="fbSourceGraphic" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-78.9388,-98.259103)">
|
||||||
|
<g
|
||||||
|
id="g47566"
|
||||||
|
mask="url(#mask-powermask-path-effect48049)"
|
||||||
|
inkscape:path-effect="#path-effect48049"
|
||||||
|
inkscape:export-filename="/home/h7x4/git/link-opener/chrome-plugin/g47566.png"
|
||||||
|
inkscape:export-xdpi="108.05971"
|
||||||
|
inkscape:export-ydpi="108.05971"
|
||||||
|
transform="translate(1.656465,1.6518004)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,6.7643219,-8.9697253)"
|
||||||
|
id="text2143"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145);shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48156"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48154">L</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,7.9007585,-8.9697253)"
|
||||||
|
id="text2143-4"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145-6);shape-padding:0;shape-margin:0;inline-size:0;vector-effect:none;fill:#ff6600;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48160"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145-6);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48158">L</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,8.9621915,-8.9697253)"
|
||||||
|
id="text2143-48"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145-60);shape-padding:0;shape-margin:0;inline-size:0;vector-effect:none;fill:#ffff00;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48164"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145-60);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48162">L</tspan></tspan></text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 8.1 KiB |
|
@ -0,0 +1,169 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="40mm"
|
||||||
|
height="40mm"
|
||||||
|
viewBox="0 0 40.000001 40"
|
||||||
|
version="1.1"
|
||||||
|
id="svg5"
|
||||||
|
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
|
||||||
|
sodipodi:docname="icon.svg"
|
||||||
|
inkscape:export-filename="/home/h7x4/git/link-opener/chrome-plugin/icon.png"
|
||||||
|
inkscape:export-xdpi="81.279999"
|
||||||
|
inkscape:export-ydpi="81.279999"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview7"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#ffffff"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:pageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:object-paths="true"
|
||||||
|
inkscape:snap-smooth-nodes="true"
|
||||||
|
inkscape:zoom="4"
|
||||||
|
inkscape:cx="76.875"
|
||||||
|
inkscape:cy="91.875"
|
||||||
|
inkscape:window-width="1914"
|
||||||
|
inkscape:window-height="1048"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="26"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
width="30.087069mm"
|
||||||
|
fit-margin-bottom="1"
|
||||||
|
fit-margin-top="1"
|
||||||
|
fit-margin-left="3.3"
|
||||||
|
fit-margin-right="3.3"
|
||||||
|
lock-margins="false">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid48124" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs2">
|
||||||
|
<inkscape:path-effect
|
||||||
|
effect="powermask"
|
||||||
|
id="path-effect48049"
|
||||||
|
is_visible="true"
|
||||||
|
lpeversion="1"
|
||||||
|
uri="#mask-powermask-path-effect48049"
|
||||||
|
invert="false"
|
||||||
|
hide_mask="false"
|
||||||
|
background="true"
|
||||||
|
background_color="#ffffffff" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-3" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-8" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-6" />
|
||||||
|
<rect
|
||||||
|
x="278.92114"
|
||||||
|
y="362.5889"
|
||||||
|
width="288.76178"
|
||||||
|
height="336.49365"
|
||||||
|
id="rect2145-60" />
|
||||||
|
<mask
|
||||||
|
maskUnits="userSpaceOnUse"
|
||||||
|
id="mask-powermask-path-effect48049">
|
||||||
|
<path
|
||||||
|
id="mask-powermask-path-effect48049_box"
|
||||||
|
style="fill:#ffffff;fill-opacity:1"
|
||||||
|
d="m 81.2388,98.259103 h 32.08707 V 134.9555 H 81.2388 Z" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:0.264856px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 82.225713,99.258464 c 6.090188,0.34762 12.270359,0.265287 18.488827,0"
|
||||||
|
id="path48047"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
</mask>
|
||||||
|
<filter
|
||||||
|
id="mask-powermask-path-effect48049_inverse"
|
||||||
|
inkscape:label="filtermask-powermask-path-effect48049"
|
||||||
|
style="color-interpolation-filters:sRGB"
|
||||||
|
height="100"
|
||||||
|
width="100"
|
||||||
|
x="-50"
|
||||||
|
y="-50">
|
||||||
|
<feColorMatrix
|
||||||
|
id="mask-powermask-path-effect48049_primitive1"
|
||||||
|
values="1"
|
||||||
|
type="saturate"
|
||||||
|
result="fbSourceGraphic" />
|
||||||
|
<feColorMatrix
|
||||||
|
id="mask-powermask-path-effect48049_primitive2"
|
||||||
|
values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 "
|
||||||
|
in="fbSourceGraphic" />
|
||||||
|
</filter>
|
||||||
|
</defs>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-78.9388,-98.259103)">
|
||||||
|
<g
|
||||||
|
id="g47566"
|
||||||
|
mask="url(#mask-powermask-path-effect48049)"
|
||||||
|
inkscape:path-effect="#path-effect48049"
|
||||||
|
inkscape:export-filename="/home/h7x4/git/link-opener/chrome-plugin/g47566.png"
|
||||||
|
inkscape:export-xdpi="108.05971"
|
||||||
|
inkscape:export-ydpi="108.05971"
|
||||||
|
transform="translate(1.656465,1.6518004)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,6.7643219,-8.9697253)"
|
||||||
|
id="text2143"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145);shape-padding:0;shape-margin:0;inline-size:0;opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000;stop-opacity:1"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48210"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48208">L</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,7.9007585,-8.9697253)"
|
||||||
|
id="text2143-4"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145-6);shape-padding:0;shape-margin:0;inline-size:0;vector-effect:none;fill:#ff6600;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48214"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145-6);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48212">L</tspan></tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,8.9621915,-8.9697253)"
|
||||||
|
id="text2143-48"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:192px;line-height:1.25;font-family:'CMU Serif';-inkscape-font-specification:'CMU Serif';font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:0px;word-spacing:0px;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;white-space:pre;shape-inside:url(#rect2145-60);shape-padding:0;shape-margin:0;inline-size:0;vector-effect:none;fill:#ffff00;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000000"><tspan
|
||||||
|
x="278.92188"
|
||||||
|
y="540.18984"
|
||||||
|
id="tspan48218"><tspan
|
||||||
|
style="baseline-shift:baseline;shape-inside:url(#rect2145-60);vector-effect:none;stop-color:#000000;stop-opacity:1"
|
||||||
|
id="tspan48216">L</tspan></tspan></text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 8.2 KiB |
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "Link Opener",
|
||||||
|
"version": "1.0.0",
|
||||||
|
|
||||||
|
"description": "An extension to open certain links in local programs",
|
||||||
|
"icons": {},
|
||||||
|
|
||||||
|
"permissions": [
|
||||||
|
"webRequest",
|
||||||
|
"webRequestBlocking",
|
||||||
|
"storage",
|
||||||
|
"<all_urls>"
|
||||||
|
],
|
||||||
|
"background": {
|
||||||
|
"scripts": ["background.js"],
|
||||||
|
"persistent": true
|
||||||
|
},
|
||||||
|
"browser_action": {
|
||||||
|
"default_icon": "graphics/icon.png",
|
||||||
|
"default_popup": "popup/popup.html"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
chrome.storage.sync.get('globalOnOffSwitch', ({globalOnOffSwitch}) => {
|
||||||
|
document.getElementById('onOffSwitch').checked = globalOnOffSwitch ?? true;
|
||||||
|
});
|
||||||
|
|
||||||
|
document
|
||||||
|
.getElementById('onOffSwitch')
|
||||||
|
.addEventListener(
|
||||||
|
'change',
|
||||||
|
e => chrome.storage.sync.set({'globalOnOffSwitch': e.target.checked})
|
||||||
|
);
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="stylesheets/toggle_button.css">
|
||||||
|
<link rel="stylesheet" href="stylesheets/style.css">
|
||||||
|
<script src="index.js" defer></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>Link Opener</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class="setting">
|
||||||
|
<h2>On/Off:</h2>
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" id="onOffSwitch">
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.setting {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* Taken from https://www.w3schools.com/howto/howto_css_switch.asp */
|
||||||
|
|
||||||
|
/* The switch - the box around the slider */
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 60px;
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide default HTML checkbox */
|
||||||
|
.switch input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The slider */
|
||||||
|
.slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #ccc;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: 26px;
|
||||||
|
width: 26px;
|
||||||
|
left: 4px;
|
||||||
|
bottom: 4px;
|
||||||
|
background-color: white;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider {
|
||||||
|
background-color: #2196F3;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus + .slider {
|
||||||
|
box-shadow: 0 0 1px #2196F3;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider:before {
|
||||||
|
-webkit-transform: translateX(26px);
|
||||||
|
-ms-transform: translateX(26px);
|
||||||
|
transform: translateX(26px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rounded sliders */
|
||||||
|
.slider.round {
|
||||||
|
border-radius: 34px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider.round:before {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
// "*://*.youtube.com/youtubei/v1/player*",
|
||||||
|
// "*://*.youtube.com/youtubei/v1/next*",
|
|
@ -0,0 +1,30 @@
|
||||||
|
import asyncio
|
||||||
|
import websockets
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
IP = 'localhost'
|
||||||
|
PORT = 40022
|
||||||
|
|
||||||
|
def run_command(cmd):
|
||||||
|
completedProcess = subprocess.run(cmd, shell=True)
|
||||||
|
|
||||||
|
if completedProcess.stdout:
|
||||||
|
print('Output:')
|
||||||
|
print(completedProcess.stdout)
|
||||||
|
|
||||||
|
if completedProcess.stderr:
|
||||||
|
print('Error:')
|
||||||
|
print(completedProcess.stderr)
|
||||||
|
|
||||||
|
async def ws_server(websocket, path):
|
||||||
|
while True:
|
||||||
|
cmd = await websocket.recv()
|
||||||
|
print(cmd)
|
||||||
|
run_command(f'notify-send -t 3000 "Command recieved:\n{cmd}"')
|
||||||
|
run_command(cmd)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
start_server = websockets.serve(ws_server, IP, PORT)
|
||||||
|
|
||||||
|
asyncio.get_event_loop().run_until_complete(start_server)
|
||||||
|
asyncio.get_event_loop().run_forever()
|
Reference in New Issue