Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added copy-button #346

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 116 additions & 81 deletions docs/_layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,54 @@
---

<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>GetNighthawk</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat|Ubuntu&display=swap" rel="stylesheet">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>GetNighthawk</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/sidebar_doc.css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat|Ubuntu&display=swap" rel="stylesheet">
// for copy button
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.8/clipboard.min.js"></script>

<script src="https://kit.fontawesome.com/2ffe680fa0.js" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>
<style>
body{
overflow: hidden;
}
</style>
<br><br><br><br><br><br>
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/main.css">

<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/sidebar_doc.css" />

<script src="https://kit.fontawesome.com/2ffe680fa0.js" crossorigin="anonymous"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"
integrity="sha384-KsvD1yqQ1/1+IA7gi3P0tyJcT3vR+NdBTt13hSJ2lnve8agRGXTTyNaBYmCR/Nwi"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-nsg8ua9HAw1y0W1btsyWgBklPnCUAFLuTMS2G72MMONqmOymq585AcH49TLBQObG"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
</head>
<style>
body {
overflow: hidden;
}
</style>
<br><br><br><br><br><br>
<div class="row">
<div class="float-button-container">
<button class="float-button" id="toggle"><i class="fas fa-angle-double-right" id="float-icon-arrow"></i>
Expand All @@ -49,69 +66,87 @@ <h2>
<h4 class="doc-heading doc-heading-tray">{{ docs.name }}</h4>
</button>
</h2>
<div>
{% for doc in site.docs %}
{% if doc.section == docs.name %}
<li>
<h5>
{% assign category = page.section %}
<a
class="doc-link doc-link-tray"
href={% include relative-src.html src=doc.url %}
>{{ doc.title }}</a
>
</h5>
</li>
{% endif %}
{% endfor %}
</div>
<div>
{% for doc in site.docs %}
{% if doc.section == docs.name %}
<li>
<h5>
{% assign category = page.section %}
<a class="doc-link doc-link-tray" href={% include relative-src.html src=doc.url %}>{{ doc.title }}</a>
</h5>
</li>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</ul>
</div>
<div class="col-sm-3 height-100">
<nav class="navbar">
<div>
<ul class="sidebar">
<div class="accordion" id="accordionExample">
{% for docs in site.data.docs %}
<div class="accordion-item">
<h2 class="accordion-header" id="flush-heading{{docs.number}}">
<button id="faq-title" class="accordion-button collapsed" type="button" data-toggle="collapse" data-target="#flush-collapse{{docs.number}}" aria-expanded="false" aria-controls="flush-collapse{{docs.number}}">
<h4 class="doc-heading">{{ docs.name }}</h4>
</button>
</h2>
<div id="flush-collapse{{docs.number}}" class="accordion-collapse collapse" aria-labelledby="flush-heading{{docs.number}}" data-parent="#accordionExample">
{% for doc in site.docs %}
{% if doc.section == docs.name %}
<li>
<h5>
<a
class="doc-link"
href="{% include relative-src.html src=doc.url %}"
>{{ doc.title }} </a
>
</h5>
</li>
{% endif %}
{% endfor %}
</div>
</div>
<nav class="navbar">
<div>
<ul class="sidebar">
<div class="accordion" id="accordionExample">
{% for docs in site.data.docs %}
<div class="accordion-item">
<h2 class="accordion-header" id="flush-heading{{docs.number}}">
<button id="faq-title" class="accordion-button collapsed" type="button" data-toggle="collapse"
data-target="#flush-collapse{{docs.number}}" aria-expanded="false"
aria-controls="flush-collapse{{docs.number}}">
<h4 class="doc-heading">{{ docs.name }}</h4>
</button>
</h2>
<div id="flush-collapse{{docs.number}}" class="accordion-collapse collapse"
aria-labelledby="flush-heading{{docs.number}}" data-parent="#accordionExample">
{% for doc in site.docs %}
{% if doc.section == docs.name %}
<li>
<h5>
<a class="doc-link" href="{% include relative-src.html src=doc.url %}">{{ doc.title }} </a>
</h5>
</li>
{% endif %}
{% endfor %}
</div>
</div>
<br>
<h4 class="doc-heading"> <a
class="doc-link" style="padding:0px; margin-left:0px; font-size: 14px;"
href={% include relative-src.html src="/docs/recent-discussions" %}
>RECENT DISCUSSIONS ON NIGHTHAWK</a></h4>
</ul>
</div>
</nav>
{% endfor %}
</div>
<br>
<h4 class="doc-heading"> <a class="doc-link" style="padding:0px; margin-left:0px; font-size: 14px;" href={%
include relative-src.html src="/docs/recent-discussions" %}>RECENT DISCUSSIONS ON NIGHTHAWK</a></h4>
</ul>
</div>
</nav>
</div>
<div class="col-sm-9 container-g section-content">
{{category}}
<script>
document.addEventListener('DOMContentLoaded', function () {
var codeBlocks = document.querySelectorAll('pre code');
codeBlocks.forEach(function (codeBlock) {
var button = document.createElement('button');
button.className = 'copy-button';
button.textContent = 'Copy';
codeBlock.parentNode.insertBefore(button, codeBlock);

var clipboard = new ClipboardJS(button, {
target: function (trigger) {
return trigger.nextElementSibling;
}
});

clipboard.on('success', function (e) {
e.clearSelection();
e.trigger.textContent = 'Copied!';
setTimeout(function () {
e.trigger.textContent = 'Copy';
}, 2000);
});
});
});
</script>
{{content}}
</div>
</div>
<script src="{{ site.baseurl }}/assets/js/docs_nav.js"></script>
<script src="{{ site.baseurl }}/assets/js/docs_nav.js"></script>
27 changes: 27 additions & 0 deletions docs/assets/css/copy-button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.copy-button {
position: absolute;
top: 0;
right: 0;
padding: 5px 10px;
font-size: 14px;
cursor: pointer;
border: 1px solid #009E7F;
border-radius: 3px;
background-color: #009E7F;
color: #fff;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
Copy link
Member

@Savio629 Savio629 Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@omesh-omg Replace the font-family with the one that is already in use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay see for all that you can suggest,
anything you else you find that needs attention.

}

.copy-button:hover {
background-color: #00B39F;
border-color: #00B39F;
}


.highlight{
display: inline-flex;
position: relative;

width: 100%;

}
1 change: 1 addition & 0 deletions docs/assets/css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@import "about.scss";
@import "mailing-list.scss";
@import "index.scss";
@import "copy-button.css";