Hide options after slide out
This commit is contained in:
@@ -21,7 +21,8 @@ var Movie = new Class({
|
||||
self.data_container = new Element('div.data.inlay.light', {
|
||||
'tween': {
|
||||
duration: 400,
|
||||
transition: 'quint:in:out'
|
||||
transition: 'quint:in:out',
|
||||
onComplete: self.fireEvent.bind(self, 'slideEnd')
|
||||
}
|
||||
}).adopt(
|
||||
self.thumbnail = File.Select.single('poster', self.data.library.files),
|
||||
@@ -95,15 +96,21 @@ var Movie = new Class({
|
||||
return 'Unknown movie'
|
||||
},
|
||||
|
||||
slide: function(direction){
|
||||
slide: function(direction, el){
|
||||
var self = this;
|
||||
|
||||
if(direction == 'in'){
|
||||
self.el.addEvent('outerClick', self.slide.bind(self, 'out'))
|
||||
el.show();
|
||||
self.data_container.tween('left', 0, self.getWidth());
|
||||
}
|
||||
else {
|
||||
self.el.removeEvents('outerClick')
|
||||
|
||||
self.addEvent('slideEnd:once', function(){
|
||||
self.el.getElements('> :not(.data)').hide();
|
||||
});
|
||||
|
||||
self.data_container.tween('left', self.getWidth(), 0);
|
||||
}
|
||||
},
|
||||
@@ -260,7 +267,8 @@ var ReleaseAction = new Class({
|
||||
});
|
||||
|
||||
}
|
||||
self.movie.slide('in');
|
||||
|
||||
self.movie.slide('in', self.options_container);
|
||||
},
|
||||
|
||||
get: function(release, type){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MooTools: the javascript framework.
|
||||
// Load this file's selection again by visiting: http://mootools.net/more/2bb87efbb3e2cfe85537fcfe52571fb4
|
||||
// Or build this file again with packager using: packager build More/Element.Forms More/Element.Shortcuts More/Fx.Scroll More/Fx.Slide More/Sortables More/Request.JSONP More/Request.Periodical More/Spinner
|
||||
// Load this file's selection again by visiting: http://mootools.net/more/710fc92ae4753344d23cbd5fc7e44420
|
||||
// Or build this file again with packager using: packager build More/Events.Pseudos More/Element.Forms More/Element.Shortcuts More/Fx.Scroll More/Fx.Slide More/Sortables More/Request.JSONP More/Request.Periodical More/Spinner
|
||||
/*
|
||||
---
|
||||
|
||||
@@ -36,6 +36,165 @@ MooTools.More = {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
---
|
||||
|
||||
name: Events.Pseudos
|
||||
|
||||
description: Adds the functionality to add pseudo events
|
||||
|
||||
license: MIT-style license
|
||||
|
||||
authors:
|
||||
- Arian Stolwijk
|
||||
|
||||
requires: [Core/Class.Extras, Core/Slick.Parser, More/MooTools.More]
|
||||
|
||||
provides: [Events.Pseudos]
|
||||
|
||||
...
|
||||
*/
|
||||
|
||||
(function(){
|
||||
|
||||
Events.Pseudos = function(pseudos, addEvent, removeEvent){
|
||||
|
||||
var storeKey = '_monitorEvents:';
|
||||
|
||||
var storageOf = function(object){
|
||||
return {
|
||||
store: object.store ? function(key, value){
|
||||
object.store(storeKey + key, value);
|
||||
} : function(key, value){
|
||||
(object._monitorEvents || (object._monitorEvents = {}))[key] = value;
|
||||
},
|
||||
retrieve: object.retrieve ? function(key, dflt){
|
||||
return object.retrieve(storeKey + key, dflt);
|
||||
} : function(key, dflt){
|
||||
if (!object._monitorEvents) return dflt;
|
||||
return object._monitorEvents[key] || dflt;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var splitType = function(type){
|
||||
if (type.indexOf(':') == -1 || !pseudos) return null;
|
||||
|
||||
var parsed = Slick.parse(type).expressions[0][0],
|
||||
parsedPseudos = parsed.pseudos,
|
||||
l = parsedPseudos.length,
|
||||
splits = [];
|
||||
|
||||
while (l--){
|
||||
var pseudo = parsedPseudos[l].key,
|
||||
listener = pseudos[pseudo];
|
||||
if (listener != null) splits.push({
|
||||
event: parsed.tag,
|
||||
value: parsedPseudos[l].value,
|
||||
pseudo: pseudo,
|
||||
original: type,
|
||||
listener: listener
|
||||
});
|
||||
}
|
||||
return splits.length ? splits : null;
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
addEvent: function(type, fn, internal){
|
||||
var split = splitType(type);
|
||||
if (!split) return addEvent.call(this, type, fn, internal);
|
||||
|
||||
var storage = storageOf(this),
|
||||
events = storage.retrieve(type, []),
|
||||
eventType = split[0].event,
|
||||
args = Array.slice(arguments, 2),
|
||||
stack = fn,
|
||||
self = this;
|
||||
|
||||
split.each(function(item){
|
||||
var listener = item.listener,
|
||||
stackFn = stack;
|
||||
if (listener == false) eventType += ':' + item.pseudo + '(' + item.value + ')';
|
||||
else stack = function(){
|
||||
listener.call(self, item, stackFn, arguments, stack);
|
||||
};
|
||||
});
|
||||
|
||||
events.include({type: eventType, event: fn, monitor: stack});
|
||||
storage.store(type, events);
|
||||
|
||||
if (type != eventType) addEvent.apply(this, [type, fn].concat(args));
|
||||
return addEvent.apply(this, [eventType, stack].concat(args));
|
||||
},
|
||||
|
||||
removeEvent: function(type, fn){
|
||||
var split = splitType(type);
|
||||
if (!split) return removeEvent.call(this, type, fn);
|
||||
|
||||
var storage = storageOf(this),
|
||||
events = storage.retrieve(type);
|
||||
if (!events) return this;
|
||||
|
||||
var args = Array.slice(arguments, 2);
|
||||
|
||||
removeEvent.apply(this, [type, fn].concat(args));
|
||||
events.each(function(monitor, i){
|
||||
if (!fn || monitor.event == fn) removeEvent.apply(this, [monitor.type, monitor.monitor].concat(args));
|
||||
delete events[i];
|
||||
}, this);
|
||||
|
||||
storage.store(type, events);
|
||||
return this;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
var pseudos = {
|
||||
|
||||
once: function(split, fn, args, monitor){
|
||||
fn.apply(this, args);
|
||||
this.removeEvent(split.event, monitor)
|
||||
.removeEvent(split.original, fn);
|
||||
},
|
||||
|
||||
throttle: function(split, fn, args){
|
||||
if (!fn._throttled){
|
||||
fn.apply(this, args);
|
||||
fn._throttled = setTimeout(function(){
|
||||
fn._throttled = false;
|
||||
}, split.value || 250);
|
||||
}
|
||||
},
|
||||
|
||||
pause: function(split, fn, args){
|
||||
clearTimeout(fn._pause);
|
||||
fn._pause = fn.delay(split.value || 250, this, args);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Events.definePseudo = function(key, listener){
|
||||
pseudos[key] = listener;
|
||||
return this;
|
||||
};
|
||||
|
||||
Events.lookupPseudo = function(key){
|
||||
return pseudos[key];
|
||||
};
|
||||
|
||||
var proto = Events.prototype;
|
||||
Events.implement(Events.Pseudos(pseudos, proto.addEvent, proto.removeEvent));
|
||||
|
||||
['Request', 'Fx'].each(function(klass){
|
||||
if (this[klass]) this[klass].implement(Events.prototype);
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
---
|
||||
|
||||
|
||||
@@ -88,7 +88,8 @@ window.addEvent('domready', function(){
|
||||
});
|
||||
|
||||
}
|
||||
self.movie.slide('in');
|
||||
|
||||
self.movie.slide('in', self.options_container);
|
||||
},
|
||||
|
||||
save: function(e){
|
||||
@@ -188,9 +189,9 @@ window.addEvent('domready', function(){
|
||||
})
|
||||
).inject(self.movie, 'top');
|
||||
}
|
||||
|
||||
self.movie.slide('in');
|
||||
|
||||
|
||||
self.movie.slide('in', self.delete_container);
|
||||
|
||||
},
|
||||
|
||||
hideConfirm: function(e){
|
||||
|
||||
Reference in New Issue
Block a user