| var buildMobileSideNav = function () { |
| |
| var navMenu = document.querySelector('nav ul') |
| var mobileMenu = navMenu.cloneNode(true) |
| |
| // Clear classList of clone |
| if ( mobileMenu.classList.length > 0 ) { |
| var classes = new Array(mobileMenu.classList.length) |
| for (var i = 0, len = mobileMenu.classList.length; i < len; i++) { |
| classes[i] = mobileMenu.classList.item(i) |
| } |
| mobileMenu.classList.remove(classes) |
| } |
| |
| mobileMenu.classList.add('side-nav') |
| mobileMenu.setAttribute('id', 'mobile-sidebar') |
| |
| var nav = document.querySelector('nav') |
| nav.appendChild(mobileMenu) |
| |
| var sidenavButton = document.createElement('a') |
| sidenavButton.setAttribute('href', '#') |
| sidenavButton.setAttribute('data-activates', 'mobile-sidebar') |
| sidenavButton.classList.add('button-collapse') |
| |
| var sidenavIcon = document.createElement('i') |
| sidenavIcon.classList.add('material-icons') |
| sidenavIcon.textContent = 'menu' |
| |
| sidenavButton.appendChild(sidenavIcon) |
| nav.appendChild(sidenavButton) |
| |
| $(".button-collapse").sideNav(); |
| |
| nav.parentNode.removeChild(nav) |
| |
| var fixedNavbar = document.createElement('div') |
| fixedNavbar.classList.add('navbar-fixed') |
| |
| fixedNavbar.appendChild(nav) |
| |
| var body = document.querySelector('body') |
| body.insertBefore(fixedNavbar, body.firstChild) |
| } |
| |
| var addBackground = function () { |
| var back = document.createElement('img') |
| back.classList.add('background') |
| back.setAttribute('src', cdn_url + 'img/background_ny_2.jpeg') |
| |
| var parallax = document.querySelector('.main-content') |
| |
| parallax.insertBefore(back, parallax.firstChild) |
| |
| var spacer = document.createElement('div'); |
| spacer.setAttribute('id', 'main-head-spacer'); |
| $(back).after(spacer); |
| } |
| |
| var wrapAll = function (target, wrapperClass) { |
| var commandlines = document.querySelectorAll(target) |
| |
| for (var i=0; i<commandlines.length; i++) { |
| var cmd = commandlines[i] |
| var parent = cmd.parentNode |
| |
| var wrapper = document.createElement('div') |
| wrapper.classList.add(wrapperClass) |
| |
| parent.insertBefore(wrapper, cmd) |
| parent.removeChild(cmd) |
| wrapper.appendChild(cmd) |
| |
| } |
| } |
| |
| buildMobileSideNav() |
| addBackground() |
| wrapAll('#community h3', 'community-title-wrapper') |
| wrapAll('.description-images img', 'description-image-wrapper') |
| wrapAll('.involved-parties-logos a', 'logo-wrapper') |
| wrapAll('.commandline:not(.li)', 'commandline-wrapper') |
| wrapAll('.commandline.li', 'commandline-li-wrapper') |
| wrapAll('.commandline-list', 'commandline-list-wrapper') |
| wrapAll('.description', 'description-wrapper') |
| wrapAll('.service', 'service-wrapper') |
| |
| $('.modal-trigger').leanModal() |