Merge pull request #850 from JackDandy/feature/ChangeImages

Change improve page load time when loading images.
This commit is contained in:
JackDandy 2017-01-01 18:19:58 +00:00 committed by GitHub
commit 5c51f20928
8 changed files with 187 additions and 66 deletions

View file

@ -3,6 +3,9 @@
* Change don't fetch caps for disabled nzb providers
* Change recent search to use centralised title and URL parser for newznab
* Add display unaired season 1 episodes of a new show in regular and pro I view modes
* Change improve page load time when loading images
* Update isotope library 2.2.2 to 3.0.1
* Add lazyload package 3.0.0 (2e318b1)
[develop changelog]

View file

@ -3348,6 +3348,18 @@ img[src=""],img:not([src]){
margin:-1%
}
/* Fixes Firefox anomaly during image load */
@-moz-document url-prefix(){
img:-moz-loading{visibility:hidden}
}
.lazy-loading-image{
display:inline-block;
position:absolute;
top:0;
left:0
}
/* =======================================================================
bootstrap Overrides
========================================================================== */

View file

@ -1,5 +1,6 @@
#import sickbeard
#import datetime
#from sickbeard import WEB_ROOT, THEME_NAME
#from sickbeard.common import *
#from sickbeard import sbdatetime, network_timezones
<% def sg_var(varname, default=False): return getattr(sickbeard, varname, default) %>#slurp#
@ -11,6 +12,7 @@
#set global $topmenu = 'home'
#set global $page_body_attr = 'show-list'
#set fuzzydate = 'airdate'
#set sg_root = $getVar('sbRoot', WEB_ROOT)
##
#import os.path
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl')
@ -28,7 +30,13 @@
fuzzydate: ".$fuzzydate",
};
</script>
<script type="text/javascript" src="$sbRoot/js/home.js?v=$sbPID"></script>
<style>
#set theme_suffix = ('', '-dark')['dark' == $getVar('sbThemeName', THEME_NAME)]
.bfr{position:absolute;left:-999px;top:-999px}.bfr img{width:16px;height:16px}.spinner{display:inline-block;width:16px;height:16px;background:url(${sg_root}/images/loading16${theme_suffix}.gif) no-repeat 0 0}
</style>
<div class="bfr"><img src="$sg_root/images/loading16${theme_suffix}.gif" /></div>
<h1 class="header" style="margin-bottom:0">$showlists[0][1]</h1>
<div id="HomeLayout" class="pull-right">
@ -38,18 +46,18 @@
<div id="top-row">
<span>Sort By:
<select id="postersort" class="form-control form-control-inline input-sm" tabindex="$tab#set $tab += 1#">
<option value="name" data-sort="$sbRoot/setPosterSortBy/?sort=name"#echo $selected if 'name' == $sg_str('POSTER_SORTBY', 'name') else ''#>Name</option>
<option value="date" data-sort="$sbRoot/setPosterSortBy/?sort=date"#echo $selected if 'date' == $sg_str('POSTER_SORTBY') else ''#>Next Episode</option>
<option value="network" data-sort="$sbRoot/setPosterSortBy/?sort=network"#echo $selected if 'network' == $sg_str('POSTER_SORTBY') else ''#>Network</option>
<option value="progress" data-sort="$sbRoot/setPosterSortBy/?sort=progress"#echo $selected if 'progress' == $sg_str('POSTER_SORTBY') else ''#>Progress</option>
<option value="quality" data-sort="$sbRoot/setPosterSortBy/?sort=quality"#echo $selected if 'quality' == $sg_str('POSTER_SORTBY') else ''#>Quality</option>
<option value="name" data-sort="$sg_root/setPosterSortBy/?sort=name"#echo $selected if 'name' == $sg_str('POSTER_SORTBY', 'name') else ''#>Name</option>
<option value="date" data-sort="$sg_root/setPosterSortBy/?sort=date"#echo $selected if 'date' == $sg_str('POSTER_SORTBY') else ''#>Next Episode</option>
<option value="network" data-sort="$sg_root/setPosterSortBy/?sort=network"#echo $selected if 'network' == $sg_str('POSTER_SORTBY') else ''#>Network</option>
<option value="progress" data-sort="$sg_root/setPosterSortBy/?sort=progress"#echo $selected if 'progress' == $sg_str('POSTER_SORTBY') else ''#>Progress</option>
<option value="quality" data-sort="$sg_root/setPosterSortBy/?sort=quality"#echo $selected if 'quality' == $sg_str('POSTER_SORTBY') else ''#>Quality</option>
</select>
</span>
<span style="margin-left:5px">Sort Order:
<select id="postersortdirection" class="form-control form-control-inline input-sm" tabindex="$tab#set $tab += 1#">
<option value="true" data-sort="$sbRoot/setPosterSortDir/?direction=1"#echo $selected if 1 == $sg_var('POSTER_SORTDIR', 1) else ''#>Asc</option>
<option value="false" data-sort="$sbRoot/setPosterSortDir/?direction=0"#echo $selected if 0 == $sg_var('POSTER_SORTDIR') else ''#>Desc</option>
<option value="true" data-sort="$sg_root/setPosterSortDir/?direction=1"#echo $selected if 1 == $sg_var('POSTER_SORTDIR', 1) else ''#>Asc</option>
<option value="false" data-sort="$sg_root/setPosterSortDir/?direction=0"#echo $selected if 0 == $sg_var('POSTER_SORTDIR') else ''#>Desc</option>
</select>
</span>
@ -58,10 +66,10 @@
<span id="top-row" class="pull-right no-marginr">Layout:
#end if
<select style="margin-bottom:10px" name="layout" class="form-control form-control-inline input-sm" onchange="location = this.options[this.selectedIndex].value;" tabindex="$tab#set $tab += 1#">
<option value="$sbRoot/setHomeLayout/?layout=poster"#echo $selected if 'poster' == $sg_str('HOME_LAYOUT', 'poster') else ''#>Poster</option>
<option value="$sbRoot/setHomeLayout/?layout=small"#echo $selected if 'small' == $sg_str('HOME_LAYOUT') else ''#>Small Poster</option>
<option value="$sbRoot/setHomeLayout/?layout=banner"#echo $selected if 'banner' == $sg_str('HOME_LAYOUT') else ''#>Banner</option>
<option value="$sbRoot/setHomeLayout/?layout=simple"#echo $selected if 'simple' == $sg_str('HOME_LAYOUT') else ''#>Simple</option>
<option value="$sg_root/setHomeLayout/?layout=poster"#echo $selected if 'poster' == $sg_str('HOME_LAYOUT', 'poster') else ''#>Poster</option>
<option value="$sg_root/setHomeLayout/?layout=small"#echo $selected if 'small' == $sg_str('HOME_LAYOUT') else ''#>Small Poster</option>
<option value="$sg_root/setHomeLayout/?layout=banner"#echo $selected if 'banner' == $sg_str('HOME_LAYOUT') else ''#>Banner</option>
<option value="$sg_root/setHomeLayout/?layout=simple"#echo $selected if 'simple' == $sg_str('HOME_LAYOUT') else ''#>Simple</option>
</select>
</span>
@ -74,6 +82,8 @@
</div>
</div><!-- /HomeLayout -->
##
#set $poster_id = 0
#set $load_normal = 0
#for $curShowlist in $showlists
#set $curListID = $curShowlist[0]
#set $curListName = $curShowlist[1]
@ -98,7 +108,7 @@
#if None is $curLoadingShow.show
##
<div class="show-card" data-name="0" data-date="010101" data-network="0">
<img alt="" title="$curLoadingShow.show_name" class="show-image" style="border-bottom:1px solid #111" src="$sbRoot/images/poster.png" />
<img alt="" title="$curLoadingShow.show_name" class="show-image" style="border-bottom:1px solid #111" src="$sg_root/images/poster.png" />
<div class="show-details">
<div class="show-add">Loading... ($curLoadingShow.show_name)</div>
</div>
@ -119,6 +129,7 @@
#set $download_stat_tip = ''
#set $display_status = $curShow.status
#set $display_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', $curShow.name), $curShow.name)[$sg_var('SORT_ARTICLE')]
#set $poster_id += 1
#if None is not $display_status
#if re.search(r'(?i)(?:new|returning)\s*series', $curShow.status)
#set $display_status = 'Continuing'
@ -150,7 +161,7 @@
#set $download_stat = str($cur_downloaded)
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
#if $cur_snatched > 0
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sg_root, $cur_snatched)
#set $download_stat_tip = download_stat_tip + '&#013;' + 'Snatched: ' + str($cur_snatched)
#end if
#set $download_stat = download_stat + ' / ' + str($cur_total)
@ -184,7 +195,14 @@
<div id="show$curShow.indexerid" class="show-card" data-name="$curShow.name" data-date="$data_date" data-network="$curShow.network">
<div class="show-card-top">
<div class="show-image">
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid"><img alt="" class="show-image" src="$sbRoot/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" /></a>
<a href="$sg_root/home/displayShow?show=$curShow.indexerid">
#if $load_normal > $poster_id
<img alt="" class="show-image" src="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" />
#else
<img id="poster-$poster_id" alt="" class="show-image" data-original="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" />
<span id="loading-poster-$poster_id" class="lazy-loading-image"><i class="spinner"></i></span>
#end if
</a>
</div>
<div style="border-top:1px solid black;height:1px"></div>
@ -224,7 +242,7 @@
#if 'No Network' is not $img_text and 'nonetwork' in $network_images[$curShow.indexerid]
$curShow.network
#else
<img class="show-network-image" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="$img_text" title="$img_text" />
<img class="show-network-image" src="$sg_root/images/network/$network_images[$curShow.indexerid]" alt="$img_text" title="$img_text" />
#end if
#end if
</td>
@ -267,7 +285,7 @@
<tfoot>
<tr>
<th><a href="$sbRoot/home/addShows/">Add Show</a></th>
<th><a href="$sg_root/home/addShows/">Add Show</a></th>
<th colspan="6"></th>
</tr>
</tfoot>
@ -284,7 +302,7 @@
#if None is $curLoadingShow.show
Loading... ($curLoadingShow.show_name)
#else
<a href="$sbRoot/home/displayShow?show=$curLoadingShow.show.indexerid">$curLoadingShow.show.name</a>
<a href="$sg_root/home/displayShow?show=$curLoadingShow.show.indexerid">$curLoadingShow.show.name</a>
#end if
</td>
<td></td>
@ -297,6 +315,8 @@
##
#set void = $myShowList.sort(lambda x, y: cmp(x.name, y.name))
##
#set $poster_id = 0
#set $load_normal = 0
#for $curShow in $myShowList
##
#set $cur_airs_next = ''
@ -305,6 +325,7 @@
#set $cur_total = 0
#set $download_stat_tip = ''
#set $display_name = (re.sub('^((?:A(?!\s+to)n?)|The)\s(\w)', r'<span class="article">\1</span> \2', $curShow.name), $curShow.name)[$sg_var('SORT_ARTICLE')]
#set $poster_id += 1
##
#if $curShow.indexerid in $show_stat
#set $cur_airs_next = $show_stat[$curShow.indexerid]['ep_airs_next']
@ -329,7 +350,7 @@
#set $download_stat = str($cur_downloaded)
#set $download_stat_tip = 'Downloaded: ' + str($cur_downloaded)
#if $cur_snatched > 0
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sbRoot, $cur_snatched)
#set $download_stat = '%s<a class="ui-font" href="%s/manage/episodeStatuses?whichStatus=2" title="View overview of snatched episodes">+%s</a>' % ($download_stat, $sg_root, $cur_snatched)
#set $download_stat_tip = download_stat_tip + '&#013;' + 'Snatched: ' + str($cur_snatched)
#end if
#set $download_stat = download_stat + ' / ' + str($cur_total)
@ -361,25 +382,35 @@
<td class="tvShow text-left">
<div class="imgsmallposter $layout">
<a href="$sbRoot/showPoster/?show=$curShow.indexerid&amp;which=poster" rel="dialog" title="$curShow.name">
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" class="$layout" alt="$curShow.indexerid"/>
<a href="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=poster" rel="dialog" title="$curShow.name">
#if $load_normal > $poster_id
<img src="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" class="$layout" alt="$curShow.indexerid" />
#else
<img id="poster-$poster_id" data-original="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=poster_thumb" class="$layout" alt="$curShow.indexerid" />
<span id="loading-poster-$poster_id" class="lazy-loading-image"><i class="spinner"></i></span>
#end if
</a>
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid" style="vertical-align:middle">$display_name</a>
<a href="$sg_root/home/displayShow?show=$curShow.indexerid" style="vertical-align:middle">$display_name</a>
</div>
</td>
#else if 'banner' == $layout
<td class="text-left">
<div class="imgbanner $layout">
<a href="$sbRoot/home/displayShow?show=$curShow.indexerid">
<img src="$sbRoot/showPoster/?show=$curShow.indexerid&amp;which=banner" class="$layout" alt="$curShow.indexerid" title="$curShow.name" />
<a href="$sg_root/home/displayShow?show=$curShow.indexerid">
#if $load_normal > $poster_id
<img src="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=banner" class="$layout" alt="$curShow.indexerid" title="$curShow.name" />
#else
<img id="poster-$poster_id" data-original="$sg_root/showPoster/?show=$curShow.indexerid&amp;which=banner" class="$layout" alt="$curShow.indexerid" title="$curShow.name" />
<span id="loading-poster-$poster_id" class="lazy-loading-image"><i class="spinner"></i></span>
#end if
</a>
</div>
<span class="sort-data">$display_name</span>
</td>
#else if 'simple' == $layout
<td class="tvShow text-left"><a href="$sbRoot/home/displayShow?show=$curShow.indexerid">$display_name</a></td>
<td class="tvShow text-left"><a href="$sg_root/home/displayShow?show=$curShow.indexerid">$display_name</a></td>
#end if
#if 'simple' != $layout
#set $img_text = ($curShow.network, 'No Network')[None is $curShow.network]
@ -388,7 +419,7 @@
#if 'No Network' is not $img_text and 'nonetwork' in $network_images[$curShow.indexerid]
$curShow.network
#else
<img width="54" height="27" src="$sbRoot/images/network/$network_images[$curShow.indexerid]" alt="#echo '%s" title="%s' % ($img_text, $img_text)#" />
<img width="54" height="27" src="$sg_root/images/network/$network_images[$curShow.indexerid]" alt="#echo '%s" title="%s' % ($img_text, $img_text)#" />
<span class="sort-data">$curShow.network</span>
#end if
</td>
@ -438,5 +469,7 @@
#end for
##
<script type="text/javascript" src="$sg_root/js/lazyload/lazyload.min.js?v=$sbPID"></script>
<script type="text/javascript" src="$sg_root/js/inc_bottom.js?v=$sbPID"></script>
<script type="text/javascript" src="$sg_root/js/home.js?v=$sbPID"></script>
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')

View file

@ -2,6 +2,7 @@
#import datetime
#import re
#import urllib
#from sickbeard import WEB_ROOT, THEME_NAME
#from sickbeard.common import *
#from sickbeard import sbdatetime
#from sickbeard.helpers import anon_url
@ -13,11 +14,12 @@
#set global $sbPath='..'
#set global $topmenu='home'
#set global $page_body_attr = 'browse-list'
#set sg_root = $getVar('sbRoot', WEB_ROOT)
##
#import os.path
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl')
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?v=$sbPID"></script>
<script type="text/javascript" src="$sg_root/js/plotTooltip.js?v=$sbPID"></script>
<script type="text/javascript" charset="utf-8">
<!--
@ -29,17 +31,19 @@
position: {viewport:$(window), my:'left center', adjust:{y: -10,x: 2 }},
style: {tip: {corner:true, method:'polygon'}, classes:'qtip-rounded qtip-bootstrap qtip-shadow ui-tooltip-sb'}
});
}),
llUpdate = (function(){
$.ll.handleScroll();
});
#end raw
\$(document).ready(function(){
$(document).ready(function(){
// initialise combos for dirty page refreshes
\$('#showsort').val('original');
\$('#showsortdirection').val('asc');
\$('#showfilter').val('*');
$('#showsort').val('original');
$('#showsortdirection').val('asc');
$('#showfilter').val('*');
var \$container = [\$('#container')];
jQuery.each(\$container, function (j) {
var $container = [$('#container')];
jQuery.each($container, function(j){
this.isotope({
itemSelector: '.show-card',
sortBy: 'original-order',
@ -52,10 +56,12 @@
getSortData: {
premiered: '[data-premiered] parseInt',
name: function( itemElem ) {
var name = \$( itemElem ).attr('data-name') || '';
var name = $( itemElem ).attr('data-name') || '';
#end raw
#if not $sg_var('SORT_ARTICLE'):
name = name.replace(/^(?:(?:A(?!\s+to)n?)|The)\s(\w)/i, '$1');
#end if
#raw
return name.toLowerCase();
},
rating: '[data-rating] parseInt',
@ -64,21 +70,19 @@
});
});
\$('#showsort').on( 'change', function() {
var sortCriteria;
$('#showsort').on('change', function(){
var sortCriteria, el$ = $('#container'), shuffle = !1;
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';
shuffle = !0;
break;
case 'rating_votes':
sortCriteria = ['rating', 'votes'];
shuffle = !0;
break;
case 'votes':
sortCriteria = 'votes';
@ -90,29 +94,62 @@
sortCriteria = 'name'
break;
}
\$('#container').isotope({sortBy: sortCriteria});
});
\$('#showsortdirection').on( 'change', function() {
\$('#container').isotope({sortAscending: ('asc' == this.value)});
});
\$('#showfilter').on( 'change', function() {
var filterValue = this.value;
if (-1 == filterValue.indexOf('trakt') && -1 == filterValue.indexOf('imdb') && -1 == filterValue.indexOf('default')) {
\$('#container').isotope({ filter: filterValue });
if (!shuffle){
el$.one('layoutComplete', llUpdate);
el$.isotope({sortBy: sortCriteria});
} else {
location = '$sbRoot/home/addShows/' + filterValue;
// shuffle rating_votes where it can already be sorted by ratings which leaves it nothing to do.
function t(sortCriteria, lastPhase){
return function(){
var el$ = $('#container');
if (!lastPhase){
lastPhase = !0;
el$.isotope({sortBy: sortCriteria});
} else {
el$.off('layoutComplete');
el$.isotope('layout');
llUpdate();
}
}
}
el$.on('layoutComplete', t(sortCriteria, !1));
el$.isotope({sortBy: 'random'});
}
});
#raw
$('.service, .browse-image').each(addQTip);
$('#showsortdirection').on('change', function(){
var el$ = $('#container')
el$.one('layoutComplete', llUpdate);
el$.isotope({sortAscending: ('asc' == this.value)});
});
$('#showfilter').on('change', function(){
var filterValue = this.value;
if (-1 == filterValue.indexOf('trakt') && -1 == filterValue.indexOf('imdb') && -1 == filterValue.indexOf('default')) {
var el$ = $('#container')
el$.on('layoutComplete', llUpdate);
el$.isotope({ filter: filterValue });
} else {
#end raw
location = '$sg_root/home/addShows/' + filterValue;
#raw
}
});
$('.service, .browse-image').each(addQTip);
});
#end raw
//-->
</script>
<style>
#set theme_suffix = ('', '-dark')['dark' == $getVar('sbThemeName', THEME_NAME)]
.bfr{position:absolute;left:-999px;top:-999px}.bfr img{width:16px;height:16px}.spinner{display:inline-block;width:16px;height:16px;background:url(${sg_root}/images/loading16${theme_suffix}.gif) no-repeat 0 0}
</style>
<div class="bfr"><img src="$sg_root/images/loading16${theme_suffix}.gif" /></div>
#if $varExists('header')
#set $heading = ('header', $header)
#else
@ -214,7 +251,10 @@
<div id="container">
#if $all_shows
#set $poster_id = 0
#for $this_show in $all_shows:
#set $poster_id += 1
#set $title_html = $this_show['title'].replace('"', '&quot;').replace("'", '&#39;')
#if 'newseasons' == $mode
#set $overview = '%s: %s' % (
@ -235,7 +275,8 @@
<span style='float:right'>Click for more at <span class='boldest'>$browse_type</span></span>">
#if 'poster' in $this_show['images']:
#set $image = $this_show['images']['poster']['thumb']
<img alt="" class="browse-image" src="#if $image and 'http' != $image[:4]#$sbRoot/#end if#$image" />
<img id="poster-$poster_id" alt="" class="browse-image" data-original="#if $image and 'http' != $image[:4]#$sg_root/#end if#$image" />
<span id="loading-poster-$poster_id" class="lazy-loading-image"><i class="spinner"></i></span>
#else:
<span>&nbsp;</span>
#end if
@ -251,14 +292,14 @@
#if 'url_tvdb' in $this_show and $this_show['url_tvdb']:
<a class="service" href="<%= anon_url(this_show['url_tvdb']) %>" onclick="window.open(this.href, '_blank'); return false;"
title="View <span class='boldest'>tvdb</span> detail for <span style='color: rgb(66, 139, 202)'>$title_html</span>">
<i><img style="margin-top:5px" alt="tvdb" height="16" width="16" src="$sbRoot/images/$sickbeard.indexerApi($sickbeard.indexers.indexer_config.INDEXER_TVDB).config['icon']" /></i></a>
<i><img style="margin-top:5px" alt="tvdb" height="16" width="16" src="$sg_root/images/$sickbeard.indexerApi($sickbeard.indexers.indexer_config.INDEXER_TVDB).config['icon']" /></i></a>
#end if
<div class="browse-add-show-holder">
#if ':' in $this_show['show_id']:
<p style="line-height:1.5;padding:2px 5px 3px" title="#echo '%s added' % $sickbeard.indexerApi(this_show['show_id'][:1]).config.get('name')#">In library</p>
#else
<a href="$sbRoot/home/addShows/add${browse_type}Show?indexer_id=${this_show['show_id']}&amp;showName=${urllib.quote($this_show['title'].encode("utf-8"))}" class="btn btn-xs">Add Show</a>
<a href="$sg_root/home/addShows/add${browse_type}Show?indexer_id=${this_show['show_id']}&amp;showName=${urllib.quote($this_show['title'].encode("utf-8"))}" class="btn btn-xs">Add Show</a>
#end if
</div>
</div>
@ -271,7 +312,7 @@
#end for
</div>
#if $kwargs and $kwargs.get('footnote'):
<div>
<div style="clear:both">
$kwargs['footnote']
</div>
#end if
@ -295,4 +336,6 @@ window.setInterval('location.reload(true)', 600000); // Refresh every 10 minutes
//-->
</script>
<script type="text/javascript" src="$sg_root/js/lazyload/lazyload.min.js?v=$sbPID"></script>
<script type="text/javascript" src="$sg_root/js/inc_bottom.js?v=$sbPID"></script>
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')

View file

@ -43,7 +43,7 @@ $.tablesorter.addParser({
type: 'numeric'
});
function valueDownloads(s) {
var valueDownloads = (function(s){
var match = s.match(/^(\?|\d+)(?:[^/]+[^\d]+(\d+))?$/);
if (null == match || '?' == match[1])
@ -59,7 +59,11 @@ function valueDownloads(s) {
finalNum += dlCnt;
return finalNum;
}
}),
llUpdate = (function(){
$.ll.handleScroll();
});
$(document).ready(function () {
if (config.homeSearchFocus) {
@ -109,6 +113,7 @@ $(document).ready(function () {
break;
}
$(obj).one('layoutComplete', llUpdate);
$(obj).isotope({
itemSelector: '.show-card',
sortBy: sortCriteria,
@ -144,6 +149,7 @@ $(document).ready(function () {
$('#postersort').on('change', function () {
var sortValue = this.value;
$(obj).one('layoutComplete', llUpdate);
$(obj).isotope({sortBy: sortValue});
$.get(this.options[this.selectedIndex].getAttribute('data-sort'));
});
@ -151,12 +157,16 @@ $(document).ready(function () {
$('#postersortdirection').on('change', function () {
var sortDirection = this.value;
sortDirection = sortDirection == 'true';
$(obj).one('layoutComplete', llUpdate);
$(obj).isotope({sortAscending: sortDirection});
$.get(this.options[this.selectedIndex].getAttribute('data-sort'));
});
});
$('#search_show_name').on('input', function() {
$('.container').isotope({
var obj = $('.container');
obj.one('layoutComplete', llUpdate);
obj.isotope({
filter: function () {
return 0 <= $(this).attr('data-name').toLowerCase().indexOf(
$('#search_show_name').val().toLowerCase());

View file

@ -0,0 +1,18 @@
function initLazyload(){
$.ll = new LazyLoad({elements_selector:'img[data-original]', callback_load:function(element){
if (element.id) {
var el = document.getElementById('loading-' + element.id), className = 'hide';
if (!!document.body.classList) {
el.classList.add(className);
} else {
el.className += (el.className ? ' ' : '') + className;
}
}
}});
$.ll.handleScroll();
return !0;
}
$(document).ready(function(){
!/undefined/i.test(typeof(LazyLoad)) && initLazyload();
});

2
gui/slick/js/lazyload/lazyload.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long