1/*! 2 3========================================================= 4* Soft UI PRO - v1.0.0 5========================================================= 6 7* Product Page: https://www.creative-tim.com/product/black-dashboard 8* Copyright site.year Creative Tim (https://www.creative-tim.com) 9* Licensed under MIT (https://github.com/creativetimofficial/black-dashboard/blob/master/LICENSE.md) 10 11* Coded by Creative Tim 12 13========================================================= 14 15* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 16 17*/ 18 19// initialization of Popovers 20var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')) 21var popoverList = popoverTriggerList.map(function(popoverTriggerEl) { 22 return new bootstrap.Popover(popoverTriggerEl) 23}) 24 25// initialization of Tooltips 26var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) 27var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) { 28 return new bootstrap.Tooltip(tooltipTriggerEl) 29}) 30 31// helper for adding on all elements multiple attributes 32function setAttributes(el, options) { 33 Object.keys(options).forEach(function(attr) { 34 el.setAttribute(attr, options[attr]); 35 }) 36} 37 38// activate popovers 39var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="popover"]')) 40var popoverList = popoverTriggerList.map(function(popoverTriggerEl) { 41 return new bootstrap.Popover(popoverTriggerEl) 42}) 43 44// activate tooltips 45var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-toggle="tooltip"]')) 46var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) { 47 return new bootstrap.Tooltip(tooltipTriggerEl) 48}) 49 50// Multi Level Dropdown 51function dropDown(a) { 52 if (!document.querySelector('.dropdown-hover')) { 53 event.stopPropagation(); 54 event.preventDefault(); 55 var multilevel = a.parentElement.parentElement.children; 56 57 58 for (var i = 0; i < multilevel.length; i++) { 59 if (multilevel[i].lastElementChild != a.parentElement.lastElementChild) { 60 multilevel[i].lastElementChild.classList.remove('show'); 61 multilevel[i].firstElementChild.classList.remove('show'); 62 } 63 } 64 65 if (!a.nextElementSibling.classList.contains("show")) { 66 a.nextElementSibling.classList.add("show"); 67 a.classList.add("show"); 68 69 } else { 70 a.nextElementSibling.classList.remove("show"); 71 a.classList.remove("show"); 72 73 } 74 } 75} 76 77// Colored shadows from Cards 78if (document.querySelector('.blur-shadow-image')) {
79 var shadowCards = document.querySelectorAll('.blur-shadow-image'); 80 81 for (var i = 0; i < shadowCards.length; i++) { 82 var div = document.createElement("DIV"); 83 shadowCards[i].parentElement.appendChild(div); 84 div.classList.add('colored-shadow'); 85 86 87 var currentSrc = shadowCards[i].children[0].getAttribute('src'); 88 var el = shadowCards[i].nextElementSibling; 89 90 el.style.backgroundImage = 'url(' + currentSrc + ')'; 91 } 92} 93 94// Colored shadows for Avatars 95if (document.querySelector('.blur-shadow-avatar')) { 96 97 var shadowCards = document.querySelectorAll('.blur-shadow-avatar'); 98 99 for (var i = 0; i < shadowCards.length; i++) { 100 101 var div = document.createElement("DIV"); 102 shadowCards[i].parentElement.appendChild(div); 103 div.classList.add('colored-shadow', 'start-0', 'end-0', 'mx-auto'); 104 105 var avatarClasses = ['avatar-xs', 'avatar-sm', 'avatar-lg', 'avatar-xl', 'avatar-xxl']; 106 107 for (var k = 0; k < avatarClasses.length; k++) { 108 if (shadowCards[i].firstElementChild.classList.contains(avatarClasses[k])) { 109 div.classList.add(avatarClasses[k]); 110 } 111 } 112 113 var currentSrc = shadowCards[i].children[0].getAttribute('src'); 114 var el = shadowCards[i].nextElementSibling; 115 116 el.style.backgroundImage = 'url(' + currentSrc + ')'; 117 } 118} 119 120//Google Maps 121if (document.querySelector('#google-maps')) { 122 var myLatlng = new google.maps.LatLng(40.748817, -73.985428); 123 var mapOptions = { 124 zoom: 13, 125 center: myLatlng, 126 scrollwheel: false, //we disable de scroll over the map, it is a really annoing when you scroll through page 127 styles: [{ 128 "featureType": "administrative", 129 "elementType": "labels.text.fill", 130 "stylers": [{ 131 "color": "#444444" 132 }] 133 }, 134 { 135 "featureType": "landscape", 136 "elementType": "all", 137 "stylers": [{ 138 "color": "#f2f2f2" 139 }] 140 }, 141 { 142 "featureType": "poi", 143 "elementType": "all", 144 "stylers": [{ 145 "visibility": "off" 146 }] 147 }, 148 { 149 "featureType": "road", 150 "elementType": "all", 151 "stylers": [{ 152 "saturation": -100 153 }, { 154 "lightness": 45 155 }] 156 }, 157 { 158 "featureType": "road.highway", 159 "elementType": "all", 160 "stylers": [{ 161 "visibility": "simplified" 162 }] 163 }, 164 { 165 "featureType": "road.arterial", 166 "elementType": "labels.icon", 167 "stylers": [{ 168 "visibility": "off" 169 }] 170 }, 171 { 172 "featureType": "transit", 173 "elementType": "all", 174 "stylers": [{ 175 "visibility": "off" 176 }] 177 }, 178 { 179 "featureType": "water", 180 "elementType": "all", 181 "stylers": [{ 182 "color": "#C5CBF5" 183 }, { 184 "visibility": "on" 185 }] 186 } 187 ] 188 }; 189 190 var map = new google.maps.Map(document.getElementById("google-maps"), mapOptions); 191 192 var marker = new google.maps.Marker({ 193 position: myLatlng, 194 title: "Hello World!" 195 }); 196 197 // To add the marker to the map, call setMap(); 198 marker.setMap(map); 199} 200 201// initialize the smooth scroll plugin 202// if (document.querySelectorAll('a[href*="#"]').length != 0) { 203// var scroll = new SmoothScroll('a[href*="#"]', { 204// speed: 500, 205// easing: 'easeInOutQuad' 206// }); 207// } 208 209// Tabs navigation 210 211var total = document.querySelectorAll('.nav-pills'); 212 213total.forEach(function(item, i) { 214 var moving_div = document.createElement('div'); 215 var first_li = item.querySelector('li:first-child .nav-link'); 216 var tab = first_li.cloneNode(); 217 tab.innerHTML = "-"; 218 219 moving_div.classList.add('moving-tab', 'position-absolute', 'nav-link'); 220 moving_div.appendChild(tab); 221 item.appendChild(moving_div); 222 223 var list_length = item.getElementsByTagName("li").length; 224 225 moving_div.style.padding = '0px'; 226 moving_div.style.width = item.querySelector('li:nth-child(1)').offsetWidth + 'px'; 227 moving_div.style.transform = 'translate3d(0px, 0px, 0px)'; 228 moving_div.style.transition = '.5s ease'; 229 230 item.onmouseover = function(event) { 231 let target = getEventTarget(event); 232 let li = target.closest('li'); // get reference 233 if (li) { 234 let nodes = Array.from(li.closest('ul').children); // get array
235 let index = nodes.indexOf(li) + 1; 236 item.querySelector('li:nth-child(' + index + ') .nav-link').onclick = function() { 237 moving_div = item.querySelector('.moving-tab'); 238 let sum = 0; 239 if (item.classList.contains('flex-column')) { 240 for (var j = 1; j <= nodes.indexOf(li); j++) { 241 sum += item.querySelector('li:nth-child(' + j + ')').offsetHeight; 242 } 243 moving_div.style.transform = 'translate3d(0px,' + sum + 'px, 0px)'; 244 moving_div.style.height = item.querySelector('li:nth-child(' + j + ')').offsetHeight; 245 } else { 246 for (var j = 1; j <= nodes.indexOf(li); j++) { 247 sum += item.querySelector('li:nth-child(' + j + ')').offsetWidth; 248 } 249 moving_div.style.transform = 'translate3d(' + sum + 'px, 0px, 0px)'; 250 moving_div.style.width = item.querySelector('li:nth-child(' + index + ')').offsetWidth + 'px'; 251 console.log('translate3d(' + sum + 'px, 0px, 0px)'); 252 } 253 } 254 } 255 } 256}); 257 258 259// Tabs navigation resize 260 261window.addEventListener('resize', function(event) { 262 total.forEach(function(item, i) { 263 item.querySelector('.moving-tab').remove(); 264 var moving_div = document.createElement('div'); 265 var tab = item.querySelector(".nav-link.active").cloneNode(); 266 tab.innerHTML = "-"; 267 268 moving_div.classList.add('moving-tab', 'position-absolute', 'nav-link'); 269 moving_div.appendChild(tab); 270 271 item.appendChild(moving_div); 272 273 moving_div.style.padding = '0px'; 274 moving_div.style.transition = '.5s ease'; 275 276 let li = item.querySelector(".nav-link.active").parentElement; 277 278 if (li) { 279 let nodes = Array.from(li.closest('ul').children); // get array 280 let index = nodes.indexOf(li) + 1; 281 282 let sum = 0; 283 if (item.classList.contains('flex-column')) { 284 for (var j = 1; j <= nodes.indexOf(li); j++) { 285 sum += item.querySelector('li:nth-child(' + j + ')').offsetHeight; 286 } 287 moving_div.style.transform = 'translate3d(0px,' + sum + 'px, 0px)'; 288 moving_div.style.width = item.querySelector('li:nth-child(' + index + ')').offsetWidth + 'px'; 289 moving_div.style.height = item.querySelector('li:nth-child(' + j + ')').offsetHeight; 290 } else { 291 for (var j = 1; j <= nodes.indexOf(li); j++) { 292 sum += item.querySelector('li:nth-child(' + j + ')').offsetWidth; 293 } 294 moving_div.style.transform = 'translate3d(' + sum + 'px, 0px, 0px)'; 295 moving_div.style.width = item.querySelector('li:nth-child(' + index + ')').offsetWidth + 'px'; 296 297 } 298 } 299 }); 300 301 if (window.innerWidth < 991) { 302 total.forEach(function(item, i) { 303 if (!item.classList.contains('flex-column')) { 304 item.classList.add('flex-column', 'on-resize'); 305 } 306 }); 307 } else { 308 total.forEach(function(item, i) { 309 if (item.classList.contains('on-resize')) { 310 item.classList.remove('flex-column', 'on-resize'); 311 } 312 }) 313 } 314}); 315 316 317function getEventTarget(e) { 318 e = e || window.event; 319 return e.target || e.srcElement; 320} 321 322// End tabs navigation 323 324 325// Copy code function 326 327function copyCode(el) { 328 const selection = window.getSelection(); 329 const range = document.createRange(); 330 const textToCopy = el.nextElementSibling; 331 range.selectNodeContents(textToCopy); 332 selection.removeAllRanges(); 333 selection.addRange(range); 334 const successful = document.execCommand('copy'); 335 window.getSelection().removeAllRanges() 336 if (!el.parentElement.querySelector('.alert')) { 337 var alert = document.createElement('div'); 338 alert.classList.add('alert', 'alert-success', 'position-absolute', 'top-0', 'border-0', 'text-white', 'w-25', 'end-0', 'start-0', 'mt-2', 'mx-auto', 'py-2'); 339 alert.style.transform = 'translate3d(0px, 0px, 0px)' 340 alert.style.opacity = '0'; 341 alert.style.transition = '.35s ease'; 342 setTimeout(function() { 343 alert.style.transform = 'translate3d(0px, 20px, 0px)'; 344 alert.style.setProperty("opacity", "1", "important"); 345 }, 100); 346 alert.innerHTML = "Code successfully copied!"; 347 el.parentElement.appendChild(alert); 348 setTimeout(function() { 349 alert.style.transform = 'translate3d(0px, 0px, 0px)' 350 alert.style.setProperty("opacity", "0", "important"); 351 }, 2000); 352 setTimeout(function() { 353 el.parentElement.querySelector('.alert').remove(); 354 }, 2500); 355 } 356} 357 358 359 360 361// End copy code function
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.