From 8a0d78ee8b3f8ef53000d131c6650221cae39a46 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Jan 2023 22:10:54 +0500 Subject: [PATCH] from server 20 --- themes/modern2/assets/new/copy.js | 13 +++++++++++++ themes/modern2/layouts/new/master-inside.htm | 1 + themes/modern2/layouts/new/master.htm | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 themes/modern2/assets/new/copy.js diff --git a/themes/modern2/assets/new/copy.js b/themes/modern2/assets/new/copy.js new file mode 100644 index 000000000..dac8be481 --- /dev/null +++ b/themes/modern2/assets/new/copy.js @@ -0,0 +1,13 @@ +const copyListener = (e) => { + const range = window.getSelection().getRangeAt(0), + rangeContents = range.cloneContents(), + pageLink = `Orient Link: ${document.location.href}`, + helper = document.createElement("div"); + + helper.appendChild(rangeContents); + + event.clipboardData.setData("text/plain", `${helper.innerText}\n${pageLink}`); + event.clipboardData.setData("text/html", `${helper.innerHTML}
${pageLink}`); + event.preventDefault(); +}; +document.addEventListener("copy", copyListener); \ No newline at end of file diff --git a/themes/modern2/layouts/new/master-inside.htm b/themes/modern2/layouts/new/master-inside.htm index c623a7f2b..9c3464e9e 100644 --- a/themes/modern2/layouts/new/master-inside.htm +++ b/themes/modern2/layouts/new/master-inside.htm @@ -119,6 +119,7 @@ default = 0 + {% framework extras %} {% scripts %} diff --git a/themes/modern2/layouts/new/master.htm b/themes/modern2/layouts/new/master.htm index f51a03036..2327bc682 100644 --- a/themes/modern2/layouts/new/master.htm +++ b/themes/modern2/layouts/new/master.htm @@ -129,10 +129,11 @@ random = 0 {% partial 'new/footer' %} - + {% scripts %} + {% framework extras %}