//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(){ $("#alert").slideUp(500); }); // Initialize Select2 Elements $('.select2').select2({ theme: 'bootstrap4' }); // Summernote $('.summernote').summernote({ toolbar: [ ['style', ['style']], ['font', ['bold', 'underline', 'clear']], ['fontname', ['fontname']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['table', ['table']], ['insert', ['link', 'picture', 'video']], ['view', ['codeview']], ], height: 300 }); // DateTime $('.datetimepicker').datetimepicker({ }); // Data Input Mask $('[data-mask]').inputmask(); // 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() {}; // Tooltip $('button').tooltip({ trigger: 'click', placement: 'bottom' }); function setTooltip(btn, message) { $(btn).tooltip('hide') .attr('data-original-title', message) .tooltip('show'); } function hideTooltip(btn) { setTimeout(function() { $(btn).tooltip('hide'); }, 1000); } // Clipboard var clipboard = new ClipboardJS('.clipboardjs'); clipboard.on('success', function(e) { setTooltip(e.trigger, 'Copied!'); hideTooltip(e.trigger); }); clipboard.on('error', function(e) { setTooltip(e.trigger, 'Failed!'); hideTooltip(e.trigger); }); // Enable Popovers $(function () { $('[data-toggle="popover"]').popover() });