...
 
Commits (8)
......@@ -85,7 +85,7 @@
"source": {
"type": "git",
"url": "https://gitlab.com/chesio/lazy-daisy",
"reference": "d148ea3b8c6f0e9a34d08d6c72f19898e4ee53cb"
"reference": "4d7f7e66377a57db33b5a5593298e5f30d8507f1"
},
"require": {
"composer/installers": "~1.0",
......@@ -127,7 +127,7 @@
"support": {
"issues": "https://gitlab.com/chesio/lazy-daisy/issues"
},
"time": "2020-01-18T15:39:00+00:00"
"time": "2020-01-18T20:12:51+00:00"
},
{
"name": "composer/installers",
......
......@@ -28,6 +28,8 @@ server {
include snippets/server/static-files.conf;
include snippets/server/fastcgi-cache.conf;
# No server-side caching in development!
set $skip_cache 1;
# WordPress specific configuration
include snippets/server/wordpress.conf;
......
......@@ -1433,7 +1433,7 @@ svg.icon {
margin-left: 0.5em; }
@media print, screen and (min-width: 60em) {
html {
body {
font-size: 1.125em; } }
/* Alternative (night) mood */
......@@ -2056,16 +2056,6 @@ nav.prev-up-next-gallery {
margin-bottom: 0.5rem;
margin-left: 0.5rem;
margin-right: 0.5rem; } }
@media screen and (min-width: 100em) {
.media-grid > div.grid-item {
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
width: calc(25% - 1.25rem);
margin-top: 0.625rem;
margin-bottom: 0.625rem;
margin-left: 0.625rem;
margin-right: 0.625rem; } }
.grid-item figure {
position: relative; }
......@@ -2118,11 +2108,6 @@ nav.prev-up-next-gallery {
width: 33.33333%; }
.grid-column.grid-column--3 {
display: block; } }
@media screen and (min-width: 100em) {
.grid-column {
width: 25%; }
.grid-column.grid-column--4 {
display: block; } }
.grid-column .grid-item {
padding: 4px; }
@media print, screen and (min-width: 40em) {
......
......@@ -1433,7 +1433,7 @@ svg.icon {
margin-left: 0.5em; }
@media print, screen and (min-width: 60em) {
html {
body {
font-size: 1.125em; } }
/* Alternative (night) mood */
......@@ -2056,16 +2056,6 @@ nav.prev-up-next-gallery {
margin-bottom: 0.5rem;
margin-left: 0.5rem;
margin-right: 0.5rem; } }
@media screen and (min-width: 100em) {
.media-grid > div.grid-item {
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
width: calc(25% - 1.25rem);
margin-top: 0.625rem;
margin-bottom: 0.625rem;
margin-left: 0.625rem;
margin-right: 0.625rem; } }
.grid-item figure {
position: relative; }
......@@ -2118,11 +2108,6 @@ nav.prev-up-next-gallery {
width: 33.33333%; }
.grid-column.grid-column--3 {
display: block; } }
@media screen and (min-width: 100em) {
.grid-column {
width: 25%; }
.grid-column.grid-column--4 {
display: block; } }
.grid-column .grid-item {
padding: 4px; }
@media print, screen and (min-width: 40em) {
......
......@@ -4,7 +4,10 @@
* Enhance media grid with Colcade
*/
(function(document, Colcade) {
(function(window, document, Colcade) {
// Do not Lazy Daisy invoke Yall.js automatically.
window.lazyDaisy = function () {};
function initMediaGrid() {
// Note: this selects only the first media grid on a page
......@@ -15,6 +18,9 @@
items: '.grid-item'
});
}
// Lazy load the bitches!
if (typeof window.yall === 'function') { window.yall(); }
}
/**
......@@ -31,4 +37,4 @@
// Load Events
domReady(initMediaGrid);
})(document, Colcade);
})(window, document, Colcade);
!function(t,n){var e;e=function(){var e=t.querySelector(".media-grid");e&&new n(e,{columns:".grid-column",items:".grid-item"})},"interactive"===t.readyState||"complete"===t.readyState?e():t.addEventListener("DOMContentLoaded",e)}(document,Colcade);
\ No newline at end of file
!function(t,n,a){t.lazyDaisy=function(){};var e;e=function(){var e=n.querySelector(".media-grid");e&&new a(e,{columns:".grid-column",items:".grid-item"}),"function"==typeof t.yall&&t.yall()},"interactive"===n.readyState||"complete"===n.readyState?e():n.addEventListener("DOMContentLoaded",e)}(window,document,Colcade);
\ No newline at end of file
!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof module&&module.exports?module.exports=e():t.Colcade=e()}(window,function(){function s(t,e){if((t=r(t))&&t.colcadeGUID){var i=n[t.colcadeGUID];return i.option(e),i}this.element=t,this.options={},this.option(e),this.create()}var t=s.prototype;t.option=function(t){this.options=function(t,e){for(var i in e)t[i]=e[i];return t}(this.options,t)};var e=0,n={};function i(t){var e=t.getAttribute("data-colcade").split(","),o={};e.forEach(function(t){var e=t.split(":"),i=e[0].trim(),n=e[1].trim();o[i]=n}),new s(t,o)}function o(t){var e=[];if(Array.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0;i<t.length;i++)e.push(t[i]);else e.push(t);return e}function u(t,e){return o((e=e||document).querySelectorAll(t))}function r(t){return"string"==typeof t&&(t=document.querySelector(t)),t}return t.create=function(){this.errorCheck();var t=this.guid=++e;this.element.colcadeGUID=t,(n[t]=this).reload(),this._windowResizeHandler=this.onWindowResize.bind(this),this._loadHandler=this.onLoad.bind(this),window.addEventListener("resize",this._windowResizeHandler),this.element.addEventListener("load",this._loadHandler,!0)},t.errorCheck=function(){var t=[];if(this.element||t.push("Bad element: "+this.element),this.options.columns||t.push("columns option required: "+this.options.columns),this.options.items||t.push("items option required: "+this.options.items),t.length)throw new Error("[Colcade error] "+t.join(". "))},t.reload=function(){this.updateColumns(),this.updateItems(),this.layout()},t.updateColumns=function(){this.columns=u(this.options.columns,this.element)},t.updateItems=function(){this.items=u(this.options.items,this.element)},t.getActiveColumns=function(){return this.columns.filter(function(t){return"none"!=getComputedStyle(t).display})},t.layout=function(){this.activeColumns=this.getActiveColumns(),this._layout()},t._layout=function(){this.columnHeights=this.activeColumns.map(function(){return 0}),this.layoutItems(this.items)},t.layoutItems=function(t){t.forEach(this.layoutItem,this)},t.layoutItem=function(t){var e=Math.min.apply(Math,this.columnHeights),i=this.columnHeights.indexOf(e);this.activeColumns[i].appendChild(t),this.columnHeights[i]+=t.offsetHeight||1},t.append=function(t){var e=this.getQueryItems(t);this.items=this.items.concat(e),this.layoutItems(e)},t.prepend=function(t){var e=this.getQueryItems(t);this.items=e.concat(this.items),this._layout()},t.getQueryItems=function(t){t=o(t);var e=document.createDocumentFragment();return t.forEach(function(t){e.appendChild(t)}),u(this.options.items,e)},t.measureColumnHeight=function(n){var o=this.element.getBoundingClientRect();this.activeColumns.forEach(function(t,e){if(!n||t.contains(n)){var i=t.lastElementChild.getBoundingClientRect();this.columnHeights[e]=i.bottom-o.top}},this)},t.onWindowResize=function(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){this.onDebouncedResize()}.bind(this),100)},t.onDebouncedResize=function(){var i=this.getActiveColumns(),t=i.length==this.activeColumns.length,n=!0;this.activeColumns.forEach(function(t,e){n=n&&t==i[e]}),t&&n||(this.activeColumns=i,this._layout())},t.onLoad=function(t){this.measureColumnHeight(t.target)},t.destroy=function(){this.items.forEach(function(t){this.element.appendChild(t)},this),window.removeEventListener("resize",this._windowResizeHandler),this.element.removeEventListener("load",this._loadHandler,!0),delete this.element.colcadeGUID,delete n[this.guid]},function(t){if("complete"==document.readyState)return t();document.addEventListener("DOMContentLoaded",t)}(function(){u("[data-colcade]").forEach(i)}),s.data=function(t){var e=(t=r(t))&&t.colcadeGUID;return e&&n[e]},s.makeJQueryPlugin=function(r){(r=r||window.jQuery)&&(r.fn.colcade=function(t){return"string"==typeof t?function(t,o,s){var u;return t.each(function(t,e){var i=r.data(e,"colcade");if(i){var n=i[o].apply(i,s);u=void 0===u?n:u}}),void 0!==u?u:t}(this,t,Array.prototype.slice.call(arguments,1)):(function(t,n){t.each(function(t,e){var i=r.data(e,"colcade");i?(i.option(n),i.layout()):(i=new s(e,n),r.data(e,"colcade",i))})}(this,t),this)})},s.makeJQueryPlugin(),s});
\ No newline at end of file
......@@ -46,23 +46,6 @@ gulp.task('fonts', function () {
});
/**
* Copy dist files from selected Node packages to dist/vendor folder.
*/
gulp.task('vendor', function () {
return gulp
.src([
'node_modules/+(object-fit-images|photoswipe)/dist/**/*.*',
'node_modules/+(colcade)/*.js'
])
.pipe(rename(function (path) {
path.dirname = path.dirname.replace('/dist', '');
}))
.pipe(gulp.dest('dist/vendor'))
;
});
/**
* Check project custom JS with ESLint.
*
......@@ -203,6 +186,37 @@ gulp.task('images', function () {
});
/**
* Copy Colcade script to /vendor and then minify it.
*/
gulp.task('vendor:colcade', function () {
return gulp
.src('node_modules/+(colcade)/*.js')
.pipe(gulp.dest('dist/vendor'))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('dist/vendor'))
;
});
/**
* Copy dist files from selected Node packages to dist/vendor folder.
*/
gulp.task('vendor:verbatim', function () {
return gulp
.src([
'node_modules/+(object-fit-images|photoswipe)/dist/**/*.*',
])
.pipe(rename(function (path) {
path.dirname = path.dirname.replace('/dist', '');
}))
.pipe(gulp.dest('dist/vendor'))
;
});
gulp.task('vendor', gulp.parallel('vendor:colcade', 'vendor:verbatim'));
/**
* Watch for changes.
*/
......
......@@ -4,7 +4,10 @@
* Enhance media grid with Colcade
*/
(function(document, Colcade) {
(function(window, document, Colcade) {
// Do not Lazy Daisy invoke Yall.js automatically.
window.lazyDaisy = function () {};
function initMediaGrid() {
// Note: this selects only the first media grid on a page
......@@ -15,6 +18,9 @@
items: '.grid-item'
});
}
// Lazy load the bitches!
if (typeof window.yall === 'function') { window.yall(); }
}
/**
......@@ -31,4 +37,4 @@
// Load Events
domReady(initMediaGrid);
})(document, Colcade);
})(window, document, Colcade);
html {
body {
@include breakpoint(large) {
font-size: 1.125em;
}
......
......@@ -10,9 +10,6 @@
@include breakpoint(xlarge) {
@include xy-grid-layout(3, 'div.grid-item', $gutters: map-get($reduced-grid-margin-gutters, xlarge), $gutter-position: top bottom left right);
}
@include breakpoint(xxlarge) {
@include xy-grid-layout(4, 'div.grid-item', $gutters: map-get($reduced-grid-margin-gutters, xxlarge), $gutter-position: top bottom left right);
}
}
// Media grid item
......@@ -82,12 +79,6 @@
display: block;
}
}
@include breakpoint(xxlarge) {
width: percentage(1/4);
&.grid-column--4 {
display: block;
}
}
.grid-item {
@include multi-breakpoint(padding, $reduced-grid-margin-gutters, 0.5);
......
......@@ -72,7 +72,7 @@ add_action('wp_enqueue_scripts', function () {
$suffix = SCRIPT_DEBUG ? '' : '.min';
// Colcade -- only register (enqueued when needed)
wp_register_script('colcade', asset_uri("vendor/colcade/colcade.js"), [], '0.2.0', true);
wp_register_script('colcade', asset_uri("vendor/colcade/colcade{$suffix}.js"), [], '0.2.0', true);
// Photoswipe -- only register (enqueued when needed) scripts (styles are compiled into main.css):
wp_register_script('photoswipe-core', asset_uri("vendor/photoswipe/photoswipe{$suffix}.js"), [], '4.1.3', true);
wp_register_script('photoswipe-ui', asset_uri("vendor/photoswipe/photoswipe-ui-default{$suffix}.js"), ['photoswipe-core'], '4.1.3', true);
......
......@@ -171,7 +171,6 @@ function mediaGrid(string $gallery, array $attachments, string $size = 'medium')
$output .= '<div class="grid-column grid-column--1"></div>';
$output .= '<div class="grid-column grid-column--2"></div>';
$output .= '<div class="grid-column grid-column--3"></div>';
$output .= '<div class="grid-column grid-column--4"></div>';
// Add item index (necessary for Colcade + PhotoSwipe integration)
$image_index = 0;
......
......@@ -18,7 +18,7 @@
do_action('get_header');
get_template_part('partials/header');
?>
<main role="document">
<main>
<?php include App\template()->main(); ?>
</main>
<?php
......
......@@ -17,7 +17,7 @@
<button id="turn-lights-off" class="mod-switcher mod-switcher--lights-off"><?= \App\svg_use_icon('weather-night'); ?></button>
</div>
<nav class="primary" role="navigation" id="primary-nav">
<nav class="primary" id="primary-nav">
<div class="container">
<?php
if (has_nav_menu('primary_navigation')) {
......