-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
68 changed files
with
21,208 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
assets/node_modules/ | ||
static/css/fonts/proxnova/ | ||
static/css/fonts/pnova/ | ||
static/css/fonts/akkurat/ | ||
build-and-deploy-hugo.sh | ||
my-notes.md |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/*Taken from https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove | ||
Allows for ChildNode.remove() in browsers that do not support it. | ||
*/ | ||
if (!('remove' in Element.prototype)) { | ||
Element.prototype.remove = function() { | ||
if (this.parentNode) { | ||
this.parentNode.removeChild(this); | ||
} | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
//If using jQuery, uncomment the following to use jQuery methods for searching the site index with lunr.js | ||
jQuery(function() { | ||
// Initialize lunr with the fields to be searched, plus the boost. | ||
window.idx = lunr(function() { | ||
this.field('id'); | ||
this.field('href'); | ||
this.field('title'); | ||
this.field('description', { boost: 50 }); | ||
this.field('tags'); | ||
this.field('categories'); | ||
this.field('content', { boost: 20 }) | ||
}); | ||
|
||
// Get the generated search_data.json file so lunr.js can search it locally. | ||
window.data = $.getJSON('/site-index.json'); | ||
|
||
// Wait for the data to load and add it to lunr | ||
window.data.then(function(loaded_data) { | ||
$.each(loaded_data, function(index, value) { | ||
window.idx.add( | ||
$.extend({ "id": index }, value) | ||
); | ||
}); | ||
}); | ||
|
||
// Run search query on keyup with focus in site search | ||
$("#site-search").keyup(function(event) { | ||
var query = $("#search-input").val(); // Get the value for the text field | ||
if ((query.length > 2) && (event.keyCode !== 9)) { | ||
var results = window.idx.search(query); // Get lunr to perform a search | ||
display_search_results(results); // Hand the results off to be displayed | ||
} | ||
}); | ||
|
||
function display_search_results(results) { | ||
var $search_results = $("#search-results"); | ||
|
||
// Wait for data to load | ||
window.data.then(function(loaded_data) { | ||
|
||
// Are there any results? | ||
if (results.length) { | ||
$search_results.empty(); // Clear any old results | ||
|
||
// Iterate over the results | ||
results.forEach(function(result) { | ||
var item = loaded_data[result.ref]; | ||
|
||
// Build a snippet of HTML for this result | ||
var appendString = '<li><a href="' + item.href + '">' + item.title + '</a><p>' + item.description + '</li>'; | ||
|
||
// Add the snippet to the collection of results. | ||
$search_results.append(appendString); | ||
}); | ||
} else { | ||
// If there are no results, let the user know. | ||
$search_results.html('<li>No results found.<br/>Please check spelling, spacing, yada...</li>'); | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
var searchData; | ||
var searchInput = document.getElementById('search-input'); | ||
searchInput.addEventListener('keyup', lunrSearch, true); | ||
window.index = lunr(function() { | ||
this.field('id'); | ||
this.field('url'); | ||
this.field('title', { boost: 50 }); | ||
this.field('description'); | ||
this.field('tags'); | ||
this.field('categories'); | ||
this.field('content', { boost: 20 }); | ||
}); | ||
|
||
var searchReq = new XMLHttpRequest(); | ||
searchReq.open('GET', '/site-index.json', true); | ||
searchReq.onload = function() { | ||
if (this.status >= 200 && this.status < 400) { | ||
// console.log("Got the site index!"); | ||
searchData = JSON.parse(this.response); | ||
searchData.forEach(function(obj, index) { | ||
obj['id'] = index; | ||
window.index.add(obj); | ||
}); | ||
} else { | ||
// console.log("Did not get the site index."); | ||
} | ||
} | ||
searchReq.onerror = function() { | ||
console.log("Error when attempting to load site-index.json"); | ||
} | ||
searchReq.send(); | ||
|
||
function lunrSearch(event) { | ||
var query = document.querySelector("#search-input").value; | ||
var searchResults = document.querySelector('#search-results'); | ||
if (query.length === 0) { | ||
searchResults.innerHTML = ''; | ||
} | ||
if ((event.keyCode !== 9) && (query.length > 2)) { | ||
var matches = window.index.search(query); | ||
displayResults(matches); | ||
} | ||
} | ||
|
||
function displayResults(results) { | ||
var searchResults = document.querySelector('#search-results'); | ||
var inputVal = document.querySelector('#search-input').value; | ||
if (results.length) { | ||
searchResults.innerHTML = ''; | ||
results.forEach(function(result) { | ||
var item = window.searchData[result.ref]; | ||
var section = item.section.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' '); | ||
var appendString = '<li class=\"search-result\"><a href="' + item.url + '"><h5>' + item.title + '</h5></a><span class=\"site-section\">In: ' + section + '</span><p>' + item.description + '</p><div class=\"search-result-tags\"><div class=\"tags\"></div>'; | ||
var tags = ''; | ||
for (var i = 0; i < item.tags.length; i++) { | ||
appendString += '<a class=\"tag\" href=\"/tags/' + item.tags[i] + '\">' + item.tags[i] + '</a> '; | ||
} | ||
appendString += '</div></li>'; | ||
// appendString += tags + '</li>'; | ||
searchResults.innerHTML += appendString; | ||
|
||
}) | ||
} else { | ||
searchResults.innerHTML = '<li class=\"search-result none\">No results found for <span class=\"input-value\">' + inputVal + '</span>.<br/>Please check spelling and spacing.</li>'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var searchOverlay = document.querySelector('.search-form'); | ||
var searchButton = document.getElementById('search-button'); | ||
var searchInput = document.getElementById('search-input'); | ||
var closeSearch = document.getElementById('close-search'); | ||
closeSearch.onclick = function() { | ||
if (searchOverlay.classList.contains('open')) { | ||
searchOverlay.classList.remove('open'); | ||
} | ||
} | ||
window.addEventListener('keyup', function(event) { | ||
var keyPressed = event.keyCode; | ||
if (keyPressed === 83 && searchOverlay.classList.contains('open')) { | ||
return; | ||
} else if (keyPressed === 83) { | ||
searchOverlay.classList.add('open'); | ||
if (searchInput.value.length > 0) { | ||
searchInput.value = ''; | ||
} | ||
searchInput.focus(); | ||
} else if (keyPressed === 27 && searchOverlay.classList.contains('open')) { | ||
searchOverlay.classList.remove('open'); | ||
} | ||
}, true); | ||
searchButton.addEventListener('click', function(event) { | ||
searchOverlay.classList.toggle('open'); | ||
searchInput.focus(); | ||
}, true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var clickOrTouchStart; | ||
if ('ontouchstart' in document.documentElement) { | ||
clickOrTouchStart = "touchstart"; | ||
} else { | ||
clickOrTouchStart = "click"; | ||
} | ||
var headerToggle = document.getElementById('site-header-toggle'); | ||
(function() { | ||
var siteSections = document.querySelectorAll('.site-section'); | ||
var address = location.pathname.split('/')[1]; | ||
if (address.length > 0) { | ||
var addressTest = new RegExp(address); | ||
for (var i = 0; i < siteSections.length; i++) { | ||
if (addressTest.test(siteSections[i].dataset.section)) { | ||
siteSections[i].className += " active"; | ||
} | ||
} | ||
} | ||
})(); | ||
headerToggle.addEventListener(clickOrTouchStart, toggleHeader, false); | ||
|
||
function toggleHeader() { | ||
document.querySelector('.site-header').classList.toggle('open'); | ||
document.querySelector('main').classList.toggle('open'); | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//Wrapvids.js | ||
//2016, Ryan Watters, https://www.github.com/rdwatters | ||
//MIT, Copyleft, Seriously-do-whatever-you-want-with-this license | ||
//Included as part of Hugo and Jekyll starter kits | ||
// Hugo: https://github.com/rdwatters/hugo-starter | ||
// Jekyll: https://github.com/rdwatters/jekyll-gulp-starter | ||
// In aforementioned starter kits starter kits, see also: js/modules/util-wrap-and-wrap-all.js for additional use of HTMLElement.prototype.wrap/wrapAll | ||
|
||
(function wrapVids() { | ||
var iframes = document.getElementsByTagName('iframe'), | ||
videoWrapper = document.createElement('div'), | ||
youTubeTest = new RegExp('youtube'); | ||
videoWrapper.className = "videoWrapper"; | ||
//Wrap function as substitute for jQuery .wrap(). Taken from http://stackoverflow.com/questions/3337587/wrapping-a-set-of-dom-elements-using-javascript | ||
HTMLElement.prototype.wrap = function(elms) { | ||
// Convert `elms` to an array, if necessary. | ||
if (!elms.length) elms = [elms]; | ||
|
||
// Loops backwards to prevent having to clone the wrapper on the | ||
// first element (see `child` below). | ||
for (var i = elms.length - 1; i >= 0; i--) { | ||
var child = (i > 0) ? this.cloneNode(true) : this; | ||
var el = elms[i]; | ||
|
||
// Cache the current parent and sibling. | ||
var parent = el.parentNode; | ||
var sibling = el.nextSibling; | ||
|
||
// Wrap the element (is automatically removed from its current | ||
// parent). | ||
child.appendChild(el); | ||
|
||
// If the element had a sibling, insert the wrapper before | ||
// the sibling to maintain the HTML structure; otherwise, just | ||
// append it to the parent. | ||
if (sibling) { | ||
parent.insertBefore(child, sibling); | ||
} else { | ||
parent.appendChild(child); | ||
} | ||
} | ||
}; | ||
for (var i = 0; i < iframes.length; i++) { | ||
if (youTubeTest.test(iframes[i].getAttribute('src'))) { | ||
videoWrapper.wrap(iframes[i]); | ||
} | ||
} | ||
})(); |
2 changes: 1 addition & 1 deletion
2
...ank-external-links-and-print-documents.js → ...ank-external-links-and-print-documents.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.