| 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 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 var localStrings = new LocalStrings(); | 865 var localStrings = new LocalStrings(); |
| 866 | 866 |
| 867 /////////////////////////////////////////////////////////////////////////////// | 867 /////////////////////////////////////////////////////////////////////////////// |
| 868 // Things we know are not needed at startup go below here | 868 // Things we know are not needed at startup go below here |
| 869 | 869 |
| 870 function afterTransition(f) { | 870 function afterTransition(f) { |
| 871 if (loading) { | 871 if (loading) { |
| 872 // Make sure we do not use a timer during load since it slows down the UI. | 872 // Make sure we do not use a timer during load since it slows down the UI. |
| 873 f(); | 873 f(); |
| 874 } else { | 874 } else { |
| 875 // The duration of all transitions are 500ms | 875 // The duration of all transitions are .15s |
| 876 window.setTimeout(f, 500); | 876 window.setTimeout(f, 150); |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 | 879 |
| 880 // Notification | 880 // Notification |
| 881 | 881 |
| 882 | 882 |
| 883 var notificationTimeout; | 883 var notificationTimeout; |
| 884 | 884 |
| 885 function showNotification(text, actionText, opt_f, opt_delay) { | 885 function showNotification(text, actionText, opt_f, opt_delay) { |
| 886 var notificationElement = $('notification'); | 886 var notificationElement = $('notification'); |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 x = Math.max(x, -rect.left); | 1551 x = Math.max(x, -rect.left); |
| 1552 x = Math.min(x, document.body.clientWidth - rect.left - item.offsetWidth - | 1552 x = Math.min(x, document.body.clientWidth - rect.left - item.offsetWidth - |
| 1553 2); | 1553 2); |
| 1554 // The shadow is 2px | 1554 // The shadow is 2px |
| 1555 y = Math.max(-rect.top, y); | 1555 y = Math.max(-rect.top, y); |
| 1556 y = Math.min(y, document.body.clientHeight - rect.top - item.offsetHeight - | 1556 y = Math.min(y, document.body.clientHeight - rect.top - item.offsetHeight - |
| 1557 2); | 1557 2); |
| 1558 | 1558 |
| 1559 item.style.left = x + 'px'; | 1559 item.style.left = x + 'px'; |
| 1560 item.style.top = y + 'px'; | 1560 item.style.top = y + 'px'; |
| 1561 item.style.zIndex = 2; |
| 1561 }, | 1562 }, |
| 1562 | 1563 |
| 1563 // We listen to mousedown to get the relative position of the cursor for dnd. | 1564 // We listen to mousedown to get the relative position of the cursor for dnd. |
| 1564 handleMouseDown: function(e) { | 1565 handleMouseDown: function(e) { |
| 1565 var item = mostVisited.getItem(e.target); | 1566 var item = mostVisited.getItem(e.target); |
| 1566 if (item) { | 1567 if (item) { |
| 1567 this.startX = item.offsetLeft; | 1568 this.startX = item.offsetLeft; |
| 1568 this.startY = item.offsetTop; | 1569 this.startY = item.offsetTop; |
| 1569 this.startScreenX = e.screenX; | 1570 this.startScreenX = e.screenX; |
| 1570 this.startScreenY = e.screenY; | 1571 this.startScreenY = e.screenY; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1680 function fixLinkUnderline(el) { | 1681 function fixLinkUnderline(el) { |
| 1681 var span = document.createElement('span'); | 1682 var span = document.createElement('span'); |
| 1682 span.className = 'link-color'; | 1683 span.className = 'link-color'; |
| 1683 while (el.hasChildNodes()) { | 1684 while (el.hasChildNodes()) { |
| 1684 span.appendChild(el.firstChild); | 1685 span.appendChild(el.firstChild); |
| 1685 } | 1686 } |
| 1686 el.appendChild(span); | 1687 el.appendChild(span); |
| 1687 } | 1688 } |
| 1688 | 1689 |
| 1689 updateAttribution(); | 1690 updateAttribution(); |
| OLD | NEW |