1/** 2* Template Name: NiceAdmin 3* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ 4* Updated: Apr 20 2024 with Bootstrap v5.3.3 5* Author: BootstrapMade.com 6* License: https://bootstrapmade.com/license/ 7*/ 8 9(function() { 10 "use strict"; 11 12 /** 13 * Easy selector helper function 14 */ 15 const select = (el, all = false) => { 16 el = el.trim() 17 if (all) { 18 return [...document.querySelectorAll(el)] 19 } else { 20 return document.querySelector(el) 21 } 22 } 23 24 /** 25 * Easy event listener function 26 */ 27 const on = (type, el, listener, all = false) => { 28 if (all) { 29 select(el, all).forEach(e => e.addEventListener(type, listener)) 30 } else { 31 select(el, all).addEventListener(type, listener) 32 } 33 } 34 35 /** 36 * Easy on scroll event listener 37 */ 38 const onscroll = (el, listener) => { 39 el.addEventListener('scroll', listener) 40 } 41 42 /** 43 * Sidebar toggle 44 */ 45 if (select('.toggle-sidebar-btn')) { 46 on('click', '.toggle-sidebar-btn', function(e) { 47 select('body').classList.toggle('toggle-sidebar') 48 }) 49 } 50 51 /** 52 * Search bar toggle 53 */ 54 if (select('.search-bar-toggle')) { 55 on('click', '.search-bar-toggle', function(e) { 56 select('.search-bar').classList.toggle('search-bar-show') 57 }) 58 } 59 60 /** 61 * Navbar links active state on scroll 62 */ 63 let navbarlinks = select('#navbar .scrollto', true) 64 const navbarlinksActive = () => { 65 let position = window.scrollY + 200 66 navbarlinks.forEach(navbarlink => { 67 if (!navbarlink.hash) return 68 let section = select(navbarlink.hash) 69 if (!section) return 70 if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) { 71 navbarlink.classList.add('active') 72 } else { 73 navbarlink.classList.remove('active') 74 } 75 }) 76 } 77 window.addEventListener('load', navbarlinksActive) 78 onscroll(document, navbarlinksActive) 79 80 /** 81 * Toggle .header-scrolled class to #header when page is scrolled 82 */ 83 let selectHeader = select('#header') 84 if (selectHeader) { 85 const headerScrolled = () => { 86 if (window.scrollY > 100) { 87 selectHeader.classList.add('header-scrolled') 88 } else { 89 selectHeader.classList.remove('header-scrolled') 90 } 91 } 92 window.addEventListener('load', headerScrolled) 93 onscroll(document, headerScrolled) 94 } 95 96 /** 97 * Back to top button 98 */ 99 let backtotop = select('.back-to-top') 100 if (backtotop) { 101 const toggleBacktotop = () => { 102 if (window.scrollY > 100) { 103 backtotop.classList.add('active') 104 } else { 105 backtotop.classList.remove('active') 106 } 107 } 108 window.addEventListener('load', toggleBacktotop) 109 onscroll(document, toggleBacktotop) 110 } 111 112 /** 113 * Initiate tooltips 114 */ 115 var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 116 var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) { 117 return new bootstrap.Tooltip(tooltipTriggerEl) 118 }) 119 120 /** 121 * Initiate quill editors 122 */ 123 if (select('.quill-editor-default')) { 124 new Quill('.quill-editor-default', { 125 theme: 'snow' 126 }); 127 } 128 129 if (select('.quill-editor-bubble')) { 130 new Quill('.quill-editor-bubble', { 131 theme: 'bubble' 132 }); 133 } 134 135 if (select('.quill-editor-full')) { 136 new Quill(".quill-editor-full", { 137 modules: { 138 toolbar: [ 139 [{ 140 font: [] 141 }, { 142 size: [] 143 }], 144 ["bold", "italic", "underline", "strike"], 145 [{ 146 color: [] 147 }, 148 { 149 background: [] 150 } 151 ], 152 [{ 153 script: "super" 154 }, 155 { 156 script: "sub" 157 } 158 ], 159 [{ 160 list: "ordered" 161 }, 162 { 163 list: "bullet" 164 }, 165 { 166 indent: "-1" 167 }, 168 { 169 indent: "+1" 170 } 171 ], 172 ["direction", { 173 align: [] 174 }], 175 ["link", "image", "video"], 176 ["clean"] 177 ] 178 }, 179 theme: "snow" 180 });
181 } 182 183 /** 184 * Initiate TinyMCE Editor 185 */ 186 187 const useDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; 188 const isSmallScreen = window.matchMedia('(max-width: 1023.5px)').matches; 189 190 tinymce.init({ 191 selector: 'textarea.tinymce-editor', 192 plugins: 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons accordion', 193 editimage_cors_hosts: ['picsum.photos'], 194 menubar: 'file edit view insert format tools table help', 195 toolbar: "undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl", 196 autosave_ask_before_unload: true, 197 autosave_interval: '30s', 198 autosave_prefix: '{path}{query}-{id}-', 199 autosave_restore_when_empty: false, 200 autosave_retention: '2m', 201 image_advtab: true, 202 link_list: [{ 203 title: 'My page 1', 204 value: 'https://www.tiny.cloud' 205 }, 206 { 207 title: 'My page 2', 208 value: 'http://www.moxiecode.com' 209 } 210 ], 211 image_list: [{ 212 title: 'My page 1', 213 value: 'https://www.tiny.cloud' 214 }, 215 { 216 title: 'My page 2', 217 value: 'http://www.moxiecode.com' 218 } 219 ], 220 image_class_list: [{ 221 title: 'None', 222 value: '' 223 }, 224 { 225 title: 'Some class', 226 value: 'class-name' 227 } 228 ], 229 importcss_append: true, 230 file_picker_callback: (callback, value, meta) => { 231 /* Provide file and text for the link dialog */ 232 if (meta.filetype === 'file') { 233 callback('https://www.google.com/logos/google.jpg', { 234 text: 'My text' 235 }); 236 } 237 238 /* Provide image and alt text for the image dialog */ 239 if (meta.filetype === 'image') { 240 callback('https://www.google.com/logos/google.jpg', { 241 alt: 'My alt text' 242 }); 243 } 244 245 /* Provide alternative source and posted for the media dialog */ 246 if (meta.filetype === 'media') { 247 callback('movie.mp4', { 248 source2: 'alt.ogg', 249 poster: 'https://www.google.com/logos/google.jpg' 250 }); 251 } 252 }, 253 height: 600, 254 image_caption: true, 255 quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable', 256 noneditable_class: 'mceNonEditable', 257 toolbar_mode: 'sliding', 258 contextmenu: 'link image table', 259 skin: useDarkMode ? 'oxide-dark' : 'oxide', 260 content_css: useDarkMode ? 'dark' : 'default', 261 content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }' 262 }); 263 264 /** 265 * Initiate Bootstrap validation check 266 */ 267 var needsValidation = document.querySelectorAll('.needs-validation') 268 269 Array.prototype.slice.call(needsValidation) 270 .forEach(function(form) { 271 form.addEventListener('submit', function(event) { 272 if (!form.checkValidity()) { 273 event.preventDefault() 274 event.stopPropagation() 275 } 276 277 form.classList.add('was-validated') 278 }, false) 279 }) 280 281 /** 282 * Initiate Datatables 283 */ 284 const datatables = select('.datatable', true) 285 datatables.forEach(datatable => { 286 new simpleDatatables.DataTable(datatable, { 287 // 1) abilita esplicitamente la ricerca 288 searchable: true, 289 perPageSelect: [5, 10, 15, ["All", -1]], 290 dateFormat: "DD/MM/YYYY", 291 columns: [{ 292 select: 2, 293 sortSequence: ["desc", "asc"] 294 }, 295 { 296 select: 3, 297 sortSequence: ["desc"] 298 }, 299 { 300 select: 4, 301 cellClass: "green", 302 headerClass: "red" 303 } 304 ] 305 }); 306 }) 307 308 /** 309 * Autoresize echart charts 310 */ 311 const mainContainer = select('#main'); 312 if (mainContainer) { 313 setTimeout(() => { 314 new ResizeObserver(function() { 315 select('.echart', true).forEach(getEchart => { 316 const chartInstance = echarts.getInstanceByDom(getEchart); 317 if (chartInstance) { 318 chartInstance.resize(); 319 } 320 }) 321 }).observe(mainContainer); 322 }, 200); 323 } 324 325})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.