clipboard support

pull/2/head
Szekeres Bálint 2018-01-08 00:59:21 +01:00
parent 6fad1e07cc
commit dd68346e29
6 changed files with 57 additions and 10 deletions

View File

@ -72,6 +72,12 @@ main .file {
margin-bottom: 2rem;
}
main .file .btn-clipboard {
font-size: 0;
padding: 0.2rem 0.4rem 0.05rem;
vertical-align: text-bottom;
}
main .file .code {
padding: 0.5rem;
overflow-x: auto;

View File

@ -0,0 +1,3 @@
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="14" viewBox="0 0 14 14">
<path d="M6 13h7v-5h-3.25q-0.312 0-0.531-0.219t-0.219-0.531v-3.25h-3v9zM8 1.75v-0.5q0-0.102-0.074-0.176t-0.176-0.074h-5.5q-0.102 0-0.176 0.074t-0.074 0.176v0.5q0 0.102 0.074 0.176t0.176 0.074h5.5q0.102 0 0.176-0.074t0.074-0.176zM10 7h2.336l-2.336-2.336v2.336zM14 8v5.25q0 0.312-0.219 0.531t-0.531 0.219h-7.5q-0.312 0-0.531-0.219t-0.219-0.531v-1.25h-4.25q-0.312 0-0.531-0.219t-0.219-0.531v-10.5q0-0.312 0.219-0.531t0.531-0.219h8.5q0.312 0 0.531 0.219t0.219 0.531v2.563q0.164 0.102 0.281 0.219l3.188 3.188q0.219 0.219 0.375 0.594t0.156 0.688z"></path>
</svg>

After

Width:  |  Height:  |  Size: 698 B

View File

@ -1,7 +1,7 @@
(function() {
angular
.module('NginxConfigIoApp', [])
.module('NginxConfigIoApp', ['ngclipboard'])
.controller('NginxConfigIoController', function NginxConfigIoController($scope, $location, $timeout) {
///////////////////////
// PRIVATE VARIABLES //

7
public/assets/js/clipboard.min.js vendored Normal file

File diff suppressed because one or more lines are too long

4
public/assets/js/ngclipboard.min.js vendored Normal file
View File

@ -0,0 +1,4 @@
/*! ngclipboard - v1.1.3 - 2017-10-31
* https://github.com/sachinchoolur/ngclipboard
* Copyright (c) 2017 Sachin; Licensed MIT */
!function(){"use strict";var a,b,c="ngclipboard";"object"==typeof module&&module.exports?(a=require("angular"),b=require("clipboard"),module.exports=c):(a=window.angular,b=window.Clipboard),a.module(c,[]).directive("ngclipboard",function(){return{restrict:"A",scope:{ngclipboardSuccess:"&",ngclipboardError:"&"},link:function(a,c){var d=new b(c[0]);d.on("success",function(b){a.$apply(function(){a.ngclipboardSuccess({e:b})})}),d.on("error",function(b){a.$apply(function(){a.ngclipboardError({e:b})})}),c.on("$destroy",function(){d.destroy()})}}})}();

View File

@ -209,51 +209,75 @@
<div class="row">
<div class="file" ng-class="data.file_structure === 'separated' || data.https || (data.php !== 'off' && data.wordpress) ? 'col-xl-6' : 'col-xl-12'">
<strong>/etc/nginx/nginx.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-nginx">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/nginx.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-nginx" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.file_structure === 'separated'">
<strong>/etc/nginx/sites-enabled/{{ data.domain }}.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-domain">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/example.com.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-domain" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.https">
<strong>/etc/nginx/_ssl.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-ssl">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_ssl.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-ssl" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.https">
<strong>/etc/nginx/_letsencrypt.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-letsencrypt">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_letsencrypt.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-letsencrypt" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.file_structure === 'separated'">
<strong>/etc/nginx/_general.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-general">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_general.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-general" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.php !== 'off' && data.file_structure === 'separated'">
<strong>/etc/nginx/_php.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-php">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_php.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-php" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.php !== 'off' && (data.file_structure === 'separated' || (data.php !== 'off' && data.wordpress))">
<strong>/etc/nginx/_php_fastcgi.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-php_fastcgi">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_php_fastcgi.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-php_fastcgi" class="code highlighted"></div>
</div>
<div class="col-xl-6 file" ng-if="data.php !== 'off' && data.wordpress && data.file_structure === 'separated'">
<strong>/etc/nginx/_wordpress.conf</strong>
<button class="btn btn-light btn-clipboard" ngclipboard data-clipboard-target="#file-wordpress">
<img src="https://cdn.nginxconfig.io/assets/img/clipboard.svg" alt="Copy to clipboard">
</button>
<div class="code source">
<pre><code class="nginx" ng-include="'templates/_wordpress.conf.html'" onload="refreshHighlighting()"></code></pre>
</div><div class="code highlighted"></div>
</div><div id="file-wordpress" class="code highlighted"></div>
</div>
</div>
</div>
@ -275,7 +299,8 @@
</main>
<footer>
<div class="container-fluid">
Lovingly made at <img src="https://cdn.nginxconfig.io/assets/img/balaton.svg" alt="Lake Balaton" class="balaton"> <span class="text-muted">(Lake Balaton, Hungary)</span>
Lovingly made at <img src="https://cdn.nginxconfig.io/assets/img/balaton.svg" alt="Lake Balaton" class="balaton"><span class="text-muted">(<a href="https://en.wikipedia.org/wiki/Lake_Balaton" target="_blank">Lake Balaton, Hungary</a>)</span><br>
BTC: <strong>1CeKtgNStn5BGk46gt14kNMhsnJoFGUfkN</strong>
</div>
</footer>
@ -288,7 +313,9 @@
gtag('config', 'UA-3084378-31');
</script>
<script src="https://cdn.nginxconfig.io/assets/js/highlight.min.js?v=9.12.0"></script>
<script src="https://cdn.nginxconfig.io/assets/js/clipboard.min.js?v=1.7.1"></script>
<script src="https://cdn.nginxconfig.io/assets/js/angular.min.js?v=1.6.8"></script>
<script src="https://cdn.nginxconfig.io/assets/js/ngclipboard.min.js?v=1.1.3"></script>
<script src="https://cdn.nginxconfig.io/assets/js/app.js"></script>
</body>
</html>