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

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: rebase 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 fillYouTubePlaceholders(); 9 fillYouTubePlaceholders();
10 } 10 }
(...skipping 22 matching lines...) Expand all
33 parent.replaceChild(container, placeholders[i]); 33 parent.replaceChild(container, placeholders[i]);
34 } 34 }
35 } 35 }
36 36
37 function showLoadingIndicator(isLastPage) { 37 function showLoadingIndicator(isLastPage) {
38 document.getElementById('loadingIndicator').className = 38 document.getElementById('loadingIndicator').className =
39 isLastPage ? 'hidden' : 'visible'; 39 isLastPage ? 'hidden' : 'visible';
40 updateLoadingIndicator(isLastPage); 40 updateLoadingIndicator(isLastPage);
41 } 41 }
42 42
43 // Sets the title. The title will be exposed with a simple animation. This
44 // should only be used when the title was not included in the initial html.
45 function setTitle(title) {
46 var holder = document.getElementById('titleHolder');
47 var collapse = document.getElementById('titleCollapse');
48
49 collapse.style.height = "0px";
50
51 holder.textContent = title;
52 var newHeight = Math.max(90, holder.getBoundingClientRect().height);
53
54 collapse.style.transition = "height 0.2s";
55 collapse.style.height = newHeight + "px";
56 }
57
43 // Maps JS Font Family to CSS class and then changes body class name. 58 // Maps JS Font Family to CSS class and then changes body class name.
44 // CSS classes must agree with distilledpage.css. 59 // CSS classes must agree with distilledpage.css.
45 function useFontFamily(fontFamily) { 60 function useFontFamily(fontFamily) {
46 var cssClass; 61 var cssClass;
47 if (fontFamily == "serif") { 62 if (fontFamily == "serif") {
48 cssClass = "serif"; 63 cssClass = "serif";
49 } else if (fontFamily == "monospace") { 64 } else if (fontFamily == "monospace") {
50 cssClass = "monospace"; 65 cssClass = "monospace";
51 } else { 66 } else {
52 cssClass = "sans-serif"; 67 cssClass = "sans-serif";
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 document.getElementById('feedbackNo').addEventListener('click', function(e) { 152 document.getElementById('feedbackNo').addEventListener('click', function(e) {
138 sendFeedback(false); 153 sendFeedback(false);
139 document.getElementById('feedbackContainer').className += " fadeOut"; 154 document.getElementById('feedbackContainer').className += " fadeOut";
140 }, true); 155 }, true);
141 156
142 document.getElementById('feedbackContainer').addEventListener('animationend', 157 document.getElementById('feedbackContainer').addEventListener('animationend',
143 function(e) { 158 function(e) {
144 document.getElementById('feedbackContainer').style.display = "none"; 159 document.getElementById('feedbackContainer').style.display = "none";
145 }, true); 160 }, true);
146 161
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