jQuery(function ($) { //matriz box é baseado em pines notify //documentação: http://pinesframework.org/pnotify $.pnotify.defaults.closer_hover = false; $.pnotify.defaults.hide = true; $.pnotify.defaults.delay = 5000; $.pnotify.defaults.history = false; $.pnotify.defaults.sticker = false; matriz.box = {}; //configs auxiliares matriz.box.config = {}; matriz.box.config.confirm = function (selector, eventtype, message, callback) { $(selector).each(function () { element = $(this); callback = matriz.box.callback(element, callback); element.on(eventtype, function () { matriz.box.obtrusive.confirm(message, callback); return false; }); }); }; matriz.box.notifications = {}; matriz.box.notifications.type = null; matriz.box.notifications.mensagem = null; matriz.box.notifications.caller = null; matriz.box.notifications.exists = function (mensagem, type) { var caller = arguments.callee.caller; try { var loop = 10; while (caller.caller !== null && loop-- >= 0) { caller = caller.caller; } } catch (e) {} if ($("#notificacoes > div").length && type === matriz.box.notifications.type && mensagem === matriz.box.notifications.mensagem && caller === matriz.box.notifications.caller) { matriz.box.notifications.shake(); return true; } else { matriz.box.notifications.type = type; matriz.box.notifications.mensagem = mensagem; matriz.box.notifications.caller = caller; matriz.box.notifications.remove(); return false; } }; matriz.box.notifications.shake = function () { $("#notificacoes").effect("shake", {times: 4}, 1000); }; matriz.box.notifications.remove = function () { $("#notificacoes").empty(); }; matriz.box.notifications.append = function (pnotify) { var $pnotify = $(pnotify[0]); $pnotify.css("width", "100%"); $pnotify.find(".ui-pnotify-icon").hide(); $pnotify.find(".ui-pnotify-text").addClass("clearfix"); $pnotify.appendTo("#notificacoes"); }; //box no estilo de notificação matriz.box.notify = {}; matriz.box.notify.default = function (mensagem, type) { matriz.box.notifications.remove(); $.pnotify({ text: mensagem, type: type, before_open: function (pnotify) { matriz.box.notifications.append(pnotify); } }); }; matriz.box.notify.danger = function (mensagem) { matriz.box.notify.default(mensagem, 'error'); }; matriz.box.notify.info = function (mensagem) { matriz.box.notify.default(mensagem, 'info'); }; matriz.box.notify.success = function (mensagem) { matriz.box.notify.default(mensagem, 'success'); }; matriz.box.notify.warning = function (mensagem) { matriz.box.notify.default(mensagem, 'info'); }; matriz.box.image = {}; matriz.box.image.show = function (imagem, caption) { var matrizBoxImage = '