Skip to content

Commit 37a8592

Browse files
committedMar 12, 2016
updates
1 parent e96f53d commit 37a8592

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed
 

‎index.html

+59-58
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,6 @@ <h1>Quick features</h1>
464464
animationClose: 'top',
465465
opacity: 0.5,
466466
buttons: {
467-
hey: {
468-
keys: [
469-
'shift',
470-
'enter'
471-
],
472-
},
473467
'confirm': function () {
474468
$.confirm({
475469
title: 'This maybe critical',
@@ -482,18 +476,21 @@ <h1>Quick features</h1>
482476
'Confirm': function () {
483477
$.alert('A very critical action triggered!');
484478
},
485-
hey: {
486-
text: 'wow',
487-
action: function () {
488-
$.alert('yp');
489-
}
479+
cancel: function(){
480+
$.alert('cancel clicked');
490481
}
491482
}
492483
});
493484
},
494-
'yetAnother' : {
495-
text: 'Buttons'
496-
}
485+
cancel: function(){
486+
$.alert('cancel clicked');
487+
},
488+
moreButtons : {
489+
text: 'something else',
490+
action: function(){
491+
$.alert('something else clicked');
492+
}
493+
},
497494
}
498495
});
499496
});
@@ -618,7 +615,7 @@ <h1>Quick features</h1>
618615
// alignment
619616
$('.example-pc-1').on('click', function () {
620617
$.confirm({
621-
title: 'This is smoooth',
618+
title: 'This is smooth',
622619
content: '<p>You can add content and not worry about the alignment. The goal is to make a Interactive dialog!.</p>' +
623620
'<button type="button">Click me to add content</button> <span> <br></span> ',
624621
confirmButtonClass: 'btn-primary',
@@ -672,7 +669,7 @@ <h1>Quick features</h1>
672669
$(' .example-pc-3').on('click', function () {
673670
$.alert({
674671
title: 'Animations',
675-
content: 'jquery-confirm provides 12 animations to choose from.',
672+
content: 'jquery-confirm provides 12 open &amp; close animations to choose from.',
676673
animation: 'rotate',
677674
closeAnimation: 'right',
678675
theme: 'white, black',
@@ -724,45 +721,38 @@ <h2>Quick Usage</h2>
724721

725722
<p><strong>Dependencies:</strong></p>
726723
<ul>
727-
<li>Bootstrap by Twitter >= v2</li>
724+
<li>Bootstrap by Twitter >= v3</li>
728725
<li>jQuery library > v1.8</li>
729726
</ul>
730727
<div class="row">
731728
<div class="col-md-12">
732729
<h4 id="alert">Alert</h4>
733730

734731
<p>
735-
<i class="fa fa-info-circle"></i> <code>$.alert()</code> Has only confirm button.
732+
<i class="fa fa-info-circle"></i> <code>$.alert()</code> adds a button if no buttons are specified, this lets the user to close the modal.
736733
</p>
737734
<button class="example1 btn btn-primary">example alert</button>
738735
<script type="text/javascript">
739736
$('.example1').on('click', function () {
740737
$.alert({
741738
title: 'Alert!',
742739
content: 'Simple alert!',
743-
confirm: function () {
744-
$.alert('Confirmed!');
745-
}
746740
});
747741
});
748742
</script>
749743
<div class="space10"></div>
750744
<pre class="prettyprint linenums"><code class="js">$.alert({
751-
title: 'Alert!',
752-
content: 'Simple alert!',
753-
confirm: function(){
754-
$.alert('Confirmed!'); // shorthand.
755-
}
756-
});
757-
</code></pre>
745+
title: 'Alert!',
746+
content: 'Simple alert!',
747+
});</code></pre>
758748
</div>
759749
<div class="col-md-12">
760750
<h4 id="confirm">
761751
Confirm
762752
</h4>
763753

764754
<p>
765-
<i class="fa fa-info-circle"></i> <code>$.confirm()</code> Has both confirm &amp; cancel buttons.
755+
<i class="fa fa-info-circle"></i> <code>$.confirm()</code> takes options as is, no buttons will be shown if none is specified.
766756
</p>
767757
</div>
768758
<div class="col-md-6">
@@ -772,26 +762,36 @@ <h4 id="confirm">
772762
$.confirm({
773763
title: 'Confirm!',
774764
content: 'Simple confirm!',
775-
confirm: function () {
776-
$.alert('Confirmed!');
777-
},
778-
cancel: function () {
779-
$.alert('Canceled!');
765+
buttons: {
766+
confirm: function () {
767+
$.alert('Confirmed!');
768+
},
769+
cancel: function () {
770+
$.alert('Canceled!');
771+
},
772+
somethingElse: function(){
773+
$.alert('Something else?');
774+
}
780775
}
781776
});
782777
});
783778
</script>
784779
<div class="space10"></div>
785780
<pre class="prettyprint linenums"><code class="js">$.confirm({
786-
title: 'Confirm!',
787-
content: 'Simple confirm!',
788-
confirm: function(){
789-
$.alert('Confirmed!');
790-
},
791-
cancel: function(){
792-
$.alert('Canceled!')
793-
}
794-
});
781+
title: 'Confirm!',
782+
content: 'Simple confirm!',
783+
buttons: {
784+
confirm: function () {
785+
$.alert('Confirmed!');
786+
},
787+
cancel: function () {
788+
$.alert('Canceled!');
789+
},
790+
somethingElse: function(){
791+
$.alert('Something else?');
792+
}
793+
}
794+
});
795795
</code></pre>
796796
</div>
797797
<div class="col-md-6">
@@ -806,12 +806,10 @@ <h4 id="confirm">
806806
});
807807
</script>
808808
<span>HTML</span>
809-
<pre class="prettyprint linenums"><code class="html">&lt;a class="twitter" data-title="Goto twitter?" href="http://twitter.com/craftpip"&gt;Goto twitter&lt;/a&gt;
810-
</code></pre>
809+
<pre class="prettyprint linenums"><code class="html">&lt;a class="twitter" data-title="Goto twitter?" href="http://twitter.com/craftpip"&gt;Goto twitter&lt;/a&gt;</code></pre>
811810
<span>Javascript</span>
812-
<pre class="prettyprint linenums"><code class="js">$('a.twitter').confirm(options);
813-
</code></pre>
814-
<p>The alias $.confirm was made to emulate the native confirm(). <br/>
811+
<pre class="prettyprint linenums"><code class="js">$('a.twitter').confirm(options);</code></pre>
812+
<p>The alias $.fn.confirm was made to emulate the native confirm(). <br/>
815813
<i class="fa fa-info"></i> By default on "confirm" the window will be redirected to the href provided, but if the `options` has the confirm callback, it will be called instead. Use <a href="#api-target">this.$target</a> to get the clicked element.</p>
816814
</div>
817815
<div class="col-md-12">
@@ -820,23 +818,27 @@ <h4 id="dialog">
820818
</h4>
821819

822820
<p>
823-
<i class="fa fa-info-circle"></i> <code>$.dialog()</code> Hides both confirm &amp; cancel buttons. (Shows close [x] button)
821+
<i class="fa fa-info-circle"></i> <code>$.dialog()</code> removes buttons and explicitly shows the closeIcon (&times;)
824822
</p>
825823
<button class="example2-1 btn btn-primary">example dialog</button>
826824
<script type="text/javascript">
827825
$('.example2-1').on('click', function () {
828826
$.dialog({
829827
title: 'Text content!',
830-
content: 'Simple modal!'
828+
content: 'Simple modal!',
829+
buttons: {
830+
aRandomButton: function(){
831+
// this will be removed.
832+
}
833+
}
831834
});
832835
});
833836
</script>
834837
<div class="space10"></div>
835838
<pre class="prettyprint linenums"><code class="js">$.dialog({
836-
title: 'Text content!',
837-
content: 'Simple modal!',
838-
});
839-
</code></pre>
839+
title: 'Text content!',
840+
content: 'Simple modal!',
841+
});</code></pre>
840842
</div>
841843
<div class="col-md-12">
842844
<h4 id="shorthand">Shorthand usage</h4>
@@ -845,10 +847,9 @@ <h4 id="shorthand">Shorthand usage</h4>
845847
The shorthand thingy takes in two string arguments, first one is the content of the dialog and second the title of the dialog.
846848
The second argument is optional.
847849
</p>
848-
<pre class="prettyprint linenums"><code class="js">$.alert('Content here', 'Title here');
849-
$.confirm('A message', 'Title is optional');
850-
$.dialog('Just to let you know');
851-
</code></pre>
850+
<pre class="prettyprint linenums"><code class="js">$.alert('Content here', 'Title here'); <a href="#" class="example-sh-1">click me</a>
851+
$.confirm('A message', 'Title is optional'); <a href="#" class="example-sh-2">click me</a>
852+
$.dialog('Just to let you know'); <a href="#" class="example-sh-3">click me</a></code></pre>
852853
</div>
853854

854855
</div>

‎jquery-confirm.png

-75.4 KB
Loading

‎js/jquery-confirm.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ var jconfirm, Jconfirm;
9797
}
9898
};
9999

100+
options['buttons'] = {}; // purge buttons
101+
100102
if (typeof options['closeIcon'] == 'undefined') {
101103
// Dialog must have a closeIcon.
102104
options['closeIcon'] = function () {}
@@ -356,9 +358,6 @@ var jconfirm, Jconfirm;
356358
}, 40);
357359
});
358360
},
359-
/*
360-
set buttons done.
361-
*/
362361
_setButtons: function () {
363362
var that = this;
364363
/*

0 commit comments

Comments
 (0)
Please sign in to comment.