OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |