Skip to content

Commit

Permalink
added option to dismiss dialog when clicked on overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed May 21, 2015
1 parent 002399e commit 391f692
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"
Expand Down
10 changes: 9 additions & 1 deletion js/msc-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
onCancel: null,
okText: 'OK',
cancelText: 'Cancel',
placeholder: 'Enter value'
placeholder: 'Enter value',
dismissOverlay: false
};

if(typeof title === 'object') {
Expand Down Expand Up @@ -55,6 +56,10 @@
closeBtn.innerHTML = '&times;';
overlay.appendChild(closeBtn);

if(options.dismissOverlay) {
overlay.addEventListener("click", destroy);
}

closeBtn.addEventListener('click', destroy);

var content = ce('div', 'msc-content'),
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 391f692

Please sign in to comment.