Browse Source

Trailer

pull/5180/head
Ruud 11 years ago
parent
commit
045c8f4dc8
  1. 5
      couchpotato/core/media/movie/_base/static/details.js
  2. 2
      couchpotato/core/media/movie/_base/static/list.js
  3. 52
      couchpotato/core/media/movie/_base/static/movie.actions.js
  4. 4
      couchpotato/core/media/movie/_base/static/movie.js
  5. 10
      couchpotato/core/media/movie/_base/static/movie.scss
  6. 2
      couchpotato/static/scripts/block/menu.js
  7. 16
      couchpotato/static/style/main.scss

5
couchpotato/core/media/movie/_base/static/details.js

@ -21,19 +21,20 @@ var MovieDetails = new Class({
),
self.content = new Element('div.content').grab(
new Element('h1', {
'text': 'Title'
'text': parent.getTitle() + (parent.get('year') ? ' (' + parent.get('year') + ')' : '')
})
)
);
self.addSection('description', new Element('div', {
'text': 'Description'
'text': parent.get('plot')
}));
},
addSection: function(name, section_el){
var self = this;
name = name.toLowerCase();
self.content.grab(
self.sections[name] = new Element('div', {

2
couchpotato/core/media/movie/_base/static/list.js

@ -311,7 +311,7 @@ var MovieList = new Class({
['thumb', 'list'].each(function(view){
var current = self.current_view == view;
new Element('a', {
'class': 'button icon-' + view + (current ? ' active ' : ''),
'class': 'icon-' + view + (current ? ' active ' : ''),
'data-view': view
}).inject(self.navigation_actions, current ? 'top' : 'bottom');
});

52
couchpotato/core/media/movie/_base/static/movie.actions.js

@ -424,49 +424,35 @@ MA.Trailer = new Class({
Extends: MovieAction,
id: null,
label: 'Trailer',
create: function(){
getDetails: function(){
var self = this;
self.el = new Element('a.trailer', {
'title': 'Watch the trailer of ' + self.getTitle(),
if(!self.player_container){
var id = 'trailer-'+randomString();
self.player_container = new Element('div.icon-play[id='+id+']', {
'events': {
'click': self.watch.bind(self)
'click': function(e){
self.watch(id);
}
}
});
self.container = new Element('div.trailer_container')
.grab(self.player_container);
}
return self.player_container;
},
watch: function(offset){
watch: function(){
var self = this;
var data_url = 'https://gdata.youtube.com/feeds/videos?vq="{title}" {year} trailer&max-results=1&alt=json-in-script&orderby=relevance&sortorder=descending&format=5&fmt=18';
var url = data_url.substitute({
var data_url = 'https://gdata.youtube.com/feeds/videos?vq="{title}" {year} trailer&max-results=1&alt=json-in-script&orderby=relevance&sortorder=descending&format=5&fmt=18',
url = data_url.substitute({
'title': encodeURI(self.getTitle()),
'year': self.get('year'),
'offset': offset || 1
}),
size = $(self.movie).getSize(),
height = self.options.height || (size.x/16)*9,
id = 'trailer-'+randomString();
self.player_container = new Element('div[id='+id+']');
self.container = new Element('div.hide.trailer_container')
.adopt(self.player_container)
.inject($(self.movie), 'top');
self.container.setStyle('height', 0);
self.container.removeClass('hide');
self.close_button = new Element('a.hide.hide_trailer', {
'text': 'Hide trailer',
'events': {
'click': self.stop.bind(self)
}
}).inject(self.movie);
self.container.setStyle('height', height);
$(self.movie).setStyle('height', height);
'year': self.get('year')
});
new Request.JSONP({
'url': url,
@ -486,8 +472,6 @@ MA.Trailer = new Class({
}
});
self.close_button.removeClass('hide');
var quality_set = false;
var change_quality = function(state){
if(!quality_set && (state.data == 1 || state.data || 2)){
@ -505,6 +489,8 @@ MA.Trailer = new Class({
}
}).send();
return self.container;
},
stop: function(){

4
couchpotato/core/media/movie/_base/static/movie.js

@ -26,8 +26,8 @@ var Movie = new Class({
self.addEvents();
//if(data.identifiers.imdb == 'tt0948470')
// self.openDetails();
if(data.identifiers.imdb == 'tt1228705')
self.openDetails();
},
openDetails: function(){

10
couchpotato/core/media/movie/_base/static/movie.scss

@ -214,13 +214,17 @@
}
.section {
padding: $padding/2 $padding;
border-bottom: 1px solid rgba(0,0,0,.1);
padding: $padding $padding;
border-top: 1px solid rgba(0,0,0,.1);
}
}
.releases {
.buttons {
margin-bottom: $padding/2;
}
.item span {
overflow: hidden;
white-space: nowrap;
@ -237,7 +241,7 @@
.size { min-width: 40px; max-width: 40px; }
.age { min-width: 40px; max-width: 40px; }
.score { min-width: 45px; max-width: 45px; }
.provider { min-width: 100px; max-width: 100px; }
.provider { min-width: 110px; max-width: 110px; }
}
}

2
couchpotato/static/scripts/block/menu.js

@ -15,7 +15,7 @@ var BlockMenu = new Class({
self.wrapper = new Element('div.wrapper').adopt(
self.more_option_ul = new Element('ul')
),
self.button = new Element('a.button' + (self.options.button_class ? '.' + self.options.button_class : ''), {
self.button = new Element('a' + (self.options.button_class ? '.' + self.options.button_class : ''), {
'text': self.options.button_text || '',
'events': {
'click': function(){

16
couchpotato/static/style/main.scss

@ -38,6 +38,21 @@ input, textarea, select {
border: 1px solid #f2f2f2;
}
.button {
color: $primary_color;
font-weight: 300;
padding: $padding/4;
cursor: pointer;
border: 1px solid $primary_color;
border-radius: $border_radius;
margin: 0 $padding/4;
&:hover {
background: $primary_color;
color: $background_color;
}
}
/* Header */
.header {
width: $header_width;
@ -357,7 +372,6 @@ input, textarea, select {
}
/* Messages */
.messages {
position: fixed;
right: 0;

Loading…
Cancel
Save