|
@@ -1,7 +1,7 @@
|
1
|
1
|
/*
|
2
|
2
|
* jQuery Plugin : jConfirmAction
|
3
|
3
|
*
|
4
|
|
- * by Hidayat Sagita
|
|
4
|
+ * by Hidayat Sagita, modified by Sevajol Bastien (http://blog.bux.fr/tag/jconfirmaction/)
|
5
|
5
|
* http://www.webstuffshare.com
|
6
|
6
|
* Licensed Under GPL version 2 license.
|
7
|
7
|
*
|
|
@@ -20,35 +20,38 @@
|
20
|
20
|
cancelAnswer: "Cancel",
|
21
|
21
|
onYes: function(){},
|
22
|
22
|
onOpen: function(){},
|
23
|
|
- onClose: function(){}
|
|
23
|
+ onClose: function(){},
|
|
24
|
+ justOneAtTime: true
|
24
|
25
|
}, options);
|
25
|
26
|
|
26
|
27
|
$(this).live('click', function(e) {
|
27
|
28
|
|
28
|
|
- $('div.question').remove();
|
|
29
|
+ if (theOptions.justOneAtTime)
|
|
30
|
+ {
|
|
31
|
+ $('div.question').remove();
|
|
32
|
+ }
|
29
|
33
|
|
30
|
|
- link = $(this);
|
31
|
|
- options.onOpen(link);
|
|
34
|
+ theOptions.onOpen($(this));
|
32
|
35
|
|
33
|
36
|
e.preventDefault();
|
34
|
|
- thisHref = $(this).attr('href');
|
35
|
37
|
|
36
|
38
|
if($(this).next('.question').length <= 0)
|
37
|
|
- $(this).after('<div class="question">'+theOptions.question
|
38
|
|
- +'<br/> <span class="yes">'+theOptions.yesAnswer
|
39
|
|
- +'</span><span class="cancel">'+theOptions.cancelAnswer
|
40
|
|
- +'</span></div>');
|
|
39
|
+ $(this).after(
|
|
40
|
+ '<div class="question">'+theOptions.question
|
|
41
|
+ +'<br/> <span class="yes">'+theOptions.yesAnswer
|
|
42
|
+ +'</span><span class="cancel">'+theOptions.cancelAnswer
|
|
43
|
+ +'</span></div>'
|
|
44
|
+ );
|
41
|
45
|
|
42
|
46
|
$(this).next('.question').animate({opacity: 1}, 300);
|
43
|
47
|
|
44
|
|
- $('.yes').bind('click', function(){
|
45
|
|
- options.onYes(link);
|
|
48
|
+ $(this).next('.question').find('.yes').bind('click', function(){
|
|
49
|
+ theOptions.onYes($(this).parents('div.question').prev('a'));
|
46
|
50
|
});
|
47
|
51
|
|
48
|
|
- $('.cancel').bind('click', function(){
|
|
52
|
+ $(this).next('.question').find('.cancel').bind('click', function(){
|
49
|
53
|
$(this).parents('.question').fadeOut(300, function() {
|
50
|
|
- options.onClose(link);
|
51
|
|
- $(this).remove();
|
|
54
|
+ theOptions.onClose($(this).parents('div.question').prev('a'));
|
52
|
55
|
});
|
53
|
56
|
});
|
54
|
57
|
|