Browse Source

Cleanup javascript events on movie delete

pull/874/merge
Ruud 13 years ago
parent
commit
3a3a4fb1f3
  1. 2
      couchpotato/core/plugins/movie/static/list.js
  2. 23
      couchpotato/core/plugins/movie/static/movie.js
  3. 2
      couchpotato/static/scripts/page/wanted.js

2
couchpotato/core/plugins/movie/static/list.js

@ -309,6 +309,8 @@ var MovieList = new Class({
erase_movies.each(function(movie){
self.movies.erase(movie);
movie.destroy()
});
self.calculateSelected();

23
couchpotato/core/plugins/movie/static/movie.js

@ -16,16 +16,35 @@ var Movie = new Class({
self.profile = Quality.getProfile(data.profile_id) || {};
self.parent(self, options);
App.addEvent('movie.update.'+data.id, self.update.bind(self));
self.addEvents();
},
addEvents: function(){
var self = this;
App.addEvent('movie.update.'+self.data.id, self.update.bind(self));
['movie.busy', 'searcher.started'].each(function(listener){
App.addEvent(listener+'.'+data.id, function(notification){
App.addEvent(listener+'.'+self.data.id, function(notification){
if(notification.data)
self.busy(true)
});
})
},
destroy: function(){
var self = this;
self.el.destroy();
delete self.list.movies_added[self.get('id')];
// Remove events
App.removeEvents('movie.update.'+self.data.id);
['movie.busy', 'searcher.started'].each(function(listener){
App.removeEvents(listener+'.'+self.data.id);
})
},
busy: function(set_busy){
var self = this;

2
couchpotato/static/scripts/page/wanted.js

@ -222,7 +222,7 @@ window.addEvent('domready', function(){
movie.set('tween', {
'duration': 300,
'onComplete': function(){
movie.destroy();
self.movie.destroy()
}
});
movie.tween('height', 0);

Loading…
Cancel
Save