| OLD | NEW |
| 1 | 1 |
| 2 // Helpers | 2 // Helpers |
| 3 | 3 |
| 4 function $(id) { | 4 function $(id) { |
| 5 return document.getElementById(id); | 5 return document.getElementById(id); |
| 6 } | 6 } |
| 7 | 7 |
| 8 // TODO(arv): Remove these when classList is available in HTML5. | 8 // TODO(arv): Remove these when classList is available in HTML5. |
| 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 | 9 // https://bugs.webkit.org/show_bug.cgi?id=20709 |
| 10 function hasClass(el, name) { | 10 function hasClass(el, name) { |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 var recentShown = shownSections & Section.RECENT; | 689 var recentShown = shownSections & Section.RECENT; |
| 690 var tipsShown = shownSections & Section.TIPS; | 690 var tipsShown = shownSections & Section.TIPS; |
| 691 | 691 |
| 692 if (recentShown || tipsShown) { | 692 if (recentShown || tipsShown) { |
| 693 lowerSectionsElement.style.height = '198px'; | 693 lowerSectionsElement.style.height = '198px'; |
| 694 lowerSectionsElement.style.opacity = ''; | 694 lowerSectionsElement.style.opacity = ''; |
| 695 } else { | 695 } else { |
| 696 lowerSectionsElement.style.height = lowerSectionsElement.style.opacity = 0; | 696 lowerSectionsElement.style.height = lowerSectionsElement.style.opacity = 0; |
| 697 } | 697 } |
| 698 | 698 |
| 699 // Even when the width is set to 0 it will take up 2px due to the border. We |
| 700 // compensate by setting the margin to -2px. |
| 699 if (recentShown && tipsShown) { | 701 if (recentShown && tipsShown) { |
| 700 var w = (totalWidth - spacing) / 2; | 702 var w = (totalWidth - spacing) / 2; |
| 701 recentElement.style.width = tipsElement.style.width = w + 'px' | 703 recentElement.style.width = tipsElement.style.width = w + 'px' |
| 702 recentElement.style.opacity = tipsElement.style.opacity = ''; | 704 recentElement.style.opacity = tipsElement.style.opacity = |
| 705 recentElement.style.WebkitMarginStart = ''; |
| 703 spacer.style.width = spacing + 'px'; | 706 spacer.style.width = spacing + 'px'; |
| 704 } else if (recentShown) { | 707 } else if (recentShown) { |
| 705 recentElement.style.width = totalWidth + 'px'; | 708 recentElement.style.width = totalWidth + 'px'; |
| 706 recentElement.style.opacity = ''; | 709 recentElement.style.opacity = recentElement.style.WebkitMarginStart = ''; |
| 707 tipsElement.style.width = | 710 tipsElement.style.width = |
| 708 tipsElement.style.opacity = 0; | 711 tipsElement.style.opacity = 0; |
| 709 spacer.style.width = 0; | 712 spacer.style.width = 0; |
| 713 |
| 710 } else if (tipsShown) { | 714 } else if (tipsShown) { |
| 711 tipsElement.style.width = totalWidth + 'px'; | 715 tipsElement.style.width = totalWidth + 'px'; |
| 712 tipsElement.style.opacity = ''; | 716 tipsElement.style.opacity = ''; |
| 713 recentElement.style.width = recentElement.style.opacity = 0; | 717 recentElement.style.width = recentElement.style.opacity = 0; |
| 718 recentElement.style.WebkitMarginStart = '-2px'; |
| 714 spacer.style.width = 0; | 719 spacer.style.width = 0; |
| 715 } | 720 } |
| 716 } | 721 } |
| 717 | 722 |
| 718 /** | 723 /** |
| 719 * Returns the text used for a recently closed window. | 724 * Returns the text used for a recently closed window. |
| 720 * @param {number} numTabs Number of tabs in the window. | 725 * @param {number} numTabs Number of tabs in the window. |
| 721 * @return {string} The text to use. | 726 * @return {string} The text to use. |
| 722 */ | 727 */ |
| 723 function formatTabsText(numTabs) { | 728 function formatTabsText(numTabs) { |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 el.addEventListener('dragover', bind(this.handleDragOver, this)); | 1409 el.addEventListener('dragover', bind(this.handleDragOver, this)); |
| 1405 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); | 1410 el.addEventListener('dragleave', bind(this.handleDragLeave, this)); |
| 1406 el.addEventListener('drop', bind(this.handleDrop, this)); | 1411 el.addEventListener('drop', bind(this.handleDrop, this)); |
| 1407 el.addEventListener('dragend', bind(this.handleDragEnd, this)); | 1412 el.addEventListener('dragend', bind(this.handleDragEnd, this)); |
| 1408 el.addEventListener('drag', bind(this.handleDrag, this)); | 1413 el.addEventListener('drag', bind(this.handleDrag, this)); |
| 1409 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); | 1414 el.addEventListener('mousedown', bind(this.handleMouseDown, this)); |
| 1410 } | 1415 } |
| 1411 }; | 1416 }; |
| 1412 | 1417 |
| 1413 dnd.init(); | 1418 dnd.init(); |
| OLD | NEW |