From f3ebba1004e7d8270bfd41514f6b792d97c2425d Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Fri, 22 May 2020 17:51:28 +0200 Subject: [PATCH] add click to copy for demo commands --- homepage/theme/static/scripts/NOTICE | 24 +++++++++++++++++++ .../theme/static/scripts/click-to-copy.js | 3 +++ .../theme/static/scripts/clipboard.min.js | 7 ++++++ homepage/theme/templates/base.html | 2 +- homepage/theme/templates/trydemo.html | 4 ++-- 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 homepage/theme/static/scripts/NOTICE create mode 100644 homepage/theme/static/scripts/click-to-copy.js create mode 100644 homepage/theme/static/scripts/clipboard.min.js diff --git a/homepage/theme/static/scripts/NOTICE b/homepage/theme/static/scripts/NOTICE new file mode 100644 index 0000000..9105c3c --- /dev/null +++ b/homepage/theme/static/scripts/NOTICE @@ -0,0 +1,24 @@ +clipboard.js +Copyright (C) Zeno Rocha + +MIT License + +Copyright (c) Zeno Rocha + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/homepage/theme/static/scripts/click-to-copy.js b/homepage/theme/static/scripts/click-to-copy.js new file mode 100644 index 0000000..d1fec21 --- /dev/null +++ b/homepage/theme/static/scripts/click-to-copy.js @@ -0,0 +1,3 @@ +$(document).ready(function () { + var clipboard = new ClipboardJS('.js-click-to-copy') +}) diff --git a/homepage/theme/static/scripts/clipboard.min.js b/homepage/theme/static/scripts/clipboard.min.js new file mode 100644 index 0000000..1e6a96f --- /dev/null +++ b/homepage/theme/static/scripts/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v2.0.6 + * https://clipboardjs.com/ + * + * 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 o={},r.m=n=[function(t,e){t.exports=function(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var o=window.getSelection(),r=document.createRange();r.selectNodeContents(t),o.removeAllRanges(),o.addRange(r),e=o.toString()}return e}},function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){var o=this;function r(){o.off(t,r),e.apply(n,arguments)}return r._=e,this.on(t,r,n)},emit:function(t){for(var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,r=n.length;o {% block scripts %} - {% assets filters="rjsmin", output="scripts/packed.js", "scripts/jquery-3.4.1.min.js", "scripts/menu.js", "scripts/fade.js" %} + {% assets filters="rjsmin", output="scripts/packed.js", "scripts/jquery-3.4.1.min.js", "scripts/menu.js", "scripts/fade.js", "scripts/clipboard.min.js", "scripts/click-to-copy.js" %} {% endassets %} {% endblock %} diff --git a/homepage/theme/templates/trydemo.html b/homepage/theme/templates/trydemo.html index eebe083..7e10ab9 100644 --- a/homepage/theme/templates/trydemo.html +++ b/homepage/theme/templates/trydemo.html @@ -19,7 +19,7 @@

- + curl https://demo.offen.dev | bash
@@ -30,7 +30,7 @@

- + docker run --rm -it -p 9876:9876 offen/offen:latest demo -port 9876