exampleSite js file added
|
@ -0,0 +1,6 @@
|
|||
/*!
|
||||
* enquire.js v2.1.6 - Awesome Media Queries in JavaScript
|
||||
* Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js
|
||||
* License: MIT */
|
||||
|
||||
!function (a) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = a(); else if ("function" == typeof define && define.amd) define([], a); else { var b; b = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, b.enquire = a() } }(function () { return function a(b, c, d) { function e(g, h) { if (!c[g]) { if (!b[g]) { var i = "function" == typeof require && require; if (!h && i) return i(g, !0); if (f) return f(g, !0); var j = new Error("Cannot find module '" + g + "'"); throw j.code = "MODULE_NOT_FOUND", j } var k = c[g] = { exports: {} }; b[g][0].call(k.exports, function (a) { var c = b[g][1][a]; return e(c ? c : a) }, k, k.exports, a, b, c, d) } return c[g].exports } for (var f = "function" == typeof require && require, g = 0; g < d.length; g++)e(d[g]); return e }({ 1: [function (a, b, c) { function d(a, b) { this.query = a, this.isUnconditional = b, this.handlers = [], this.mql = window.matchMedia(a); var c = this; this.listener = function (a) { c.mql = a.currentTarget || a, c.assess() }, this.mql.addListener(this.listener) } var e = a(3), f = a(4).each; d.prototype = { constuctor: d, addHandler: function (a) { var b = new e(a); this.handlers.push(b), this.matches() && b.on() }, removeHandler: function (a) { var b = this.handlers; f(b, function (c, d) { if (c.equals(a)) return c.destroy(), !b.splice(d, 1) }) }, matches: function () { return this.mql.matches || this.isUnconditional }, clear: function () { f(this.handlers, function (a) { a.destroy() }), this.mql.removeListener(this.listener), this.handlers.length = 0 }, assess: function () { var a = this.matches() ? "on" : "off"; f(this.handlers, function (b) { b[a]() }) } }, b.exports = d }, { 3: 3, 4: 4 }], 2: [function (a, b, c) { function d() { if (!window.matchMedia) throw new Error("matchMedia not present, legacy browsers require a polyfill"); this.queries = {}, this.browserIsIncapable = !window.matchMedia("only all").matches } var e = a(1), f = a(4), g = f.each, h = f.isFunction, i = f.isArray; d.prototype = { constructor: d, register: function (a, b, c) { var d = this.queries, f = c && this.browserIsIncapable; return d[a] || (d[a] = new e(a, f)), h(b) && (b = { match: b }), i(b) || (b = [b]), g(b, function (b) { h(b) && (b = { match: b }), d[a].addHandler(b) }), this }, unregister: function (a, b) { var c = this.queries[a]; return c && (b ? c.removeHandler(b) : (c.clear(), delete this.queries[a])), this } }, b.exports = d }, { 1: 1, 4: 4 }], 3: [function (a, b, c) { function d(a) { this.options = a, !a.deferSetup && this.setup() } d.prototype = { constructor: d, setup: function () { this.options.setup && this.options.setup(), this.initialised = !0 }, on: function () { !this.initialised && this.setup(), this.options.match && this.options.match() }, off: function () { this.options.unmatch && this.options.unmatch() }, destroy: function () { this.options.destroy ? this.options.destroy() : this.off() }, equals: function (a) { return this.options === a || this.options.match === a } }, b.exports = d }, {}], 4: [function (a, b, c) { function d(a, b) { var c = 0, d = a.length; for (c; c < d && b(a[c], c) !== !1; c++); } function e(a) { return "[object Array]" === Object.prototype.toString.apply(a) } function f(a) { return "function" == typeof a } b.exports = { isFunction: f, isArray: e, each: d } }, {}], 5: [function (a, b, c) { var d = a(2); b.exports = new d }, { 2: 2 }] }, {}, [5])(5) });
|
|
@ -0,0 +1,2 @@
|
|||
/*! Fetch Inject v2.0.4 | Copyright (C) Josh Habdas <jhabdas@protonmail.com> (https://habd.as) | @license Zlib */
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).fetchInject=t()}(this,function(){"use strict";const e=function(e,t,n,r,o,c,i){c=t.createElement(n),i=t.getElementsByTagName(n)[0],c.appendChild(t.createTextNode(r.text)),c.onload=o(r),i?i.parentNode.insertBefore(c,i):t.head.appendChild(c)};return function(t,n){if(!arguments.length)return Promise.reject(new ReferenceError("Failed to execute 'fetchInject': 1 argument required but only 0 present."));if(arguments[0]&&arguments[0].constructor!==Array)return Promise.reject(new TypeError("Failed to execute 'fetchInject': argument 1 must be of type 'Array'."));if(arguments[1]&&arguments[1].constructor!==Promise)return Promise.reject(new TypeError("Failed to execute 'fetchInject': argument 2 must be of type 'Promise'."));const r=[],o=n?[].concat(n):[],c=[];return t.forEach(e=>o.push(window.fetch(e).then(e=>[e.clone().text(),e.blob()]).then(e=>Promise.all(e).then(e=>{r.push({text:e[0],blob:e[1]})})))),Promise.all(o).then(()=>(r.forEach(t=>{c.push({then:n=>{t.blob.type.includes("text/css")?e(window,document,"style",t,n):e(window,document,"script",t,n)}})}),Promise.all(c)))}});
|
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
shave - Shave is a javascript plugin that truncates multi-line text within a html element based on set max height
|
||||
@version v2.5.6
|
||||
@link https://github.com/dollarshaveclub/shave#readme
|
||||
@author Jeff Wainwright <yowainwright@gmail.com> (jeffry.in)
|
||||
@license MIT
|
||||
**/
|
||||
!function (e) { "function" == typeof define && define.amd ? define(e) : e() }(function () { "use strict"; if ("undefined" != typeof window) { var e = window.$ || window.jQuery || window.Zepto; e && (e.fn.shave = function (e, t) { return function (e, t) { var n = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; if (void 0 === t || isNaN(t)) throw Error("maxHeight is required"); var i = "string" == typeof e ? document.querySelectorAll(e) : e; if (i) { var a = n.character || "…", o = n.classname || "js-shave", r = "boolean" != typeof n.spaces || n.spaces, s = '<span class="js-shave-char">'.concat(a, "</span>"); "length" in i || (i = [i]); for (var c = 0; c < i.length; c += 1) { var h = i[c], d = h.style, l = h.querySelector(".".concat(o)), f = void 0 === h.textContent ? "innerText" : "textContent"; l && (h.removeChild(h.querySelector(".js-shave-char")), h[f] = h[f]); var v = h[f], g = r ? v.split(" ") : v; if (!(g.length < 2)) { var u = d.height; d.height = "auto"; var p = d.maxHeight; if (d.maxHeight = "none", h.offsetHeight <= t) d.height = u, d.maxHeight = p; else { for (var m = g.length - 1, y = 0, j = void 0; y < m;)j = y + m + 1 >> 1, h[f] = r ? g.slice(0, j).join(" ") : g.slice(0, j), h.insertAdjacentHTML("beforeend", s), h.offsetHeight > t ? m = j - 1 : y = j; h[f] = r ? g.slice(0, m).join(" ") : g.slice(0, m), h.insertAdjacentHTML("beforeend", s); var w = r ? " ".concat(g.slice(m).join(" ")) : g.slice(m), x = document.createTextNode(w), H = document.createElement("span"); H.classList.add(o), H.style.display = "none", H.appendChild(x), h.insertAdjacentElement("beforeend", H), d.height = u, d.maxHeight = p } } } } }(this, e, t), this }) } });
|
|
@ -0,0 +1,2 @@
|
|||
/*! Table of Contents jQuery Plugin - jquery.toc * Copyright (c) 2013-2016 Nikhil Dabas * http://www.apache.org/licenses/LICENSE-2.0 */
|
||||
!function(a){"use strict";var b=function(b){return this.each(function(){var c,d,e=a(this),f=e.data(),g=[e],h=this.tagName,i=0;c=a.extend({content:"body",headings:"h1,h2,h3"},{content:f.toc||void 0,headings:f.tocHeadings||void 0},b),d=c.headings.split(","),a(c.content).find(c.headings).attr("id",function(b,c){var d=function(a){0===a.length&&(a="?");for(var b=a.replace(/\s+/g,"_"),c="",d=1;null!==document.getElementById(b+c);)c="_"+d++;return b+c};return c||d(a(this).text())}).each(function(){var b=a(this),c=a.map(d,function(a,c){return b.is(a)?c:void 0})[0];if(c>i){var e=g[0].children("li:last")[0];e&&g.unshift(a("<"+h+"/>").appendTo(e))}else g.splice(0,Math.min(i-c,Math.max(g.length-1,0)));a("<li/>").appendTo(g[0]).append(a("<a/>").text(b.text()).attr("href","#"+b.attr("id"))),i=c})})},c=a.fn.toc;a.fn.toc=b,a.fn.toc.noConflict=function(){return a.fn.toc=c,this},a(function(){b.call(a("[data-toc]"))})}(window.jQuery);
|
|
@ -0,0 +1,87 @@
|
|||
|
||||
|
||||
$(document).ready(function() {
|
||||
// scroll
|
||||
var position = $(window).scrollTop();
|
||||
$(window).scroll(function () {
|
||||
var navbar = $('.navbar');
|
||||
|
||||
var scroll = $(window).scrollTop();
|
||||
if (scroll > position) { // scroll down
|
||||
if (!navbar.hasClass('navbar--hide')) {
|
||||
navbar.addClass('navbar--hide');
|
||||
} else if (navbar.hasClass('navbar--show')) {
|
||||
navbar.removeClass('navbar--show');
|
||||
}
|
||||
|
||||
$(".single__contents :header").each(function () {
|
||||
if ($(window).scrollTop() >= $(this).position().top) {
|
||||
var id = $(this).attr('id');
|
||||
$('.toc a').removeClass('active');
|
||||
$('.toc a[href="#' + id + '"]').addClass('active');
|
||||
|
||||
$('#toc > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
});
|
||||
$(`#toc [href="#${id}"]`).next().css('display', 'block');
|
||||
$(`#toc [href="#${id}"]`).parents('ul').css('display', 'block');
|
||||
}
|
||||
});
|
||||
} else { // scroll up
|
||||
var navbar = $('.navbar');
|
||||
if (navbar.hasClass('navbar--hide')) {
|
||||
navbar.removeClass('navbar--hide');
|
||||
} else if (!navbar.hasClass('navbar--show')) {
|
||||
navbar.addClass('navbar--show');
|
||||
}
|
||||
|
||||
$(".single__contents :header").each(function () {
|
||||
if ($(window).scrollTop() >= $(this).position().top) {
|
||||
var id = $(this).attr('id');
|
||||
$('.toc a').removeClass('active');
|
||||
$('.toc a[href="#' + id + '"]').addClass('active');
|
||||
|
||||
$('#toc > li').each(function () {
|
||||
$(this).find('ul').css('display', 'none');
|
||||
});
|
||||
$(`#toc [href="#${id}"]`).next().css('display', 'block');
|
||||
$(`#toc [href="#${id}"]`).parents('ul').css('display', 'block');
|
||||
}
|
||||
});
|
||||
}
|
||||
position = scroll;
|
||||
});
|
||||
|
||||
// media query
|
||||
enquire.register("screen and (max-width:769px)", {
|
||||
match: function () {
|
||||
$('main').removeClass('main-main').removeClass('main').addClass('main');
|
||||
$('aside').removeClass('main-side').removeClass('hide').addClass('hide');
|
||||
},
|
||||
unmatch: function () {
|
||||
if ($('aside').length > 0) {
|
||||
$('main').removeClass('main-main').removeClass('main').addClass('main-main');
|
||||
$('aside').removeClass('main-side').removeClass('hide').addClass('main-side');
|
||||
}
|
||||
$('.navbar__burger').removeClass('is-active');
|
||||
$('.navbar__menu').removeClass('is-active');
|
||||
},
|
||||
setup: function () { },
|
||||
deferSetup: true,
|
||||
destroy: function () { },
|
||||
});
|
||||
|
||||
// navbar
|
||||
$('.navbar__burger').click(function() {
|
||||
if ($(this).hasClass('is-active')) {
|
||||
$(this).removeClass('is-active');
|
||||
$('.navbar__menu').removeClass('is-active');
|
||||
} else {
|
||||
$(this).addClass('is-active');
|
||||
$('.navbar__menu').addClass('is-active');
|
||||
}
|
||||
});
|
||||
|
||||
// truncate
|
||||
$('.summary__text').shave(160);
|
||||
});
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
Before Width: | Height: | Size: 137 KiB After Width: | Height: | Size: 137 KiB |
Before Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 112 KiB |