| 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 var MAX_APPS_PER_ROW = []; | 5 var MAX_APPS_PER_ROW = []; |
| 6 MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4; | 6 MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4; |
| 7 MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6; | 7 MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6; |
| 8 | 8 |
| 9 function getAppsCallback(data) { | 9 function getAppsCallback(data) { |
| 10 logEvent('received apps'); | 10 logEvent('received apps'); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 // Move the bubble to the right location. | 186 // Move the bubble to the right location. |
| 187 var bubble = $('app-notification-bubble'); | 187 var bubble = $('app-notification-bubble'); |
| 188 var x = target.parentElement.offsetLeft + | 188 var x = target.parentElement.offsetLeft + |
| 189 target.parentElement.offsetWidth - 20; | 189 target.parentElement.offsetWidth - 20; |
| 190 var y = target.parentElement.offsetTop + 20; | 190 var y = target.parentElement.offsetTop + 20; |
| 191 bubble.style.left = x + "px"; | 191 bubble.style.left = x + "px"; |
| 192 bubble.style.top = y + "px"; | 192 bubble.style.top = y + "px"; |
| 193 | 193 |
| 194 // Move the arrow and shadow to the right location. | 194 // Move the arrow and shadow to the right location. |
| 195 var arrow = $('arrow-contents'); | 195 var arrow_container = $('arrow-container'); |
| 196 var border = $('arrow-border'); | |
| 197 var shadow = $('arrow-shadow'); | |
| 198 y += 26; | 196 y += 26; |
| 199 x -= arrow.style.width + 23; | 197 x -= arrow_container.style.width + 25; |
| 200 arrow.style.left = x + "px"; | 198 arrow_container.style.left = x + "px"; |
| 201 arrow.style.top = y + "px"; | 199 arrow_container.style.top = y + "px"; |
| 202 x -= 1; | |
| 203 border.style.left = x + "px"; | |
| 204 border.style.top = y + "px"; | |
| 205 x -= 1; | |
| 206 shadow.style.left = x + "px"; | |
| 207 shadow.style.top = y + "px"; | |
| 208 | 200 |
| 209 // Animate the bubble into view. | 201 // Animate the bubble into view. |
| 210 bubble.classList.add("notification-bubble-opened"); | 202 bubble.classList.add("notification-bubble-opened"); |
| 211 bubble.classList.remove("notification-bubble-closed"); | 203 bubble.classList.remove("notification-bubble-closed"); |
| 212 arrow.classList.add("notification-bubble-opened"); | 204 arrow_container.classList.add("notification-bubble-opened"); |
| 213 arrow.classList.remove("notification-bubble-closed"); | 205 arrow_container.classList.remove("notification-bubble-closed"); |
| 214 border.classList.add("notification-bubble-opened"); | |
| 215 border.classList.remove("notification-bubble-closed"); | |
| 216 shadow.classList.add("notification-bubble-opened"); | |
| 217 shadow.classList.remove("notification-bubble-closed"); | |
| 218 | 206 |
| 219 bubble.focus(); | 207 bubble.focus(); |
| 220 } | 208 } |
| 221 | 209 |
| 222 // Hide the notification bubble. | 210 // Hide the notification bubble. |
| 223 function hideNotificationBubble(event) { | 211 function hideNotificationBubble(event) { |
| 224 // This will fade the bubble out of existence. | 212 // This will fade the bubble out of existence. |
| 225 $('app-notification-bubble').classList.add("notification-bubble-closed"); | 213 $('app-notification-bubble').classList.add("notification-bubble-closed"); |
| 226 $('app-notification-bubble').classList.remove("notification-bubble-opened"); | 214 $('app-notification-bubble').classList.remove("notification-bubble-opened"); |
| 227 $('arrow-border').classList.add("notification-bubble-closed"); | 215 $('arrow-container').classList.add("notification-bubble-closed"); |
| 228 $('arrow-border').classList.remove("notification-bubble-opened"); | 216 $('arrow-container').classList.remove("notification-bubble-opened"); |
| 229 $('arrow-shadow').classList.add("notification-bubble-closed"); | |
| 230 $('arrow-shadow').classList.remove("notification-bubble-opened"); | |
| 231 $('arrow-contents').classList.add("notification-bubble-closed"); | |
| 232 $('arrow-contents').classList.remove("notification-bubble-opened"); | |
| 233 } | 217 } |
| 234 | 218 |
| 235 var apps = (function() { | 219 var apps = (function() { |
| 236 | 220 |
| 237 function createElement(app) { | 221 function createElement(app) { |
| 238 var div = document.createElement('div'); | 222 var div = document.createElement('div'); |
| 239 div.className = 'app'; | 223 div.className = 'app'; |
| 240 | 224 |
| 241 var a = div.appendChild(document.createElement('a')); | 225 var a = div.appendChild(document.createElement('a')); |
| 242 a.className = 'app-anchor'; | 226 a.className = 'app-anchor'; |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 a.href = localStrings.getString('web_store_url'); | 899 a.href = localStrings.getString('web_store_url'); |
| 916 a.style.backgroundImage = url('chrome://theme/IDR_WEBSTORE_ICON_16'); | 900 a.style.backgroundImage = url('chrome://theme/IDR_WEBSTORE_ICON_16'); |
| 917 a.className = 'item'; | 901 a.className = 'item'; |
| 918 return a; | 902 return a; |
| 919 } | 903 } |
| 920 }; | 904 }; |
| 921 })(); | 905 })(); |
| 922 | 906 |
| 923 // Enable drag and drop reordering of the app launcher. | 907 // Enable drag and drop reordering of the app launcher. |
| 924 var appDragAndDrop = new DragAndDropController(apps); | 908 var appDragAndDrop = new DragAndDropController(apps); |
| OLD | NEW |