mirror of
https://github.com/openvk/openvk
synced 2024-11-11 01:19:53 +03:00
Make "copy video link to clipboard" button work
This commit is contained in:
parent
9e80ce16f1
commit
ccb392b228
1 changed files with 22 additions and 0 deletions
|
@ -181,6 +181,28 @@ function _bsdnEventListenerFactory(el, v) {
|
||||||
click: [ () => el.querySelector(".bsdn_contextMenu").style.display = "none" ]
|
click: [ () => el.querySelector(".bsdn_contextMenu").style.display = "none" ]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
".bsdn_copyVideoUrl": {
|
||||||
|
click: [
|
||||||
|
async () => {
|
||||||
|
let videoUrl = el.querySelector(".bsdn_video > video").src;
|
||||||
|
let fallback = () => {
|
||||||
|
prompt("URL:", videoUrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(typeof navigator.clipboard == "undefined") {
|
||||||
|
fallback();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(videoUrl);
|
||||||
|
confirm("👍🏼");
|
||||||
|
} catch(e) {
|
||||||
|
fallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
".bsdn_video > video": {
|
".bsdn_video > video": {
|
||||||
play: [
|
play: [
|
||||||
() => {
|
() => {
|
||||||
|
|
Loading…
Reference in a new issue