Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more | 5 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more |
| 6 // than this many items in the miniview. | 6 // than this many items in the miniview. |
| 7 var MAX_MINIVIEW_ITEMS = 15; | 7 var MAX_MINIVIEW_ITEMS = 15; |
| 8 | 8 |
| 9 // Extra spacing at the top of the layout. | 9 // Extra spacing at the top of the layout. |
| 10 var LAYOUT_SPACING_TOP = 25; | 10 var LAYOUT_SPACING_TOP = 25; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 a.style.backgroundImage = 'url(' + imageUrl + ')'; | 66 a.style.backgroundImage = 'url(' + imageUrl + ')'; |
| 67 addClosedMenuEntryWithLink(menu, a); | 67 addClosedMenuEntryWithLink(menu, a); |
| 68 } | 68 } |
| 69 | 69 |
| 70 function addClosedMenuFooter(menu, sectionId, mask, opt_section) { | 70 function addClosedMenuFooter(menu, sectionId, mask, opt_section) { |
| 71 menu.appendChild(document.createElement('hr')); | 71 menu.appendChild(document.createElement('hr')); |
| 72 | 72 |
| 73 var span = document.createElement('span'); | 73 var span = document.createElement('span'); |
| 74 var a = span.appendChild(document.createElement('a')); | 74 var a = span.appendChild(document.createElement('a')); |
| 75 a.href = ''; | 75 a.href = ''; |
| 76 a.textContent = | 76 if (cr.isChromeOS) { |
| 77 localStrings.getString(getSectionMenuButtonTextId(sectionId)); | 77 a.textContent = |
| 78 localStrings.getString('expandMenu'); | |
|
Aaron Boodman
2010/11/30 18:38:32
This can fit on the previous line.
xiyuan
2010/11/30 19:07:58
Done.
| |
| 79 } else { | |
| 80 a.textContent = | |
| 81 localStrings.getString(getSectionMenuButtonTextId(sectionId)); | |
| 82 } | |
| 78 a.className = 'item'; | 83 a.className = 'item'; |
| 79 a.addEventListener( | 84 a.addEventListener( |
| 80 'click', | 85 'click', |
| 81 function(e) { | 86 function(e) { |
| 82 getSectionMenuButton(sectionId).hideMenu(); | 87 getSectionMenuButton(sectionId).hideMenu(); |
| 83 e.preventDefault(); | 88 e.preventDefault(); |
| 84 setSectionVisible(sectionId, opt_section, true, mask); | 89 setSectionVisible(sectionId, opt_section, true, mask); |
| 85 shownSections &= ~mask; | 90 shownSections &= ~mask; |
| 86 saveShownSections(); | 91 saveShownSections(); |
| 87 }); | 92 }); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 y += section.fixedHeight; | 431 y += section.fixedHeight; |
| 427 | 432 |
| 428 if (section.maxiview && section == expandedSection) { | 433 if (section.maxiview && section == expandedSection) { |
| 429 section.maxiview.style.top = y + 'px'; | 434 section.maxiview.style.top = y + 'px'; |
| 430 updateMask(section.maxiview, expandedSectionHeight); | 435 updateMask(section.maxiview, expandedSectionHeight); |
| 431 } | 436 } |
| 432 | 437 |
| 433 if (section == expandedSection) | 438 if (section == expandedSection) |
| 434 y += expandedSectionHeight; | 439 y += expandedSectionHeight; |
| 435 } | 440 } |
| 441 if (cr.isChromeOS) | |
| 442 $('closed-sections-bar').style.top = y + 'px'; | |
| 436 | 443 |
| 437 updateAttributionDisplay(y); | 444 updateAttributionDisplay(y); |
| 438 } | 445 } |
| 439 | 446 |
| 440 function updateMask(maxiview, visibleHeightPx) { | 447 function updateMask(maxiview, visibleHeightPx) { |
| 441 // We want to end up with 10px gradients at the top and bottom of | 448 // We want to end up with 10px gradients at the top and bottom of |
| 442 // visibleHeight, but webkit-mask only supports expression in terms of | 449 // visibleHeight, but webkit-mask only supports expression in terms of |
| 443 // percentages. | 450 // percentages. |
| 444 | 451 |
| 445 // We might not have enough room to do 10px gradients on each side. To get the | 452 // We might not have enough room to do 10px gradients on each side. To get the |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1240 var promoLink = promoText1.querySelector('a'); | 1247 var promoLink = promoText1.querySelector('a'); |
| 1241 promoLink.id = 'apps-promo-link'; | 1248 promoLink.id = 'apps-promo-link'; |
| 1242 promoLink.href = localStrings.getString('web_store_url'); | 1249 promoLink.href = localStrings.getString('web_store_url'); |
| 1243 | 1250 |
| 1244 $('apps-promo-hide').addEventListener('click', function() { | 1251 $('apps-promo-hide').addEventListener('click', function() { |
| 1245 chrome.send('hideAppsPromo', []); | 1252 chrome.send('hideAppsPromo', []); |
| 1246 document.documentElement.classList.remove('apps-promo-visible'); | 1253 document.documentElement.classList.remove('apps-promo-visible'); |
| 1247 layoutSections(); | 1254 layoutSections(); |
| 1248 }); | 1255 }); |
| 1249 }); | 1256 }); |
| OLD | NEW |