diff --git a/assets/built/casper.js b/assets/built/casper.js index 27f8bed..f2535ec 100644 --- a/assets/built/casper.js +++ b/assets/built/casper.js @@ -1,2 +1,2 @@ -!function(n){"use strict";n.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("div");r.innerHTML='

x

',t.appendChild(r.childNodes[1])}return e&&n.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var t=n(this).find(e.join(","));(t=(t=t.not("object object")).not(r)).each(function(){var e=n(this);if(!(0
').parent(".fluid-width-video-wrapper").css("padding-top",100*t+"%"),e.removeAttr("height").removeAttr("width")}})})},n.fn.fitVids._count=0}(window.jQuery||window.Zepto),function(c,i){c.Casper||(c.Casper={}),c.Casper.floatingHeader=function(){var r=i.querySelector("#reading-progress"),n=i.querySelector(".floating-header"),o=i.querySelector(".post-full-title"),a=c.scrollY,s=c.innerHeight,d=i.body.clientHeight,l=!1;function e(){l||requestAnimationFrame(t),l=!0}function t(){var e=o.getBoundingClientRect().top+c.scrollY,t=o.offsetHeight+35,i=d-s;e+t<=a?n.classList.add("floating-active"):n.classList.remove("floating-active"),r.setAttribute("max",i),r.setAttribute("value",a),l=!1}c.addEventListener("scroll",function(){a=c.scrollY,e()},{passive:!0}),c.addEventListener("resize",function(){s=c.innerHeight,d=i.body.clientHeight,e()},!1),t()}}(window,document),function(e,t){t.addEventListener("DOMContentLoaded",function(){t.querySelectorAll(".kg-gallery-image img").forEach(function(e){var t=e.closest(".kg-gallery-image"),i=e.attributes.width.value/e.attributes.height.value;t.style.flex=i+" 1 0%"})})}(window,document),function(t,i){var r=i.querySelector("link[rel=next]");if(r){var n=i.querySelector(".post-feed");if(n){var o=300,a=!1,s=!1,d=t.scrollY,l=t.innerHeight,c=i.documentElement.scrollHeight;t.addEventListener("scroll",f,{passive:!0}),t.addEventListener("resize",v),h()}}function u(){if(404===this.status)return t.removeEventListener("scroll",f),void t.removeEventListener("resize",v);this.response.querySelectorAll(".post-card").forEach(function(e){n.appendChild(e)});var e=this.response.querySelector("link[rel=next]");e?r.href=e.href:(t.removeEventListener("scroll",f),t.removeEventListener("resize",v)),c=i.documentElement.scrollHeight,s=a=!1}function e(){if(!s)if(d+l<=c-o)a=!1;else{s=!0;var e=new t.XMLHttpRequest;e.responseType="document",e.addEventListener("load",u),e.open("GET",r.href),e.send(null)}}function h(){a||t.requestAnimationFrame(e),a=!0}function f(){d=t.scrollY,h()}function v(){l=t.innerHeight,c=i.documentElement.scrollHeight,h()}}(window,document); +!function(n){"use strict";n.fn.fitVids=function(e){var i={customSelector:null,ignore:null};if(!document.getElementById("fit-vids-style")){var t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("div");r.innerHTML='

x

',t.appendChild(r.childNodes[1])}return e&&n.extend(i,e),this.each(function(){var e=['iframe[src*="player.vimeo.com"]','iframe[src*="youtube.com"]','iframe[src*="youtube-nocookie.com"]','iframe[src*="kickstarter.com"][src*="video.html"]',"object","embed"];i.customSelector&&e.push(i.customSelector);var r=".fitvidsignore";i.ignore&&(r=r+", "+i.ignore);var t=n(this).find(e.join(","));(t=(t=t.not("object object")).not(r)).each(function(){var e=n(this);if(!(0
').parent(".fluid-width-video-wrapper").css("padding-top",100*t+"%"),e.removeAttr("height").removeAttr("width")}})})},n.fn.fitVids._count=0}(window.jQuery||window.Zepto),function(e,t){t.addEventListener("DOMContentLoaded",function(){t.querySelectorAll(".kg-gallery-image img").forEach(function(e){var t=e.closest(".kg-gallery-image"),i=e.attributes.width.value/e.attributes.height.value;t.style.flex=i+" 1 0%"})})}(window,document),function(t,i){var r=i.querySelector("link[rel=next]");if(r){var n=i.querySelector(".post-feed");if(n){var o=300,s=!1,a=!1,d=t.scrollY,l=t.innerHeight,c=i.documentElement.scrollHeight;t.addEventListener("scroll",f,{passive:!0}),t.addEventListener("resize",v),h()}}function u(){if(404===this.status)return t.removeEventListener("scroll",f),void t.removeEventListener("resize",v);this.response.querySelectorAll(".post-card").forEach(function(e){n.appendChild(e)});var e=this.response.querySelector("link[rel=next]");e?r.href=e.href:(t.removeEventListener("scroll",f),t.removeEventListener("resize",v)),c=i.documentElement.scrollHeight,a=s=!1}function e(){if(!a)if(d+l<=c-o)s=!1;else{a=!0;var e=new t.XMLHttpRequest;e.responseType="document",e.addEventListener("load",u),e.open("GET",r.href),e.send(null)}}function h(){s||t.requestAnimationFrame(e),s=!0}function f(){d=t.scrollY,h()}function v(){l=t.innerHeight,c=i.documentElement.scrollHeight,h()}}(window,document),function(s,a){s.Casper||(s.Casper={}),s.Casper.stickyNavTitle=function(e){var t=a.querySelector(e.navSelector),i=a.querySelector(e.titleSelector),r=s.scrollY,n=!1;function o(){i.getBoundingClientRect().top+s.scrollY+(i.offsetHeight+35)<=r?t.classList.add(e.activeClass):t.classList.remove(e.activeClass),n=!1}s.addEventListener("scroll",function(){r=s.scrollY,function(){n||requestAnimationFrame(o);n=!0}()},{passive:!0}),o()}}(window,document); //# sourceMappingURL=casper.js.map \ No newline at end of file diff --git a/assets/built/casper.js.map b/assets/built/casper.js.map index cb5c23f..50dc194 100644 --- a/assets/built/casper.js.map +++ b/assets/built/casper.js.map @@ -1 +1 @@ -{"version":3,"sources":["jquery.fitvids.js","floating-header.js","gallery-card.js","infinitescroll.js"],"names":["$","fn","fitVids","options","settings","customSelector","ignore","document","getElementById","head","getElementsByTagName","div","createElement","innerHTML","appendChild","childNodes","extend","this","each","selectors","push","ignoreList","$allVideos","find","join","not","$this","parents","length","tagName","toLowerCase","parent","css","isNaN","attr","aspectRatio","parseInt","height","width","videoName","_count","wrap","removeAttr","window","jQuery","Zepto","Casper","floatingHeader","progressBar","querySelector","header","title","lastScrollY","scrollY","lastWindowHeight","innerHeight","lastDocumentHeight","body","clientHeight","ticking","requestTick","requestAnimationFrame","update","trigger","getBoundingClientRect","top","triggerOffset","offsetHeight","progressMax","classList","add","remove","setAttribute","addEventListener","passive","querySelectorAll","forEach","image","container","closest","ratio","attributes","value","style","flex","nextElement","feedElement","buffer","loading","documentElement","scrollHeight","onScroll","onResize","onPageLoad","status","removeEventListener","response","item","resNextElement","href","onUpdate","xhr","XMLHttpRequest","responseType","open","send"],"mappings":"CAYA,SAAAA,GAEA,aAEAA,EAAAC,GAAAC,QAAA,SAAAC,GACA,IAAAC,EAAA,CACAC,eAAA,KACAC,OAAA,MAGA,IAAAC,SAAAC,eAAA,kBAAA,CAEA,IAAAC,EAAAF,SAAAE,MAAAF,SAAAG,qBAAA,QAAA,GAEAC,EAAAJ,SAAAK,cAAA,OACAD,EAAAE,UAAA,oUACAJ,EAAAK,YAAAH,EAAAI,WAAA,IAOA,OAJAZ,GACAH,EAAAgB,OAAAZ,EAAAD,GAGAc,KAAAC,KAAA,WACA,IAAAC,EAAA,CACA,kCACA,6BACA,sCACA,oDACA,SACA,SAGAf,EAAAC,gBACAc,EAAAC,KAAAhB,EAAAC,gBAGA,IAAAgB,EAAA,iBAEAjB,EAAAE,SACAe,EAAAA,EAAA,KAAAjB,EAAAE,QAGA,IAAAgB,EAAAtB,EAAAiB,MAAAM,KAAAJ,EAAAK,KAAA,OAEAF,GADAA,EAAAA,EAAAG,IAAA,kBACAA,IAAAJ,IAEAH,KAAA,WACA,IAAAQ,EAAA1B,EAAAiB,MACA,KAAA,EAAAS,EAAAC,QAAAN,GAAAO,QAGA,UAAAX,KAAAY,QAAAC,eAAAJ,EAAAK,OAAA,UAAAH,QAAAF,EAAAK,OAAA,8BAAAH,QAAA,CACAF,EAAAM,IAAA,WAAAN,EAAAM,IAAA,WAAAC,MAAAP,EAAAQ,KAAA,aAAAD,MAAAP,EAAAQ,KAAA,YAEAR,EAAAQ,KAAA,SAAA,GACAR,EAAAQ,KAAA,QAAA,KAEA,IAEAC,GAFA,WAAAlB,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AF,EAAA5B,iBAAA,OAAAoB,GAEAQ,EAAAG,KAAA,MAAAnB,EAAAc,MACAE,EAAAI,KAAA,OAGA,SAAA7C,IACAD,GAAAhB,EAAAkB,sBAAAuC,GACAzC,GAAA,EAGA,SAAAgC,IACAvC,EAAAT,EAAAU,QACAO,IAGA,SAAAgC,IACAtC,EAAAX,EAAAY,YACAC,EAAAjD,EAAAkF,gBAAAC,aACA9B,KAtFA,CA6FAjB,OAAApC","file":"casper.js","sourcesContent":["/*jshint browser:true */\n/*!\n* FitVids 1.3\n*\n*\n* Copyright 2017, Chris Coyier + Dave Rupert + Ghost Foundation\n* This is an unofficial release, ported by John O'Nolan\n* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/\n* Released under the MIT license\n*\n*/\n\n;(function( $ ){\n\n 'use strict';\n\n $.fn.fitVids = function( options ) {\n var settings = {\n customSelector: null,\n ignore: null\n };\n\n if(!document.getElementById('fit-vids-style')) {\n // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js\n var head = document.head || document.getElementsByTagName('head')[0];\n var css = '.fluid-width-video-container{flex-grow: 1;width:100%;}.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';\n var div = document.createElement(\"div\");\n div.innerHTML = '

x

';\n head.appendChild(div.childNodes[1]);\n }\n\n if ( options ) {\n $.extend( settings, options );\n }\n\n return this.each(function(){\n var selectors = [\n 'iframe[src*=\"player.vimeo.com\"]',\n 'iframe[src*=\"youtube.com\"]',\n 'iframe[src*=\"youtube-nocookie.com\"]',\n 'iframe[src*=\"kickstarter.com\"][src*=\"video.html\"]',\n 'object',\n 'embed'\n ];\n\n if (settings.customSelector) {\n selectors.push(settings.customSelector);\n }\n\n var ignoreList = '.fitvidsignore';\n\n if(settings.ignore) {\n ignoreList = ignoreList + ', ' + settings.ignore;\n }\n\n var $allVideos = $(this).find(selectors.join(','));\n $allVideos = $allVideos.not('object object'); // SwfObj conflict patch\n $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.\n\n $allVideos.each(function(){\n var $this = $(this);\n if($this.parents(ignoreList).length > 0) {\n return; // Disable FitVids on this video.\n }\n if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }\n if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))\n {\n $this.attr('height', 9);\n $this.attr('width', 16);\n }\n var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),\n width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),\n aspectRatio = height / width;\n if(!$this.attr('name')){\n var videoName = 'fitvid' + $.fn.fitVids._count;\n $this.attr('name', videoName);\n $.fn.fitVids._count++;\n }\n $this.wrap('
').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');\n $this.removeAttr('height').removeAttr('width');\n });\n });\n };\n\n // Internal counter for unique video names.\n $.fn.fitVids._count = 0;\n\n// Works with either jQuery or Zepto\n})( window.jQuery || window.Zepto );\n","/* eslint-env browser */\n\n/**\n * Floating header\n * Used on invividual post pages, displays a sticky header with progress indicator\n *\n * This JS is automatically applied for any template where you use the\n * {{> floating-header}} partial\n */\n\n(function (window, document) {\n // set up Casper as a global object\n if (!window.Casper) {\n window.Casper = {};\n }\n\n window.Casper.floatingHeader = function floatingHeader() {\n // NOTE: Scroll performance is poor in Safari\n // - this appears to be due to the events firing much more slowly in Safari.\n // Dropping the scroll event and using only a raf loop results in smoother\n // scrolling but continuous processing even when not scrolling\n\n var progressBar = document.querySelector('#reading-progress');\n var header = document.querySelector('.floating-header');\n var title = document.querySelector('.post-full-title');\n\n var lastScrollY = window.scrollY;\n var lastWindowHeight = window.innerHeight;\n var lastDocumentHeight = document.body.clientHeight;\n var ticking = false;\n\n function onScroll() {\n lastScrollY = window.scrollY;\n requestTick();\n }\n\n function onResize() {\n lastWindowHeight = window.innerHeight;\n lastDocumentHeight = document.body.clientHeight;\n requestTick();\n }\n\n function requestTick() {\n if (!ticking) {\n requestAnimationFrame(update);\n }\n ticking = true;\n }\n\n function update() {\n var trigger = title.getBoundingClientRect().top + window.scrollY;\n var triggerOffset = title.offsetHeight + 35;\n var progressMax = lastDocumentHeight - lastWindowHeight;\n\n // show/hide floating header\n if (lastScrollY >= trigger + triggerOffset) {\n header.classList.add('floating-active');\n } else {\n header.classList.remove('floating-active');\n }\n\n progressBar.setAttribute('max', progressMax);\n progressBar.setAttribute('value', lastScrollY);\n\n ticking = false;\n }\n\n window.addEventListener('scroll', onScroll, {passive: true});\n window.addEventListener('resize', onResize, false);\n\n update();\n };\n})(window, document);\n","/* eslint-env browser */\n\n/**\n * Gallery card support\n * Used on any individual post/page\n *\n * Detects when a gallery card has been used and applies sizing to make sure\n * the display matches what is seen in the editor.\n */\n\n(function (window, document) {\n var resizeImagesInGalleries = function resizeImagesInGalleries() {\n var images = document.querySelectorAll('.kg-gallery-image img');\n images.forEach(function (image) {\n var container = image.closest('.kg-gallery-image');\n var width = image.attributes.width.value;\n var height = image.attributes.height.value;\n var ratio = width / height;\n container.style.flex = ratio + ' 1 0%';\n });\n };\n\n document.addEventListener('DOMContentLoaded', resizeImagesInGalleries);\n})(window, document);\n","/* eslint-env browser */\n\n/**\n * Infinite Scroll\n * Used on all pages where there is a list of posts (homepage, tag index, etc).\n *\n * When the page is scrolled to 300px from the bottom, the next page of posts\n * is fetched by following the the that is output\n * by {{ghost_head}}.\n *\n * The individual post items are extracted from the fetched pages by looking for\n * a wrapper element with the class \"post-card\". Any found elements are appended\n * to the element with the class \"post-feed\" in the currently viewed page.\n */\n\n(function (window, document) {\n // next link element\n var nextElement = document.querySelector('link[rel=next]');\n if (!nextElement) {\n return;\n }\n\n // post feed element\n var feedElement = document.querySelector('.post-feed');\n if (!feedElement) {\n return;\n }\n\n var buffer = 300;\n\n var ticking = false;\n var loading = false;\n\n var lastScrollY = window.scrollY;\n var lastWindowHeight = window.innerHeight;\n var lastDocumentHeight = document.documentElement.scrollHeight;\n\n function onPageLoad() {\n if (this.status === 404) {\n window.removeEventListener('scroll', onScroll);\n window.removeEventListener('resize', onResize);\n return;\n }\n\n // append contents\n var postElements = this.response.querySelectorAll('.post-card');\n postElements.forEach(function (item) {\n feedElement.appendChild(item);\n });\n\n // set next link\n var resNextElement = this.response.querySelector('link[rel=next]');\n if (resNextElement) {\n nextElement.href = resNextElement.href;\n } else {\n window.removeEventListener('scroll', onScroll);\n window.removeEventListener('resize', onResize);\n }\n\n // sync status\n lastDocumentHeight = document.documentElement.scrollHeight;\n ticking = false;\n loading = false;\n }\n\n function onUpdate() {\n // return if already loading\n if (loading) {\n return;\n }\n\n // return if not scroll to the bottom\n if (lastScrollY + lastWindowHeight <= lastDocumentHeight - buffer) {\n ticking = false;\n return;\n }\n\n loading = true;\n\n var xhr = new window.XMLHttpRequest();\n xhr.responseType = 'document';\n\n xhr.addEventListener('load', onPageLoad);\n\n xhr.open('GET', nextElement.href);\n xhr.send(null);\n }\n\n function requestTick() {\n ticking || window.requestAnimationFrame(onUpdate);\n ticking = true;\n }\n\n function onScroll() {\n lastScrollY = window.scrollY;\n requestTick();\n }\n\n function onResize() {\n lastWindowHeight = window.innerHeight;\n lastDocumentHeight = document.documentElement.scrollHeight;\n requestTick();\n }\n\n window.addEventListener('scroll', onScroll, {passive: true});\n window.addEventListener('resize', onResize);\n\n requestTick();\n})(window, document);\n"]} \ No newline at end of file +{"version":3,"sources":["jquery.fitvids.js","gallery-card.js","infinite-scroll.js","sticky-nav-title.js"],"names":["$","fn","fitVids","options","settings","customSelector","ignore","document","getElementById","head","getElementsByTagName","div","createElement","innerHTML","appendChild","childNodes","extend","this","each","selectors","push","ignoreList","$allVideos","find","join","not","$this","parents","length","tagName","toLowerCase","parent","css","isNaN","attr","aspectRatio","parseInt","height","width","videoName","_count","wrap","removeAttr","window","jQuery","Zepto","addEventListener","querySelectorAll","forEach","image","container","closest","ratio","attributes","value","style","flex","nextElement","querySelector","feedElement","buffer","ticking","loading","lastScrollY","scrollY","lastWindowHeight","innerHeight","lastDocumentHeight","documentElement","scrollHeight","onScroll","passive","onResize","requestTick","onPageLoad","status","removeEventListener","response","item","resNextElement","href","onUpdate","xhr","XMLHttpRequest","responseType","open","send","requestAnimationFrame","Casper","stickyNavTitle","nav","navSelector","title","titleSelector","update","getBoundingClientRect","top","offsetHeight","classList","add","activeClass","remove"],"mappings":"CAYA,SAAAA,GAEA,aAEAA,EAAAC,GAAAC,QAAA,SAAAC,GACA,IAAAC,EAAA,CACAC,eAAA,KACAC,OAAA,MAGA,IAAAC,SAAAC,eAAA,kBAAA,CAEA,IAAAC,EAAAF,SAAAE,MAAAF,SAAAG,qBAAA,QAAA,GAEAC,EAAAJ,SAAAK,cAAA,OACAD,EAAAE,UAAA,oUACAJ,EAAAK,YAAAH,EAAAI,WAAA,IAOA,OAJAZ,GACAH,EAAAgB,OAAAZ,EAAAD,GAGAc,KAAAC,KAAA,WACA,IAAAC,EAAA,CACA,kCACA,6BACA,sCACA,oDACA,SACA,SAGAf,EAAAC,gBACAc,EAAAC,KAAAhB,EAAAC,gBAGA,IAAAgB,EAAA,iBAEAjB,EAAAE,SACAe,EAAAA,EAAA,KAAAjB,EAAAE,QAGA,IAAAgB,EAAAtB,EAAAiB,MAAAM,KAAAJ,EAAAK,KAAA,OAEAF,GADAA,EAAAA,EAAAG,IAAA,kBACAA,IAAAJ,IAEAH,KAAA,WACA,IAAAQ,EAAA1B,EAAAiB,MACA,KAAA,EAAAS,EAAAC,QAAAN,GAAAO,QAGA,UAAAX,KAAAY,QAAAC,eAAAJ,EAAAK,OAAA,UAAAH,QAAAF,EAAAK,OAAA,8BAAAH,QAAA,CACAF,EAAAM,IAAA,WAAAN,EAAAM,IAAA,WA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AiG,aAGAvC,GAAA,EAGAlB,EAAAG,iBAAA,SA1BA,WACAiB,EAAApB,EAAAqB,QAIA,WACAH,GACA0B,sBAAAO,GAEAjC,GAAA,EAPAY,IAwBA,CAAAF,SAAA,IAEAuB,KAzCA,CA2CAnD,OAAApC","file":"casper.js","sourcesContent":["/*jshint browser:true */\n/*!\n* FitVids 1.3\n*\n*\n* Copyright 2017, Chris Coyier + Dave Rupert + Ghost Foundation\n* This is an unofficial release, ported by John O'Nolan\n* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/\n* Released under the MIT license\n*\n*/\n\n;(function( $ ){\n\n 'use strict';\n\n $.fn.fitVids = function( options ) {\n var settings = {\n customSelector: null,\n ignore: null\n };\n\n if(!document.getElementById('fit-vids-style')) {\n // appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js\n var head = document.head || document.getElementsByTagName('head')[0];\n var css = '.fluid-width-video-container{flex-grow: 1;width:100%;}.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';\n var div = document.createElement(\"div\");\n div.innerHTML = '

x

';\n head.appendChild(div.childNodes[1]);\n }\n\n if ( options ) {\n $.extend( settings, options );\n }\n\n return this.each(function(){\n var selectors = [\n 'iframe[src*=\"player.vimeo.com\"]',\n 'iframe[src*=\"youtube.com\"]',\n 'iframe[src*=\"youtube-nocookie.com\"]',\n 'iframe[src*=\"kickstarter.com\"][src*=\"video.html\"]',\n 'object',\n 'embed'\n ];\n\n if (settings.customSelector) {\n selectors.push(settings.customSelector);\n }\n\n var ignoreList = '.fitvidsignore';\n\n if(settings.ignore) {\n ignoreList = ignoreList + ', ' + settings.ignore;\n }\n\n var $allVideos = $(this).find(selectors.join(','));\n $allVideos = $allVideos.not('object object'); // SwfObj conflict patch\n $allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.\n\n $allVideos.each(function(){\n var $this = $(this);\n if($this.parents(ignoreList).length > 0) {\n return; // Disable FitVids on this video.\n }\n if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }\n if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))\n {\n $this.attr('height', 9);\n $this.attr('width', 16);\n }\n var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),\n width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),\n aspectRatio = height / width;\n if(!$this.attr('name')){\n var videoName = 'fitvid' + $.fn.fitVids._count;\n $this.attr('name', videoName);\n $.fn.fitVids._count++;\n }\n $this.wrap('
').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');\n $this.removeAttr('height').removeAttr('width');\n });\n });\n };\n\n // Internal counter for unique video names.\n $.fn.fitVids._count = 0;\n\n// Works with either jQuery or Zepto\n})( window.jQuery || window.Zepto );\n","/* eslint-env browser */\n\n/**\n * Gallery card support\n * Used on any individual post/page\n *\n * Detects when a gallery card has been used and applies sizing to make sure\n * the display matches what is seen in the editor.\n */\n\n(function (window, document) {\n var resizeImagesInGalleries = function resizeImagesInGalleries() {\n var images = document.querySelectorAll('.kg-gallery-image img');\n images.forEach(function (image) {\n var container = image.closest('.kg-gallery-image');\n var width = image.attributes.width.value;\n var height = image.attributes.height.value;\n var ratio = width / height;\n container.style.flex = ratio + ' 1 0%';\n });\n };\n\n document.addEventListener('DOMContentLoaded', resizeImagesInGalleries);\n})(window, document);\n","/* eslint-env browser */\n\n/**\n * Infinite Scroll\n * Used on all pages where there is a list of posts (homepage, tag index, etc).\n *\n * When the page is scrolled to 300px from the bottom, the next page of posts\n * is fetched by following the the that is output\n * by {{ghost_head}}.\n *\n * The individual post items are extracted from the fetched pages by looking for\n * a wrapper element with the class \"post-card\". Any found elements are appended\n * to the element with the class \"post-feed\" in the currently viewed page.\n */\n\n(function (window, document) {\n // next link element\n var nextElement = document.querySelector('link[rel=next]');\n if (!nextElement) {\n return;\n }\n\n // post feed element\n var feedElement = document.querySelector('.post-feed');\n if (!feedElement) {\n return;\n }\n\n var buffer = 300;\n\n var ticking = false;\n var loading = false;\n\n var lastScrollY = window.scrollY;\n var lastWindowHeight = window.innerHeight;\n var lastDocumentHeight = document.documentElement.scrollHeight;\n\n function onPageLoad() {\n if (this.status === 404) {\n window.removeEventListener('scroll', onScroll);\n window.removeEventListener('resize', onResize);\n return;\n }\n\n // append contents\n var postElements = this.response.querySelectorAll('.post-card');\n postElements.forEach(function (item) {\n feedElement.appendChild(item);\n });\n\n // set next link\n var resNextElement = this.response.querySelector('link[rel=next]');\n if (resNextElement) {\n nextElement.href = resNextElement.href;\n } else {\n window.removeEventListener('scroll', onScroll);\n window.removeEventListener('resize', onResize);\n }\n\n // sync status\n lastDocumentHeight = document.documentElement.scrollHeight;\n ticking = false;\n loading = false;\n }\n\n function onUpdate() {\n // return if already loading\n if (loading) {\n return;\n }\n\n // return if not scroll to the bottom\n if (lastScrollY + lastWindowHeight <= lastDocumentHeight - buffer) {\n ticking = false;\n return;\n }\n\n loading = true;\n\n var xhr = new window.XMLHttpRequest();\n xhr.responseType = 'document';\n\n xhr.addEventListener('load', onPageLoad);\n\n xhr.open('GET', nextElement.href);\n xhr.send(null);\n }\n\n function requestTick() {\n ticking || window.requestAnimationFrame(onUpdate);\n ticking = true;\n }\n\n function onScroll() {\n lastScrollY = window.scrollY;\n requestTick();\n }\n\n function onResize() {\n lastWindowHeight = window.innerHeight;\n lastDocumentHeight = document.documentElement.scrollHeight;\n requestTick();\n }\n\n window.addEventListener('scroll', onScroll, {passive: true});\n window.addEventListener('resize', onResize);\n\n requestTick();\n})(window, document);\n","/* eslint-env browser */\n\n/**\n * Nav/Title replacement\n * Used on invividual post pages, displays the post title in place of the nav\n * bar when scrolling past the title\n *\n * Usage:\n * ```\n * Casper.stickyTitle({\n * navSelector: '.site-nav-main',\n * titleSelector: '.post-full-title',\n * activeClass: 'nav-post-title-active'\n * });\n * ```\n */\n\n(function (window, document) {\n // set up Casper as a global object\n if (!window.Casper) {\n window.Casper = {};\n }\n\n window.Casper.stickyNavTitle = function stickyNavTitle(options) {\n var nav = document.querySelector(options.navSelector);\n var title = document.querySelector(options.titleSelector);\n\n var lastScrollY = window.scrollY;\n var ticking = false;\n\n function onScroll() {\n lastScrollY = window.scrollY;\n requestTick();\n }\n\n function requestTick() {\n if (!ticking) {\n requestAnimationFrame(update);\n }\n ticking = true;\n }\n\n function update() {\n var trigger = title.getBoundingClientRect().top + window.scrollY;\n var triggerOffset = title.offsetHeight + 35;\n\n // show/hide post title\n if (lastScrollY >= trigger + triggerOffset) {\n nav.classList.add(options.activeClass);\n } else {\n nav.classList.remove(options.activeClass);\n }\n\n ticking = false;\n }\n\n window.addEventListener('scroll', onScroll, {passive: true});\n\n update();\n };\n})(window, document);\n"]} \ No newline at end of file diff --git a/assets/js/floating-header.js b/assets/js/floating-header.js deleted file mode 100644 index b69646f..0000000 --- a/assets/js/floating-header.js +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-env browser */ - -/** - * Floating header - * Used on invividual post pages, displays a sticky header with progress indicator - * - * This JS is automatically applied for any template where you use the - * {{> floating-header}} partial - */ - -(function (window, document) { - // set up Casper as a global object - if (!window.Casper) { - window.Casper = {}; - } - - window.Casper.floatingHeader = function floatingHeader() { - // NOTE: Scroll performance is poor in Safari - // - this appears to be due to the events firing much more slowly in Safari. - // Dropping the scroll event and using only a raf loop results in smoother - // scrolling but continuous processing even when not scrolling - - var progressBar = document.querySelector('#reading-progress'); - var header = document.querySelector('.floating-header'); - var title = document.querySelector('.post-full-title'); - - var lastScrollY = window.scrollY; - var lastWindowHeight = window.innerHeight; - var lastDocumentHeight = document.body.clientHeight; - var ticking = false; - - function onScroll() { - lastScrollY = window.scrollY; - requestTick(); - } - - function onResize() { - lastWindowHeight = window.innerHeight; - lastDocumentHeight = document.body.clientHeight; - requestTick(); - } - - function requestTick() { - if (!ticking) { - requestAnimationFrame(update); - } - ticking = true; - } - - function update() { - var trigger = title.getBoundingClientRect().top + window.scrollY; - var triggerOffset = title.offsetHeight + 35; - var progressMax = lastDocumentHeight - lastWindowHeight; - - // show/hide floating header - if (lastScrollY >= trigger + triggerOffset) { - header.classList.add('floating-active'); - } else { - header.classList.remove('floating-active'); - } - - progressBar.setAttribute('max', progressMax); - progressBar.setAttribute('value', lastScrollY); - - ticking = false; - } - - window.addEventListener('scroll', onScroll, {passive: true}); - window.addEventListener('resize', onResize, false); - - update(); - }; -})(window, document); diff --git a/assets/js/infinitescroll.js b/assets/js/infinite-scroll.js similarity index 100% rename from assets/js/infinitescroll.js rename to assets/js/infinite-scroll.js diff --git a/assets/js/sticky-nav-title.js b/assets/js/sticky-nav-title.js new file mode 100644 index 0000000..6e14bb9 --- /dev/null +++ b/assets/js/sticky-nav-title.js @@ -0,0 +1,61 @@ +/* eslint-env browser */ + +/** + * Nav/Title replacement + * Used on invividual post pages, displays the post title in place of the nav + * bar when scrolling past the title + * + * Usage: + * ``` + * Casper.stickyTitle({ + * navSelector: '.site-nav-main', + * titleSelector: '.post-full-title', + * activeClass: 'nav-post-title-active' + * }); + * ``` + */ + +(function (window, document) { + // set up Casper as a global object + if (!window.Casper) { + window.Casper = {}; + } + + window.Casper.stickyNavTitle = function stickyNavTitle(options) { + var nav = document.querySelector(options.navSelector); + var title = document.querySelector(options.titleSelector); + + var lastScrollY = window.scrollY; + var ticking = false; + + function onScroll() { + lastScrollY = window.scrollY; + requestTick(); + } + + function requestTick() { + if (!ticking) { + requestAnimationFrame(update); + } + ticking = true; + } + + function update() { + var trigger = title.getBoundingClientRect().top + window.scrollY; + var triggerOffset = title.offsetHeight + 35; + + // show/hide post title + if (lastScrollY >= trigger + triggerOffset) { + nav.classList.add(options.activeClass); + } else { + nav.classList.remove(options.activeClass); + } + + ticking = false; + } + + window.addEventListener('scroll', onScroll, {passive: true}); + + update(); + }; +})(window, document); diff --git a/post.hbs b/post.hbs index 588b5e5..f11d4c0 100644 --- a/post.hbs +++ b/post.hbs @@ -173,17 +173,42 @@ into the {body} of the default.hbs template --}} -{{!-- Floating header which appears on-scroll, included from includes/floating-header.hbs --}} -{{!-- {{> floating-header}} --}} - {{/post}} {{!-- The #contentFor helper here will send everything inside it up to the matching #block helper found in default.hbs --}} {{#contentFor "scripts"}} {{/contentFor}}