Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/resources/security_warnings/interstitial_v2_mobile.js

Issue 916093003: Intersitial page updates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Optimise icons, update secondary button colour Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var mobileNav = false; 5 var mobileNav = false;
6 6
7 /** 7 /**
8 * For small screen mobile the navigation buttons are moved 8 * For small screen mobile the navigation buttons are moved
9 * below the advanced text. 9 * below the advanced text.
10 */ 10 */
11 function onResize() { 11 function onResize() {
12 var helpOuterBox = document.querySelector('#details'); 12 var helpOuterBox = document.querySelector('#details');
13 var mainContent = document.querySelector('#main-content'); 13 var mainContent = document.querySelector('#main-content');
14 var mediaQuery = '(max-width: 420px) and (orientation: portrait),' + 14 var mediaQuery = '(min-width: 300px) and (max-width: 420px) and ' +
15 '(max-width: 736px) and (max-height: 420px) and (orientation: landscape)'; 15 '(orientation: portrait), (max-width: 736px) and ' +
16 '(max-height: 420px) and (orientation: landscape)';
17 var detailsHidden = helpOuterBox.classList.contains('hidden');
16 18
17 // Check for change in nav status. 19 // Check for change in nav status.
18 if (mobileNav != window.matchMedia(mediaQuery).matches) { 20 if (mobileNav != window.matchMedia(mediaQuery).matches) {
19 // Show the top content and reset the details section to hidden.
20 mainContent.classList.toggle('hidden', false);
21 helpOuterBox.classList.toggle('hidden', true);
22 mobileNav = !mobileNav; 21 mobileNav = !mobileNav;
22
23 // Handle showing the top content / details sections according to state.
24 if (mobileNav) {
25 mainContent.classList.toggle('hidden', !detailsHidden);
26 helpOuterBox.classList.toggle('hidden', detailsHidden);
27 } else if (!detailsHidden) {
28 // Non mobile nav with visible details.
29 mainContent.classList.remove('hidden');
30 helpOuterBox.classList.remove('hidden');
31 }
23 } 32 }
24 } 33 }
25 34
26 function setupMobileNav() { 35 function setupMobileNav() {
27 window.addEventListener('resize', onResize); 36 window.addEventListener('resize', onResize);
28 onResize(); 37 onResize();
29 } 38 }
30 39
31 document.addEventListener('DOMContentLoaded', setupMobileNav); 40 document.addEventListener('DOMContentLoaded', setupMobileNav);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698