Skip to content

Commit

Permalink
#290 prevent multiple attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
craftpip committed Aug 9, 2017
1 parent 97f4a4c commit e564260
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js/jquery-confirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ var jconfirm, Jconfirm;
*/
$(this).each(function () {
var $this = $(this);
if ($this.attr('jc-attached')) {
console.warn('jConfirm has already binded to this element ', $this[0]);
return;
}

$this.on('click', function (e) {
e.preventDefault();
var jcOption = $.extend({}, options);
Expand All @@ -49,8 +54,10 @@ var jconfirm, Jconfirm;
};
}
jcOption['closeIcon'] = false;
$.confirm(jcOption);
var instance = $.confirm(jcOption);
});

$this.attr('jc-attached', true);
});
return $(this);
};
Expand Down Expand Up @@ -1324,10 +1331,8 @@ var jconfirm, Jconfirm;
$(window).on('keyup', function () {
keyDown = false;
});

jconfirm.lastClicked = false;
$(document).on('mousedown', 'button, a', function () {
console.log('hey clicked', this);
jconfirm.lastClicked = $(this);
});
})(jQuery, window);

1 comment on commit e564260

@historylife
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't fix the problem :

function popupalert(title, text, reload) {
      $.alert({
          title: title,
          content: text,
          confirmButton: 'Ok',
          boxWidth: '30%',
          useBootstrap: false,
          icon: 'ui large red warning circle icon',
          animation: 'zoom',
          buttons: {
              close: {
                  btnClass: 'btn-blue',
                  action: function() {
                      if (reload) {
                          location.reload();
                      }
                  }
              }
          }
      })
  }


$(".globalbody").on("touchend mousedown", ".add_mor_time_sign", function() {
              popupalert('Error!', 'There is no enough time in your global account balance Please <b><a href="https://instaranker.com/prices/">Buy more time</a></b>!', false);
  })

Please sign in to comment.