summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/newtab/transformations.js
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-06-22 12:55:34 +0200
committerGitHub <noreply@github.com>2018-06-22 12:55:34 +0200
commit4b65237d5d6e6f84a69571435e7b9fa5b36f444f (patch)
tree2e64ef05d542aca638ea2970d620c987d113e2d5 /application/palemoon/base/content/newtab/transformations.js
parente6f765a27070a6b922742e61d0a14dcc2c18baba (diff)
parent576124e629862cd75769074d572dbf4ee8149945 (diff)
downloadUXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar
UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.gz
UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.lz
UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.tar.xz
UXP-4b65237d5d6e6f84a69571435e7b9fa5b36f444f.zip
Merge pull request #525 from MoonchildProductions/newtab-page-work
Newtab page work
Diffstat (limited to 'application/palemoon/base/content/newtab/transformations.js')
-rw-r--r--application/palemoon/base/content/newtab/transformations.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/application/palemoon/base/content/newtab/transformations.js b/application/palemoon/base/content/newtab/transformations.js
index 978116182..f7db0ad84 100644
--- a/application/palemoon/base/content/newtab/transformations.js
+++ b/application/palemoon/base/content/newtab/transformations.js
@@ -156,7 +156,7 @@ var gTransformation = {
finish();
} else {
this.setSitePosition(aSite, targetPosition);
- this._whenTransitionEnded(aSite.node, finish);
+ this._whenTransitionEnded(aSite.node, ["left", "top"], finish);
}
},
@@ -181,13 +181,13 @@ var gTransformation = {
batch.push(new Promise(resolve => {
if (!cells[aIndex]) {
- // The site disappeared from the grid, hide it.
+ // The site disappeared from the grid, hide it.
this.hideSite(aSite, resolve);
} else if (this._getNodeOpacity(aSite.node) != 1) {
- // The site disappeared before but is now back, show it.
+ // The site disappeared before but is now back, show it.
this.showSite(aSite, resolve);
} else {
- // The site's position has changed, move it around.
+ // The site's position has changed, move it around.
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: resolve});
}
}));
@@ -202,15 +202,19 @@ var gTransformation = {
* Listens for the 'transitionend' event on a given node and calls the given
* callback.
* @param aNode The node that is transitioned.
+ * @param aProperties The properties we'll wait to be transitioned.
* @param aCallback The callback to call when finished.
*/
_whenTransitionEnded:
- function Transformation_whenTransitionEnded(aNode, aCallback) {
+ function Transformation_whenTransitionEnded(aNode, aProperties, aCallback) {
- aNode.addEventListener("transitionend", function onEnd() {
- aNode.removeEventListener("transitionend", onEnd, false);
- aCallback();
- }, false);
+ let props = new Set(aProperties);
+ aNode.addEventListener("transitionend", function onEnd(e) {
+ if (props.has(e.propertyName)) {
+ aNode.removeEventListener("transitionend", onEnd);
+ aCallback();
+ }
+ });
},
/**
@@ -236,8 +240,9 @@ var gTransformation = {
if (aCallback)
aCallback();
} else {
- if (aCallback)
- this._whenTransitionEnded(aNode, aCallback);
+ if (aCallback) {
+ this._whenTransitionEnded(aNode, ["opacity"], aCallback);
+ }
aNode.style.opacity = aOpacity;
}