Fix toclayout

This commit is contained in:
Ryan Watters 2017-02-14 10:05:04 -08:00
parent 9764af5be3
commit 7ae01dbb87
8 changed files with 35 additions and 20 deletions

View File

@ -1,5 +1,6 @@
{{ define "main" }}
{{$title := .Title}}
<span id="page-top"></span>
<main class="main">
{{with .Params.testing }}
{{range $ind,$value := . }}

View File

@ -1,7 +1,9 @@
{{ if gt .WordCount 500}}
{{ if gt .WordCount 300}}
<aside id="toc">
<header>
<a href="#page-top">
<h3>{{.Title}}</h3>
</a>
</header>
{{.TableOfContents}}
<a href="#" id="toc-toggle">ToC</a>

View File

@ -1,15 +1,24 @@
$('document').ready(function() {
$('.body-copy a[href$=".pdf"]').append('<i class="icon-pdf"></i>');
$('.body-copy > h2,.body-copy > h3').each(function() {
var id = $(this).attr('id'),
baseurl = window.location.origin,
path = window.location.pathname,
fullurl = `${baseurl}${path}#${id}`;
$(this).append(`<a class="smooth-scroll heading-link" data-clipboard-text="${fullurl}" href="#${id}"><i class="icon-link"></i></a>`);
$(this).append(`<a class="smooth-scroll heading-link" title="Copy heading link to clipboard" data-clip="${fullurl}" href="#${id}"><i class="icon-link"></i></a>`);
});
});
// const hasCopy = document.execCommand('copy', false, null);
// console.log(`${hasCopy} is hasCopy value`);
$('document').ready(function() {
var cliplink = new Clipboard('.heading-link');
cliplink.on('success', function(e) {
console.log("hello");
});
});
window.setTimeout(function() {
// let headLinks = document.querySelector('.heading-link');
// for (var i = 0; i < headLinks.length; i++) {
// headLinks[i].addEventListener('click', copyHeaderLink, false);
// }
}, 2000);
function copyHeaderLink(evt) {
let link = evt.target.dataset.clip;
console.log(link);
}

View File

@ -1,6 +1,6 @@
$(document).ready(function() {
// bind click event to all internal page anchors
$('a.heading-link,#TableOfContents a').on('click', function(e) {
$('a.heading-link,#toc a').on('click', function(e) {
// prevent default action and bubbling
e.preventDefault();
e.stopPropagation();
@ -16,3 +16,5 @@ $(document).ready(function() {
location.hash = hashid;
});
});

View File

@ -13,6 +13,7 @@ aside#toc {
ul li ul {
font-size: .8em;
li {
margin-top:.5em;
a {
color: lighten($base-font-color, 25%);
}
@ -29,7 +30,7 @@ aside#toc {
}
@include MQ(XL) {
top: $site-header-height + 20px;
right: 2vw;
left: calc(#{$site-navigation-width} + #{$content-max-width} + 3em);
}
@include MQ(HUGE){

View File

@ -4,7 +4,7 @@ ul.tags {
overflow: hidden;
padding: 0;
margin-top:-1em;
margin-bottom:.5em;
margin-bottom:1em;
}
.tags li {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long