mirror of
https://github.com/ViViDboarder/Vivid-Casper.git
synced 2024-12-23 12:07:40 +00:00
8993409296
refs. https://github.com/TryGhost/Casper/issues/632 Error page fixes and improvements - uses default template (i.e. standard header and footer) on 404 error page - fixed not displaying authors and primary tags on recommended posts on 404 error page - fixed background for navigation bar on generic error page - refined error code and message styles
1 line
13 KiB
Plaintext
1 line
13 KiB
Plaintext
{"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","importNode","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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AP,EAAAtB,EAAAuB,YACAC,EAAA5D,EAAA6D,gBAAAC,aACAI,KAzFA,CAgGA9B,OAAApC,UC9FA,SAAAoC,EAAApC,GAEAoC,EAAA8C,SACA9C,EAAA8C,OAAA,IAGA9C,EAAA8C,OAAAC,eAAA,SAAAvF,GACA,IAAAwF,EAAApF,EAAAmD,cAAAvD,EAAAyF,aACAC,EAAAtF,EAAAmD,cAAAvD,EAAA2F,eAEA/B,EAAApB,EAAAqB,QACAH,GAAA,EAcA,SAAAkC,IACAF,EAAAG,wBAAAC,IAAAtD,EAAAqB,SACA6B,EAAAK,aAAA,KAGAnC,EACA4B,EAAAQ,UAAAC,IAAAjG,EAAAkG,aAEAV,EAAAQ,UAAAG,OAAAnG,EAAAkG,aAGAxC,GAAA,EAGAlB,EAAAG,iBAAA,SA1BA,WACAiB,EAAApB,EAAAqB,QAIA,WACAH,GACA2B,sBAAAO,GAEAlC,GAAA,EAPAY,IAwBA,CAAAF,SAAA,IAEAwB,KAzCA,CA2CApD,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 = '<p>x</p><style id=\"fit-vids-style\">' + css + '</style>';\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('<div class=\"fluid-width-video-container\"><div class=\"fluid-width-video-wrapper\"></div></div>').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 <link rel=\"next\" href=\"...\"> 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 // document.importNode is important, without it the item's owner\n // document will be different which can break resizing of\n // `object-fit: cover` images in Safari\n feedElement.appendChild(document.importNode(item, true));\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"]} |