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 $(document).ready(function() {
if(window.history.replaceState){ //Prevents resubmit on forms
if(window.history.replaceState){
window.history.replaceState(null, null, window.location.href); window.history.replaceState(null, null, window.location.href);
} }
// Slide alert up after 4 secs // Slide alert up after 4 secs
$("#alert").fadeTo(5000, 500).slideUp(500, function(){ $("#alert").fadeTo(5000, 500).slideUp(500, function(){
$("#alert").slideUp(500); $("#alert").slideUp(500);
}); });
// Initialize Select2 Elements // Initialize Select2 Elements
$('.select2').select2({ $('.select2').select2({
theme: 'bootstrap4', theme: 'bootstrap4',
}); });
// Initialize TinyMCE // Initialize TinyMCE
tinymce.init({ tinymce.init({
selector: '.tinymce', selector: '.tinymce',
browser_spellcheck: true, browser_spellcheck: true,
contextmenu: false, contextmenu: false,
@@ -43,10 +44,10 @@ tinymce.init({
convert_urls: false, convert_urls: false,
plugins: 'link image lists table code codesample fullscreen autoresize', plugins: 'link image lists table code codesample fullscreen autoresize',
license_key: 'gpl' license_key: 'gpl'
}); });
// Initialize TinyMCE // Initialize TinyMCE
tinymce.init({ tinymce.init({
selector: '.tinymceAI', selector: '.tinymceAI',
browser_spellcheck: true, browser_spellcheck: true,
contextmenu: false, contextmenu: false,
@@ -147,9 +148,9 @@ tinymce.init({
} }
}); });
} }
}); });
tinymce.init({ tinymce.init({
selector: '.tinymceTicket', // Your selector selector: '.tinymceTicket', // Your selector
browser_spellcheck: true, browser_spellcheck: true,
contextmenu: false, contextmenu: false,
@@ -196,10 +197,10 @@ tinymce.init({
} }
}); });
} }
}); });
// Initialize TinyMCE AI // Initialize TinyMCE AI
tinymce.init({ tinymce.init({
selector: '.tinymceTicketAI', selector: '.tinymceTicketAI',
browser_spellcheck: true, browser_spellcheck: true,
contextmenu: false, contextmenu: false,
@@ -317,10 +318,10 @@ tinymce.init({
} }
}); });
} }
}); });
// Initialize TinyMCE editor with only a redact button // Initialize TinyMCE editor with only a redact button
tinymce.init({ tinymce.init({
selector: '.tinymceTicketRedact', selector: '.tinymceTicketRedact',
browser_spellcheck: false, browser_spellcheck: false,
contextmenu: false, contextmenu: false,
@@ -334,9 +335,9 @@ tinymce.init({
license_key: 'gpl', license_key: 'gpl',
readonly: true, readonly: true,
toolbar: '', toolbar: '',
}); });
tinymce.init({ tinymce.init({
selector: '.tinymceRedact', // Your selector selector: '.tinymceRedact', // Your selector
browser_spellcheck: true, browser_spellcheck: true,
contextmenu: false, contextmenu: false,
@@ -383,71 +384,75 @@ tinymce.init({
} }
}); });
} }
}); });
// DateTime // DateTime
$('.datetimepicker').datetimepicker({ $('.datetimepicker').datetimepicker({
}); });
// Data Input Mask // Data Input Mask
$('[data-mask]').inputmask(); $('[data-mask]').inputmask();
// ClipboardJS // ClipboardJS
//Fix to allow Clipboard Copying within Bootstrap Modals //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. //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() {}; $.fn.modal.Constructor.prototype._enforceFocus = function() {};
// Tooltip // Tooltip
$('button').tooltip({ $('button').tooltip({
trigger: 'click', trigger: 'click',
placement: 'bottom' placement: 'bottom'
}); });
function setTooltip(btn, message) { function setTooltip(btn, message) {
$(btn).tooltip('hide') $(btn).tooltip('hide')
.attr('data-original-title', message) .attr('data-original-title', message)
.tooltip('show'); .tooltip('show');
} }
function hideTooltip(btn) { function hideTooltip(btn) {
setTimeout(function() { setTimeout(function() {
$(btn).tooltip('hide'); $(btn).tooltip('hide');
}, 1000); }, 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!'); setTooltip(e.trigger, 'Copied!');
hideTooltip(e.trigger); hideTooltip(e.trigger);
}); });
clipboard.on('error', function(e) { clipboard.on('error', function(e) {
setTooltip(e.trigger, 'Failed!'); setTooltip(e.trigger, 'Failed!');
hideTooltip(e.trigger); hideTooltip(e.trigger);
}); });
// Enable Popovers // Enable Popovers
$(function () { $(function () {
$('[data-toggle="popover"]').popover() $('[data-toggle="popover"]').popover()
}); });
// Data Tables // Data Tables
new DataTable('.dataTables'); new DataTable('.dataTables');
// Initialize International Phone Input
const inputs = document.querySelectorAll('input[type="tel"]'); // Initialize International Phone Input
// Loop through all the selected inputs and initialize intlTelInput on each one const inputs = document.querySelectorAll('input[type="tel"]');
inputs.forEach(input => {
// Loop through all the selected inputs and initialize intlTelInput on each one
inputs.forEach(input => {
window.intlTelInput(input, { window.intlTelInput(input, {
initialCountry: "us", initialCountry: "us",
strictMode: true, strictMode: true,
loadUtils: () => import("../plugins/intl-tel-input/js/utils.js") // for formatting/placeholders etc loadUtils: () => import("../plugins/intl-tel-input/js/utils.js") // for formatting/placeholders etc
}); });
});
}); });