Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base element for all the triggered events #1

Merged
merged 1 commit into from
Jul 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/clockpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@
this.canvas = canvas;
}

raiseCallback(this.options.init);
raiseCallback(this.element, this.options.init);
}

function raiseCallback(callbackFunction) {
function raiseCallback(element, callbackFunction) {
if (callbackFunction && typeof callbackFunction === "function") {
callbackFunction();
callbackFunction(element);
}
}

Expand Down Expand Up @@ -434,7 +434,7 @@
return;
}

raiseCallback(this.options.beforeShow);
raiseCallback(this.element, this.options.beforeShow);

var self = this;

Expand Down Expand Up @@ -492,12 +492,12 @@
}
});

raiseCallback(this.options.afterShow);
raiseCallback(this.element, this.options.afterShow);
};

// Hide popover
ClockPicker.prototype.hide = function(){
raiseCallback(this.options.beforeHide);
raiseCallback(this.element, this.options.beforeHide);

this.isShown = false;

Expand All @@ -507,14 +507,14 @@

this.popover.hide();

raiseCallback(this.options.afterHide);
raiseCallback(this.element, this.options.afterHide);
};

// Toggle to hours or minutes view
ClockPicker.prototype.toggleView = function(view, delay){
var raiseAfterHourSelect = false;
if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
raiseCallback(this.options.beforeHourSelect);
raiseCallback(this.element, this.options.beforeHourSelect);
raiseAfterHourSelect = true;
}
var isHours = view === 'hours',
Expand All @@ -540,7 +540,7 @@
}, duration);

if (raiseAfterHourSelect) {
raiseCallback(this.options.afterHourSelect);
raiseCallback(this.element, this.options.afterHourSelect);
}
};

Expand Down Expand Up @@ -672,7 +672,7 @@

// Hours and minutes are selected
ClockPicker.prototype.done = function() {
raiseCallback(this.options.beforeDone);
raiseCallback(this.element, this.options.beforeDone);
this.hide();
var last = this.input.prop('value'),
value = leadingZero(this.hours) + ':' + leadingZero(this.minutes);
Expand All @@ -692,7 +692,7 @@
this.input.trigger('blur');
}

raiseCallback(this.options.afterDone);
raiseCallback(this.element, this.options.afterDone);
};

// Remove clockpicker from input
Expand Down