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

Unified Diff: components/supervised_user_error_page/resources/supervised_user_block_interstitial.js

Issue 2739473006: Update supervised user interstitial pages. (Closed)
Patch Set: fix Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/supervised_user_error_page/resources/supervised_user_block_interstitial.js
diff --git a/components/supervised_user_error_page/resources/supervised_user_block_interstitial.js b/components/supervised_user_error_page/resources/supervised_user_block_interstitial.js
index 18a46c808a21ae4edb8c9e6c592a3960c019023f..6b9abf41343a2eb3ad215c721d25e41ead5c55d4 100644
--- a/components/supervised_user_error_page/resources/supervised_user_block_interstitial.js
+++ b/components/supervised_user_error_page/resources/supervised_user_block_interstitial.js
@@ -2,6 +2,40 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var mobileNav = false;
+
+var showDetails = false;
+
+/**
+ * For small screen mobile the navigation buttons are moved
+ * below the advanced text.
+ */
+function onResize() {
+ var mediaQuery = '(min-width: 240px) and (max-width: 420px) and ' +
+ '(max-height: 736px) and (min-height: 401px) and ' +
+ '(orientation: portrait), (max-width: 736px) and ' +
+ '(max-height: 420px) and (min-height: 240px) and ' +
+ '(min-width: 421px) and (orientation: landscape)';
+
+ // Check for change in nav status.
+ if (mobileNav != window.matchMedia(mediaQuery).matches) {
+ mobileNav = !mobileNav;
+ updateDetails();
+ }
+}
+
+function updateDetails() {
+ $('information-container').hidden = mobileNav && showDetails;
+ $('details').hidden = !showDetails;
+}
+
+function setupMobileNav() {
+ window.addEventListener('resize', onResize);
+ onResize();
+}
+
+document.addEventListener('DOMContentLoaded', setupMobileNav);
+
function sendCommand(cmd) {
window.domAutomationController.setAutomationId(1);
window.domAutomationController.send(cmd);
@@ -57,18 +91,16 @@ function initialize() {
sendCommand('back');
};
$('show-details-link').onclick = function(event) {
- $('details').hidden = false;
+ showDetails = true;
$('show-details-link').hidden = true;
$('hide-details-link').hidden = false;
- $('information-container').classList.add('hidden-on-mobile');
- $('request-access-button').classList.add('hidden-on-mobile');
+ updateDetails();
};
$('hide-details-link').onclick = function(event) {
- $('details').hidden = true;
+ showDetails = false;
$('show-details-link').hidden = false;
$('hide-details-link').hidden = true;
- $('information-container').classList.remove('hidden-on-mobile');
- $('request-access-button').classList.remove('hidden-on-mobile');
+ updateDetails();
};
if (window.domAutomationController &&
loadTimeData.getBoolean('showFeedbackLink')) {
@@ -88,17 +120,20 @@ function setRequestStatus(isSuccessful) {
console.log('setRequestStatus(' + isSuccessful +')');
$('block-page-header').hidden = true;
$('block-page-message').hidden = true;
+ $('hide-details-link').hidden = true;
+ showDetails = false;
+ updateDetails();
+
if (isSuccessful) {
$('request-failed-message').hidden = true;
$('request-sent-message').hidden = false;
- $('show-details-link').hidden = true;
- $('hide-details-link').hidden = true;
- $('details').hidden = true;
$('back-button').hidden = !window.domAutomationController;
$('request-access-button').hidden = true;
+ $('show-details-link').hidden = true;
} else {
$('request-failed-message').hidden = false;
$('request-access-button').hidden = false;
+ $('show-details-link').hidden = false;
}
}

Powered by Google App Engine
This is Rietveld 408576698