From 33db3fd8f954292786f81f10ba49a68d1606c5f4 Mon Sep 17 00:00:00 2001 From: Jose Vera Date: Thu, 12 May 2016 10:20:01 -0500 Subject: [PATCH 1/3] Higher z-index for logs --- src/css/alertify.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/css/alertify.css b/src/css/alertify.css index 80bbc603..3f838fc8 100644 --- a/src/css/alertify.css +++ b/src/css/alertify.css @@ -93,7 +93,7 @@ .alertify-logs { position: fixed; - z-index: 100; } + z-index: 99999; } .alertify-logs.bottom, .alertify-logs:not(.top) { bottom: 16px; } .alertify-logs.left, .alertify-logs:not(.right) { From 9d18d0e7c1b90a8d86f8de633600cb1a1e62896b Mon Sep 17 00:00:00 2001 From: Jose Vera Date: Sun, 10 Jul 2016 14:34:13 -0500 Subject: [PATCH 2/3] Adds support for alertify.password and alertify.select --- src/js/alertify.js | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/src/js/alertify.js b/src/js/alertify.js index 4f9a405e..12a7f0f4 100644 --- a/src/js/alertify.js +++ b/src/js/alertify.js @@ -33,7 +33,7 @@ var _alertify = { parent: document.body, - version: "1.0.10", + version: "1.0.11", defaultOkLabel: "Ok", okLabel: "Ok", defaultCancelLabel: "Cancel", @@ -55,6 +55,7 @@ cancel: "" }, input: "", + select: "", + select: "'; + html += select; + } + html = (html + this.dialogs.buttons.holder + "" + "") .replace("{{buttons}}", btnTxt) .replace("{{ok}}", this.okLabel) @@ -141,12 +158,13 @@ * * @return {Object} */ - dialog: function(message, type, onOkay, onCancel) { + dialog: function(message, type, onOkay, onCancel, selectOptions) { return this.setup({ type: type, message: message, onOkay: onOkay, - onCancel: onCancel + onCancel: onCancel, + selectOptions: selectOptions }); }, @@ -247,7 +265,7 @@ var btnOK = el.querySelector(".ok"); var btnCancel = el.querySelector(".cancel"); - var input = el.querySelector("input"); + var input = el.querySelector("input,select"); var label = el.querySelector("label"); // Set default value/placeholder of input @@ -312,6 +330,14 @@ hideElement(el); }); } + + if (input) { + input.addEventListener("keyup", function(ev) { + if (ev.which === 13) { + btnOK.click(); + } + }); + } } var promise; @@ -325,7 +351,7 @@ this.parent.appendChild(el); setTimeout(function() { el.classList.remove("hide"); - if(input && item.type && item.type === "prompt") { + if(input && item.type && (item.type === "prompt" || item.type === "password")) { input.select(); input.focus(); } else { @@ -364,6 +390,7 @@ this.dialogs.buttons.ok = ""; this.dialogs.buttons.cancel = ""; this.dialogs.input = ""; + this.dialogs.select = "