Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 35ad665

Browse files
committed
Very close
Added Copy to clipboard functionality for all coded areas Refining every page. All of them.
1 parent 22ab00f commit 35ad665

21 files changed

+252
-797
lines changed

_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ gems:
33
- jekyll-sitemap
44
#- jemoji
55

6-
url: https://plot.ly
7-
BASE_URL: https://plot.ly
6+
url: http://api.plotly.ineffable.co
7+
BASE_URL: http://api.plotly.ineffable.co
88
staticurl: https://plot.ly/gh-pages/documentation/static/
99
exclude: [_posts/temp, '*.Rmd',]
1010
imgurl: https://images.plot.ly/plotly-documentation/

_includes/_new/_page-components/_footer-main.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,5 @@ <h6 class="--footer-heading">Connect</h6>&#x9;&#x9;&#x9;
126126
</div>
127127
</section>
128128
</footer>
129-
<script src="/js/main.js"></script>
129+
<script src="//images.plot.ly/assets/js/ZeroClipboard.min.js"></script>
130+
<script src="//images.plot.ly/assets/js/main.js"></script>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script>
2+
3+
var array = [];
4+
5+
$('.tutorial-content :header:not(h6)').each(function (i, e) {
6+
7+
var item = $(e);
8+
var itemText = item.text();
9+
10+
11+
var hash = itemText.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/^-+|-+$/g, '').toLowerCase();
12+
console.log(hash);
13+
item.attr("id", hash);
14+
15+
array.push(itemText);
16+
17+
});
18+
19+
$(".--sidebar-list").html(array.map(function(value) {
20+
var hash = value.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').replace(/^-+|-+$/g, '').toLowerCase();
21+
return('<li class="--sidebar-item"><a href="#' + hash + '">' + value.replace(/[^a-z0-9\s]/gi, '') + '</a></li>');
22+
}).join(""));
23+
24+
25+
$(".tutorial-content :header:not(h6)").append( "\<div class=\"icon copy\" data-tooltip=\"Click to copy direct link\"><svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\"/> </svg> </div>");
26+
27+
</script>

_includes/head.html

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,36 @@
55
<!-- Media query magic - http://stackoverflow.com/questions/19945658/my-iphone-thinks-its-980px-wide -->
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77

8-
<!-- Fonts -->
9-
<link rel="stylesheet" type="text/css" href="/fonts/font-awesome/css/font-awesome.min.css" />
10-
<link rel="stylesheet" type="text/css" href="/css/plotly_icons.css" />
11-
<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700" rel="stylesheet" type="text/css" />
12-
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
8+
139

1410
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script>
1511
<script>hljs.initHighlightingOnLoad();</script>
1612
<script src="//cdn.plot.ly/plotly-latest.min.js"></script>
1713

18-
<!-- Stylesheets -->
19-
<!--<link rel="stylesheet" href="{{ site.staticurl }}/css/js-splash-highlight.css"/>-->
20-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/normalize.css">-->
21-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/base.css">-->
22-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/layout_block.css">-->
23-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/modules.css">-->
24-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/state.css">-->
25-
<!--<link rel="stylesheet" href="{{ site.staticurl }}/css/js-splash.css"/>-->
14+
<!--
15+
//// Stylesheets
16+
-->
17+
18+
<!-- Fonts -->
19+
<link href="//fonts.googleapis.com/css?family=Open+Sans:600,400,300,200|Inconsolata|Ubuntu+Mono:400,700" rel="stylesheet" type="text/css" />
20+
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
21+
22+
<!-- code highlighting -->
23+
<link rel="stylesheet" href="https://plot.ly/gh-pages/documentation/static/javascripts/codehighlight/styles/tomorrow.css">
24+
<link rel="stylesheet" type="text/css" href="https://plot.ly/gh-pages/documentation/static//css/js-splash-highlight.css" />
2625

26+
<!-- Main Stylesheets -->
2727
<link rel="stylesheet" type="text/css" href="/styles/normalize.css">
2828
<link rel="stylesheet" type="text/css" href="/styles/main.css">
2929

30-
<!--{% if page.page_type == "ipython" %}-->
31-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/ipython_notebook.css">-->
32-
<!--{% else %}-->
33-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/api_docs.css">-->
34-
<!--{% endif %}-->
35-
<!--{% if page.page_type == "reference" %}-->
36-
<!--<link rel="stylesheet" type="text/css" href="{{site.staticurl}}/css/reference.css">-->
37-
<!--{% endif %}-->
3830

3931
<!-- Icon -->
4032
<link rel="shortcut icon" href="/images/plotly-ico.png" type="image/x-icon" />
4133

34+
4235
<!-- META TAGS -->
4336
{% include seo.html %}
4437

45-
<!-- code highlighting -->
46-
<!--<link rel="stylesheet" href="{{site.staticurl}}/javascripts/codehighlight/styles/tomorrow.css">-->
4738
{% include analytics.html %}
4839
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
4940
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

_includes/lang-navigation.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{% if page.language != "r" %}
21
<nav class="lang-nav">
32
<ul class="lang-nav--list">
43

@@ -102,4 +101,3 @@
102101
{% endfor %}
103102
</ul>
104103
</nav>
105-
{% endif %}

_layouts/base.html

Lines changed: 3 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
{% include head.html %}
5-
6-
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
7-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
8-
</head>
9-
3+
{% include head.html %}
104
<body data-spy="scroll" data-target=".watch" style="position:relative;">
115

126
<!--[if lt IE 10]>
@@ -120,128 +114,12 @@ <h1>
120114
</main>
121115
{% include helpbox.html %}
122116

123-
{% include _new/_page-components/_footer-main.html %}
124-
125-
<script>
126-
127-
128-
129-
var array = [];
130-
131-
132-
$('.tutorial-content :header').each(function (i, e) {
133-
array.push($(e).text());
134-
});
135-
136-
$('*').not('p').prev('p').addClass('last');
137-
138-
139-
$(".--sidebar-list").html(array.map(function(value) {
140-
var hash = value.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '-').toLowerCase();
141-
return('<li class="--sidebar-item"><a href="#' + hash + '">' + value + '</a></li>');
142-
}).join(""));
143-
144-
145-
$("a[href^='#']").on('click', function(event) {
146-
var target;
147-
target = this.hash;
148-
149-
event.preventDefault();
150-
151-
var navOffset;
152-
navOffset = 148;
153-
154-
return $('html, body').animate({
155-
scrollTop: $(this.hash).offset().top - 128
156-
}, 300, function() {
157-
return window.history.pushState(null, null, target);
158-
});
159-
});
160-
$("h4").append( "\<div class=\"icon copy\" data-tooltip=\"Click to copy direct link\"><svg style=\"width:24px;height:24px\" viewBox=\"0 0 24 24\"><path fill=\"#000000\" d=\"M10.59,13.41C11,13.8 11,14.44 10.59,14.83C10.2,15.22 9.56,15.22 9.17,14.83C7.22,12.88 7.22,9.71 9.17,7.76V7.76L12.71,4.22C14.66,2.27 17.83,2.27 19.78,4.22C21.73,6.17 21.73,9.34 19.78,11.29L18.29,12.78C18.3,11.96 18.17,11.14 17.89,10.36L18.36,9.88C19.54,8.71 19.54,6.81 18.36,5.64C17.19,4.46 15.29,4.46 14.12,5.64L10.59,9.17C9.41,10.34 9.41,12.24 10.59,13.41M13.41,9.17C13.8,8.78 14.44,8.78 14.83,9.17C16.78,11.12 16.78,14.29 14.83,16.24V16.24L11.29,19.78C9.34,21.73 6.17,21.73 4.22,19.78C2.27,17.83 2.27,14.66 4.22,12.71L5.71,11.22C5.7,12.04 5.83,12.86 6.11,13.65L5.64,14.12C4.46,15.29 4.46,17.19 5.64,18.36C6.81,19.54 8.71,19.54 9.88,18.36L13.41,14.83C14.59,13.66 14.59,11.76 13.41,10.59C13,10.2 13,9.56 13.41,9.17Z\"/> </svg> </div>");
161-
162-
// to top right away
163-
if (window.location.hash) scroll(0, 0);
164-
// void some browsers issue
165-
setTimeout(function () {
166-
scroll(0, 0);
167-
}, 1);
168-
169-
// any position
170-
$(function () {
171-
// *only* if we have anchor on the url
172-
if (window.location.hash) {
173-
// smooth scroll to the anchor id
174-
$('html, body').animate({
175-
scrollTop: ($(window.location.hash).offset().top - 148) + 'px'
176-
}, 1000, 'swing');
177-
}
178-
});
179-
180-
181-
// Smooth Scroll
182-
183-
184-
// Mobile Menu toggle
185-
186-
$('.mobile-menu-btn').on('click', function (e) {
187-
$('header.header-main').toggleClass("mobile-menu");
188-
$('body').toggleClass("no-scroll");
189-
});
190-
191-
192-
// Copy link to section on page
193-
194-
$('.copy').on('click', function (e) {
195-
var link = $(this).prev();
196-
copyToClipboard(link);
197-
console.log('element: ' + link)
198-
199-
$(this).attr('data-tooltip', 'Copied!');
200-
201-
});
202-
203-
$(".copy").hover(
204-
function () {
205-
//$(this).attr('data-tooltip', 'Copied!');
206-
},
207-
function () {
208-
$(this).attr('data-tooltip', 'Click to copy direct link.');
209-
}
210-
);
211-
212-
function copyToClipboard(element) {
213-
var $temp = $("<input>");
214-
$("body").append($temp);
215-
216-
$temp.val(window.location.href.split('#')[0] + $(element).attr("href")).select();
217-
document.execCommand("copy");
218-
$temp.remove();
219-
console.log('yes');
220-
}
221-
$('.toggle-sidebar').on('click', function (e) {
222-
$('.--sidebar-container').toggleClass("show");
223-
$('.toggle-sidebar').toggleClass("on");
224-
225-
});
226-
$('.--sidebar-container').not('.toggle-sidebar').on('click', function (e) {
227-
$('.--sidebar-container').removeClass("show");
228-
$('.toggle-sidebar').removeClass("on");
229-
//console.log('clicked');
230-
});
231-
232-
// Sidebar toggle
233-
$(document).ready(function() {
234-
235-
236-
});
237-
238-
239-
240117

118+
{% include _new/_page-components/insertSidebarElement.html %}
241119

242120

121+
{% include _new/_page-components/_footer-main.html %}
243122

244-
</script>
245123
</body>
246124

247125
</html>

0 commit comments

Comments
 (0)