mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 13:03:20 +00:00
wip: component reorg, gathering js, css, images, ...
This commit is contained in:
59
resources/www/prod/js/jquery.Alerts.js
Normal file
59
resources/www/prod/js/jquery.Alerts.js
Normal file
@@ -0,0 +1,59 @@
|
||||
var p4 = p4 || {};
|
||||
|
||||
(function (p4) {
|
||||
|
||||
function create_dialog() {
|
||||
if ($('#p4_alerts').length === 0) {
|
||||
$('body').append('<div id="p4_alerts"></div>');
|
||||
}
|
||||
return $('#p4_alerts');
|
||||
}
|
||||
|
||||
function alert(title, message, callback) {
|
||||
var dialog = create_dialog();
|
||||
|
||||
var button = new Object();
|
||||
|
||||
button['Ok'] = function () {
|
||||
if (typeof callback === 'function')
|
||||
callback();
|
||||
else
|
||||
dialog.dialog('close');
|
||||
};
|
||||
if (dialog.data('ui-dialog')) {
|
||||
dialog.dialog('destroy');
|
||||
}
|
||||
|
||||
dialog.attr('title', title)
|
||||
.empty()
|
||||
.append(message)
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: false,
|
||||
draggable: false,
|
||||
modal: true,
|
||||
buttons: button,
|
||||
overlay: {
|
||||
backgroundColor: '#000',
|
||||
opacity: 0.7
|
||||
}
|
||||
}).dialog('open');
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
dialog.bind("dialogclose", function (event, ui) {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
p4.Alerts = alert;
|
||||
|
||||
|
||||
return;
|
||||
}(p4));
|
Reference in New Issue
Block a user