diff --git a/bower.json b/bower.json index d26787f..1b2e7fc 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "medium-style-confirm", - "version": "0.4.0", + "version": "0.4.1", "homepage": "http://bitwiser.i/medium-style-confirm/", "authors": [ "Brijesh Bittu " diff --git a/js/msc-script.js b/js/msc-script.js index fc0904c..9db4626 100644 --- a/js/msc-script.js +++ b/js/msc-script.js @@ -25,7 +25,8 @@ onCancel: null, okText: 'OK', cancelText: 'Cancel', - placeholder: 'Enter value' + placeholder: 'Enter value', + dismissOverlay: false }; if(typeof title === 'object') { @@ -55,6 +56,10 @@ closeBtn.innerHTML = '×'; overlay.appendChild(closeBtn); + if(options.dismissOverlay) { + overlay.addEventListener("click", destroy); + } + closeBtn.addEventListener('click', destroy); var content = ce('div', 'msc-content'), @@ -104,6 +109,9 @@ closeBtn.removeEventListener('click', destroy); okBtn.removeEventListener('click', ok); cancelbtn.removeEventListener('click', cancel); + if(options.dismissOverlay) { + overlay.removeEventListener("click", destroy); + } document.removeEventListener('keyup', _hide); document.body.removeChild(dialog); }