-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
6,741 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,103 @@ | ||
window.imagify=window.imagify||{},jQuery.extend(window.imagify,{concat:ajaxurl.indexOf("?")>0?"&":"?",log:function(a){void 0!==console&&console.log(a)},info:function(a){void 0!==console&&console.info(a)},openModal:function(a){var b=a.data("target")||a.attr("href");jQuery(b).css("display","flex").hide().fadeIn(400).attr({"aria-hidden":"false",tabindex:"0"}).focus().removeAttr("tabindex").addClass("modal-is-open"),jQuery("body").addClass("imagify-modal-is-open")},template:function(a){return void 0===_?"":_.memoize(function(b){var c,d={evaluate:/<#([\s\S]+?)#>/g,interpolate:/\{\{\{([\s\S]+?)\}\}\}/g,escape:/\{\{([^}]+?)\}\}(?!\})/g,variable:"data"};return function(){return c=c||_.template(jQuery("#tmpl-"+a).html(),d),b=b||{},c(b)}})},humanSize:function(a){var b,c=["B","kB","MB"];return 0===a?"0 kB":(b=parseInt(Math.floor(Math.log(a)/Math.log(1024)),10),(a/Math.pow(1024,b)).toFixed(2)+" "+c[b])}}),function(a,b,c,d){a(".imagify-modal").attr("aria-hidden","true"),a(b).on("click.imagify",".imagify-modal-trigger",function(b){b.preventDefault(),c.imagify.openModal(a(this))}).on("click.imagify",".imagify-modal .close-btn",function(){a(this).closest(".imagify-modal").fadeOut(400).attr("aria-hidden","true").removeClass("modal-is-open").trigger("modalClosed.imagify"),a("body").removeClass("imagify-modal-is-open")}).on("blur.imagify",".imagify-modal .close-btn",function(){var b=a(this).closest(".imagify-modal");"false"===b.attr("aria-hidden")&&b.attr("tabindex","0").focus().removeAttr("tabindex")}).on("click.imagify",".imagify-modal",function(b){a(b.target).filter(".modal-is-open").find(".close-btn").trigger("click.imagify")}).on("keydown.imagify",function(b){27===b.keyCode&&a(".imagify-modal.modal-is-open").length>0&&(b.preventDefault(),a(".imagify-modal.modal-is-open").find(".close-btn").trigger("click.imagify"))})}(jQuery,document,window); | ||
window.imagify = window.imagify || {}; | ||
|
||
jQuery.extend( window.imagify, { | ||
concat: ajaxurl.indexOf( '?' ) > 0 ? '&' : '?', | ||
log: function( content ) { | ||
if ( undefined !== console ) { | ||
console.log( content ); // eslint-disable-line no-console | ||
} | ||
}, | ||
info: function( content ) { | ||
if ( undefined !== console ) { | ||
console.info( content ); // eslint-disable-line no-console | ||
} | ||
}, | ||
openModal: function( $link ) { | ||
var target = $link.data( 'target' ) || $link.attr( 'href' ); | ||
|
||
jQuery( target ).css( 'display', 'flex' ).hide().fadeIn( 400 ).attr( { | ||
'aria-hidden': 'false', | ||
'tabindex': '0' | ||
} ).focus().removeAttr( 'tabindex' ).addClass( 'modal-is-open' ); | ||
|
||
jQuery( 'body' ).addClass( 'imagify-modal-is-open' ); | ||
}, | ||
template: function( id ) { | ||
if ( undefined === _ ) { | ||
// No need to load underscore everywhere if we don't use it. | ||
return ''; | ||
} | ||
|
||
return _.memoize( function( data ) { | ||
var compiled, | ||
options = { | ||
evaluate: /<#([\s\S]+?)#>/g, | ||
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, | ||
escape: /\{\{([^}]+?)\}\}(?!\})/g, | ||
variable: 'data' | ||
}; | ||
|
||
return function() { | ||
compiled = compiled || _.template( jQuery( '#tmpl-' + id ).html(), null, options ); | ||
data = data || {}; | ||
return compiled( data ); | ||
}; | ||
} ); | ||
}, | ||
humanSize: function( bytes ) { | ||
var sizes = ['B', 'kB', 'MB'], | ||
i; | ||
|
||
if ( 0 === bytes ) { | ||
return '0\xA0kB'; | ||
} | ||
|
||
i = parseInt( Math.floor( Math.log( bytes ) / Math.log( 1024 ) ), 10 ); | ||
|
||
return ( bytes / Math.pow( 1024, i ) ).toFixed( 2 ) + '\xA0' + sizes[ i ]; | ||
} | ||
} ); | ||
|
||
|
||
// Imagify light modal ============================================================================= | ||
(function($, d, w, undefined) { // eslint-disable-line no-unused-vars, no-shadow, no-shadow-restricted-names | ||
|
||
// Accessibility. | ||
$( '.imagify-modal' ).attr( 'aria-hidden', 'true' ); | ||
|
||
$( d ) | ||
// On click on modal trigger, open modal. | ||
.on( 'click.imagify', '.imagify-modal-trigger', function( e ) { | ||
e.preventDefault(); | ||
w.imagify.openModal( $( this ) ); | ||
} ) | ||
// On click on close button, close modal. | ||
.on( 'click.imagify', '.imagify-modal .close-btn', function() { | ||
var $modal = $( this ).closest( '.imagify-modal' ); | ||
|
||
$modal.fadeOut( 400 ).attr( 'aria-hidden', 'true' ).removeClass( 'modal-is-open' ).trigger( 'modalClosed.imagify' ); | ||
|
||
$( 'body' ).removeClass( 'imagify-modal-is-open' ); | ||
} ) | ||
// On close button blur, improve accessibility. | ||
.on( 'blur.imagify', '.imagify-modal .close-btn', function() { | ||
var $modal = $( this ).closest( '.imagify-modal' ); | ||
|
||
if ( $modal.attr( 'aria-hidden' ) === 'false' ) { | ||
$modal.attr( 'tabindex', '0' ).focus().removeAttr( 'tabindex' ); | ||
} | ||
} ) | ||
// On click on dropped layer of modal, close modal. | ||
.on( 'click.imagify', '.imagify-modal', function( e ) { | ||
$( e.target ).filter( '.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' ); | ||
} ) | ||
// `Esc` key binding, close modal. | ||
.on( 'keydown.imagify', function( e ) { | ||
if ( 27 === e.keyCode && $( '.imagify-modal.modal-is-open' ).length > 0 ) { | ||
e.preventDefault(); | ||
// Trigger the event. | ||
$( '.imagify-modal.modal-is-open' ).find( '.close-btn' ).trigger( 'click.imagify' ); | ||
} | ||
} ); | ||
|
||
} )(jQuery, document, window); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.