jquery-slideoutpanel
Advanced tools
Comparing version 1.0.20 to 1.0.21
@@ -1,1 +0,1 @@ | ||
"use strict";function _slicedToArray(t,n){return _arrayWithHoles(t)||_iterableToArrayLimit(t,n)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(t,n){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var i=[],o=!0,e=!1,a=void 0;try{for(var s,r=t[Symbol.iterator]();!(o=(s=r.next()).done)&&(i.push(s.value),!n||i.length!==n);o=!0);}catch(t){e=!0,a=t}finally{try{o||null==r.return||r.return()}finally{if(e)throw a}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(F,C){var w,x="SlideOutPanel",T={bodyPush:!1,breakpoint:"768px",closeBtn:"✕",closeBtnSize:"",enableEscapeKey:!1,offsetTop:0,screenClose:!0,screenOpacity:"0.5",screenZindex:"9998",showScreen:!0,slideFrom:"right",transition:"ease",transitionDuration:"0.35s",width:"350px",afterClosed:function(){},afterOpen:function(){},beforeClosed:function(){},beforeOpen:function(){},rendered:function(){}};F.fn[x]=function(t){var o,e,a,s,n=this;if(void 0===F(this).attr("id"))return console.error("".concat(x,": Element not found. Element options:"),t),!1;function i(t,n){if(o=F("#".concat(t.id)),e=F("#".concat(t.id," header")),a=F("#".concat(t.id," section")),s=F("#".concat(t.id," footer")),o.hasClass("slide-out-panel")||o.addClass("slide-out-panel"),void 0===F(a).html())return y(t.id,"#".concat(t.id," <section> missing.")),!1;(w=w||{})[t.id]=t,w[t.id]=F.extend({},T,n);var i=w[t.id].transitionDuration;return i=i.replace("s",""),w[t.id].transitionDuration=parseFloat(i),g(),this._defaults=T,this._name=x,u(t.id,w[t.id]),!1}function r(t,n,i){var o,e,a="left"===n.slideFrom||"right"===n.slideFrom;return o="open"===i?"0":a?"-".concat(n.width):"-100%",e=a?{left:"right"===n.slideFrom?"initial":o,right:"left"===n.slideFrom?"initial":o}:{top:"bottom"===n.slideFrom?"initial":o,bottom:"top"===n.slideFrom?"initial":o},"open"===i?F("#".concat(t)).addClass("open"):F("#".concat(t)).removeClass("open"),F("#".concat(t)).css(e),0}function c(t,n,i){var o=0<arguments.length&&void 0!==t&&t,e=1<arguments.length&&void 0!==n&&n,a=2<arguments.length&&void 0!==i&&i;return void 0===e?y(o,"#".concat(o," doesn't exist.")):F(a).hasClass("slide-out-panel-screen")&&!e.screenClose||(o||e||a?(e.beforeClosed(),r(o,e,"close"),F('.slide-out-panel-screen[data-id="'.concat(o,'"')).removeClass("open").css({opacity:0,transitionDuration:"".concat(e.transitionDuration,"s")}),!e.bodyPush||"left"!==e.slideFrom&&"right"!==e.slideFrom||F("html").css({width:"100%"}),setTimeout(function(){F('.slide-out-panel-screen[data-id="'.concat(o,'"')).css({zIndex:"-".concat(e.screenZindex)}),e.afterClosed()},1e3*e.transitionDuration)):Object.entries(w).forEach(function(t){var n=_slicedToArray(t,2),i=n[0];n[1];c(i,w[i])})),!1}function d(t,n){var i=0<arguments.length&&void 0!==t&&t,o=1<arguments.length?n:void 0;return void 0===o?y(i,"#".concat(i," doesn't exist.")):(o.beforeOpen(),r(i,o,"open"),F('.slide-out-panel-screen[data-id="'.concat(i,'"]')).addClass("open").css({opacity:1,transitionDuration:"".concat(o.transitionDuration,"s"),zIndex:"".concat(o.screenZindex)}),!o.bodyPush||"left"!==o.slideFrom&&"right"!==o.slideFrom||F("html").css({position:"fixed",width:"calc(".concat(F("body").width(),"px - ").concat(o.width)}),setTimeout(function(){o.afterOpen()},1e3*o.transitionDuration)),0}var l,u=function(t,n){return h(t,n),void 0!==F(e).html()&&f(t,n),p(t,n),m(),n.showScreen&&b(t,n),n.rendered(),!1},h=function(t,n){var i="left"===n.slideFrom||"right"===n.slideFrom;o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({display:"block",height:0===n.offsetTop?"initial":"calc(100vh - ".concat(n.offsetTop,")"),top:"bottom"===n.slideFrom?"initial":n.offsetTop,transitionTimingFunction:"".concat(n.transition),transitionDuration:"".concat(n.transitionDuration,"s"),width:n.width}).attr("data-id",t),n.bodyPush&&i&&F("html").css({transition:"width ".concat(n.transitionDuration,"s ").concat(n.transition)}),i?(o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({left:"left"!==n.slideFrom?"initial":"-".concat(n.width),right:"right"!==n.slideFrom?"initial":"-".concat(n.width)}),!n.bodyPush||"left"!==n.slideFrom&&"right"!==n.slideFrom||F("html").addClass("slide-out-".concat(n.slideFrom))):o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({bottom:"bottom"!==n.slideFrom?"initial":"-100%",top:"top"!==n.slideFrom?"initial":"-100%",width:"100vw"})},f=function(t,n){void 0!==e.html()&&e.addClass("slide-out-header").append(v(t,n))},p=function(t,n){a.addClass("slide-out-content"),void 0===e.html()&&a.append(v(t,n))},m=function(){s.addClass("slide-out-footer")},v=function(t,n){var i="";return i+='<span class="close-slide-out-panel" data-id="'.concat(t,'" ').concat(n.closeBtnSize?'style="font-size: '.concat(n.closeBtnSize,'; display: block;"'):"",">"),i+=n.closeBtn,i+="</span>"},b=function(t,n){var i="";i+="<div ",i+='class="slide-out-panel-screen" ',i+='data-id="'.concat(t,'" '),i+='style="',i+="background-color: rgba(0, 0, 0, ".concat(n.screenOpacity,");"),i+="transition-timing-function: ".concat(n.transition,";"),i+="transition-duration: ".concat(n.transitionDuration,"s;"),i+="z-index: -".concat(n.screenZindex,";"),i+='">',i+="</div>",F("body").append(i)},y=function(t,n){var i=1<arguments.length&&void 0!==n&&n;return F("#".concat(t,', .slide-out-panel-screen[data-id="').concat(t,'"]')).remove(),i&&console.error("".concat(x,": ").concat(i)),!1},g=function(){for(var t=F(C).width(),n=0;n<Object.values(w).length;n+=1){var i=Object.values(w)[n];if(t<i.breakpoint.match(/(\d+)/)[0]&&i.bodyPush){F("html").addClass("slide-out-panel-static");break}F("html").removeClass("slide-out-panel-static"),i.bodyPush&&F(".slide-out-panel-container.".concat(i.slideFrom)).hasClass("open")&&F("html").css({width:"calc(".concat(t,"px - ").concat(i.width)})}};return F(C).on("resize",function(t){clearTimeout(l),l=setTimeout(function(){g()},250)}),this.close=function(){var t=F(this).attr("id");c(t,w[t])},F("body").off().on("click",".close-slide-out-panel, .slide-out-panel-screen",function(){var t=F(this).attr("data-id");return c(t,w[t],this),!1}),F("body").on("keyup",function(t){27===t.keyCode&&c()}),this.destroy=function(){var t=F(n).attr("id");y(t)},this.open=function(){var t=F(this).attr("id");F("#".concat(t)).hasClass("open")||d(t,w[t])},this.toggle=function(){var t=F(this).attr("id");!function(t){var n=0<arguments.length&&void 0!==t&&t;(F("#".concat(n)).hasClass("open")?c:d)(n,w[n])}(t,w[t])},this.each(function(){F.data(this,"plugin-".concat(x,"-").concat(F(this).attr("id")),new i(this,t))})}}(jQuery,window); | ||
"use strict";function _slicedToArray(t,n){return _arrayWithHoles(t)||_iterableToArrayLimit(t,n)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(t,n){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t)){var i=[],o=!0,e=!1,a=void 0;try{for(var s,r=t[Symbol.iterator]();!(o=(s=r.next()).done)&&(i.push(s.value),!n||i.length!==n);o=!0);}catch(t){e=!0,a=t}finally{try{o||null==r.return||r.return()}finally{if(e)throw a}}return i}}function _arrayWithHoles(t){if(Array.isArray(t))return t}!function(F,C){var w,x="SlideOutPanel",T={bodyPush:!1,breakpoint:"768px",closeBtn:"✕",closeBtnSize:"",enableEscapeKey:!1,offsetTop:0,screenClose:!0,screenOpacity:"0.5",screenZindex:"9998",showScreen:!0,slideFrom:"right",transition:"ease",transitionDuration:"0.35s",width:"350px",afterClosed:function(){},afterOpen:function(){},beforeClosed:function(){},beforeOpen:function(){},rendered:function(){}},D=!1;F.fn[x]=function(t){var o,e,a,s,n=this;if(void 0===F(this).attr("id"))return console.error("".concat(x,": Element not found. Element options:"),t),!1;function i(t,n){if(o=F("#".concat(t.id)),e=F("#".concat(t.id," header")),a=F("#".concat(t.id," section")),s=F("#".concat(t.id," footer")),o.hasClass("slide-out-panel")||o.addClass("slide-out-panel"),void 0===F(a).html())return y(t.id,"#".concat(t.id," <section> missing.")),!1;(w=w||{})[t.id]=t,w[t.id]=F.extend({},T,n);var i=w[t.id].transitionDuration;return i=i.replace("s",""),w[t.id].transitionDuration=parseFloat(i),g(),this._defaults=T,this._name=x,u(t.id,w[t.id]),!1}function r(t,n,i){var o,e,a="left"===n.slideFrom||"right"===n.slideFrom;return o="open"===i?"0":a?"-".concat(n.width):"-100%",e=a?{left:"right"===n.slideFrom?"initial":o,right:"left"===n.slideFrom?"initial":o}:{top:"bottom"===n.slideFrom?"initial":o,bottom:"top"===n.slideFrom?"initial":o},"open"===i?F("#".concat(t)).addClass("open"):F("#".concat(t)).removeClass("open"),F("#".concat(t)).css(e),0}function c(t,n,i){var o=0<arguments.length&&void 0!==t&&t,e=1<arguments.length&&void 0!==n&&n,a=2<arguments.length&&void 0!==i&&i;return void 0===e?y(o,"#".concat(o," doesn't exist.")):F(a).hasClass("slide-out-panel-screen")&&!e.screenClose||(o||e||a?(e.beforeClosed(),r(o,e,"close"),F('.slide-out-panel-screen[data-id="'.concat(o,'"')).removeClass("open").css({opacity:0,transitionDuration:"".concat(e.transitionDuration,"s")}),!e.bodyPush||"left"!==e.slideFrom&&"right"!==e.slideFrom||F("html").css({width:"100%"}),setTimeout(function(){F('.slide-out-panel-screen[data-id="'.concat(o,'"')).css({zIndex:"-".concat(e.screenZindex)}),e.afterClosed()},1e3*e.transitionDuration)):Object.entries(w).forEach(function(t){var n=_slicedToArray(t,2),i=n[0];n[1];c(i,w[i])})),!1}function d(t,n){var i=0<arguments.length&&void 0!==t&&t,o=1<arguments.length?n:void 0;return void 0===o?y(i,"#".concat(i," doesn't exist.")):(o.beforeOpen(),r(i,o,"open"),F('.slide-out-panel-screen[data-id="'.concat(i,'"]')).addClass("open").css({opacity:1,transitionDuration:"".concat(o.transitionDuration,"s"),zIndex:"".concat(o.screenZindex)}),!o.bodyPush||"left"!==o.slideFrom&&"right"!==o.slideFrom||F("html").css({position:"fixed",width:"calc(".concat(F("body").width(),"px - ").concat(o.width)}),setTimeout(function(){o.afterOpen()},1e3*o.transitionDuration)),0}var l,u=function(t,n){return h(t,n),void 0!==F(e).html()&&f(t,n),p(t,n),m(),n.showScreen&&b(t,n),n.rendered(),!1},h=function(t,n){var i="left"===n.slideFrom||"right"===n.slideFrom;o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({display:"block",height:0===n.offsetTop?"initial":"calc(100vh - ".concat(n.offsetTop,")"),top:"bottom"===n.slideFrom?"initial":n.offsetTop,transitionTimingFunction:"".concat(n.transition),transitionDuration:"".concat(n.transitionDuration,"s"),width:n.width}).attr("data-id",t),n.bodyPush&&i&&F("html").css({transition:"width ".concat(n.transitionDuration,"s ").concat(n.transition)}),i?(o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({left:"left"!==n.slideFrom?"initial":"-".concat(n.width),right:"right"!==n.slideFrom?"initial":"-".concat(n.width)}),!n.bodyPush||"left"!==n.slideFrom&&"right"!==n.slideFrom||F("html").addClass("slide-out-".concat(n.slideFrom))):o.addClass("slide-out-panel-container ".concat(n.slideFrom)).css({bottom:"bottom"!==n.slideFrom?"initial":"-100%",top:"top"!==n.slideFrom?"initial":"-100%",width:"100vw"})},f=function(t,n){void 0!==e.html()&&e.addClass("slide-out-header").append(v(t,n))},p=function(t,n){a.addClass("slide-out-content"),void 0===e.html()&&a.append(v(t,n))},m=function(){s.addClass("slide-out-footer")},v=function(t,n){var i="";return i+='<span class="close-slide-out-panel" data-id="'.concat(t,'" ').concat(n.closeBtnSize?'style="font-size: '.concat(n.closeBtnSize,'; display: block;"'):"",">"),i+=n.closeBtn,i+="</span>"},b=function(t,n){var i="";i+="<div ",i+='class="slide-out-panel-screen" ',i+='data-id="'.concat(t,'" '),i+='style="',i+="background-color: rgba(0, 0, 0, ".concat(n.screenOpacity,");"),i+="transition-timing-function: ".concat(n.transition,";"),i+="transition-duration: ".concat(n.transitionDuration,"s;"),i+="z-index: -".concat(n.screenZindex,";"),i+='">',i+="</div>",F("body").append(i)},y=function(t,n){var i=1<arguments.length&&void 0!==n&&n;return F("#".concat(t,', .slide-out-panel-screen[data-id="').concat(t,'"]')).remove(),i&&console.error("".concat(x,": ").concat(i)),!1},g=function(){for(var t=F(C).width(),n=0;n<Object.values(w).length;n+=1){var i=Object.values(w)[n];if(t<i.breakpoint.match(/(\d+)/)[0]&&i.bodyPush){F("html").addClass("slide-out-panel-static");break}F("html").removeClass("slide-out-panel-static"),i.bodyPush&&F(".slide-out-panel-container.".concat(i.slideFrom)).hasClass("open")&&F("html").css({width:"calc(".concat(t,"px - ").concat(i.width)})}};return F(C).on("resize",function(t){clearTimeout(l),l=setTimeout(function(){g()},250)}),this.close=function(){var t=F(this).attr("id");c(t,w[t])},D||(F("body").on("click",".close-slide-out-panel, .slide-out-panel-screen",function(){var t=F(this).attr("data-id");return c(t,w[t],this),!1}),D=!0),F("body").on("keyup",function(t){27===t.keyCode&&c()}),this.destroy=function(){var t=F(n).attr("id");y(t)},this.open=function(){var t=F(this).attr("id");F("#".concat(t)).hasClass("open")||d(t,w[t])},this.toggle=function(){var t=F(this).attr("id");!function(t){var n=0<arguments.length&&void 0!==t&&t;(F("#".concat(n)).hasClass("open")?c:d)(n,w[n])}(t,w[t])},this.each(function(){F.data(this,"plugin-".concat(x,"-").concat(F(this).attr("id")),new i(this,t))})}}(jQuery,window); |
{ | ||
"name": "jquery-slideoutpanel", | ||
"version": "1.0.20", | ||
"version": "1.0.21", | ||
"description": "jQuery SlideOutPanel is a jQuery Plugin to add a sliding out panel.", | ||
@@ -5,0 +5,0 @@ "main": "Gruntfile.js", |
@@ -5,2 +5,3 @@ | ||
[![NPM_PACKAGE](https://img.shields.io/badge/NPM%20-Package-%23cb3837)](https://www.npmjs.com/package/jquery-slideoutpanel) | ||
@@ -225,3 +226,3 @@ Simple jQuery Plugin to add a sliding out panel. | ||
[CHANGELOG](https://github.com/webdevnerdstuff/jquery-SlideOutPanel/blob/master/CHANGELOG.txt) | ||
[CHANGELOG](https://github.com/webdevnerdstuff/jquery-SlideOutPanel/blob/master/CHANGELOG.md) | ||
@@ -228,0 +229,0 @@ <br> |
@@ -29,3 +29,4 @@ (function($, window) { | ||
let globalSettings; | ||
let globalSettings; | ||
let pluginLoaded = false; | ||
@@ -397,9 +398,13 @@ // ---------------------------------------------------- PLUGIN DEFINITION // | ||
// Click to close // | ||
$('body').off().on('click', '.close-slide-out-panel, .slide-out-panel-screen', function() { | ||
const closeBtnElemId = $(this).attr('data-id'); | ||
closePanel(closeBtnElemId, globalSettings[closeBtnElemId], this); | ||
return false; | ||
}); | ||
// Click to close // | ||
if (!pluginLoaded) { | ||
$('body').on('click', '.close-slide-out-panel, .slide-out-panel-screen', function() { | ||
const closeBtnElemId = $(this).attr('data-id'); | ||
closePanel(closeBtnElemId, globalSettings[closeBtnElemId], this); | ||
return false; | ||
}); | ||
pluginLoaded = true; | ||
} | ||
// -------------------------- Escape Key to Close | ||
@@ -406,0 +411,0 @@ $('body').on('keyup', e => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91086
18
1064
235