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

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

Issue 1160113004: HTML exit reader view button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up Created 5 years, 6 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.
6 var distiller_on_ios = false;
7
5 function addToPage(html) { 8 function addToPage(html) {
6 var div = document.createElement('div'); 9 var div = document.createElement('div');
7 div.innerHTML = html; 10 div.innerHTML = html;
8 document.getElementById('content').appendChild(div); 11 document.getElementById('content').appendChild(div);
9 fillYouTubePlaceholders(); 12 fillYouTubePlaceholders();
10 } 13 }
11 14
12 function fillYouTubePlaceholders() { 15 function fillYouTubePlaceholders() {
13 var placeholders = document.getElementsByClassName('embed-placeholder'); 16 var placeholders = document.getElementsByClassName('embed-placeholder');
14 for (var i = 0; i < placeholders.length; i++) { 17 for (var i = 0; i < placeholders.length; i++) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }; 116 };
114 }(); 117 }();
115 118
116 /** 119 /**
117 * Show the distiller feedback form. 120 * Show the distiller feedback form.
118 * @param questionText The i18n text for the feedback question. 121 * @param questionText The i18n text for the feedback question.
119 * @param yesText The i18n text for the feedback answer 'YES'. 122 * @param yesText The i18n text for the feedback answer 'YES'.
120 * @param noText The i18n text for the feedback answer 'NO'. 123 * @param noText The i18n text for the feedback answer 'NO'.
121 */ 124 */
122 function showFeedbackForm(questionText, yesText, noText) { 125 function showFeedbackForm(questionText, yesText, noText) {
126 // If the distiller is running on iOS, do not show the feedback form. This
127 // variable is set in distiller_viewer.cc before this function is run.
128 if (distiller_on_ios) return;
129
123 document.getElementById('feedbackYes').innerText = yesText; 130 document.getElementById('feedbackYes').innerText = yesText;
124 document.getElementById('feedbackNo').innerText = noText; 131 document.getElementById('feedbackNo').innerText = noText;
125 document.getElementById('feedbackQuestion').innerText = questionText; 132 document.getElementById('feedbackQuestion').innerText = questionText;
126 133
134 document.getElementById('contentWrap').style.paddingBottom = '120px';
127 document.getElementById('feedbackContainer').style.display = 'block'; 135 document.getElementById('feedbackContainer').style.display = 'block';
128 } 136 }
129 137
130 /** 138 /**
131 * Send feedback about this distilled article. 139 * Send feedback about this distilled article.
132 * @param good True if the feedback was positive, false if negative. 140 * @param good True if the feedback was positive, false if negative.
133 */ 141 */
134 function sendFeedback(good) { 142 function sendFeedback(good) {
135 var img = document.createElement('img'); 143 var img = document.createElement('img');
136 if (good) { 144 if (good) {
137 img.src = '/feedbackgood'; 145 img.src = '/feedbackgood';
138 } else { 146 } else {
139 img.src = '/feedbackbad'; 147 img.src = '/feedbackbad';
140 } 148 }
141 img.style.display = "none"; 149 img.style.display = "none";
142 document.body.appendChild(img); 150 document.body.appendChild(img);
143 } 151 }
144 152
145 // Add a listener to the "View Original" link to report opt-outs. 153 // Add a listener to the "View Original" link to report opt-outs.
146 document.getElementById('showOriginal').addEventListener('click', function(e) { 154 document.getElementById('closeReaderView').addEventListener('click',
147 var img = document.createElement('img'); 155 function(e) {
148 img.src = "/vieworiginal"; 156 var img = document.createElement('img');
149 img.style.display = "none"; 157 img.src = "/vieworiginal";
150 document.body.appendChild(img); 158 img.style.display = "none";
151 }, true); 159 document.body.appendChild(img);
160 }, true);
152 161
153 document.getElementById('feedbackYes').addEventListener('click', function(e) { 162 document.getElementById('feedbackYes').addEventListener('click', function(e) {
154 sendFeedback(true); 163 sendFeedback(true);
155 document.getElementById('feedbackContainer').className += " fadeOut"; 164 document.getElementById('feedbackContainer').className += " fadeOut";
156 }, true); 165 }, true);
157 166
158 document.getElementById('feedbackNo').addEventListener('click', function(e) { 167 document.getElementById('feedbackNo').addEventListener('click', function(e) {
159 sendFeedback(false); 168 sendFeedback(false);
160 document.getElementById('feedbackContainer').className += " fadeOut"; 169 document.getElementById('feedbackContainer').className += " fadeOut";
161 }, true); 170 }, true);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 shiftY: shiftY 377 shiftY: shiftY
369 }; 378 };
370 } 379 }
371 }; 380 };
372 }()); 381 }());
373 382
374 window.addEventListener('touchstart', pincher.handleTouchStart, false); 383 window.addEventListener('touchstart', pincher.handleTouchStart, false);
375 window.addEventListener('touchmove', pincher.handleTouchMove, false); 384 window.addEventListener('touchmove', pincher.handleTouchMove, false);
376 window.addEventListener('touchend', pincher.handleTouchEnd, false); 385 window.addEventListener('touchend', pincher.handleTouchEnd, false);
377 window.addEventListener('touchcancel', pincher.handleTouchCancel, false); 386 window.addEventListener('touchcancel', pincher.handleTouchCancel, false);
OLDNEW
« no previous file with comments | « components/dom_distiller/core/html/dom_distiller_viewer.html ('k') | components/dom_distiller/core/viewer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698