summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/new_new_tab.js
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 22:53:22 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-09 22:53:22 +0000
commit47397c453355a98acd3981767b675c2192e7d275 (patch)
tree95fffe02ea77c766bba8cf9e214376d1e3469df0 /chrome/browser/resources/new_new_tab.js
parent5438ddec244232cb54ba95455d8745ea577c0578 (diff)
downloadchromium_src-47397c453355a98acd3981767b675c2192e7d275.zip
chromium_src-47397c453355a98acd3981767b675c2192e7d275.tar.gz
chromium_src-47397c453355a98acd3981767b675c2192e7d275.tar.bz2
NTP Apps bug fixes.
o Only do the bounce animation once when installing an app. Collapsing and expanding the apps section would cause the new app icon to bounce again. o Expand the Apps section if it is collapsed and a new app isn't installed. BUG=53974,54421 TEST=manual Review URL: http://codereview.chromium.org/3371010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/new_new_tab.js')
-rw-r--r--chrome/browser/resources/new_new_tab.js67
1 files changed, 35 insertions, 32 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 79a459f..895959b 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);
- }
};
}