Chromium Code Reviews| 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 // 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 } else { | 104 } else { |
| 105 toolbarColor = "#F5F5F5"; | 105 toolbarColor = "#F5F5F5"; |
| 106 } | 106 } |
| 107 document.getElementById('theme-color').content = toolbarColor; | 107 document.getElementById('theme-color').content = toolbarColor; |
| 108 } | 108 } |
| 109 | 109 |
| 110 function useFontScaling(scaling) { | 110 function useFontScaling(scaling) { |
| 111 pincher.useFontScaling(scaling); | 111 pincher.useFontScaling(scaling); |
| 112 } | 112 } |
| 113 | 113 |
| 114 /** | |
| 115 * Show the distiller feedback form. | |
| 116 * @param questionText The i18n text for the feedback question. | |
| 117 * @param yesText The i18n text for the feedback answer 'YES'. | |
| 118 * @param noText The i18n text for the feedback answer 'NO'. | |
| 119 */ | |
| 120 function showFeedbackForm(questionText, yesText, noText) { | |
| 121 // If the distiller is running on iOS, do not show the feedback form. This | |
| 122 // variable is set in distiller_viewer.cc before this function is run. | |
| 123 if (distiller_on_ios) return; | |
| 124 | |
| 125 document.getElementById('feedbackYes').innerText = yesText; | |
| 126 document.getElementById('feedbackNo').innerText = noText; | |
| 127 document.getElementById('feedbackQuestion').innerText = questionText; | |
| 128 | |
| 129 document.getElementById('feedbackContainer').classList.remove("hidden"); | |
| 130 } | |
| 131 | |
| 132 // Add a listener to the "View Original" link to report opt-outs. | 114 // Add a listener to the "View Original" link to report opt-outs. |
| 133 document.getElementById('closeReaderView').addEventListener('click', | 115 document.getElementById('closeReaderView').addEventListener('click', |
| 134 function(e) { | 116 function(e) { |
| 135 if (distiller) { | 117 if (distiller) { |
| 136 distiller.closePanel(true); | 118 distiller.closePanel(true); |
| 137 } | 119 } |
| 138 }, true); | 120 }, true); |
| 139 | 121 |
| 140 document.getElementById('feedbackYes').addEventListener('click', function(e) { | |
| 141 if (distiller) { | |
| 142 distiller.sendFeedback(true); | |
| 143 } | |
| 144 document.getElementById('feedbackContainer').className += " fadeOut"; | |
| 145 }, true); | |
| 146 | |
| 147 document.getElementById('feedbackNo').addEventListener('click', function(e) { | |
| 148 if (distiller) { | |
| 149 distiller.sendFeedback(false); | |
| 150 } | |
| 151 document.getElementById('feedbackContainer').className += " fadeOut"; | |
| 152 }, true); | |
| 153 | |
| 154 document.getElementById('feedbackContainer').addEventListener('animationend', | |
| 155 function(e) { | |
| 156 var feedbackContainer = document.getElementById('feedbackContainer'); | |
| 157 feedbackContainer.classList.remove("fadeOut"); | |
| 158 document.getElementById('contentWrap').style.paddingBottom = | |
| 159 window.getComputedStyle(feedbackContainer).height; | |
| 160 feedbackContainer.className += " hidden"; | |
| 161 setTimeout(function() { | |
| 162 // Close the gap where the feedback form was. | |
| 163 var contentWrap = document.getElementById('contentWrap'); | |
| 164 contentWrap.style.transition = '0.5s'; | |
| 165 contentWrap.style.paddingBottom = ''; | |
| 166 }, 0); | |
| 167 }, true); | |
| 168 | |
| 169 document.getElementById('contentWrap').addEventListener('transitionend', | 122 document.getElementById('contentWrap').addEventListener('transitionend', |
|
wychen
2017/03/24 17:57:20
Doesn't seem needed anymore.
mdjones
2017/03/24 18:08:28
Done.
| |
| 170 function(e) { | 123 function(e) { |
| 171 var contentWrap = document.getElementById('contentWrap'); | 124 var contentWrap = document.getElementById('contentWrap'); |
| 172 contentWrap.style.transition = ''; | 125 contentWrap.style.transition = ''; |
| 173 }, true); | 126 }, true); |
| 174 | 127 |
| 175 updateToolbarColor(); | 128 updateToolbarColor(); |
| 176 | 129 |
| 177 var pincher = (function() { | 130 var pincher = (function() { |
| 178 'use strict'; | 131 'use strict'; |
| 179 // When users pinch in Reader Mode, the page would zoom in or out as if it | 132 // When users pinch in Reader Mode, the page would zoom in or out as if it |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 clampedScale = scaling; | 348 clampedScale = scaling; |
| 396 restoreCenter(); | 349 restoreCenter(); |
| 397 } | 350 } |
| 398 }; | 351 }; |
| 399 }()); | 352 }()); |
| 400 | 353 |
| 401 window.addEventListener('touchstart', pincher.handleTouchStart, false); | 354 window.addEventListener('touchstart', pincher.handleTouchStart, false); |
| 402 window.addEventListener('touchmove', pincher.handleTouchMove, false); | 355 window.addEventListener('touchmove', pincher.handleTouchMove, false); |
| 403 window.addEventListener('touchend', pincher.handleTouchEnd, false); | 356 window.addEventListener('touchend', pincher.handleTouchEnd, false); |
| 404 window.addEventListener('touchcancel', pincher.handleTouchCancel, false); | 357 window.addEventListener('touchcancel', pincher.handleTouchCancel, false); |
| OLD | NEW |