2
0
mirror of https://github.com/offen/website.git synced 2024-10-18 20:20:24 +02:00

add click to copy for demo commands

This commit is contained in:
Frederik Ring 2020-05-22 17:51:28 +02:00
parent 33624e9735
commit f3ebba1004
5 changed files with 37 additions and 3 deletions

View File

@ -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.

View File

@ -0,0 +1,3 @@
$(document).ready(function () {
var clipboard = new ClipboardJS('.js-click-to-copy')
})

File diff suppressed because one or more lines are too long

View File

@ -199,7 +199,7 @@
{% endif %} {% endif %}
</div> </div>
{% block scripts %} {% 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" %}
<script src="/{{ ASSET_URL }}"></script> <script src="/{{ ASSET_URL }}"></script>
{% endassets %} {% endassets %}
{% endblock %} {% endblock %}

View File

@ -19,7 +19,7 @@
</p> </p>
<div class="flex flex-column items-center"> <div class="flex flex-column items-center">
<div class="w-100 ph4 pv2 mb5 inner-shaddow bg-gray"> <div class="w-100 ph4 pv2 mb5 inner-shaddow bg-gray">
<code class="ma0 lh-solid word-wrap white"> <code class="ma0 lh-solid word-wrap white js-click-to-copy pointer" data-clipboard-text="curl https://demo.offen.dev | bash" title="Click to copy">
curl https://demo.offen.dev | bash curl https://demo.offen.dev | bash
</code> </code>
</div> </div>
@ -30,7 +30,7 @@
</p> </p>
<div class="flex flex-column items-center"> <div class="flex flex-column items-center">
<div class="w-100 ph4 pv2 mb5 inner-shaddow bg-gray"> <div class="w-100 ph4 pv2 mb5 inner-shaddow bg-gray">
<code class="ma0 lh-solid word-wrap white"> <code class="ma0 lh-solid word-wrap white js-click-to-copy pointer" data-clipboard-text="docker run --rm -it -p 9876:9876 offen/offen:latest demo -port 9876" title="Click to copy">
docker run --rm -it -p 9876:9876 offen/offen:latest demo -port 9876 docker run --rm -it -p 9876:9876 offen/offen:latest demo -port 9876
</code> </code>
</div> </div>