Chromium Code Reviews| Index: chrome/browser/resources/security_warnings/interstitial_v2_mobile.js |
| diff --git a/chrome/browser/resources/security_warnings/interstitial_v2_mobile.js b/chrome/browser/resources/security_warnings/interstitial_v2_mobile.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1e08bbaf0b5e69d5baac7eff8d0b0bf439ecaa18 |
| --- /dev/null |
| +++ b/chrome/browser/resources/security_warnings/interstitial_v2_mobile.js |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +var mobileNav = false; |
| + |
| +/** |
| + * For small screen mobile the navigation buttons are moved |
| + * below the advanced text. |
| + */ |
| +function onResize() { |
| + var helpOuterBox = document.querySelector('#details'); |
| + var mainContent = document.querySelector('#main-content'); |
| + var mainFrame = document.querySelector('.interstitial-wrapper'); |
| + var navWrapper = document.querySelector('.nav-wrapper'); |
| + |
| + var mediaQuery = '(max-width: 420px) and (orientation:portrait),' + |
| + '(max-width: 736px) and (max-height: 420px) and (orientation:landscape)'; |
| + |
| + if (window.matchMedia(mediaQuery).matches) { |
| + if (navWrapper.parentNode != document.body) { |
| + document.body.insertBefore(navWrapper, mainFrame.nextSibling); |
|
arv (Not doing code reviews)
2015/01/23 15:03:20
Why is this done in js instead of css? Maybe you c
edwardjung
2015/01/23 16:33:42
That makes sense. My first implementation of this
edwardjung
2015/01/23 22:04:25
Done. Removed this DOM manipulation code.
|
| + mobileNav = true; |
| + } |
| + } else if (navWrapper.parentNode != mainContent) { |
| + mainContent.appendChild(navWrapper); |
| + mobileNav = false; |
| + } |
| +} |
| + |
| +function setupMobileNav() { |
| + window.addEventListener('resize', onResize); |
| + onResize(); |
| +} |
| + |
| +document.addEventListener('DOMContentLoaded', setupMobileNav); |