Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zebra_dialog

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zebra_dialog - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

examples/browserstack.png

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## version 1.4.1 (October 13, 2017)
- fixed bug where dialog box height could exceed viewport height; see [#8](https://github.com/stefangabos/Zebra_Dialog/issues/8)
- fixed scrolling on iPhone; see [#9](https://github.com/stefangabos/Zebra_Dialog/issues/9)
## version 1.4.0 (June 04, 2017)

@@ -2,0 +7,0 @@

2

dist/zebra_dialog.min.js

@@ -1,1 +0,1 @@

!function(t){"use strict";t.Zebra_Dialog=function(){var e,s={animation_speed_hide:250,animation_speed_show:0,auto_close:!1,buttons:!0,center_buttons:!1,custom_class:!1,keyboard:!0,max_height:0,message:"",modal:!0,overlay_close:!0,overlay_opacity:".9",position:"center",reposition_speed:500,show_close_button:!0,source:!1,title:"",type:"information",vcenter_short_message:!0,width:0,onClose:null},i=this,o={},n=function(){var e,s,o,n=t(window).width(),r=t(window).height(),g=i.dialog.width(),c=i.dialog.height(),d={left:0,top:0,right:n-g,bottom:r-c,center:(n-g)/2,middle:(r-c)/2};i.dialog_left=void 0,i.dialog_top=void 0,t.isArray(i.settings.position)&&2===i.settings.position.length&&"string"==typeof i.settings.position[0]&&i.settings.position[0].match(/^(left|right|center)[\s0-9\+\-]*$/)&&"string"==typeof i.settings.position[1]&&i.settings.position[1].match(/^(top|bottom|middle)[\s0-9\+\-]*$/)&&(i.settings.position[0]=i.settings.position[0].toLowerCase(),i.settings.position[1]=i.settings.position[1].toLowerCase(),t.each(d,function(t,e){var s,o;for(s=0;s<2;s++)(o=i.settings.position[s].replace(t,e))!==i.settings.position[s]&&(0===s?i.dialog_left=l(o):i.dialog_top=l(o))})),void 0!==i.dialog_left&&void 0!==i.dialog_top||(i.dialog_left=d.center,i.dialog_top=d.middle),i.settings.vcenter_short_message&&(s=(e=i.message.find("div:first")).height())<(o=i.message.height())&&e.css({"padding-top":(o-s)/2}),"boolean"==typeof arguments[0]&&!1===arguments[0]||0===i.settings.reposition_speed?i.dialog.css({left:i.dialog_left,top:i.dialog_top,visibility:"visible",opacity:0}).animate({opacity:1},i.settings.animation_speed_show):(i.dialog.stop(!0),i.dialog.css("visibility","visible").animate({left:i.dialog_left,top:i.dialog_top},i.settings.reposition_speed)),i.dialog.find("a[class^=ZebraDialog_Button]:first").focus(),i.isIE6&&setTimeout(a,500)},a=function(){var e=t(window).scrollTop(),s=t(window).scrollLeft();i.settings.modal&&i.overlay.css({top:e,left:s}),i.dialog.css({left:i.dialog_left+s,top:i.dialog_top+e})},r=function(){if(!0!==i.settings.buttons&&!t.isArray(i.settings.buttons))return!1;if(!0===i.settings.buttons)switch(i.settings.type){case"question":i.settings.buttons=["Yes","No"];break;default:i.settings.buttons=["Ok"]}return i.settings.buttons},g=function(){switch(i.settings.type){case"confirmation":case"error":case"information":case"question":case"warning":return i.settings.type.charAt(0).toUpperCase()+i.settings.type.slice(1).toLowerCase();default:return!1}},l=function(t){var e=0;for(t=t.replace(/\s/g,"").match(/[+\-]?([0-9\.\s]+)/g)||[];t.length;)e+=parseFloat(t.shift());return e},c={init:function(){this.name=this.searchString(this.dataBrowser)||"",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||""},searchString:function(t){var e,s,i;for(e=0;e<t.length;e++)if(s=t[e].string,i=t[e].prop,this.versionSearchString=t[e].versionSearch||t[e].identity,s){if(-1!==s.indexOf(t[e].subString))return t[e].identity}else if(i)return t[e].identity},searchVersion:function(t){var e=t.indexOf(this.versionSearchString);if(-1!==e)return parseFloat(t.substring(e+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"MSIE",identity:"explorer",versionSearch:"MSIE"}]};return i.settings={},"string"==typeof arguments[0]&&(o.message=arguments[0]),"object"!=typeof arguments[0]&&"object"!=typeof arguments[1]||(o=t.extend(o,"object"==typeof arguments[0]?arguments[0]:arguments[1])),i.init=function(){var l,d,p,u,h,f,_,m,v,b,y,w;if(i.settings=t.extend({},s,o),i.isIE6="explorer"===c.name&&6===c.version||!1,i.settings.modal&&(i.overlay=t("<div>",{class:"ZebraDialogOverlay"}).css({position:i.isIE6?"absolute":"fixed",left:0,top:0,opacity:i.settings.overlay_opacity}),i.settings.overlay_close&&i.overlay.on("click",function(){i.close()}),i.overlay.appendTo("body")),i.dialog=t("<div>",{class:"ZebraDialog"+(i.settings.custom_class?" "+i.settings.custom_class:"")}).css({position:i.isIE6?"absolute":"fixed",left:0,top:0,visibility:"hidden"}),!i.settings.buttons&&i.settings.auto_close&&i.dialog.attr("id","ZebraDialog_"+Math.floor(9999999*Math.random())),y=parseInt(i.settings.width,10),!isNaN(y)&&y===i.settings.width&&y.toString()===i.settings.width.toString()&&y>0&&i.dialog.css({width:i.settings.width}),i.settings.title&&(b=t("<h3>",{class:"ZebraDialog_Title"}).html(i.settings.title).appendTo(i.dialog)),u=r(),d=t("<div>",{class:"ZebraDialog_BodyOuter"+(i.settings.title?"":" ZebraDialog_NoTitle")+(u?"":" ZebraDialog_NoButtons")}).appendTo(i.dialog),i.message=t("<div>",{class:"ZebraDialog_Body"+(!1!==g()?" ZebraDialog_Icon ZebraDialog_"+g():"")}),i.settings.max_height>0&&(i.message.css("max-height",i.settings.max_height),i.isIE6&&i.message.attr("style","height: expression(this.scrollHeight > "+i.settings.max_height+' ? "'+i.settings.max_height+'px" : "85px")')),i.settings.vcenter_short_message?t("<div>").html(i.settings.message).appendTo(i.message):i.message.html(i.settings.message),i.settings.source&&"object"==typeof i.settings.source){h=i.settings.vcenter_short_message?t("div:first",i.message):i.message;for(w in i.settings.source)switch(w){case"ajax":l="string"==typeof i.settings.source[w]?{url:i.settings.source[w]}:i.settings.source[w],v=t("<div>").attr("class","ZebraDialog_Preloader").appendTo(h),l.success=function(t){v.remove(),h.append(t),n(!1)},t.ajax(l);break;case"iframe":_={width:"100%",height:"100%",marginheight:"0",marginwidth:"0",frameborder:"0"},m=t.extend(_,"string"==typeof i.settings.source[w]?{src:i.settings.source[w]}:i.settings.source[w]),h.append(t("<iframe>").attr(m));break;case"inline":h.append(i.settings.source[w])}}return i.message.appendTo(d),u&&(u.reverse(),p=t("<div>",{class:"ZebraDialog_Buttons"}).appendTo(i.dialog),t.each(u,function(e,s){var o=t("<a>",{href:"javascript:void(0)",class:"ZebraDialog_Button_"+e});t.isPlainObject(s)?o.html(s.caption):o.html(s),o.on("click",function(){var t=!0;void 0!==s.callback&&(t=s.callback(i.dialog)),!1!==t&&i.close(void 0!==s.caption?s.caption:s)}),o.appendTo(p)}),p.wrap(t("<div>").addClass("ZebraDialog_ButtonsOuter"+(i.settings.center_buttons?" ZebraDialog_Buttons_Centered":"")))),i.dialog.appendTo("body"),i.settings.show_close_button&&(f=t('<a href="javascript:void(0)" class="ZebraDialog_Close">&times;</a>').on("click",function(t){t.preventDefault(),i.close()}).appendTo(b||i.message),b&&f.css({right:parseInt(b.css("paddingRight"),10),top:(parseInt(b.css("height"),10)+parseInt(b.css("paddingTop"),10)+parseInt(b.css("paddingBottom"),10)-f.height())/2})),t(window).on("resize.Zebra_Dialog",function(){clearTimeout(e),e=setTimeout(function(){n()},100)}),i.settings.keyboard&&t(document).on("keyup.Zebra_Dialog",function(t){return 27===t.which&&i.close(),!0}),i.isIE6&&t(window).on("scroll.Zebra_Dialog",function(){a()}),!1!==i.settings.auto_close&&(i.dialog.on("click",function(){clearTimeout(i.timeout),i.close()}),i.timeout=setTimeout(i.close,i.settings.auto_close)),n(!1),i},i.close=function(e){t(document).unbind(".Zebra_Dialog"),t(window).unbind(".Zebra_Dialog"),i.overlay&&i.overlay.animate({opacity:0},i.settings.animation_speed_hide,function(){i.overlay.remove()}),i.dialog.animate({top:0,opacity:0},i.settings.animation_speed_hide,function(){i.dialog.remove(),i.settings.onClose&&"function"==typeof i.settings.onClose&&i.settings.onClose(void 0!==e?e:"")})},c.init(),i.init()}}(jQuery);
!function(t){"use strict";t.Zebra_Dialog=function(){var e,s={animation_speed_hide:250,animation_speed_show:0,auto_close:!1,buttons:!0,center_buttons:!1,custom_class:!1,keyboard:!0,max_height:0,message:"",modal:!0,overlay_close:!0,overlay_opacity:".9",position:"center",reposition_speed:500,show_close_button:!0,source:!1,title:"",type:"information",vcenter_short_message:!0,width:0,onClose:null},i=this,o={},a=function(){var e,s,o,a=t(window).width(),r=t(window).height(),g=i.dialog.width(),c=i.dialog.height(),d={left:0,top:0,right:a-g,bottom:r-c,center:(a-g)/2,middle:(r-c)/2};i.dialog_left=void 0,i.dialog_top=void 0,t.isArray(i.settings.position)&&2===i.settings.position.length&&"string"==typeof i.settings.position[0]&&i.settings.position[0].match(/^(left|right|center)[\s0-9\+\-]*$/)&&"string"==typeof i.settings.position[1]&&i.settings.position[1].match(/^(top|bottom|middle)[\s0-9\+\-]*$/)&&(i.settings.position[0]=i.settings.position[0].toLowerCase(),i.settings.position[1]=i.settings.position[1].toLowerCase(),t.each(d,function(t,e){var s,o;for(s=0;s<2;s++)(o=i.settings.position[s].replace(t,e))!==i.settings.position[s]&&(0===s?i.dialog_left=l(o):i.dialog_top=l(o))})),void 0!==i.dialog_left&&void 0!==i.dialog_top||(i.dialog_left=d.center,i.dialog_top=d.middle),i.dialog_top<0&&(i.dialog_top=0),c>r&&i.message.css("height",r-(t(".ZebraDialog_Title",i.dialog)?t(".ZebraDialog_Title",i.dialog).outerHeight():0)-(t(".ZebraDialog_ButtonsOuter",i.dialog)?t(".ZebraDialog_ButtonsOuter",i.dialog).outerHeight():0)-(parseFloat(i.message.css("paddingTop"))||0)-(parseFloat(i.message.css("paddingBottom"))||0)-(parseFloat(i.message.css("borderTopWidth"))||0)-(parseFloat(i.message.css("borderBottomWidth"))||0)),i.settings.vcenter_short_message&&(s=(e=i.message.find("div:first")).height())<(o=i.message.height())&&e.css({"padding-top":(o-s)/2}),"boolean"==typeof arguments[0]&&!1===arguments[0]||0===i.settings.reposition_speed?i.dialog.css({left:i.dialog_left,top:i.dialog_top,visibility:"visible",opacity:0}).animate({opacity:1},i.settings.animation_speed_show):(i.dialog.stop(!0),i.dialog.css("visibility","visible").animate({left:i.dialog_left,top:i.dialog_top},i.settings.reposition_speed)),i.dialog.find("a[class^=ZebraDialog_Button]:first").focus(),i.isIE6&&setTimeout(n,500)},n=function(){var e=t(window).scrollTop(),s=t(window).scrollLeft();i.settings.modal&&i.overlay.css({top:e,left:s}),i.dialog.css({left:i.dialog_left+s,top:i.dialog_top+e})},r=function(){if(!0!==i.settings.buttons&&!t.isArray(i.settings.buttons))return!1;if(!0===i.settings.buttons)switch(i.settings.type){case"question":i.settings.buttons=["Yes","No"];break;default:i.settings.buttons=["Ok"]}return i.settings.buttons},g=function(){switch(i.settings.type){case"confirmation":case"error":case"information":case"question":case"warning":return i.settings.type.charAt(0).toUpperCase()+i.settings.type.slice(1).toLowerCase();default:return!1}},l=function(t){var e=0;for(t=t.replace(/\s/g,"").match(/[+\-]?([0-9\.\s]+)/g)||[];t.length;)e+=parseFloat(t.shift());return e},c={init:function(){this.name=this.searchString(this.dataBrowser)||"",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||""},searchString:function(t){var e,s,i;for(e=0;e<t.length;e++)if(s=t[e].string,i=t[e].prop,this.versionSearchString=t[e].versionSearch||t[e].identity,s){if(-1!==s.indexOf(t[e].subString))return t[e].identity}else if(i)return t[e].identity},searchVersion:function(t){var e=t.indexOf(this.versionSearchString);if(-1!==e)return parseFloat(t.substring(e+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"MSIE",identity:"explorer",versionSearch:"MSIE"}]};return i.settings={},"string"==typeof arguments[0]&&(o.message=arguments[0]),"object"!=typeof arguments[0]&&"object"!=typeof arguments[1]||(o=t.extend(o,"object"==typeof arguments[0]?arguments[0]:arguments[1])),i.init=function(){var l,d,p,u,h,f,_,m,b,v,y,w;if(i.settings=t.extend({},s,o),i.isIE6="explorer"===c.name&&6===c.version||!1,i.settings.modal&&(i.overlay=t("<div>",{class:"ZebraDialogOverlay"}).css({position:i.isIE6?"absolute":"fixed",left:0,top:0,opacity:i.settings.overlay_opacity}),i.settings.overlay_close&&i.overlay.on("click",function(){i.close()}),i.overlay.appendTo("body")),i.dialog=t("<div>",{class:"ZebraDialog"+(i.settings.custom_class?" "+i.settings.custom_class:"")}).css({position:i.isIE6?"absolute":"fixed",left:0,top:0,visibility:"hidden"}),!i.settings.buttons&&i.settings.auto_close&&i.dialog.attr("id","ZebraDialog_"+Math.floor(9999999*Math.random())),y=parseInt(i.settings.width,10),!isNaN(y)&&y===i.settings.width&&y.toString()===i.settings.width.toString()&&y>0&&i.dialog.css({width:i.settings.width}),i.settings.title&&(v=t("<h3>",{class:"ZebraDialog_Title"}).html(i.settings.title).appendTo(i.dialog)),u=r(),d=t("<div>",{class:"ZebraDialog_BodyOuter"+(i.settings.title?"":" ZebraDialog_NoTitle")+(u?"":" ZebraDialog_NoButtons")}).appendTo(i.dialog),i.message=t("<div>",{class:"ZebraDialog_Body"+(!1!==g()?" ZebraDialog_Icon ZebraDialog_"+g():"")}),i.settings.max_height>0&&(i.message.css("max-height",i.settings.max_height),i.isIE6&&i.message.attr("style","height: expression(this.scrollHeight > "+i.settings.max_height+' ? "'+i.settings.max_height+'px" : "85px")')),i.settings.vcenter_short_message?t("<div>").html(i.settings.message).appendTo(i.message):i.message.html(i.settings.message),i.settings.source&&"object"==typeof i.settings.source){h=i.settings.vcenter_short_message?t("div:first",i.message):i.message;for(w in i.settings.source)switch(w){case"ajax":l="string"==typeof i.settings.source[w]?{url:i.settings.source[w]}:i.settings.source[w],b=t("<div>").attr("class","ZebraDialog_Preloader").appendTo(h),l.success=function(t){b.remove(),h.append(t),a(!1)},t.ajax(l);break;case"iframe":_={width:"100%",height:"100%",marginheight:"0",marginwidth:"0",frameborder:"0"},m=t.extend(_,"string"==typeof i.settings.source[w]?{src:i.settings.source[w]}:i.settings.source[w]),h.append(t("<iframe>").attr(m));break;case"inline":h.append(i.settings.source[w])}}return i.message.appendTo(d),u&&(u.reverse(),p=t("<div>",{class:"ZebraDialog_Buttons"}).appendTo(i.dialog),t.each(u,function(e,s){var o=t("<a>",{href:"javascript:void(0)",class:"ZebraDialog_Button_"+e});t.isPlainObject(s)?o.html(s.caption):o.html(s),o.on("click",function(){var t=!0;void 0!==s.callback&&(t=s.callback(i.dialog)),!1!==t&&i.close(void 0!==s.caption?s.caption:s)}),o.appendTo(p)}),p.wrap(t("<div>").addClass("ZebraDialog_ButtonsOuter"+(i.settings.center_buttons?" ZebraDialog_Buttons_Centered":"")))),i.dialog.appendTo("body"),i.settings.show_close_button&&(f=t('<a href="javascript:void(0)" class="ZebraDialog_Close">&times;</a>').on("click",function(t){t.preventDefault(),i.close()}).appendTo(v||i.message),v&&f.css({right:parseInt(v.css("paddingRight"),10),top:(parseInt(v.css("height"),10)+parseInt(v.css("paddingTop"),10)+parseInt(v.css("paddingBottom"),10)-f.height())/2})),t(window).on("resize.Zebra_Dialog",function(){clearTimeout(e),e=setTimeout(function(){a()},100)}),i.settings.keyboard&&t(document).on("keyup.Zebra_Dialog",function(t){return 27===t.which&&i.close(),!0}),i.isIE6&&t(window).on("scroll.Zebra_Dialog",function(){n()}),!1!==i.settings.auto_close&&(i.dialog.on("click",function(){clearTimeout(i.timeout),i.close()}),i.timeout=setTimeout(i.close,i.settings.auto_close)),a(!1),i},i.close=function(e){t(document).unbind(".Zebra_Dialog"),t(window).unbind(".Zebra_Dialog"),i.overlay&&i.overlay.animate({opacity:0},i.settings.animation_speed_hide,function(){i.overlay.remove()}),i.dialog.animate({top:0,opacity:0},i.settings.animation_speed_hide,function(){i.dialog.remove(),i.settings.onClose&&"function"==typeof i.settings.onClose&&i.settings.onClose(void 0!==e?e:"")})},c.init(),i.init()}}(jQuery);

@@ -22,8 +22,6 @@ /**

*
* Visit {@link http://stefangabos.ro/jquery/zebra-dialog/} for more information.
* Read more {@link https://github.com/stefangabos/Zebra_Dialog/ here}
*
* For more resources visit {@link http://stefangabos.ro/}
*
* @author Stefan Gabos <contact@stefangabos.ro>
* @version 1.4.0 (last revision: June 04, 2017)
* @version 1.4.1 (last revision: October 13, 2017)
* @copyright (c) 2011 - 2017 Stefan Gabos

@@ -400,2 +398,11 @@ * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU LESSER GENERAL PUBLIC LICENSE

// make sure top is not negative
if (plugin.dialog_top < 0) plugin.dialog_top = 0;
// if dialog height exceeds screen's height
if (dialog_height > viewport_height)
// adjust the dialog box's height so that it fits
plugin.message.css('height', viewport_height - ($('.ZebraDialog_Title', plugin.dialog) ? $('.ZebraDialog_Title', plugin.dialog).outerHeight() : 0) - ($('.ZebraDialog_ButtonsOuter', plugin.dialog) ? $('.ZebraDialog_ButtonsOuter', plugin.dialog).outerHeight() : 0) - (parseFloat(plugin.message.css('paddingTop')) || 0) - (parseFloat(plugin.message.css('paddingBottom')) || 0) - (parseFloat(plugin.message.css('borderTopWidth')) || 0) - (parseFloat(plugin.message.css('borderBottomWidth')) || 0));
// if short messages are to be centered vertically

@@ -402,0 +409,0 @@ if (plugin.settings.vcenter_short_message) {

@@ -15,3 +15,3 @@ {

"license": "LGPL-3.0",
"version": "1.4.0",
"version": "1.4.1",
"keywords": [

@@ -18,0 +18,0 @@ "jquery-plugin",

@@ -40,2 +40,6 @@ <img src="https://raw.githubusercontent.com/stefangabos/zebrajs/master/docs/images/logo.png" alt="zebrajs" align="right">

Cross browser/device testing done with
[![BrowserStack](https://github.com/stefangabos/Zebra_Dialog/raw/master/examples/browserstack.png)](https://www.browserstack.com/)
## Requirements

@@ -74,9 +78,9 @@

Alternatively, you can load Zebra_Dialog from [JSDelivr CDN](https://www.jsdelivr.com/) like this:
Alternatively, you can load Zebra_Dialog from [JSDelivr CDN](https://www.jsdelivr.com/package/npm/zebra_dialog) like this:
```html
<!-- for the most recent version -->
<script src="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Dialog/dist/zebra_dialog.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/zebra_dialog/dist/zebra_dialog.min.js"></script>
<!-- for a specific version -->
<script src="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Dialog@1.3.0/dist/zebra_dialog.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/zebra_dialog@1.4.0/dist/zebra_dialog.min.js"></script>

@@ -96,6 +100,6 @@ <!-- replacing "min" with "src" will serve you the non-compressed version -->

<!-- for the most recent version of the "flat" theme -->
<link rel="stylesheet" href=="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Dialog/dist/css/flat/zebra_dialog.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zebra_dialog@latest/dist/css/flat/zebra_dialog.min.css">
<!-- for the most recent version of the "default" theme -->
<link rel="stylesheet" href=="https://cdn.jsdelivr.net/gh/stefangabos/Zebra_Dialog/dist/css/flat/zebra_dialog.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zebra_dialog@latest/dist/css/default/zebra_dialog.min.css">

@@ -413,2 +417,2 @@ <!-- replacing "min" with "src" will serve you the non-compressed version -->

See the [demos](http://stefangabos.github.io/Zebra_Dialog/)
See the [demos](http://stefangabos.github.io/Zebra_Dialog/)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc