OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var mobileNav = false; |
| 6 |
| 7 /** |
| 8 * For small screen mobile the navigation buttons are moved |
| 9 * below the advanced text. |
| 10 */ |
| 11 function onResize() { |
| 12 var helpOuterBox = document.querySelector('#details'); |
| 13 var mainContent = document.querySelector('#main-content'); |
| 14 var mainFrame = document.querySelector('.interstitial-wrapper'); |
| 15 var navWrapper = document.querySelector('.nav-wrapper'); |
| 16 |
| 17 var mediaQuery = '(max-width: 420px) and (orientation:portrait),' + |
| 18 '(max-width: 736px) and (max-height: 420px) and (orientation:landscape)'; |
| 19 |
| 20 if (window.matchMedia(mediaQuery).matches) { |
| 21 if (navWrapper.parentNode != document.body) { |
| 22 document.body.insertBefore(navWrapper, mainFrame.nextSibling); |
| 23 mobileNav = true; |
| 24 } |
| 25 } else if (navWrapper.parentNode != mainContent) { |
| 26 mainContent.appendChild(navWrapper); |
| 27 mobileNav = false; |
| 28 } |
| 29 } |
| 30 |
| 31 function setupMobileNav() { |
| 32 window.addEventListener('resize', onResize); |
| 33 onResize(); |
| 34 } |
| 35 |
| 36 document.addEventListener('DOMContentLoaded', setupMobileNav); |
OLD | NEW |