| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Counter used to give webkit animations unique names. | 5 // Counter used to give webkit animations unique names. |
| 6 var animationCounter = 0; | 6 var animationCounter = 0; |
| 7 | 7 |
| 8 function addAnimation(code) { | 8 function addAnimation(code) { |
| 9 var name = 'anim' + animationCounter; | 9 var name = 'anim' + animationCounter; |
| 10 animationCounter++; | 10 animationCounter++; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 /** | 71 /** |
| 72 * Removes the <style> element corrsponding to |animationName| from the DOM. | 72 * Removes the <style> element corrsponding to |animationName| from the DOM. |
| 73 * @param {string} animationName The name of the animation to be removed. | 73 * @param {string} animationName The name of the animation to be removed. |
| 74 */ | 74 */ |
| 75 function fadeInOutCleanup(animationName) { | 75 function fadeInOutCleanup(animationName) { |
| 76 animEl = document.getElementById(animationName); | 76 animEl = document.getElementById(animationName); |
| 77 if (animEl) | 77 if (animEl) |
| 78 animEl.parentNode.removeChild(animEl); | 78 animEl.parentNode.removeChild(animEl); |
| 79 } | 79 } |
| 80 | 80 |
| 81 function showLoadingAnimation() { | 81 /** |
| 82 $('dancing-dots-text').classList.remove('hidden'); | 82 * Displays |message| followed by three dancing dots animation. |
| 83 */ |
| 84 function showCustomMessage(message) { |
| 85 $('custom-message-with-dots').innerHTML = message + |
| 86 $('dancing-dots-text').innerHTML; |
| 87 $('custom-message-with-dots').hidden = false; |
| 83 var pdfViewer = $('pdf-viewer'); | 88 var pdfViewer = $('pdf-viewer'); |
| 84 if (pdfViewer) | 89 if (pdfViewer) |
| 85 pdfViewer.classList.add('invisible'); | 90 pdfViewer.classList.add('invisible'); |
| 86 $('overlay-layer').classList.remove('invisible'); | 91 $('overlay-layer').classList.remove('invisible'); |
| 87 } | 92 } |
| 88 | 93 |
| 89 function hideLoadingAnimation() { | 94 /** |
| 95 * Displays the "Preview loading..." animation. |
| 96 */ |
| 97 function showLoadingAnimation() { |
| 98 showCustomMessage(localStrings.getString('loading')); |
| 99 } |
| 100 |
| 101 /** |
| 102 * Hides the |overlay-layer| and any messages currently displayed. |
| 103 */ |
| 104 function hideOverlayLayer() { |
| 105 if (hasPendingPrintDocumentRequest) |
| 106 return; |
| 107 |
| 90 var overlayLayer = $('overlay-layer'); | 108 var overlayLayer = $('overlay-layer'); |
| 91 overlayLayer.addEventListener('webkitTransitionEnd', loadingAnimationCleanup); | 109 overlayLayer.addEventListener('webkitTransitionEnd', loadingAnimationCleanup); |
| 92 var pdfViewer = $('pdf-viewer'); | 110 var pdfViewer = $('pdf-viewer'); |
| 93 if (pdfViewer) | 111 if (pdfViewer) |
| 94 pdfViewer.classList.remove('invisible'); | 112 pdfViewer.classList.remove('invisible'); |
| 95 overlayLayer.classList.add('invisible'); | 113 overlayLayer.classList.add('invisible'); |
| 96 } | 114 } |
| 97 | 115 |
| 98 function loadingAnimationCleanup() { | 116 function loadingAnimationCleanup() { |
| 99 $('dancing-dots-text').classList.add('hidden'); | 117 $('custom-message-with-dots').hidden = true; |
| 100 $('overlay-layer').removeEventListener('webkitTransitionEnd', | 118 $('overlay-layer').removeEventListener('webkitTransitionEnd', |
| 101 loadingAnimationCleanup); | 119 loadingAnimationCleanup); |
| 102 } | 120 } |
| OLD | NEW |