Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const d = document;
- d.addEventListener("DOMContentLoaded", function(event) {
- // options
- const breakpoints = {
- sm: 540,
- md: 720,
- lg: 960,
- xl: 1140
- };
- var preloader = d.querySelector('.preloader');
- if(preloader) {
- setTimeout(function() {
- preloader.classList.add('show');
- setTimeout(function() {
- d.querySelector('.loader-element').classList.add('hide');
- }, 200);
- }, 1000);
- }
- var iconNotifications = d.querySelector('.icon-notifications');
- if(iconNotifications) {
- var unreadNotifications = d.querySelector('.unread-notifications');
- var bellShake = d.querySelector('.bell-shake');
- if (iconNotifications.getAttribute('data-unread-notifications') === 'true') {
- unreadNotifications.style.display = 'block';
- } else {
- unreadNotifications.style.display = 'none';
- }
- // bell shake
- var shakingInterval = setInterval(function() {
- if (iconNotifications.getAttribute('data-unread-notifications') === 'true') {
- if (bellShake.classList.contains('shaking')) {
- bellShake.classList.remove('shaking');
- } else {
- bellShake.classList.add('shaking');
- }
- }
- }, 5000);
- iconNotifications.addEventListener('show.bs.dropdown', function () {
- bellShake.setAttribute('data-unread-notifications', false);
- clearInterval(shakingInterval);
- bellShake.classList.remove('shaking');
- unreadNotifications.style.display = 'none';
- });
- }
- [].slice.call(d.querySelectorAll('[data-background]')).map(function(el) {
- el.style.background = 'url(' + el.getAttribute('data-background') + ')';
- });
- [].slice.call(d.querySelectorAll('[data-background-lg]')).map(function(el) {
- if(document.body.clientWidth > breakpoints.lg) {
- el.style.background = 'url(' + el.getAttribute('data-background-lg') + ')';
- }
- });
- [].slice.call(d.querySelectorAll('[data-background-color]')).map(function(el) {
- el.style.background = 'url(' + el.getAttribute('data-background-color') + ')';
- });
- [].slice.call(d.querySelectorAll('[data-color]')).map(function(el) {
- el.style.color = 'url(' + el.getAttribute('data-color') + ')';
- });
- // Tooltips
- var tooltipTriggerList = [].slice.call(d.querySelectorAll('[data-toggle="tooltip"]'))
- var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
- return new bootstrap.Tooltip(tooltipTriggerEl)
- })
- // Popovers
- var popoverTriggerList = [].slice.call(d.querySelectorAll('[data-toggle="popover"]'))
- var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
- return new bootstrap.Popover(popoverTriggerEl)
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement