Added option to notify method.
This commit is contained in:
parent
687c87bc5b
commit
11aa571751
|
@ -12,10 +12,28 @@ String.prototype.strip_tags = function(){
|
||||||
|
|
||||||
Contacts={
|
Contacts={
|
||||||
UI:{
|
UI:{
|
||||||
|
/**
|
||||||
|
* Arguments:
|
||||||
|
* message: The text message to show. The only mandatory parameter.
|
||||||
|
* timeout: The timeout in seconds before the notification disappears. Default 10.
|
||||||
|
* timeouthandler: A function to run on timeout.
|
||||||
|
* clickhandler: A function to run on click. If a timeouthandler is given it will be cancelled.
|
||||||
|
*/
|
||||||
notify:function(params) {
|
notify:function(params) {
|
||||||
$('#notification').text(params.message);
|
var notifier = $('#notification');
|
||||||
$('#notification').fadeIn();
|
notifier.text(params.message);
|
||||||
setTimeout(function() {$('#notification').fadeOut();}, 10000);
|
notifier.fadeIn();
|
||||||
|
var timer = setTimeout(function() {
|
||||||
|
notifier.fadeOut();
|
||||||
|
if(params.timeouthandler && $.isFunction(params.timeouthandler)) { params.timeouthandler();}
|
||||||
|
}, params.timeout && $.isNumeric(params.timeout) ? parseInt(params.timeout)*1000 : 10000);
|
||||||
|
if(params.clickhandler && $.isFunction(params.clickhandler)) {
|
||||||
|
notifier.on('click', function() {
|
||||||
|
clearTimeout(timer);
|
||||||
|
notifier.off('click');
|
||||||
|
params.clickhandler();
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
notImplemented:function() {
|
notImplemented:function() {
|
||||||
OC.dialogs.alert(t('contacts', 'Sorry, this functionality has not been implemented yet'), t('contacts', 'Not implemented'));
|
OC.dialogs.alert(t('contacts', 'Sorry, this functionality has not been implemented yet'), t('contacts', 'Not implemented'));
|
||||||
|
|
Loading…
Reference in New Issue