diff --git a/media/css/main.css b/media/css/main.css
index dede2b90..34e04cb5 100644
--- a/media/css/main.css
+++ b/media/css/main.css
@@ -2001,10 +2001,49 @@ button.imagebutton {
position: relative;
}
+.pg-script-container pre.code {
+ padding-right: 2.5rem;
+ min-height: 3rem;
+ display: flex;
+ align-items: center;
+}
+
.pg-script-copy-btn {
position: absolute;
- top: 8px;
- right: 8px;
+ top: 0.5rem;
+ right: 0.5rem;
+ background: transparent;
+ border: none;
+ font-size: 1rem;
+ padding: 4px 6px;
+ cursor: pointer;
+ transition: color 0.2s;
+}
+
+.pg-script-copy-btn i {
+ color: #555 !important;
+ margin: 0 !important;
+ transition: color 0.2s;
+}
+
+.pg-script-copy-btn:hover i {
+ color: #336791 !important;
+}
+
+.pg-script-copy-btn.copied i {
+ color: #28a745 !important;
+}
+
+[data-theme="dark"] .pg-script-copy-btn i {
+ color: #ccc !important;
+}
+
+[data-theme="dark"] .pg-script-copy-btn:hover i {
+ color: #fff !important;
+}
+
+[data-theme="dark"] .pg-script-copy-btn.copied i {
+ color: #7dff7d !important;
}
.nobr {
diff --git a/media/js/main.js b/media/js/main.js
index 335efb2a..4d18db87 100644
--- a/media/js/main.js
+++ b/media/js/main.js
@@ -39,17 +39,17 @@ window.addEventListener("hashchange", shiftWindow);
*/
function copyScript(trigger, elem) {
- var raw = document.getElementById(elem).innerHTML;
+ const raw = document.getElementById(elem).innerHTML;
// Create a scratch div to copy from
- var scratch = document.createElement("div");
+ const scratch = document.createElement("div");
document.body.appendChild(scratch);
// Copy the contents of the script box into the scratch div, removing
// comments and blank lines
- var lines = raw.split("\n");
- var output = '';
- for (var l = 0; l < lines.length; l++) {
+ const lines = raw.split("\n");
+ let output = '';
+ for (let l = 0; l < lines.length; l++) {
if (lines[l][0] != '#' && lines[l].trim() != '')
output += lines[l] + '
';
}
@@ -58,7 +58,7 @@ function copyScript(trigger, elem) {
// Perform the copy
if(document.body.createTextRange) {
// IE 11
- var range = document.body.createTextRange();
+ const range = document.body.createTextRange();
range.moveToElementText(scratch);
range.select();
document.execCommand("Copy");
@@ -66,8 +66,8 @@ function copyScript(trigger, elem) {
}
else if(window.getSelection) {
// Sane browsers
- var selection = window.getSelection();
- var range = document.createRange();
+ const selection = window.getSelection();
+ const range = document.createRange();
range.selectNodeContents(scratch);
selection.removeAllRanges();
selection.addRange(range);
@@ -79,11 +79,15 @@ function copyScript(trigger, elem) {
scratch.parentNode.removeChild(scratch);
// Indicate to the user that the script was copied
- var label = trigger.innerHTML;
- trigger.innerHTML = 'Copied!';
+ const icon = trigger.querySelector('i');
+ icon.classList.remove('fa-copy');
+ icon.classList.add('fa-check');
+ trigger.classList.add('copied');
setTimeout(function() {
- trigger.innerHTML = label;
+ icon.classList.remove('fa-check');
+ icon.classList.add('fa-copy');
+ trigger.classList.remove('copied');
}, 3000);
}
diff --git a/templates/pages/download/linux/debian.html b/templates/pages/download/linux/debian.html
index a11e7a0f..6901eb38 100644
--- a/templates/pages/download/linux/debian.html
+++ b/templates/pages/download/linux/debian.html
@@ -58,7 +58,7 @@ Automated repository configuration:
sudo apt install -y postgresql-common sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh- +
@@ -77,14 +77,14 @@ sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresq # Update the package lists: sudo apt update - + Install PostgreSQL: (replace "18" by the version you want)
sudo apt install postgresql-18- +
diff --git a/templates/pages/download/linux/redhat.html b/templates/pages/download/linux/redhat.html index e352dccb..7215a083 100644 --- a/templates/pages/download/linux/redhat.html +++ b/templates/pages/download/linux/redhat.html @@ -60,7 +60,7 @@ To use the PostgreSQL Yum Repository, follow these steps:
sudo apt install -y postgresql-common sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh- +
@@ -76,14 +76,14 @@ sudo sh -c "echo 'deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresq # Update the package lists: sudo apt update - + Install PostgreSQL: (replace "18" by the version you want)
sudo apt install postgresql-18- +