diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2019-06-10 04:57:05 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2019-06-10 04:57:05 +0300 |
commit | 1ffa696b4a19841727178914acc29afe485abd13 (patch) | |
tree | 3b00d0d072098f107d9ef1348c0fd44d80590606 /static | |
parent | 9a7441889c82bc56eed0a3721580900b7d9d980c (diff) |
Added share button
Diffstat (limited to 'static')
-rw-r--r-- | static/css/kitab.css | 9 | ||||
-rw-r--r-- | static/js/myFunctions.js | 20 |
2 files changed, 26 insertions, 3 deletions
diff --git a/static/css/kitab.css b/static/css/kitab.css index 4b6065d..e6e764d 100644 --- a/static/css/kitab.css +++ b/static/css/kitab.css @@ -1,6 +1,3 @@ -html {
- width: 100vw;
-}
* {
font-family: "Roboto", sans-serif;
}
@@ -66,3 +63,9 @@ a:hover { padding-left: 15px;
text-indent: -15px;
}
+#copiedMessage {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transition: all 1s;
+}
diff --git a/static/js/myFunctions.js b/static/js/myFunctions.js index 2bcca8e..d3bbf13 100644 --- a/static/js/myFunctions.js +++ b/static/js/myFunctions.js @@ -5,3 +5,23 @@ let scrollToTop = () => { window.scrollTo(0, c - c / 8);
}
};
+
+function copyUrl(text) {
+ let copyFrom = document.createElement("textarea");
+ copyFrom.textContent = text;
+ document.body.appendChild(copyFrom);
+ copyFrom.select();
+ document.execCommand("copy");
+ copyFrom.blur();
+ document.body.removeChild(copyFrom);
+
+ let copiedMessage = document.createElement("div");
+ copiedMessage.id = "copiedMessage";
+ copiedMessage.textContent = "Link copied to clipboard";
+ copiedMessage.classList.add("bg-warning", "shadow", "p-4", "d-block");
+ document.body.appendChild(copiedMessage);
+
+ setTimeout(function() {
+ copiedMessage.style.opacity = 0;
+ }, 500);
+}
|