Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Google Inc. |
| 3 | * Licensed to The Android Open Source Project. |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 18 | var BLOCKED_SRC_ATTR = "blocked-src"; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 19 | |
Andy Huang | 63b3c67 | 2012-10-05 19:27:28 -0700 | [diff] [blame] | 20 | // the set of Elements currently scheduled for processing in handleAllImageLoads |
| 21 | // this is an Array, but we treat it like a Set and only insert unique items |
| 22 | var gImageLoadElements = []; |
| 23 | |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 24 | /** |
| 25 | * Returns the page offset of an element. |
| 26 | * |
| 27 | * @param {Element} element The element to return the page offset for. |
| 28 | * @return {left: number, top: number} A tuple including a left and top value representing |
| 29 | * the page offset of the element. |
| 30 | */ |
| 31 | function getTotalOffset(el) { |
| 32 | var result = { |
| 33 | left: 0, |
| 34 | top: 0 |
| 35 | }; |
| 36 | var parent = el; |
| 37 | |
| 38 | while (parent) { |
| 39 | result.left += parent.offsetLeft; |
| 40 | result.top += parent.offsetTop; |
| 41 | parent = parent.offsetParent; |
| 42 | } |
| 43 | |
| 44 | return result; |
| 45 | } |
| 46 | |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 47 | /** |
| 48 | * Walks up the DOM starting at a given element, and returns an element that has the |
| 49 | * specified class name or null. |
| 50 | */ |
| 51 | function up(el, className) { |
| 52 | var parent = el; |
| 53 | while (parent) { |
| 54 | if (parent.classList && parent.classList.contains(className)) { |
| 55 | break; |
| 56 | } |
| 57 | parent = parent.parentNode; |
| 58 | } |
| 59 | return parent || null; |
| 60 | } |
| 61 | |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 62 | function onToggleClick(e) { |
| 63 | toggleQuotedText(e.target); |
| 64 | measurePositions(); |
| 65 | } |
| 66 | |
| 67 | function toggleQuotedText(toggleElement) { |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 68 | var elidedTextElement = toggleElement.nextSibling; |
| 69 | var isHidden = getComputedStyle(elidedTextElement).display == 'none'; |
| 70 | toggleElement.innerHTML = isHidden ? MSG_HIDE_ELIDED : MSG_SHOW_ELIDED; |
| 71 | elidedTextElement.style.display = isHidden ? 'block' : 'none'; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 72 | |
| 73 | // Revealing the elided text should normalize it to fit-width to prevent |
| 74 | // this message from blowing out the conversation width. |
| 75 | if (isHidden) { |
| 76 | normalizeElementWidths([elidedTextElement]); |
| 77 | } |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 78 | } |
| 79 | |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 80 | function collapseAllQuotedText() { |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 81 | processQuotedText(document.documentElement, false /* showElided */); |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 84 | function processQuotedText(elt, showElided) { |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 85 | var i; |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 86 | var elements = elt.getElementsByClassName("elided-text"); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 87 | var elidedElement, toggleElement; |
| 88 | for (i = 0; i < elements.length; i++) { |
| 89 | elidedElement = elements[i]; |
| 90 | toggleElement = document.createElement("div"); |
Andy Huang | 82119af | 2012-06-26 17:15:40 -0700 | [diff] [blame] | 91 | toggleElement.className = "mail-elided-text"; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 92 | toggleElement.innerHTML = MSG_SHOW_ELIDED; |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 93 | toggleElement.onclick = onToggleClick; |
| 94 | elidedElement.style.display = 'none'; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 95 | elidedElement.parentNode.insertBefore(toggleElement, elidedElement); |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 96 | if (showElided) { |
| 97 | toggleQuotedText(toggleElement); |
| 98 | } |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 102 | function normalizeAllMessageWidths() { |
| 103 | normalizeElementWidths(document.querySelectorAll(".expanded > .mail-message-content")); |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | * Normalizes the width of all elements supplied to the document body's overall width. |
| 108 | * Narrower elements are zoomed in, and wider elements are zoomed out. |
| 109 | * This method is idempotent. |
| 110 | */ |
| 111 | function normalizeElementWidths(elements) { |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 112 | var i; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 113 | var el; |
Andy Huang | 256b35c | 2012-08-22 15:19:13 -0700 | [diff] [blame] | 114 | var documentWidth = document.body.offsetWidth; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 115 | var newZoom, oldZoom; |
Andy Huang | 256b35c | 2012-08-22 15:19:13 -0700 | [diff] [blame] | 116 | |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 117 | for (i = 0; i < elements.length; i++) { |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 118 | el = elements[i]; |
| 119 | oldZoom = el.style.zoom; |
| 120 | // reset any existing normalization |
| 121 | if (oldZoom) { |
| 122 | el.style.zoom = 1; |
| 123 | } |
| 124 | newZoom = documentWidth / el.scrollWidth; |
| 125 | el.style.zoom = newZoom; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 126 | } |
| 127 | } |
| 128 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 129 | function hideUnsafeImages() { |
| 130 | var i, bodyCount; |
| 131 | var j, imgCount; |
| 132 | var body, image; |
| 133 | var images; |
| 134 | var showImages; |
| 135 | var bodies = document.getElementsByClassName("mail-message-content"); |
| 136 | for (i = 0, bodyCount = bodies.length; i < bodyCount; i++) { |
| 137 | body = bodies[i]; |
| 138 | showImages = body.classList.contains("mail-show-images"); |
| 139 | |
| 140 | images = body.getElementsByTagName("img"); |
| 141 | for (j = 0, imgCount = images.length; j < imgCount; j++) { |
| 142 | image = images[j]; |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 143 | rewriteRelativeImageSrc(image); |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 144 | attachImageLoadListener(image); |
| 145 | // TODO: handle inline image attachments for all supported protocols |
| 146 | if (!showImages) { |
| 147 | blockImage(image); |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | } |
| 152 | |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 153 | /** |
| 154 | * Changes relative paths to absolute path by pre-pending the account uri |
| 155 | * @param {Element} imgElement Image for which the src path will be updated. |
| 156 | */ |
| 157 | function rewriteRelativeImageSrc(imgElement) { |
| 158 | var src = imgElement.src; |
Paul Westbrook | cebcc64 | 2012-08-08 10:06:04 -0700 | [diff] [blame] | 159 | |
| 160 | // DOC_BASE_URI will always be a unique x-thread:// uri for this particular conversation |
| 161 | if (src.indexOf(DOC_BASE_URI) == 0 && (DOC_BASE_URI != CONVERSATION_BASE_URI)) { |
| 162 | // The conversation specifies a different base uri than the document |
| 163 | src = CONVERSATION_BASE_URI + src.substring(DOC_BASE_URI.length); |
| 164 | imgElement.src = src; |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 165 | } |
| 166 | }; |
| 167 | |
| 168 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 169 | function attachImageLoadListener(imageElement) { |
| 170 | // Reset the src attribute to the empty string because onload will only fire if the src |
| 171 | // attribute is set after the onload listener. |
| 172 | var originalSrc = imageElement.src; |
| 173 | imageElement.src = ''; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 174 | imageElement.onload = imageOnLoad; |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 175 | imageElement.src = originalSrc; |
| 176 | } |
| 177 | |
Andy Huang | 63b3c67 | 2012-10-05 19:27:28 -0700 | [diff] [blame] | 178 | /** |
| 179 | * Handle an onload event for an <img> tag. |
| 180 | * The image could be within an elided-text block, or at the top level of a message. |
| 181 | * When a new image loads, its new bounds may affect message or elided-text geometry, |
| 182 | * so we need to inspect and adjust the enclosing element's zoom level where necessary. |
| 183 | * |
| 184 | * Because this method can be called really often, and zoom-level adjustment is slow, |
| 185 | * we collect the elements to be processed and do them all later in a single deferred pass. |
| 186 | */ |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 187 | function imageOnLoad(e) { |
| 188 | // normalize the quoted text parent if we're in a quoted text block, or else |
| 189 | // normalize the parent message content element |
| 190 | var parent = up(e.target, "elided-text") || up(e.target, "mail-message-content"); |
Andy Huang | 63b3c67 | 2012-10-05 19:27:28 -0700 | [diff] [blame] | 191 | if (!parent) { |
| 192 | // sanity check. shouldn't really happen. |
| 193 | return; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 194 | } |
Andy Huang | 63b3c67 | 2012-10-05 19:27:28 -0700 | [diff] [blame] | 195 | |
| 196 | // if there was no previous work, schedule a new deferred job |
| 197 | if (gImageLoadElements.length == 0) { |
| 198 | window.setTimeout(handleAllImageOnLoads, 0); |
| 199 | } |
| 200 | |
| 201 | // enqueue the work if it wasn't already enqueued |
| 202 | if (gImageLoadElements.indexOf(parent) == -1) { |
| 203 | gImageLoadElements.push(parent); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | // handle all deferred work from image onload events |
| 208 | function handleAllImageOnLoads() { |
| 209 | normalizeElementWidths(gImageLoadElements); |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 210 | measurePositions(); |
Andy Huang | 63b3c67 | 2012-10-05 19:27:28 -0700 | [diff] [blame] | 211 | // clear the queue so the next onload event starts a new job |
| 212 | gImageLoadElements = []; |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 213 | } |
| 214 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 215 | function blockImage(imageElement) { |
| 216 | var src = imageElement.src; |
Paul Westbrook | 41dca18 | 2012-08-07 10:43:42 -0700 | [diff] [blame] | 217 | if (src.indexOf("http://") == 0 || src.indexOf("https://") == 0 || |
| 218 | src.indexOf("content://") == 0) { |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 219 | imageElement.setAttribute(BLOCKED_SRC_ATTR, src); |
| 220 | imageElement.src = "data:"; |
| 221 | } |
| 222 | } |
| 223 | |
Andy Huang | 2301470 | 2012-07-09 12:50:36 -0700 | [diff] [blame] | 224 | function setWideViewport() { |
| 225 | var metaViewport = document.getElementById('meta-viewport'); |
| 226 | metaViewport.setAttribute('content', 'width=' + WIDE_VIEWPORT_WIDTH); |
| 227 | } |
| 228 | |
Andy Huang | e964eee | 2012-10-02 19:24:58 -0700 | [diff] [blame] | 229 | function restoreScrollPosition() { |
| 230 | var scrollYPercent = window.mail.getScrollYPercent(); |
| 231 | if (scrollYPercent && document.body.offsetHeight > window.innerHeight) { |
| 232 | document.body.scrollTop = Math.floor(scrollYPercent * document.body.offsetHeight); |
| 233 | } |
| 234 | } |
| 235 | |
Andy Huang | bffc312 | 2012-10-05 21:20:56 -0700 | [diff] [blame] | 236 | function onContentReady(event) { |
| 237 | window.mail.onContentReady(); |
| 238 | } |
| 239 | |
| 240 | function setupContentReady() { |
| 241 | var signalDiv; |
| 242 | |
| 243 | // PAGE READINESS SIGNAL FOR JELLYBEAN AND NEWER |
| 244 | // Notify the app on 'webkitAnimationStart' of a simple dummy element with a simple no-op |
| 245 | // animation that immediately runs on page load. The app uses this as a signal that the |
| 246 | // content is loaded and ready to draw, since WebView delays firing this event until the |
| 247 | // layers are composited and everything is ready to draw. |
| 248 | // |
| 249 | // This code is conditionally enabled on JB+ by setting the ENABLE_CONTENT_READY flag. |
| 250 | if (ENABLE_CONTENT_READY) { |
| 251 | signalDiv = document.getElementById("initial-load-signal"); |
| 252 | signalDiv.addEventListener("webkitAnimationStart", onContentReady, false); |
| 253 | signalDiv.classList.add("initial-load"); |
| 254 | } |
| 255 | } |
| 256 | |
Andy Huang | 2301470 | 2012-07-09 12:50:36 -0700 | [diff] [blame] | 257 | // BEGIN Java->JavaScript handlers |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 258 | function measurePositions() { |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 259 | var overlayBottoms; |
Andy Huang | b5078b2 | 2012-03-05 19:52:29 -0800 | [diff] [blame] | 260 | var h; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 261 | var i; |
| 262 | var len; |
| 263 | |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 264 | var expandedSpacerDivs = document.querySelectorAll(".expanded > .spacer"); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 265 | |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 266 | overlayBottoms = new Array(expandedSpacerDivs.length + 1); |
| 267 | for (i = 0, len = expandedSpacerDivs.length; i < len; i++) { |
| 268 | h = expandedSpacerDivs[i].offsetHeight; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 269 | // addJavascriptInterface handler only supports string arrays |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 270 | overlayBottoms[i] = "" + (getTotalOffset(expandedSpacerDivs[i]).top + h); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 271 | } |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 272 | // add an extra one to mark the bottom of the last message |
| 273 | overlayBottoms[i] = "" + document.body.offsetHeight; |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 274 | |
Andy Huang | 7bdc375 | 2012-03-25 17:18:19 -0700 | [diff] [blame] | 275 | window.mail.onWebContentGeometryChange(overlayBottoms); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 276 | } |
| 277 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 278 | function unblockImages(messageDomId) { |
| 279 | var i, images, imgCount, image, blockedSrc; |
| 280 | var msg = document.getElementById(messageDomId); |
| 281 | if (!msg) { |
| 282 | console.log("can't unblock, no matching message for id: " + messageDomId); |
| 283 | return; |
| 284 | } |
| 285 | images = msg.getElementsByTagName("img"); |
| 286 | for (i = 0, imgCount = images.length; i < imgCount; i++) { |
| 287 | image = images[i]; |
| 288 | blockedSrc = image.getAttribute(BLOCKED_SRC_ATTR); |
| 289 | if (blockedSrc) { |
| 290 | image.src = blockedSrc; |
| 291 | image.removeAttribute(BLOCKED_SRC_ATTR); |
| 292 | } |
| 293 | } |
| 294 | } |
Andy Huang | c754357 | 2012-04-03 15:34:29 -0700 | [diff] [blame] | 295 | |
Mark Wei | ab2d998 | 2012-09-25 13:06:17 -0700 | [diff] [blame] | 296 | function setConversationHeaderSpacerHeight(spacerHeight) { |
| 297 | var spacer = document.getElementById("conversation-header"); |
| 298 | if (!spacer) { |
| 299 | console.log("can't set spacer for conversation header"); |
| 300 | return; |
| 301 | } |
| 302 | spacer.style.height = spacerHeight + "px"; |
| 303 | measurePositions(); |
| 304 | } |
| 305 | |
Andy Huang | c754357 | 2012-04-03 15:34:29 -0700 | [diff] [blame] | 306 | function setMessageHeaderSpacerHeight(messageDomId, spacerHeight) { |
| 307 | var spacer = document.querySelector("#" + messageDomId + " > .mail-message-header"); |
| 308 | if (!spacer) { |
| 309 | console.log("can't set spacer for message with id: " + messageDomId); |
| 310 | return; |
| 311 | } |
| 312 | spacer.style.height = spacerHeight + "px"; |
| 313 | measurePositions(); |
| 314 | } |
| 315 | |
| 316 | function setMessageBodyVisible(messageDomId, isVisible, spacerHeight) { |
| 317 | var i, len; |
| 318 | var visibility = isVisible ? "block" : "none"; |
| 319 | var messageDiv = document.querySelector("#" + messageDomId); |
| 320 | var collapsibleDivs = document.querySelectorAll("#" + messageDomId + " > .collapsible"); |
| 321 | if (!messageDiv || collapsibleDivs.length == 0) { |
| 322 | console.log("can't set body visibility for message with id: " + messageDomId); |
| 323 | return; |
| 324 | } |
| 325 | messageDiv.classList.toggle("expanded"); |
| 326 | for (i = 0, len = collapsibleDivs.length; i < len; i++) { |
| 327 | collapsibleDivs[i].style.display = visibility; |
| 328 | } |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 329 | |
| 330 | // revealing new content should trigger width normalization, since the initial render |
| 331 | // skips collapsed and super-collapsed messages |
| 332 | if (isVisible) { |
| 333 | normalizeElementWidths(messageDiv.getElementsByClassName("mail-message-content")); |
| 334 | } |
| 335 | |
Andy Huang | c754357 | 2012-04-03 15:34:29 -0700 | [diff] [blame] | 336 | setMessageHeaderSpacerHeight(messageDomId, spacerHeight); |
| 337 | } |
Andy Huang | 46dfba6 | 2012-04-19 01:47:32 -0700 | [diff] [blame] | 338 | |
| 339 | function replaceSuperCollapsedBlock(startIndex) { |
| 340 | var parent, block, header; |
| 341 | |
| 342 | block = document.querySelector(".mail-super-collapsed-block[index='" + startIndex + "']"); |
| 343 | if (!block) { |
| 344 | console.log("can't expand super collapsed block at index: " + startIndex); |
| 345 | return; |
| 346 | } |
| 347 | parent = block.parentNode; |
| 348 | block.innerHTML = window.mail.getTempMessageBodies(); |
| 349 | |
| 350 | header = block.firstChild; |
| 351 | while (header) { |
| 352 | parent.insertBefore(header, block); |
| 353 | header = block.firstChild; |
| 354 | } |
| 355 | parent.removeChild(block); |
| 356 | measurePositions(); |
| 357 | } |
mindyp | 3bcf180 | 2012-09-09 11:17:00 -0700 | [diff] [blame] | 358 | |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 359 | function replaceMessageBodies(messageIds) { |
| 360 | var i; |
| 361 | var id; |
| 362 | var msgContentDiv; |
| 363 | |
| 364 | for (i = 0, len = messageIds.length; i < len; i++) { |
| 365 | id = messageIds[i]; |
| 366 | msgContentDiv = document.querySelector("#" + id + " > .mail-message-content"); |
| 367 | msgContentDiv.innerHTML = window.mail.getMessageBody(id); |
Andy Huang | df0d91c | 2012-10-08 18:44:42 -0700 | [diff] [blame^] | 368 | processQuotedText(msgContentDiv, true /* showElided */); |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 369 | } |
| 370 | } |
| 371 | |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 372 | // END Java->JavaScript handlers |
| 373 | |
Andy Huang | 014ea4c | 2012-09-25 14:50:54 -0700 | [diff] [blame] | 374 | collapseAllQuotedText(); |
Andy Huang | 3233bff | 2012-03-20 19:38:45 -0700 | [diff] [blame] | 375 | hideUnsafeImages(); |
Andy Huang | ffc725f | 2012-10-01 14:48:02 -0700 | [diff] [blame] | 376 | normalizeAllMessageWidths(); |
Andy Huang | 2301470 | 2012-07-09 12:50:36 -0700 | [diff] [blame] | 377 | //setWideViewport(); |
Andy Huang | e964eee | 2012-10-02 19:24:58 -0700 | [diff] [blame] | 378 | restoreScrollPosition(); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 379 | measurePositions(); |
Andy Huang | bffc312 | 2012-10-05 21:20:56 -0700 | [diff] [blame] | 380 | setupContentReady(); |
Andy Huang | f70fc40 | 2012-02-17 15:37:42 -0800 | [diff] [blame] | 381 | |