Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Compatible with Bootstrap 3.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tavicu committed Jul 14, 2015
1 parent c9ac100 commit 4692779
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bootstrap-confirmation v1.0.1
# bootstrap-confirmation v1.0.2

This is a fork of ethaizone's [original code](https://github.com/ethaizone/Bootstrap-Confirmation)

Expand Down
36 changes: 19 additions & 17 deletions bootstrap-confirmation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

this.init('confirmation', element, options);


$(element).on('show.bs.confirmation', function(e) {
that.options.onShow(e, this);

Expand Down Expand Up @@ -42,16 +41,15 @@
var options = that.options;
var all = options.all_selector;

that.$element.on('click.dismiss.bs.confirmation', '[data-dismiss="confirmation"]', $.proxy(that.hide, that));

if(that.isPopout()) {
if(!event_body) {
event_body = $('body').on('click', function (e) {
if(that.$element.is(e.target)) return;
if(that.$element.has(e.target).length) return;
if($('.popover').has(e.target).length) return;

that.$element.confirmation('hide');
that.hide();
that.inState.click = false;

$('body').unbind(e);

Expand All @@ -70,6 +68,8 @@

if (!$.fn.popover || !$.fn.tooltip) throw new Error('Confirmation requires popover.js and tooltip.js');

Confirmation.VERSION = '1.0.2'

Confirmation.DEFAULTS = $.extend({}, $.fn.popover.Constructor.DEFAULTS, {
placement : 'right',
title : 'Are you sure?',
Expand Down Expand Up @@ -108,12 +108,12 @@
}

Confirmation.prototype.setContent = function () {
var that = this;
var $tip = this.tip();
var title = this.getTitle();
var $btnOk = $tip.find('[data-apply="confirmation"]');
var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
var options = this.options
var that = this;
var $tip = this.tip();
var title = this.getTitle();
var $btnOk = $tip.find('[data-apply="confirmation"]');
var $btnCancel = $tip.find('[data-dismiss="confirmation"]');
var options = this.options

$btnOk.addClass(this.getBtnOkClass())
.html(this.getBtnOkLabel())
Expand All @@ -123,7 +123,8 @@
.off('click').on('click', function(event) {
options.onConfirm(event, that.$element);

that.$element.confirmation('hide');
that.hide();
that.inState.click = false;
});

$btnCancel.addClass(this.getBtnCancelClass())
Expand All @@ -132,7 +133,8 @@
.off('click').on('click', function(event){
options.onCancel(event, that.$element);

that.$element.confirmation('hide');
that.hide();
that.inState.click = false;
});

$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title);
Expand Down Expand Up @@ -203,7 +205,7 @@
Confirmation.prototype.isPopout = function () {
var popout;
var $e = this.$element;
var o = this.options;
var o = this.options;

popout = $e.attr('data-popout') || (typeof o.popout == 'function' ? o.popout.call($e[0]) : o.popout);

Expand All @@ -221,11 +223,11 @@
var that = this;

return this.each(function () {
var $this = $(this);
var data = $this.data('bs.confirmation');
var options = typeof option == 'object' && option;
var $this = $(this);
var data = $this.data('bs.confirmation');
var options = typeof option == 'object' && option;

options = options || {};
options = options || {};
options.all_selector = that.selector;

if (!data && option == 'destroy') return;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"keywords": ["bootstrap", "bootstrap dialog", "bootstrap confirmation", "confirmation"],
"description": "Confirmation plugin compatible with Twitter Bootstrap 3 extending Popover",
"homepage": "https://github.com/tavicu/bs-confirmation",
"version": "1.0.1",
"version": "1.0.2",
"authors": [
{
"name": "Tavicu",
Expand Down
4 changes: 2 additions & 2 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
Expand All @@ -32,7 +32,7 @@ <h1>With callback functions</h1>
</div>

<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
<script src="bootstrap-confirmation.js"></script>

<script>
Expand Down

0 comments on commit 4692779

Please sign in to comment.