2014-12-11 17:28:52 -05:00
|
|
|
#import sickbeard
|
|
|
|
#import datetime
|
|
|
|
#import re
|
|
|
|
#import os.path
|
|
|
|
#from sickbeard.common import *
|
|
|
|
#from sickbeard import sbdatetime
|
|
|
|
#from sickbeard.helpers import anon_url
|
|
|
|
|
2014-12-11 16:15:08 -05:00
|
|
|
<script type="text/javascript" charset="utf-8">
|
|
|
|
<!--
|
2014-12-11 15:46:01 -05:00
|
|
|
|
2014-12-11 16:15:08 -05:00
|
|
|
\$(document).ready(function(){
|
|
|
|
// initialise combos for dirty page refreshes
|
|
|
|
\$('#showsort').val('original');
|
|
|
|
\$('#showsortdirection').val('asc');
|
2014-12-11 15:46:01 -05:00
|
|
|
|
2014-12-11 16:15:08 -05:00
|
|
|
var \$container = [\$('#container')];
|
|
|
|
jQuery.each(\$container, function (j) {
|
|
|
|
this.isotope({
|
|
|
|
itemSelector: '.trakt_show',
|
|
|
|
sortBy: 'original-order',
|
|
|
|
layoutMode: 'fitRows',
|
|
|
|
getSortData: {
|
|
|
|
name: function( itemElem ) {
|
|
|
|
var name = \$( itemElem ).attr('data-name') || '';
|
|
|
|
#if not $sickbeard.SORT_ARTICLE:
|
|
|
|
name = name.replace(/^(The|A|An)\s/i, '');
|
|
|
|
#end if
|
|
|
|
return name.toLowerCase();
|
|
|
|
},
|
|
|
|
rating: '[data-rating] parseInt',
|
|
|
|
votes: '[data-votes] parseInt',
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2014-12-11 15:46:01 -05:00
|
|
|
|
2014-12-11 16:15:08 -05:00
|
|
|
\$('#showsort').on( 'change', function() {
|
|
|
|
var sortCriteria;
|
|
|
|
switch (this.value) {
|
|
|
|
case 'original':
|
|
|
|
sortCriteria = 'original-order'
|
|
|
|
break;
|
|
|
|
case 'rating':
|
|
|
|
/* randomise, else the rating_votes can already
|
|
|
|
* have sorted leaving this with nothing to do.
|
|
|
|
*/
|
|
|
|
\$('#container').isotope({sortBy: 'random'});
|
|
|
|
sortCriteria = 'rating';
|
|
|
|
break;
|
|
|
|
case 'rating_votes':
|
|
|
|
sortCriteria = ['rating', 'votes'];
|
|
|
|
break;
|
|
|
|
case 'votes':
|
|
|
|
sortCriteria = 'votes';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sortCriteria = 'name'
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
\$('#container').isotope({sortBy: sortCriteria});
|
|
|
|
});
|
2014-12-11 15:46:01 -05:00
|
|
|
|
2014-12-11 16:15:08 -05:00
|
|
|
\$('#showsortdirection').on( 'change', function() {
|
|
|
|
\$('#container').isotope({sortAscending: ('asc' == this.value)});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//-->
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div id="container">
|
2014-12-11 15:46:01 -05:00
|
|
|
#if not $trending_shows
|
|
|
|
<div class="trakt_show" style="width:100%; margin-top:20px">
|
|
|
|
<p class="red-text">Trakt API did not return any results, please check your config.
|
|
|
|
</div>
|
|
|
|
#else
|
|
|
|
#for $cur_show in $trending_shows:
|
2015-01-25 15:14:57 -05:00
|
|
|
#set $show_url = 'http://www.trakt.tv/shows/%s' % $cur_show['show']['ids']['slug']
|
2014-12-11 15:46:01 -05:00
|
|
|
|
2015-01-25 15:14:57 -05:00
|
|
|
<div class="trakt_show" data-name="$cur_show['show']['title']" data-rating="$cur_show['show']['rating']" data-votes="$cur_show['show']['votes']">
|
2014-12-11 15:46:01 -05:00
|
|
|
<div class="traktContainer">
|
|
|
|
<div class="trakt-image">
|
2015-01-25 15:14:57 -05:00
|
|
|
<a class="trakt-image" href="<%= anon_url(show_url) %>" target="_blank"><img alt="" class="trakt-image" src="$cur_show['show']['images']['poster']['thumb']" /></a>
|
2014-12-11 15:46:01 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="show-title">
|
2015-01-25 15:14:57 -05:00
|
|
|
<%= (cur_show['show']['title'], '<span> </span>')[ '' == cur_show['show']['title']] %>
|
2014-12-11 15:46:01 -05:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="clearfix">
|
2015-01-25 22:31:53 -05:00
|
|
|
<p><%= int(cur_show['show']['rating']*10) %>% <img src="$sbRoot/images/heart.png"></p>
|
2015-01-25 15:14:57 -05:00
|
|
|
<i>$cur_show['show']['votes'] votes</i>
|
2014-12-11 15:46:01 -05:00
|
|
|
<div class="traktShowTitleIcons">
|
2015-01-25 15:14:57 -05:00
|
|
|
<a href="$sbRoot/home/addShows/addTraktShow?indexer_id=${cur_show['show']['ids']['tvdb'] or cur_show['show']['ids']['tvrage']}&showName=${cur_show['show']['title']}" class="btn btn-xs">Add Show</a>
|
2014-12-11 15:46:01 -05:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
#end for
|
2014-12-11 16:15:08 -05:00
|
|
|
#end if
|
|
|
|
</div>
|