diff options
author | Mirek Szajowski <mirek@szajowski.net> | 2022-05-25 00:15:46 +0200 |
---|---|---|
committer | Mirek Szajowski <mirek@szajowski.net> | 2022-05-25 00:15:46 +0200 |
commit | 2f66f05ccc86455cabdbe2304214e988f3c40e6e (patch) | |
tree | 026711e9f1aa884163b96be0ad1cfd5b76d258f6 | |
parent | upgraded yt-dlp (diff) | |
download | metube-2f66f05ccc86455cabdbe2304214e988f3c40e6e.tar.gz metube-2f66f05ccc86455cabdbe2304214e988f3c40e6e.tar.bz2 metube-2f66f05ccc86455cabdbe2304214e988f3c40e6e.zip |
Add bookmarklets with toast
-rw-r--r-- | README.md | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -85,6 +85,20 @@ javascript:!function(){xhr=new XMLHttpRequest();xhr.open("POST","https://metube. javascript:(function(){xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function(){if(xhr.status==200){alert("Sent to metube!")}else{alert("Send to metube failed. Check the javascript console for clues.")}}})();
```
+The above bookmarklets use `alert()` as a success/failure notification. The following will show a toast message instead:
+
+Chrome:
+
+```javascript
+javascript:!function(){function notify(msg) {var sc = document.scrollingElement.scrollTop; var text = document.createElement('span');text.innerHTML=msg;var ts = text.style;ts.all = 'revert';ts.color = '#000';ts.fontFamily = 'Verdana, sans-serif';ts.fontSize = '15px';ts.backgroundColor = 'white';ts.padding = '15px';ts.border = '1px solid gainsboro';ts.boxShadow = '3px 3px 10px';ts.zIndex = '100';document.body.appendChild(text);ts.position = 'absolute'; ts.top = 50 + sc + 'px'; ts.left = (window.innerWidth / 2)-(text.offsetWidth / 2) + 'px'; setTimeout(function () { text.style.visibility = "hidden"; }, 1500);}xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function() { if(xhr.status==200){notify("Sent to metube!")}else {notify("Send to metube failed. Check the javascript console for clues.")}}}();
+```
+
+Firefox:
+
+```javascript
+javascript:(function(){function notify(msg) {var sc = document.scrollingElement.scrollTop; var text = document.createElement('span');text.innerHTML=msg;var ts = text.style;ts.all = 'revert';ts.color = '#000';ts.fontFamily = 'Verdana, sans-serif';ts.fontSize = '15px';ts.backgroundColor = 'white';ts.padding = '15px';ts.border = '1px solid gainsboro';ts.boxShadow = '3px 3px 10px';ts.zIndex = '100';document.body.appendChild(text);ts.position = 'absolute'; ts.top = 50 + sc + 'px'; ts.left = (window.innerWidth / 2)-(text.offsetWidth / 2) + 'px'; setTimeout(function () { text.style.visibility = "hidden"; }, 1500);}xhr=new XMLHttpRequest();xhr.open("POST","https://metube.domain.com/add");xhr.send(JSON.stringify({"url":document.location.href,"quality":"best"}));xhr.onload=function() { if(xhr.status==200){notify("Sent to metube!")}else {notify("Send to metube failed. Check the javascript console for clues.")}}})();
+```
+
## Running behind a reverse proxy
It's advisable to run MeTube behind a reverse proxy, if authentication and/or HTTPS support are required.
|