Fix "tabs don't appear" problem. (Animation effects were unexpectedly stopped by some errors.)

This commit is contained in:
YUKI "Piro" Hiroshi 2012-08-08 15:35:59 +09:00
parent a83bc07a87
commit 8184411e0e

View File

@ -46,7 +46,7 @@ if (typeof window == 'undefined' ||
} }
(function() { (function() {
const currentRevision = 11; const currentRevision = 12;
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {}; if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
@ -97,7 +97,9 @@ if (typeof window == 'undefined' ||
{ {
if (!aTask) return; if (!aTask) return;
var task; var task;
this.tasks = this.tasks.filter(function(aRegisteredTask) { var tasks = this.tasks;
this.tasks = [null];
tasks = tasks.filter(function(aRegisteredTask) {
if (!aRegisteredTask) return false; if (!aRegisteredTask) return false;
if (aRegisteredTask.task != aTask) return true; if (aRegisteredTask.task != aTask) return true;
delete aRegisteredTask.task; delete aRegisteredTask.task;
@ -109,6 +111,7 @@ if (typeof window == 'undefined' ||
this._cleanUpWindows(); this._cleanUpWindows();
return false; return false;
}, this); }, this);
this.tasks = this.tasks.slice(1).concat(tasks);
if (!this.tasks.length) if (!this.tasks.length)
this.stop(); this.stop();
}, },
@ -117,7 +120,7 @@ if (typeof window == 'undefined' ||
{ {
this.stop(); this.stop();
if (this.tasks.some(function(aTask) { if (this.tasks.some(function(aTask) {
return !aTask.window; return aTask && !aTask.window;
})) { })) {
this.timer = window.setInterval( this.timer = window.setInterval(
this.onAnimation, this.onAnimation,
@ -191,7 +194,7 @@ if (typeof window == 'undefined' ||
{ {
this._windows = this._windows.filter(function(aWindow) { this._windows = this._windows.filter(function(aWindow) {
if (this.tasks.some(function(aTask) { if (this.tasks.some(function(aTask) {
return aTask.window && this._windows.indexOf(aTask.window) > -1; return aTask && aTask.window && this._windows.indexOf(aTask.window) > -1;
}, this)) }, this))
return true; return true;
let index = this._animatingWindows.indexOf(aWindow); let index = this._animatingWindows.indexOf(aWindow);
@ -228,11 +231,11 @@ if (typeof window == 'undefined' ||
var tasks = aSelf.tasks; var tasks = aSelf.tasks;
aSelf.tasks = [null]; aSelf.tasks = [null];
tasks = tasks.filter(function(aTask) { tasks = tasks.filter(function(aTask) {
if (!aTask)
return false;
if (aWindow && aTask.window != aWindow)
return true;
try { try {
if (!aTask)
return false;
if (aWindow && aTask.window != aWindow)
return true;
var time = Math.min(aTask.duration, now - aTask.start); var time = Math.min(aTask.duration, now - aTask.start);
var finished = aTask.task( var finished = aTask.task(
time, time,