Files
SmartHomePHP/web/js/site.js
2017-03-16 23:15:26 +02:00

44 lines
939 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function showErrorMessage(message) {
return $.snackbar({
content: message,
timeout: 5000
});
}
function showSuccessMessage(message) {
return $.snackbar({
content: message,
timeout: 5000
});
}
$('.navbar-toggle-drawer').click(function (e) {
e.preventDefault();
$('body').toggleClass('drawer-open');
return false;
});
$('.ajax-call').click(function (e) {
e.preventDefault();
$.post($(this).attr('href'), function (data) {
if (data.success) {
showSuccessMessage('Успешно обновлено');
} else {
showErrorMessage('Не удалось обновить');
}
}).fail(function () {
showErrorMessage('Не удалось обновить');
});
});
$('.show-on-click').click(function (e) {
e.preventDefault();
$(this).text($(this).data('text')).addClass('open');
return false;
});