copyright2
This commit is contained in:
parent
05b67618d9
commit
787070199c
|
|
@ -18,3 +18,26 @@ searchBtn.onclick = function () {
|
|||
searchClose.onclick = function () {
|
||||
searchModal.classList.remove("active");
|
||||
};
|
||||
// =============================================
|
||||
function addLink() {
|
||||
//Get the selected text and append the extra info
|
||||
var selection = window.getSelection();
|
||||
pagelink = ". Orient: " + document.location.href;
|
||||
copytext = selection + pagelink;
|
||||
//Create a new div to hold the prepared text
|
||||
newdiv = document.createElement('div');
|
||||
|
||||
//hide the newly created container
|
||||
newdiv.style.position = 'absolute';
|
||||
newdiv.style.left = '-99999px';
|
||||
|
||||
//insert the container, fill it with the extended text, and define the new selection
|
||||
document.body.appendChild(newdiv);
|
||||
newdiv.innerHTML = copytext;
|
||||
selection.selectAllChildren(newdiv);
|
||||
|
||||
window.setTimeout(function () {
|
||||
document.body.removeChild(newdiv);
|
||||
}, 100);
|
||||
}
|
||||
document.addEventListener('copy', addLink);
|
||||
|
|
|
|||
|
|
@ -148,26 +148,4 @@ if (
|
|||
false
|
||||
);
|
||||
// lazyload end
|
||||
// =============================================
|
||||
function addLink() {
|
||||
//Get the selected text and append the extra info
|
||||
var selection = window.getSelection();
|
||||
pagelink = ". Orient: " + document.location.href;
|
||||
copytext = selection + pagelink;
|
||||
//Create a new div to hold the prepared text
|
||||
newdiv = document.createElement('div');
|
||||
|
||||
//hide the newly created container
|
||||
newdiv.style.position = 'absolute';
|
||||
newdiv.style.left = '-99999px';
|
||||
|
||||
//insert the container, fill it with the extended text, and define the new selection
|
||||
document.body.appendChild(newdiv);
|
||||
newdiv.innerHTML = copytext;
|
||||
selection.selectAllChildren(newdiv);
|
||||
|
||||
window.setTimeout(function () {
|
||||
document.body.removeChild(newdiv);
|
||||
}, 100);
|
||||
}
|
||||
document.addEventListener('copy', addLink);
|
||||
|
|
|
|||
Loading…
Reference in New Issue