From d89dd25b52caa3e60ca68e366e6c765835d9c130 Mon Sep 17 00:00:00 2001 From: Darshan Baral Date: Mon, 17 Jun 2019 19:38:52 -0700 Subject: Using clipboard.js to allow copying in iOS --- layouts/partials/head.html | 5 +++-- layouts/partials/sidebar.html | 43 ++++++++++++++++++++++++++++++++++++++++++- static/js/clipboard.min.js | 7 +++++++ static/js/myFunctions.js | 25 +------------------------ 4 files changed, 53 insertions(+), 27 deletions(-) create mode 100644 static/js/clipboard.min.js diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 3dbc754..a11124a 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -27,7 +27,8 @@ integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous" /> - + - + + diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index d4c24ed..48c7e7b 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -13,7 +13,6 @@

@@ -26,3 +25,45 @@

+ + diff --git a/static/js/clipboard.min.js b/static/js/clipboard.min.js new file mode 100644 index 0000000..02c549e --- /dev/null +++ b/static/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.4 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i=function(){function o(t,e){for(var n=0;n { window.requestAnimationFrame(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", "d-block", "text-center"); - document.body.appendChild(copiedMessage); - - setTimeout(function() { - copiedMessage.style.opacity = 0; - }, 500); - setTimeout(function() { - document.body.removeChild(copiedMessage); - }, 1500); -} +}; \ No newline at end of file -- cgit v1.2.3