Wrap a wait before the DOM is loaded before loading anything calling anything in app.js

This commit is contained in:
johnnyq
2025-03-23 18:08:14 -04:00
parent 53713a0318
commit df8a755462
+61 -56
View File
@@ -1,20 +1,21 @@
//Prevents resubmit on forms
if(window.history.replaceState){
$(document).ready(function() {
//Prevents resubmit on forms
if(window.history.replaceState){
window.history.replaceState(null, null, window.location.href);
}
}
// Slide alert up after 4 secs
$("#alert").fadeTo(5000, 500).slideUp(500, function(){
// Slide alert up after 4 secs
$("#alert").fadeTo(5000, 500).slideUp(500, function(){
$("#alert").slideUp(500);
});
});
// Initialize Select2 Elements
$('.select2').select2({
// Initialize Select2 Elements
$('.select2').select2({
theme: 'bootstrap4',
});
});
// Initialize TinyMCE
tinymce.init({
// Initialize TinyMCE
tinymce.init({
selector: '.tinymce',
browser_spellcheck: true,
contextmenu: false,
@@ -43,10 +44,10 @@ tinymce.init({
convert_urls: false,
plugins: 'link image lists table code codesample fullscreen autoresize',
license_key: 'gpl'
});
});
// Initialize TinyMCE
tinymce.init({
// Initialize TinyMCE
tinymce.init({
selector: '.tinymceAI',
browser_spellcheck: true,
contextmenu: false,
@@ -147,9 +148,9 @@ tinymce.init({
}
});
}
});
});
tinymce.init({
tinymce.init({
selector: '.tinymceTicket', // Your selector
browser_spellcheck: true,
contextmenu: false,
@@ -196,10 +197,10 @@ tinymce.init({
}
});
}
});
});
// Initialize TinyMCE AI
tinymce.init({
// Initialize TinyMCE AI
tinymce.init({
selector: '.tinymceTicketAI',
browser_spellcheck: true,
contextmenu: false,
@@ -317,10 +318,10 @@ tinymce.init({
}
});
}
});
});
// Initialize TinyMCE editor with only a redact button
tinymce.init({
// Initialize TinyMCE editor with only a redact button
tinymce.init({
selector: '.tinymceTicketRedact',
browser_spellcheck: false,
contextmenu: false,
@@ -334,9 +335,9 @@ tinymce.init({
license_key: 'gpl',
readonly: true,
toolbar: '',
});
});
tinymce.init({
tinymce.init({
selector: '.tinymceRedact', // Your selector
browser_spellcheck: true,
contextmenu: false,
@@ -383,71 +384,75 @@ tinymce.init({
}
});
}
});
});
// DateTime
$('.datetimepicker').datetimepicker({
});
// DateTime
$('.datetimepicker').datetimepicker({
});
// Data Input Mask
$('[data-mask]').inputmask();
// Data Input Mask
$('[data-mask]').inputmask();
// ClipboardJS
// ClipboardJS
//Fix to allow Clipboard Copying within Bootstrap Modals
//For use in Bootstrap Modals or with any other library that changes the focus you'll want to set the focused element as the container value.
$.fn.modal.Constructor.prototype._enforceFocus = function() {};
//Fix to allow Clipboard Copying within Bootstrap Modals
//For use in Bootstrap Modals or with any other library that changes the focus you'll want to set the focused element as the container value.
$.fn.modal.Constructor.prototype._enforceFocus = function() {};
// Tooltip
// Tooltip
$('button').tooltip({
$('button').tooltip({
trigger: 'click',
placement: 'bottom'
});
});
function setTooltip(btn, message) {
function setTooltip(btn, message) {
$(btn).tooltip('hide')
.attr('data-original-title', message)
.tooltip('show');
}
}
function hideTooltip(btn) {
function hideTooltip(btn) {
setTimeout(function() {
$(btn).tooltip('hide');
}, 1000);
}
}
// Clipboard
// Clipboard
var clipboard = new ClipboardJS('.clipboardjs');
var clipboard = new ClipboardJS('.clipboardjs');
clipboard.on('success', function(e) {
clipboard.on('success', function(e) {
setTooltip(e.trigger, 'Copied!');
hideTooltip(e.trigger);
});
});
clipboard.on('error', function(e) {
clipboard.on('error', function(e) {
setTooltip(e.trigger, 'Failed!');
hideTooltip(e.trigger);
});
});
// Enable Popovers
$(function () {
// Enable Popovers
$(function () {
$('[data-toggle="popover"]').popover()
});
});
// Data Tables
new DataTable('.dataTables');
// Data Tables
new DataTable('.dataTables');
// Initialize International Phone Input
const inputs = document.querySelectorAll('input[type="tel"]');
// Loop through all the selected inputs and initialize intlTelInput on each one
inputs.forEach(input => {
// Initialize International Phone Input
const inputs = document.querySelectorAll('input[type="tel"]');
// Loop through all the selected inputs and initialize intlTelInput on each one
inputs.forEach(input => {
window.intlTelInput(input, {
initialCountry: "us",
strictMode: true,
loadUtils: () => import("../plugins/intl-tel-input/js/utils.js") // for formatting/placeholders etc
});
});
});