Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: chrome/browser/resources/new_new_tab.js

Issue 3371010: NTP Apps bug fixes. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Arv's comments Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/ntp/apps.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/new_new_tab.js
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 79a459f01144d38d6551ee18220c8b0a6c12b409..895959b3fe99efcfe5b424e7c35708ac4cd10bc4 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -270,15 +270,15 @@ function updateMask(maxiview, visibleHeightPx) {
var third = fourth - gradientHeightPx / window.innerHeight;
var gradientArguments = [
- "linear",
- "0 0",
- "0 100%",
- "from(transparent)",
- getColorStopString(first, "transparent"),
+ 'linear',
+ '0 0',
+ '0 100%',
+ 'from(transparent)',
+ getColorStopString(first, 'transparent'),
getColorStopString(second, gradientDestination),
getColorStopString(third, gradientDestination),
- getColorStopString(fourth, "transparent"),
- "to(transparent)"
+ getColorStopString(fourth, 'transparent'),
+ 'to(transparent)'
];
var gradient = '-webkit-gradient(' + gradientArguments.join(', ') + ')';
@@ -286,7 +286,7 @@ function updateMask(maxiview, visibleHeightPx) {
}
function getColorStopString(height, color) {
- return "color-stop(" + height + ", " + color + ")";
+ return 'color-stop(' + height + ', ' + color + ')';
}
window.addEventListener('resize', handleWindowResize);
@@ -357,10 +357,12 @@ function hideSection(section) {
}
window.addEventListener('webkitTransitionEnd', function(e) {
- if (e.target.classList.contains('hiding'))
+ if (e.target.classList.contains('hiding')) {
e.target.classList.add('hidden');
+ e.target.classList.remove('hiding');
+ }
- document.documentElement.setAttribute("enable-section-animations", "false");
+ document.documentElement.setAttribute('enable-section-animations', 'false');
});
/**
@@ -657,39 +659,40 @@ $('main').addEventListener('click', function(e) {
p = p.parentNode;
}
- if (!p) {
+ if (!p)
return;
- }
p = p.parentNode;
- if (!getSectionMaxiview(p)) {
+ if (!getSectionMaxiview(p))
return;
- }
- var section = p.getAttribute('section');
- if (section) {
- // We set it back in webkitTransitionEnd.
- document.documentElement.setAttribute("enable-section-animations", "true");
- if (shownSections & Section[section]) {
- hideSection(Section[section]);
- } else {
- for (var p in Section) {
- if (p == section)
- showSection(Section[p]);
- else
- hideSection(Section[p]);
- }
+ toggleSectionVisibilityAndAnimate(p.getAttribute('section'));
+});
+
+function toggleSectionVisibilityAndAnimate(section) {
+ if (!section)
+ return;
+
+ // We set it back in webkitTransitionEnd.
+ document.documentElement.setAttribute('enable-section-animations', 'true');
+ if (shownSections & Section[section]) {
+ hideSection(Section[section]);
+ } else {
+ for (var p in Section) {
+ if (p == section)
+ showSection(Section[p]);
+ else
+ hideSection(Section[p]);
}
- layoutSections();
- saveShownSections();
}
-});
+ layoutSections();
+ saveShownSections();
+}
function handleIfEnterKey(f) {
return function(e) {
- if (e.keyIdentifier == 'Enter') {
+ if (e.keyIdentifier == 'Enter')
f(e);
- }
};
}
« no previous file with comments | « no previous file | chrome/browser/resources/ntp/apps.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698