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

Side by Side Diff: components/dom_distiller/core/javascript/dom_distiller_viewer.js

Issue 1920563002: Only trigger navigation in distiller if in print preview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This variable will be changed by iOS scripts. 5 // This variable will be changed by iOS scripts.
6 var distiller_on_ios = false; 6 var distiller_on_ios = false;
7 7
8 function addToPage(html) { 8 function addToPage(html) {
9 var div = document.createElement('div'); 9 var div = document.createElement('div');
10 div.innerHTML = html; 10 div.innerHTML = html;
(...skipping 25 matching lines...) Expand all
36 parent.replaceChild(container, placeholders[i]); 36 parent.replaceChild(container, placeholders[i]);
37 } 37 }
38 } 38 }
39 39
40 function showLoadingIndicator(isLastPage) { 40 function showLoadingIndicator(isLastPage) {
41 document.getElementById('loadingIndicator').className = 41 document.getElementById('loadingIndicator').className =
42 isLastPage ? 'hidden' : 'visible'; 42 isLastPage ? 'hidden' : 'visible';
43 // This function will be one of the last things to occur when a page is 43 // This function will be one of the last things to occur when a page is
44 // loaded. This is temporarily used to signal print preview to generate 44 // loaded. This is temporarily used to signal print preview to generate
45 // a PDF. 45 // a PDF.
46 if (isLastPage) { 46 if (isLastPage && typeof is_print_preview_distiller !== 'undefined'
Bernhard Bauer 2016/04/25 15:36:38 If you declare this at the global level and initia
mdjones 2016/04/25 16:33:13 Updated var name. Unfortunately I can't pre-define
Bernhard Bauer 2016/04/25 17:30:31 But that's fine, because you'll have declared the
mdjones 2016/04/25 18:24:08 Yes, the whole file is parsed after the JavaScript
Bernhard Bauer 2016/04/28 16:24:04 That does not seem like the right solution. From t
47 && is_print_preview_distiller) {
47 setTimeout(function() { 48 setTimeout(function() {
48 window.location = window.location + "#loaded"; 49 window.location = window.location + "#loaded";
49 }, 0); 50 }, 0);
50 } 51 }
51 } 52 }
52 53
53 // Sets the title. 54 // Sets the title.
54 function setTitle(title) { 55 function setTitle(title) {
55 var holder = document.getElementById('titleHolder'); 56 var holder = document.getElementById('titleHolder');
56 57
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 clampedScale = scaling; 404 clampedScale = scaling;
404 restoreCenter(); 405 restoreCenter();
405 } 406 }
406 }; 407 };
407 }()); 408 }());
408 409
409 window.addEventListener('touchstart', pincher.handleTouchStart, false); 410 window.addEventListener('touchstart', pincher.handleTouchStart, false);
410 window.addEventListener('touchmove', pincher.handleTouchMove, false); 411 window.addEventListener('touchmove', pincher.handleTouchMove, false);
411 window.addEventListener('touchend', pincher.handleTouchEnd, false); 412 window.addEventListener('touchend', pincher.handleTouchEnd, false);
412 window.addEventListener('touchcancel', pincher.handleTouchCancel, false); 413 window.addEventListener('touchcancel', pincher.handleTouchCancel, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698