༼ つ ◕_◕ ༽つ
This commit is contained in:
parent
eb9a294b1d
commit
2d9342f089
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/out/*
|
20
README.md
20
README.md
@ -1,9 +1,17 @@
|
||||
## Build
|
||||
# Build
|
||||
|
||||
1. Checkout and dir into project folder
|
||||
```shell
|
||||
cd base; find base -type f -exec zip out/artifacts/firefox/extension.crx {} +
|
||||
find firefox -type f -exec zip out/artifacts/firefox/extension.crx {} +
|
||||
zip -r out/artifacts/firefox/extension.crx base/* firefox/*
|
||||
git checkout https://lab.thereno.cloud/stammtv-extension
|
||||
cd stammtv-extension
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
- Chromium based Browser (Chrome, Edge, ..)
|
||||
2.1 For Firefox
|
||||
```shell
|
||||
./build-ff.sh
|
||||
```
|
||||
|
||||
2.2 For Chrome
|
||||
```shell
|
||||
./build-chrome.sh
|
||||
```
|
@ -4,9 +4,17 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Popup</title>
|
||||
</head>
|
||||
<body style="min-width: 10rem; min-height: 5rem; display: grid; justify-content: center; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank" style="font-weight: bold; color: #ff0000; border: 2px solid black;">→ Take me to StammTV!</a>
|
||||
<a href="/options/options.html" id="open-settings" target="_blank" style="font-weight: bold;">⚙ Settings</a>
|
||||
<body style="min-width: 8rem; display: flex; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank">
|
||||
<img src="/stammtv-large.png" alt="StammTV Logo" height="128px" width="128px"/>
|
||||
</a>
|
||||
<a href="/options/options.html" id="open-settings" target="_blank" style="
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
font-size: 1rem;
|
||||
width: 6rem;
|
||||
color: black;
|
||||
">⚙ Settings</a>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -3,7 +3,6 @@ let websocket;
|
||||
const CONTEXT_MENU_ID = "STAMMTV_ADD_URL_TO_PLAYLIST";
|
||||
|
||||
chrome.storage.local.get('firstRun', function (result) {
|
||||
console.log(result);
|
||||
if (result.firstRun === false) {
|
||||
chrome.storage.local.set({'firstRun': false}, function (result) {
|
||||
openSettings();
|
||||
@ -58,14 +57,6 @@ function addToStammTV(info, tab) {
|
||||
if (info.menuItemId === CONTEXT_MENU_ID) { //if OUR menu item was clicked
|
||||
let videoId = parseYoutubeURL(info.linkUrl)
|
||||
if (videoId) {
|
||||
const playerReady = {"type": "playerReady"};
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
|
||||
console.log(websocket);
|
||||
if (websocket === undefined
|
||||
|| websocket.readyState !== WebSocket.OPEN) {
|
||||
websocket = new WebSocket(WEBSOCKET_URL);
|
||||
@ -73,8 +64,16 @@ function addToStammTV(info, tab) {
|
||||
}
|
||||
|
||||
websocket.onopen = function () {
|
||||
console.log('websocket ready');
|
||||
console.log('websocket ready - sending');
|
||||
|
||||
const playerReady = {"type": "playerReady"};
|
||||
websocket.send(JSON.stringify(playerReady));
|
||||
console.log(playerReady);
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
websocket.send(JSON.stringify(setVideo));
|
||||
console.log(setVideo);
|
||||
};
|
||||
|
@ -1,24 +1,29 @@
|
||||
{
|
||||
"name": "StammTV Firefox Extension",
|
||||
"description": "Adds a context-menu option to send URLs to StammTV",
|
||||
"name": "StammTV Context Menu",
|
||||
"description": "Adds a context-menu option to send URLs to your instance of StammTV",
|
||||
"version": "1.0",
|
||||
"manifest_version": 2,
|
||||
"background": {
|
||||
"scripts": [
|
||||
"script.js"
|
||||
]
|
||||
],
|
||||
"persistent": true
|
||||
},
|
||||
"options_ui":{
|
||||
"page": "options/options.html",
|
||||
"open_in_tab": true
|
||||
},
|
||||
"options_page": "options/options.html",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"contextMenus"
|
||||
],
|
||||
"action": {
|
||||
"browser_action": {
|
||||
"default_title": "StammTV Context-Menu",
|
||||
"default_popup": "popup/popup.html"
|
||||
},
|
||||
"icons": {
|
||||
"16": "icon-bitty.png",
|
||||
"48": "icon-small.png",
|
||||
"128": "icon-large.png"
|
||||
"16": "stammtv-bitty.png",
|
||||
"48": "stammtv-small.png",
|
||||
"128": "stammtv-large.png"
|
||||
}
|
||||
}
|
@ -4,9 +4,17 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Popup</title>
|
||||
</head>
|
||||
<body style="min-width: 10rem; min-height: 5rem; display: grid; justify-content: center; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank" style="font-weight: bold; color: #ff0000; border: 2px solid black;">→ Take me to StammTV!</a>
|
||||
<a href="/options/options.html" id="open-settings" target="_blank" style="font-weight: bold;">⚙ Settings</a>
|
||||
<body style="min-width: 8rem; display: flex; align-items: center;">
|
||||
<a href="" id="open-stammtv" target="_blank">
|
||||
<img src="/stammtv-large.png" alt="StammTV Logo" height="128px" width="128px"/>
|
||||
</a>
|
||||
<a href="/options/options.html" id="open-settings" target="_blank" style="
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
font-size: 1rem;
|
||||
width: 6rem;
|
||||
color: black;
|
||||
">⚙ Settings</a>
|
||||
<script src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -3,7 +3,6 @@ let websocket;
|
||||
const CONTEXT_MENU_ID = "STAMMTV_ADD_URL_TO_PLAYLIST";
|
||||
|
||||
chrome.storage.local.get('firstRun', function (result) {
|
||||
console.log(result);
|
||||
if (result.firstRun === false) {
|
||||
chrome.storage.local.set({'firstRun': false}, function (result) {
|
||||
openSettings();
|
||||
@ -58,14 +57,6 @@ function addToStammTV(info, tab) {
|
||||
if (info.menuItemId === CONTEXT_MENU_ID) { //if OUR menu item was clicked
|
||||
let videoId = parseYoutubeURL(info.linkUrl)
|
||||
if (videoId) {
|
||||
const playerReady = {"type": "playerReady"};
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
|
||||
console.log(websocket);
|
||||
if (websocket === undefined
|
||||
|| websocket.readyState !== WebSocket.OPEN) {
|
||||
websocket = new WebSocket(WEBSOCKET_URL);
|
||||
@ -73,8 +64,16 @@ function addToStammTV(info, tab) {
|
||||
}
|
||||
|
||||
websocket.onopen = function () {
|
||||
console.log('websocket ready');
|
||||
console.log('websocket ready - sending');
|
||||
|
||||
const playerReady = {"type": "playerReady"};
|
||||
websocket.send(JSON.stringify(playerReady));
|
||||
console.log(playerReady);
|
||||
|
||||
const setVideo = {
|
||||
type: "setVideo",
|
||||
video: videoId,
|
||||
};
|
||||
websocket.send(JSON.stringify(setVideo));
|
||||
console.log(setVideo);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user