From b60988168bef16edd5a24dce71fb1c9d1581c709 Mon Sep 17 00:00:00 2001 From: Chen Zhe Date: Tue, 4 Jan 2022 17:07:27 -0500 Subject: auto minify css and js --- assets/css/component.css | 249 +++++++++++++++++++++ assets/css/default.css | 111 ++++++++++ assets/js/main.js | 494 ++++++++++++++++++++++++++++++++++++++++++ layouts/partials/head.html | 6 +- layouts/partials/scripts.html | 2 +- static/css/component.css | 249 --------------------- static/css/default.css | 111 ---------- static/js/main.js | 494 ------------------------------------------ 8 files changed, 858 insertions(+), 858 deletions(-) create mode 100644 assets/css/component.css create mode 100644 assets/css/default.css create mode 100644 assets/js/main.js delete mode 100644 static/css/component.css delete mode 100644 static/css/default.css delete mode 100644 static/js/main.js diff --git a/assets/css/component.css b/assets/css/component.css new file mode 100644 index 0000000..493188a --- /dev/null +++ b/assets/css/component.css @@ -0,0 +1,249 @@ +.og-grid { + list-style: none; + padding: 20px 0; + margin: 0 auto; + text-align: center; + width: 100%; +} + +.og-grid li { + display: inline-block; + margin: 10px 5px 0 5px; + vertical-align: top; + height: 250px; +} + +.og-grid li > a, +.og-grid li > a img { + border: none; + outline: none; + display: block; + position: relative; + width: 100%; +} + +.og-grid li.og-expanded > a::after { + top: auto; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; + border-bottom-color: #ddd; + border-width: 15px; + left: 50%; + margin: -20px 0 0 -15px; +} + +.og-expander { + position: absolute; + background: #ddd; + top: auto; + left: 0; + width: 100%; + margin-top: 10px; + text-align: left; + height: 0; + overflow: hidden; +} + +.og-expander-inner { + padding: 30px; + height: 100%; +} + +.og-close { + position: absolute; + width: 40px; + height: 40px; + top: 20px; + right: 20px; + cursor: pointer; +} + +.og-close::before, +.og-close::after { + content: ''; + position: absolute; + width: 100%; + top: 50%; + height: 1px; + background: #888; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + transform: rotate(45deg); +} + +.og-close::after { + -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + transform: rotate(-45deg); +} + +.og-close:hover::before, +.og-close:hover::after { + background: #333; +} + +.og-fullimg, +.og-details { + float: left; + height: 100%; + overflow: hidden; + position: relative; +} + +.og-details { + width: 40%; + padding: 0 40px 0 20px; + color: #555; +} + +.og-fullimg { + width: 60%; + text-align: center; +} + +.og-fullimg img, +.og-fullimg iframe { + display: inline-block; + max-height: 100%; + max-width: 100%; +} + +.og-fullimg iframe { + border: none; + height: 100%; + width: 100%; +} + +.og-details h3 { + font-weight: 300; + font-size: 36px; + padding: 30px 0 10px; + margin-bottom: 10px; + color: black; +} + +.og-details p { + font-weight: 400; + font-size: 16px; + line-height: 22px; + padding-bottom: 1em; +} + +.og-details > a { + font-weight: 700; + font-size: 16px; + color: #333; + text-transform: uppercase; + letter-spacing: 2px; + padding: 10px 20px; + border: 3px solid #333; + display: inline-block; + margin: 20px 0 0; + outline: none; +} + +.og-details > h3 > a { + width: 0; + height: 0; + border-top: 0.8em solid transparent; + border-bottom: 0.8em solid transparent; + border-left: 1.3em solid gray; + display: inline-block; + outline: none; + margin-left: 0.5em; +} + +.og-details > a::before { + content: '\2192'; + display: inline-block; + margin-right: 10px; +} + +.og-details > a:hover { + border-color: #999; + color: #999; +} + +.og-loading { + width: 20px; + height: 20px; + border-radius: 50%; + background: #ddd; + box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ccc; + position: absolute; + top: 50%; + left: 50%; + margin: -25px 0 0 -25px; + -webkit-animation: loader 0.5s infinite ease-in-out both; + -moz-animation: loader 0.5s infinite ease-in-out both; + animation: loader 0.5s infinite ease-in-out both; +} + +.stamp { + color: #555; + font-size: 1em; + font-weight: 700; + border: 0.5rem double #555; + display: inline-block; + padding: 0.25rem 1rem; + text-transform: uppercase; + border-radius: 1rem; +} + +ul.exif { + list-style-type: square; + -webkit-column-width: 180px; + -moz-column-width: 180px; + column-width: 180px; + -webkit-column-count: 2; /* max count */ + -moz-column-count: 2; + column-count: 2; + text-align: left; + padding: 10px; + margin: 0; + +} + +ul.exif > li { + height: auto; + display: list-item; + margin: 0; +} + +@-webkit-keyframes loader { + 0% { background: #ddd; } + 33% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ddd; } + 66% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ddd, -15px 30px 1px #ccc; } +} + +@-moz-keyframes loader { + 0% { background: #ddd; } + 33% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ddd; } + 66% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ddd, -15px 30px 1px #ccc; } +} + +@keyframes loader { + 0% { background: #ddd; } + 33% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ccc, -15px 30px 1px #ddd; } + 66% { background: #ccc; box-shadow: 0 0 1px #ccc, 15px 30px 1px #ddd, -15px 30px 1px #ccc; } +} + +@media screen and (max-width: 830px) { + + .stamp { font-size: 0.8em; border: 0.3rem double #555; } + .og-expander h3 { font-size: 28px; padding: 10px 0px; } + .og-expander p, ul.exif { font-size: 13px; } + .og-expander a { font-size: 12px; } + +} + +@media screen and (max-width: 650px) { + + .og-fullimg { display: none; } + .og-details { float: none; width: 100%; } + +} \ No newline at end of file diff --git a/assets/css/default.css b/assets/css/default.css new file mode 100644 index 0000000..ea88574 --- /dev/null +++ b/assets/css/default.css @@ -0,0 +1,111 @@ +html { height: 100%; } + +*, +*:after, +*:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; + margin: 0; +} + +/* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ +.clearfix:before, +.clearfix:after { + content: " "; + display: table; +} + +.clearfix:after { + clear: both; +} + +.clearfix { + *zoom: 1; +} + +body { + font-family: 'Lato', Arial, Calibri, sans-serif; + font-weight: 300; + font-size: 15px; + overflow: scroll; + overflow-x: hidden; +} + +a { + text-decoration: none; +} + +.container { + width: 100%; + position: relative; +} + +.container > header { + width: 90%; + max-width: 1240px; + margin: 0 auto; + position: relative; + padding: 20px 30px; + text-align: center; + font-size: 20px; +} + +.container > header h1 { + font-size: 34px; + margin: 0 auto; + font-weight: 700; +} + +.container > header h5 { + padding-bottom: 0.3em; + text-align: right; +} + +.container > header span { + display: block; + font-weight: 300; + text-align: left; + padding-bottom: 0.5em; +} + +.main > p { + text-align: center; + padding: 50px 20px; +} + +img.lazy{ + display: block; + height: 250px; +} + +footer { + text-align: center; + padding: 0.5em; +} + +footer > p.credits { + font-size: 0.6em; + font-style: bold; + padding-top: 0.4em; + opacity: 0.6; +} + +span.video-icon svg { + z-index: 1; + position: absolute; + left: 50%; + top: 50%; + width: 60px; + height: 60px; + margin-top: -30px; + margin-left: -30px; + opacity: 86%; + transition: 0.2s; +} + +.og-grid li > a:hover span.video-icon svg{ + filter: invert(90%); +} + diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..68b577c --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1,494 @@ +// main popup function +$(function() { + Grid.init(); +}); + +var $event = $.event, +$special, +resizeTimeout; + +$special = $event.special.debouncedresize = { + setup: function() { + $( this ).on( "resize", $special.handler ); + }, + teardown: function() { + $( this ).off( "resize", $special.handler ); + }, + handler: function( event, execAsap ) { + var context = this, + args = arguments, + dispatch = function() { + event.type = "debouncedresize"; + $event.dispatch.apply( context, args ); + }; + + if ( resizeTimeout ) { + clearTimeout( resizeTimeout ); + } + + execAsap ? + dispatch() : + resizeTimeout = setTimeout( dispatch, $special.threshold ); + }, + threshold: 250 +}; + +var BLANK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; + +$.fn.imagesLoaded = function( callback ) { + var $this = this, + deferred = $.isFunction($.Deferred) ? $.Deferred() : 0, + hasNotify = $.isFunction(deferred.notify), + $images = $this.find('img').add( $this.filter('img') ), + loaded = [], + proper = [], + broken = []; + + if ($.isPlainObject(callback)) { + $.each(callback, function (key, value) { + if (key === 'callback') { + callback = value; + } else if (deferred) { + deferred[key](value); + } + }); + } + + function doneLoading() { + var $proper = $(proper), + $broken = $(broken); + + if ( deferred ) { + if ( broken.length ) { + deferred.reject( $images, $proper, $broken ); + } else { + deferred.resolve( $images ); + } + } + + if ( $.isFunction( callback ) ) { + callback.call( $this, $images, $proper, $broken ); + } + } + + function imgLoaded( img, isBroken ) { + if ( img.src === BLANK || $.inArray( img, loaded ) !== -1 ) { + return; + } + + loaded.push( img ); + + if ( isBroken ) { + broken.push( img ); + } else { + proper.push( img ); + } + + $.data( img, 'imagesLoaded', { isBroken: isBroken, src: img.src } ); + + if ( hasNotify ) { + deferred.notifyWith( $(img), [ isBroken, $images, $(proper), $(broken) ] ); + } + + if ( $images.length === loaded.length ){ + setTimeout( doneLoading ); + $images.unbind( '.imagesLoaded' ); + } + } + + if ( !$images.length ) { + doneLoading(); + } else { + $images.bind( 'load.imagesLoaded error.imagesLoaded', function( event ){ + imgLoaded( event.target, event.type === 'error' ); + }).each( function( i, el ) { + var src = el.src; + + var cached = $.data( el, 'imagesLoaded' ); + if ( cached && cached.src === src ) { + imgLoaded( el, cached.isBroken ); + return; + } + + if ( el.complete && el.naturalWidth !== undefined ) { + imgLoaded( el, el.naturalWidth === 0 || el.naturalHeight === 0 ); + return; + } + + if ( el.readyState || el.complete ) { + el.src = BLANK; + el.src = src; + } + }); + } + + return deferred ? deferred.promise( $this ) : $this; +}; + +var Grid = (function() { + + var $grid = $( '*#og-grid' ), + $items = $grid.children( 'li' ), + current = -1, + previewPos = -1, + scrollExtra = 0, + marginExpanded = 10, + $window = $( window ), winsize, + $body = $( 'html, body' ), + transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd', + 'MozTransition' : 'transitionend', + 'OTransition' : 'oTransitionEnd', + 'msTransition' : 'MSTransitionEnd', + 'transition' : 'transitionend' + }, + transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ], + support = Modernizr.csstransitions, + settings = { + minHeight : 500, + speed : 350, + easing : 'ease' + }; + + function updateList() { + $items = $grid.children( 'li' ); + saveItemInfo(true); + } + + function init( config ) { + + settings = $.extend( true, {}, settings, config ); + + $grid.imagesLoaded( function() { + + saveItemInfo( true ); + getWinSize(); + initEvents(); + + } ); + + } + + function addItems( $newitems ) { + + $items = $items.add( $newitems ); + + $newitems.each( function() { + var $item = $( this ); + $item.data( { + offsetTop : $item.offset().top, + height : $item.height() + } ); + } ); + + initItemsEvents( $newitems ); + + } + + function saveItemInfo( saveheight ) { + $items.each( function() { + var $item = $( this ); + $item.data( 'offsetTop', $item.offset().top ); + if( saveheight ) { + $item.data( 'height', $item.height() ); + } + } ); + } + + function initEvents() { + + initItemsEvents( $items ); + + $window.on( 'debouncedresize', function() { + + scrollExtra = 0; + previewPos = -1; + saveItemInfo(); + getWinSize(); + var preview = $.data( this, 'preview' ); + if( typeof preview != 'undefined' ) { + hidePreview(); + } + + } ); + + } + + function initItemsEvents( $items ) { + $items.on( 'click', 'span.og-close', function() { + hidePreview(); + return false; + } ).children( 'a' ).on( 'click', function(e) { + + var $item = $( this ).parent(); + current === Array.from($items).findIndex(d => d == $item[0]) ? hidePreview() : showPreview( $item ); + return false; + + } ); + } + + function getWinSize() { + winsize = { width : $window.width(), height : $window.height() }; + } + + function showPreview( $item ) { + + var preview = $.data( this, 'preview' ), + position = $item.data( 'offsetTop' ); + + scrollExtra = 0; + + if( typeof preview != 'undefined' ) { + + if( previewPos !== position ) { + if( position > previewPos ) { + scrollExtra = preview.height; + } + hidePreview(); + } + else { + preview.update( $item ); + return false; + } + + } + + previewPos = position; + preview = $.data( this, 'preview', new Preview( $item ) ); + preview.open(); + + } + + function hidePreview() { + current = -1; + var preview = $.data( this, 'preview' ); + preview.close(); + $.removeData( this, 'preview' ); + } + + function Preview( $item ) { + this.$item = $item; + this.expandedIdx = Array.from($items).findIndex(d => d == this.$item[0]); + this.create(); + this.update(); + } + + Preview.prototype = { + create : function() { + this.$title = $( '

' ); + this.$description = $( '

' ); + this.$href = $( '' ); + this.$exifInfo = $( '' ); + this.$collectionName = $( '
' ); + this.$details = $( '
' ).append( this.$collectionName, this.$title, this.$description, this.$exifInfo, this.$href); + this.$loading = $( '
' ); + this.$fullimage = $( '
' ).append( this.$loading ); + this.$closePreview = $( '' ); + this.$previewInner = $( '
' ).append( this.$fullimage, this.$details, this.$closePreview ); + this.$previewEl = $( '
' ).append( this.$previewInner ); + this.$item.append( this.getEl() ); + if( support ) { + this.setTransition(); + } + }, + update : function( $item ) { + + if( $item ) { + this.$item = $item; + } + + if( current !== -1 ) { + var $currentItem = $items.eq( current ); + $currentItem.removeClass( 'og-expanded' ); + this.$item.addClass( 'og-expanded' ); + this.positionPreview(); + } + + current = this.$item.index(); + + var $itemEl = this.$item.children( 'a' ), + eldata = { + href : $itemEl.attr( 'href' ), + largesrc : $itemEl.data( 'largesrc' ), + title : $itemEl.data( 'title' ), + description : $itemEl.data( 'description' ), + exif : $itemEl.data( 'exif' ), + buttontext : $itemEl.data( 'buttontext' ), + collectionName : $itemEl.data( 'collection' ), + isVideo: $itemEl.data( 'is-video' ) + }; + + this.$title.html( eldata.title ); + this.$description.html( eldata.description ); + if(eldata.exif) { + this.$exifInfo.html( eldata.exif ); + this.$exifInfo.show(); + } else this.$exifInfo.hide(); + if(eldata.collectionName) { + this.$collectionName.html( eldata.collectionName ); + this.$collectionName.show(); + } else this.$collectionName.hide(); + if(eldata.buttontext) this.$href.text(eldata.buttontext); + + if (eldata.href && eldata.buttontext) { + this.$href.attr( 'href', eldata.href ); + this.$href.show(); + } + else { + this.$href.hide(); + } + + var self = this; + + if( typeof self.$largeImg != 'undefined' ) { + self.$largeImg.remove(); + } + + if( self.$fullimage.is( ':visible' ) ) { + this.$loading.show(); + if (eldata.isVideo) { + // iframe load will only happen when it's appended to page + $( '