view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Materialize/css/materialize.css view on Meta::CPAN
padding: 4px 6px;
height: 56px;
width: 100%;
}
.modal .modal-footer .btn, .modal .modal-footer .btn-large, .modal .modal-footer .btn-flat {
float: right;
margin: 6px 0;
}
.lean-overlay {
position: fixed;
z-index: 999;
top: -100px;
left: 0;
bottom: 0;
right: 0;
height: 125%;
width: 100%;
background: #000;
display: none;
lib/Mojolicious/Plugin/Materialize/css/materialize.css view on Meta::CPAN
.materialboxed:hover:not(.active) {
opacity: .8;
}
.materialboxed.active {
cursor: -webkit-zoom-out;
cursor: zoom-out;
}
#materialbox-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #292929;
z-index: 1000;
will-change: opacity;
}
lib/Mojolicious/Plugin/Materialize/css/materialize.css view on Meta::CPAN
.side-nav .collapsible-body li.active,
.side-nav.fixed .collapsible-body li.active {
background-color: #ee6e73;
}
.side-nav .collapsible-body li.active a,
.side-nav.fixed .collapsible-body li.active a {
color: #fff;
}
#sidenav-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 120vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 997;
will-change: opacity;
}
lib/Mojolicious/Plugin/Materialize/css/materialize.css view on Meta::CPAN
*/
.picker__holder,
.picker__frame {
bottom: 0;
left: 0;
right: 0;
top: 100%;
}
/**
* The holder should overlay the entire screen.
*/
.picker__holder {
position: fixed;
transition: background 0.15s ease-out, top 0s 0.15s;
-webkit-backface-visibility: hidden;
}
/**
* The frame that bounds the box contents of the picker.
*/
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
$(document).ready(function(){
$('.dropdown-button').dropdown();
});
}( jQuery ));
;(function($) {
var _stack = 0,
_lastID = 0,
_generateID = function() {
_lastID++;
return 'materialize-lean-overlay-' + _lastID;
};
$.fn.extend({
openModal: function(options) {
var $body = $('body');
var oldWidth = $body.innerWidth();
$body.css('overflow', 'hidden');
$body.width(oldWidth);
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
dismissible: true,
starting_top: '4%',
ending_top: '10%'
};
var $modal = $(this);
if ($modal.hasClass('open')) {
return;
}
var overlayID = _generateID();
var $overlay = $('<div class="lean-overlay"></div>');
lStack = (++_stack);
// Store a reference of the overlay
$overlay.attr('id', overlayID).css('z-index', 1000 + lStack * 2);
$modal.data('overlay-id', overlayID).css('z-index', 1000 + lStack * 2 + 1);
$modal.addClass('open');
$("body").append($overlay);
// Override defaults
options = $.extend(defaults, options);
if (options.dismissible) {
$overlay.click(function() {
$modal.closeModal(options);
});
// Return on ESC
$(document).on('keyup.leanModal' + overlayID, function(e) {
if (e.keyCode === 27) { // ESC key
$modal.closeModal(options);
}
});
}
$modal.find(".modal-close").on('click.close', function(e) {
$modal.closeModal(options);
});
$overlay.css({ display : "block", opacity : 0 });
$modal.css({
display : "block",
opacity: 0
});
$overlay.velocity({opacity: options.opacity}, {duration: options.in_duration, queue: false, ease: "easeOutCubic"});
$modal.data('associated-overlay', $overlay[0]);
// Define Bottom Sheet animation
if ($modal.hasClass('bottom-sheet')) {
$modal.velocity({bottom: "0", opacity: 1}, {
duration: options.in_duration,
queue: false,
ease: "easeOutCubic",
// Handle modal ready callback
complete: function() {
if (typeof(options.ready) === "function") {
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
}
});
$.fn.extend({
closeModal: function(options) {
var defaults = {
out_duration: 250,
complete: undefined
};
var $modal = $(this);
var overlayID = $modal.data('overlay-id');
var $overlay = $('#' + overlayID);
$modal.removeClass('open');
options = $.extend(defaults, options);
// Enable scrolling
$('body').css({
overflow: '',
width: ''
});
$modal.find('.modal-close').off('click.close');
$(document).off('keyup.leanModal' + overlayID);
$overlay.velocity( { opacity: 0}, {duration: options.out_duration, queue: false, ease: "easeOutQuart"});
// Define Bottom Sheet animation
if ($modal.hasClass('bottom-sheet')) {
$modal.velocity({bottom: "-100%", opacity: 0}, {
duration: options.out_duration,
queue: false,
ease: "easeOutCubic",
// Handle modal ready callback
complete: function() {
$overlay.css({display:"none"});
// Call complete callback
if (typeof(options.complete) === "function") {
options.complete();
}
$overlay.remove();
_stack--;
}
});
}
else {
$modal.velocity(
{ top: options.starting_top, opacity: 0, scaleX: 0.7}, {
duration: options.out_duration,
complete:
function() {
$(this).css('display', 'none');
// Call complete callback
if (typeof(options.complete) === "function") {
options.complete();
}
$overlay.remove();
_stack--;
}
}
);
}
}
});
$.fn.extend({
leanModal: function(option) {
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
$.fn.materialbox = function () {
return this.each(function() {
if ($(this).hasClass('initialized')) {
return;
}
$(this).addClass('initialized');
var overlayActive = false;
var doneAnimating = true;
var inDuration = 275;
var outDuration = 200;
var origin = $(this);
var placeholder = $('<div></div>').addClass('material-placeholder');
var originalWidth = 0;
var originalHeight = 0;
var ancestorsChanged;
var ancestor;
origin.wrap(placeholder);
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
var windowHeight = window.innerHeight;
var originalWidth = origin.width();
var originalHeight = origin.height();
// If already modal, return to original
if (doneAnimating === false) {
returnToOriginal();
return false;
}
else if (overlayActive && doneAnimating===true) {
returnToOriginal();
return false;
}
// Set states
doneAnimating = false;
origin.addClass('active');
overlayActive = true;
// Set positioning for placeholder
placeholder.css({
width: placeholder[0].getBoundingClientRect().width,
height: placeholder[0].getBoundingClientRect().height,
position: 'relative',
top: 0,
left: 0
});
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
}
}
ancestor = ancestor.parentNode;
}
// Set css on origin
origin.css({position: 'absolute', 'z-index': 1000})
.data('width', originalWidth)
.data('height', originalHeight);
// Add overlay
var overlay = $('<div id="materialbox-overlay"></div>')
.css({
opacity: 0
})
.click(function(){
if (doneAnimating === true)
returnToOriginal();
});
// Animate Overlay
// Put before in origin image to preserve z-index layering.
origin.before(overlay);
overlay.velocity({opacity: 1},
{duration: inDuration, queue: false, easing: 'easeOutQuad'} );
// Add and animate caption if it exists
if (origin.data('caption') !== "") {
var $photo_caption = $('<div class="materialbox-caption"></div>');
$photo_caption.text(origin.data('caption'));
$('body').append($photo_caption);
$photo_caption.css({ "display": "inline" });
$photo_caption.velocity({opacity: 1}, {duration: inDuration, queue: false, easing: 'easeOutQuad'});
}
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
complete: function(){doneAnimating = true;}
}
); // End Velocity
}
}); // End origin on click
// Return on scroll
$(window).scroll(function() {
if (overlayActive) {
returnToOriginal();
}
});
// Return on ESC
$(document).keyup(function(e) {
if (e.keyCode === 27 && doneAnimating === true) { // ESC key
if (overlayActive) {
returnToOriginal();
}
}
});
// This function returns the modaled image to the original spot
function returnToOriginal() {
doneAnimating = false;
var placeholder = origin.parent('.material-placeholder');
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
var originalWidth = origin.data('width');
var originalHeight = origin.data('height');
origin.velocity("stop", true);
$('#materialbox-overlay').velocity("stop", true);
$('.materialbox-caption').velocity("stop", true);
$('#materialbox-overlay').velocity({opacity: 0}, {
duration: outDuration, // Delay prevents animation overlapping
queue: false, easing: 'easeOutQuad',
complete: function(){
// Remove Overlay
overlayActive = false;
$(this).remove();
}
});
// Resize Image
origin.velocity(
{
width: originalWidth,
height: originalHeight,
left: 0,
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
if (window.innerWidth > 992) {
menu_id.css('transform', 'translateX(0)');
}
}
// Window resize to reset on large screens fixed
if (menu_id.hasClass('fixed')) {
$(window).resize( function() {
if (window.innerWidth > 992) {
// Close menu if window is resized bigger than 992 and user has fixed sidenav
if ($('#sidenav-overlay').length !== 0 && menuOut) {
removeMenu(true);
}
else {
// menu_id.removeAttr('style');
menu_id.css('transform', 'translateX(0%)');
// menu_id.css('width', options.menuWidth);
}
}
else if (menuOut === false){
if (options.edge === 'left') {
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
function removeMenu(restoreNav) {
panning = false;
menuOut = false;
// Reenable scrolling
$('body').css({
overflow: '',
width: ''
});
$('#sidenav-overlay').velocity({opacity: 0}, {duration: 200,
queue: false, easing: 'easeOutQuad',
complete: function() {
$(this).remove();
} });
if (options.edge === 'left') {
// Reset phantom div
dragTarget.css({width: '', right: '', left: '0'});
menu_id.velocity(
{'translateX': '-100%'},
{ duration: 200,
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
var x = e.gesture.center.x;
var y = e.gesture.center.y;
var velocityX = e.gesture.velocityX;
// Disable Scrolling
var $body = $('body');
var oldWidth = $body.innerWidth();
$body.css('overflow', 'hidden');
$body.width(oldWidth);
// If overlay does not exist, create one and if it is clicked, close menu
if ($('#sidenav-overlay').length === 0) {
var overlay = $('<div id="sidenav-overlay"></div>');
overlay.css('opacity', 0).click( function(){
removeMenu();
});
$('body').append(overlay);
}
// Keep within boundaries
if (options.edge === 'left') {
if (x > options.menuWidth) { x = options.menuWidth; }
else if (x < 0) { x = 0; }
}
if (options.edge === 'left') {
// Left Direction
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
}
var rightPos = (x - options.menuWidth / 2);
if (rightPos < 0) {
rightPos = 0;
}
menu_id.css('transform', 'translateX(' + rightPos + 'px)');
}
// Percentage overlay
var overlayPerc;
if (options.edge === 'left') {
overlayPerc = x / options.menuWidth;
$('#sidenav-overlay').velocity({opacity: overlayPerc }, {duration: 10, queue: false, easing: 'easeOutQuad'});
}
else {
overlayPerc = Math.abs((x - window.innerWidth) / options.menuWidth);
$('#sidenav-overlay').velocity({opacity: overlayPerc }, {duration: 10, queue: false, easing: 'easeOutQuad'});
}
}
}).bind('panend', function(e) {
if (e.gesture.pointerType == "touch") {
var velocityX = e.gesture.velocityX;
var x = e.gesture.center.x;
var leftPos = x - options.menuWidth;
var rightPos = x - options.menuWidth / 2;
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
panning = false;
if (options.edge === 'left') {
// If velocityX <= 0.3 then the user is flinging the menu closed so ignore menuOut
if ((menuOut && velocityX <= 0.3) || velocityX < -0.5) {
// Return menu to open
if (leftPos !== 0) {
menu_id.velocity({'translateX': [0, leftPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
}
$('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
dragTarget.css({width: '50%', right: 0, left: ''});
menuOut = true;
}
else if (!menuOut || velocityX > 0.3) {
// Enable Scrolling
$('body').css({
overflow: '',
width: ''
});
// Slide menu closed
menu_id.velocity({'translateX': [-1 * options.menuWidth - 10, leftPos]}, {duration: 200, queue: false, easing: 'easeOutQuad'});
$('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
complete: function () {
$(this).remove();
}});
dragTarget.css({width: '10px', right: '', left: 0});
}
}
else {
if ((menuOut && velocityX >= -0.3) || velocityX > 0.5) {
// Return menu to open
if (rightPos !== 0) {
menu_id.velocity({'translateX': [0, rightPos]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
}
$('#sidenav-overlay').velocity({opacity: 1 }, {duration: 50, queue: false, easing: 'easeOutQuad'});
dragTarget.css({width: '50%', right: '', left: 0});
menuOut = true;
}
else if (!menuOut || velocityX < -0.3) {
// Enable Scrolling
$('body').css({
overflow: '',
width: ''
});
// Slide menu closed
menu_id.velocity({'translateX': [options.menuWidth + 10, rightPos]}, {duration: 200, queue: false, easing: 'easeOutQuad'});
$('#sidenav-overlay').velocity({opacity: 0 }, {duration: 200, queue: false, easing: 'easeOutQuad',
complete: function () {
$(this).remove();
}});
dragTarget.css({width: '10px', right: 0, left: ''});
}
}
}
});
lib/Mojolicious/Plugin/Materialize/js/materialize.js view on Meta::CPAN
if (options.edge === 'left') {
dragTarget.css({width: '50%', right: 0, left: ''});
menu_id.velocity({'translateX': [0, -1 * options.menuWidth]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
}
else {
dragTarget.css({width: '50%', right: '', left: 0});
menu_id.velocity({'translateX': [0, options.menuWidth]}, {duration: 300, queue: false, easing: 'easeOutQuad'});
}
var overlay = $('<div id="sidenav-overlay"></div>');
overlay.css('opacity', 0)
.click(function(){
menuOut = false;
panning = false;
removeMenu();
overlay.velocity({opacity: 0}, {duration: 300, queue: false, easing: 'easeOutQuad',
complete: function() {
$(this).remove();
} });
});
$('body').append(overlay);
overlay.velocity({opacity: 1}, {duration: 300, queue: false, easing: 'easeOutQuad',
complete: function () {
menuOut = true;
panning = false;
}
});
}
return false;
});
});
},
show : function() {
this.trigger('click');
},
hide : function() {
$('#sidenav-overlay').trigger('click');
}
};
$.fn.sideNav = function(methodOrOptions) {
if ( methods[methodOrOptions] ) {
return methods[ methodOrOptions ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
// Default to "init"
return methods.init.apply( this, arguments );