| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /**
- * Main Javascript file
- *
- * @author Open Mind
- * @date 04/12/2018
- * @time 16:00
- */
- var fetchHeaders = {
- 'Accept': 'text/html',
- 'Content-Type': 'text/html',
- 'X-Requested-With': 'XMLHttpRequest',
- 'Cache-Control': 'no-cache',
- 'Pragma': 'no-cache',
- 'Expires': '0'
- };
- /* usefull if a blinking text is need, like in MaxMara project, you need to place this code in html:
- *
- * <nav class="navbar navbar-collapse p-0">
- * <span class="navbar-text blink" style="color: red" id="statusbartext"></span>
- * </nav>
- */
- function SetStatusBarText(msg) {
- $('#statusbartext').text(msg);
- setTimeout(() => {
- $('#statusbartext').text('');
- }, 60000);
- }
- /*
- function refreshNotificationArea() {
- fetch(`${BASEURL}/api.system.getserverstatus`, {headers: fetchHeaders})
- .then(resp => {
- if (resp.status === 200)
- return resp.json();
- else
- return Promise.reject("getserverstatus: error");
- })
- .then(data => {
- NotificationBuilder(data.notify);
- })
- .catch(err => {
- console.log(err);
- });
- }
- */
- function SetupConfirmationDialog() {
- $('.requestconfirm').on('click', function (ev) {
- let confirmText = $(this).data('confirmtext');
- if (!confirm(confirmText))
- ev.preventDefault();
- });
- }
- function SetupSubmitFormDisabler() {
- $('body').on('submit', 'form', function () {
- $('form input,form select').prop('disabled', false);
- setTimeout(function () {
- $('form input,form select').prop('disabled', true);
- }, 500);
- });
- }
- $(function () {
- SetupConfirmationDialog();
- SetupSubmitFormDisabler();
- });
|