dolibarr/htdocs/core/js/blockUI.js

106 lines
3.0 KiB
JavaScript
Raw Permalink Normal View History

2018-10-27 14:43:12 +02:00
// Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
2012-09-03 22:05:13 +02:00
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
2012-09-03 22:05:13 +02:00
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// or see https://www.gnu.org/
2012-09-03 22:05:13 +02:00
//
//
// \file htdocs/core/js/blockUI.js
// \brief File that include javascript functions for blockUI default options
//
// Examples
$(document).ready(function() {
2012-09-04 09:38:38 +02:00
// override these in your code to change the default behavior and style
/*$.blockUI.events = {
2012-09-04 09:38:38 +02:00
// styles applied when using $.growlUI
dolEventValidCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.8,
cursor: 'default',
color: '#fff',
backgroundColor: '#e3f0db',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
},
2018-08-12 19:59:39 +02:00
2012-09-04 09:38:38 +02:00
// styles applied when using $.growlUI
dolEventErrorCSS: {
width: '350px',
top: '10px',
left: '',
right: '10px',
border: 'none',
padding: '5px',
opacity: 0.8,
cursor: 'default',
color: '#a72947',
backgroundColor: '#d79eac',
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
'border-radius': '10px'
}
};*/
2018-08-12 19:59:39 +02:00
2012-09-04 09:38:38 +02:00
$.dolEventValid = function(title, message, timeout, onClose) {
var $m = $('<div class="dolEventValid"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 3000;
$.blockUI({
message: $m, fadeIn: 0, fadeOut: 0, centerY: false,
2012-09-04 09:38:38 +02:00
timeout: timeout, showOverlay: false,
onUnblock: onClose,
2012-09-04 19:19:30 +02:00
css: $.blockUI.events.dolEventValidCSS
2012-09-04 09:38:38 +02:00
});
};
2018-08-12 19:59:39 +02:00
2012-09-04 09:38:38 +02:00
$.dolEventError = function(title, message, timeout, onClose) {
var $m = $('<div class="dolEventError"></div>');
if (title) $m.append('<h1>'+title+'</h1>');
if (message) $m.append('<h2>'+message+'</h2>');
if (timeout == undefined) timeout = 0;
$.blockUI({
message: $m, fadeIn: 0, centerY: false,
2012-09-04 09:38:38 +02:00
timeout: timeout, showOverlay: false,
onUnblock: onClose,
2012-09-04 19:19:30 +02:00
css: $.blockUI.events.dolEventErrorCSS
2012-09-04 09:38:38 +02:00
});
$('.dolEventError').click($.unblockUI);
};
2018-08-12 19:59:39 +02:00
2012-09-04 19:25:31 +02:00
$.pleaseBePatient = function(message) {
2012-09-04 19:19:30 +02:00
$.blockUI({
2012-09-04 19:25:31 +02:00
message: message,
2012-09-04 19:19:30 +02:00
css: {
border: 'none',
padding: '15px',
2012-10-31 15:50:14 +01:00
background: '#000 url(' + indicatorBlockUI + ') no-repeat 10px center',
2012-09-04 19:19:30 +02:00
'-webkit-border-radius': '10px',
'-moz-border-radius': '10px',
2012-09-04 19:33:11 +02:00
'border-radius': '10px',
2012-09-04 19:19:30 +02:00
color: '#fff'
}
});
}
2019-09-23 21:55:30 +02:00
});