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

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

Issue 1060623002: Adds support for dynamically setting the title (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « components/dom_distiller/core/html/dom_distiller_viewer.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function addToPage(html) { 5 function addToPage(html) {
6 var div = document.createElement('div'); 6 var div = document.createElement('div');
7 div.innerHTML = html; 7 div.innerHTML = html;
8 document.getElementById('content').appendChild(div); 8 document.getElementById('content').appendChild(div);
9 } 9 }
10 10
11 function showLoadingIndicator(isLastPage) { 11 function showLoadingIndicator(isLastPage) {
12 document.getElementById('loadingIndicator').className = 12 document.getElementById('loadingIndicator').className =
13 isLastPage ? 'hidden' : 'visible'; 13 isLastPage ? 'hidden' : 'visible';
14 updateLoadingIndicator(isLastPage); 14 updateLoadingIndicator(isLastPage);
15 } 15 }
16 16
17 // Sets the title. The title will be exposed with a simple animation. This
18 // should only be used when the title was not included in the initial html.
19 function setTitle(title) {
20 var holder = document.getElementById('titleHolder');
21 var collapse = document.getElementById('titleCollapse');
22
23 collapse.style.height = "0px";
24
25 holder.textContent = title;
26 var newHeight = Math.max(90, holder.getBoundingClientRect().height);
27
28 collapse.style.transition = "height 0.2s";
mdjones 2015/04/03 22:35:39 Note that "transition" is not a standard feature:
29 collapse.style.height = newHeight + "px";
30 }
31
17 // Maps JS Font Family to CSS class and then changes body class name. 32 // Maps JS Font Family to CSS class and then changes body class name.
18 // CSS classes must agree with distilledpage.css. 33 // CSS classes must agree with distilledpage.css.
19 function useFontFamily(fontFamily) { 34 function useFontFamily(fontFamily) {
20 var cssClass; 35 var cssClass;
21 if (fontFamily == "serif") { 36 if (fontFamily == "serif") {
22 cssClass = "serif"; 37 cssClass = "serif";
23 } else if (fontFamily == "monospace") { 38 } else if (fontFamily == "monospace") {
24 cssClass = "monospace"; 39 cssClass = "monospace";
25 } else { 40 } else {
26 cssClass = "sans-serif"; 41 cssClass = "sans-serif";
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 }(); 82 }();
68 83
69 // Add a listener to the "View Original" link to report opt-outs. 84 // Add a listener to the "View Original" link to report opt-outs.
70 document.getElementById('showOriginal').addEventListener('click', function(e) { 85 document.getElementById('showOriginal').addEventListener('click', function(e) {
71 var img = document.createElement('img'); 86 var img = document.createElement('img');
72 img.src = "/vieworiginal"; 87 img.src = "/vieworiginal";
73 img.style.display = "none"; 88 img.style.display = "none";
74 document.body.appendChild(img); 89 document.body.appendChild(img);
75 }, true); 90 }, true);
76 91
OLDNEW
« no previous file with comments | « components/dom_distiller/core/html/dom_distiller_viewer.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698