Refactor: Use thisPin instead this in pin-event binding

This commit is contained in:
winkidney
2019-02-25 13:37:21 +08:00
committed by Isaac Bythewood
parent 1d739aca54
commit 0565d9985e

View File

@@ -51,30 +51,30 @@ $(window).load(function() {
// Open add-to-board panel
$('.glyphicon-heart').each(function() {
var thisPin = $(this);
$(this).off('click');
$(this).click(function() {
$(this).off('click');
pinForm($(this).data('id'));
thisPin.off('click');
thisPin.click(function() {
thisPin.off('click');
pinForm($(thisPin).data('id'));
});
});
// Edit pin if pencil icon clicked
$('.glyphicon-pencil').each(function() {
var thisPin = $(this);
$(this).off('click');
$(this).click(function() {
$(this).off('click');
pinForm($(this).data('id'));
thisPin.off('click');
thisPin.click(function() {
thisPin.off('click');
pinForm(thisPin.data('id'));
});
});
// Delete pin if trash icon clicked
$('.glyphicon-trash').each(function() {
var thisPin = $(this);
$(this).off('click');
$(this).click(function() {
$(this).off('click');
var promise = deletePinData($(this).data('id'));
thisPin.off('click');
thisPin.click(function() {
thisPin.off('click');
var promise = deletePinData(thisPin.data('id'));
promise.success(function() {
thisPin.closest('.pin').remove();
tileLayout();