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

Unified Diff: components/dom_distiller/core/javascript/dom_distiller_viewer.js

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More refactors and remove tab_helpers dependency Created 5 years, 5 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/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';
+ }
+ });
}
/**

Powered by Google App Engine
This is Rietveld 408576698