copy url to clipboard
This commit is contained in:
parent
2a9b97e7bb
commit
4c92ead37f
2 changed files with 16 additions and 0 deletions
8
dist/utils.js
vendored
8
dist/utils.js
vendored
|
|
@ -291,6 +291,14 @@ function embed(){
|
||||||
let newHash = document.location.hash.replace(/[&]?pos=[0-9\.-]+,[0-9\.-]+,[0-9\.-]+/,'')
|
let newHash = document.location.hash.replace(/[&]?pos=[0-9\.-]+,[0-9\.-]+,[0-9\.-]+/,'')
|
||||||
newHash += `&${lastPos}`
|
newHash += `&${lastPos}`
|
||||||
document.location.hash = newHash.replace(/&&/,'&')
|
document.location.hash = newHash.replace(/&&/,'&')
|
||||||
|
// copy url to clipboard
|
||||||
|
var dummy = document.createElement('input'),
|
||||||
|
text = window.location.href;
|
||||||
|
document.body.appendChild(dummy);
|
||||||
|
dummy.value = text;
|
||||||
|
dummy.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(dummy);
|
||||||
// End of *TODO*
|
// End of *TODO*
|
||||||
window.notify(`<b>Link copied to clipboard!</b> ❤️<br>ps. to embed this experience in your website,<br>copy/paste the following into your HTML:<br><input type="text" value="<iframe src='${document.location.href}'><br></iframe>" id="share"/>`,{timeout:10000})
|
window.notify(`<b>Link copied to clipboard!</b> ❤️<br>ps. to embed this experience in your website,<br>copy/paste the following into your HTML:<br><input type="text" value="<iframe src='${document.location.href}'><br></iframe>" id="share"/>`,{timeout:10000})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,6 +291,14 @@ export function embed(){
|
||||||
let newHash = document.location.hash.replace(/[&]?pos=[0-9\.-]+,[0-9\.-]+,[0-9\.-]+/,'')
|
let newHash = document.location.hash.replace(/[&]?pos=[0-9\.-]+,[0-9\.-]+,[0-9\.-]+/,'')
|
||||||
newHash += `&${lastPos}`
|
newHash += `&${lastPos}`
|
||||||
document.location.hash = newHash.replace(/&&/,'&')
|
document.location.hash = newHash.replace(/&&/,'&')
|
||||||
|
// copy url to clipboard
|
||||||
|
var dummy = document.createElement('input'),
|
||||||
|
text = window.location.href;
|
||||||
|
document.body.appendChild(dummy);
|
||||||
|
dummy.value = text;
|
||||||
|
dummy.select();
|
||||||
|
document.execCommand('copy');
|
||||||
|
document.body.removeChild(dummy);
|
||||||
// End of *TODO*
|
// End of *TODO*
|
||||||
window.notify(`<b>Link copied to clipboard!</b> ❤️<br>ps. to embed this experience in your website,<br>copy/paste the following into your HTML:<br><input type="text" value="<iframe src='${document.location.href}'><br></iframe>" id="share"/>`,{timeout:10000})
|
window.notify(`<b>Link copied to clipboard!</b> ❤️<br>ps. to embed this experience in your website,<br>copy/paste the following into your HTML:<br><input type="text" value="<iframe src='${document.location.href}'><br></iframe>" id="share"/>`,{timeout:10000})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue