Index: components/dom_distiller/core/javascript/dom_distiller_viewer.js |
diff --git a/components/dom_distiller/core/javascript/dom_distiller_viewer.js b/components/dom_distiller/core/javascript/dom_distiller_viewer.js |
index bf114cf6c9ad14639da53c4fef3a71e2e56ad27c..147efb6b4ff911c1cfa5d4173714069582ce1ca3 100644 |
--- a/components/dom_distiller/core/javascript/dom_distiller_viewer.js |
+++ b/components/dom_distiller/core/javascript/dom_distiller_viewer.js |
@@ -5,11 +5,26 @@ |
// This variable will be changed by iOS scripts. |
var distiller_on_ios = false; |
+// This variable allows the page to signal the BrowserProcess |
+// when the first bit of content is loaded. |
+var navigate_on_initial_content_load = false; |
+ |
+function setNavigateOnInitialContentLoad(navigate) { |
+ navigate_on_initial_content_load = navigate; |
+} |
+ |
function addToPage(html) { |
var div = document.createElement('div'); |
div.innerHTML = html; |
document.getElementById('content').appendChild(div); |
fillYouTubePlaceholders(); |
+ |
+ if (navigate_on_initial_content_load) { |
+ navigate_on_initial_content_load = false; |
+ setTimeout(function() { |
+ window.location = window.location + "#loaded"; |
+ }, 0); |
+ } |
} |
function fillYouTubePlaceholders() { |
@@ -57,6 +72,12 @@ function setTitle(title) { |
collapse.style.transition = "height 0.2s"; |
collapse.style.height = newHeight + "px"; |
+ |
+ var mediaQuery = window.matchMedia("print"); |
+ mediaQuery.addListener(function (query) { |
+ if (query.matches) |
+ collapse.style.transition = ''; |
+ }); |
} |
// Set the text direction of the document ('ltr', 'rtl', or 'auto'). |
@@ -133,6 +154,13 @@ function showFeedbackForm(questionText, yesText, noText) { |
document.getElementById('contentWrap').style.paddingBottom = '120px'; |
document.getElementById('feedbackContainer').style.display = 'block'; |
+ var mediaQuery = window.matchMedia("print"); |
+ mediaQuery.addListener(function (query) { |
+ if (query.matches) { |
+ document.getElementById('contentWrap').style.paddingBottom = '0px'; |
+ document.getElementById('feedbackContainer').style.display = 'none'; |
+ } |
+ }); |
} |
/** |