remove lazyload lib + make random list ext more readable
lazyload is no longer used, see: 7c959813191a8fb4d17ec7b21b33d88c834dd0e6
This commit is contained in:
parent
134f9082fd
commit
c51d1388c0
@ -14,55 +14,41 @@ class RandomList extends Extension {
|
||||
public function onPageRequest(PageRequestEvent $event) {
|
||||
global $config, $page;
|
||||
|
||||
if($event->page_matches("random")) {
|
||||
// set vars
|
||||
$page->title = "Random Images";
|
||||
$images_per_page = $config->get_int("random_images_list_count", 12);
|
||||
$random_images = array();
|
||||
$random_html = "<b>Refresh the page to view more images</b>
|
||||
<div class='shm-image-list'>";
|
||||
if($event->page_matches("random")) {
|
||||
// set vars
|
||||
$page->title = "Random Images";
|
||||
$images_per_page = $config->get_int("random_images_list_count", 12);
|
||||
$random_images = array();
|
||||
$random_html = "<b>Refresh the page to view more images</b>
|
||||
<div class='shm-image-list'>";
|
||||
|
||||
// generate random images
|
||||
for ($i = 0; $i < $images_per_page; $i++)
|
||||
array_push($random_images, Image::by_random());
|
||||
// generate random images
|
||||
for ($i = 0; $i < $images_per_page; $i++)
|
||||
array_push($random_images, Image::by_random());
|
||||
|
||||
// create html to display images
|
||||
foreach ($random_images as $image)
|
||||
$random_html .= $this->build_random_html($image);
|
||||
// create html to display images
|
||||
foreach ($random_images as $image)
|
||||
$random_html .= $this->theme->build_thumb_html($image);
|
||||
|
||||
// display it
|
||||
$random_html .= "</div>";
|
||||
$page->add_block(new Block("Random Images", $random_html));
|
||||
// display it
|
||||
$random_html .= "</div>";
|
||||
$page->add_block(new Block("Random Images", $random_html));
|
||||
}
|
||||
}
|
||||
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
global $config;
|
||||
$config->set_default_int("random_images_list_count", 12);
|
||||
}
|
||||
public function onInitExt(InitExtEvent $event) {
|
||||
global $config;
|
||||
$config->set_default_int("random_images_list_count", 12);
|
||||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
||||
$sb = new SetupBlock("Random Images List");
|
||||
|
||||
// custom headers
|
||||
// custom headers
|
||||
$sb->add_int_option("random_images_list_count",
|
||||
"Amount of Random images to display ");
|
||||
"Amount of Random images to display ");
|
||||
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
|
||||
private function build_random_html(Image $image, $query=null) {
|
||||
$i_id = int_escape($image->id);
|
||||
$h_view_link = make_link("post/view/$i_id", $query);
|
||||
$h_thumb_link = $image->get_thumb_link();
|
||||
$h_tip = html_escape($image->get_tooltip());
|
||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||
|
||||
return "
|
||||
<a href='$h_view_link' class='thumb shm-thumb' data-post-id='$i_id'>
|
||||
<img id='thumb_$i_id' height='{$tsize[1]}' width='{$tsize[0]}' class='lazy' data-original='$h_thumb_link' src='/lib/static/grey.gif'><noscript>
|
||||
<img id='thumb_$i_id' height='{$tsize[1]} width='{$tsize[0]} src='$h_thumb_link'></noscript></a>
|
||||
";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
4
ext/random_list/theme.php
Normal file
4
ext/random_list/theme.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
/* needed for access to build_thumb_html */
|
||||
class RandomListTheme extends Themelet {}
|
||||
?>
|
15
lib/jquery.lazyload.min.js
vendored
15
lib/jquery.lazyload.min.js
vendored
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Lazy Load - jQuery plugin for lazy loading images
|
||||
*
|
||||
* Copyright (c) 2007-2012 Mika Tuupola
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Project home:
|
||||
* http://www.appelsiini.net/projects/lazyload
|
||||
*
|
||||
* Version: 1.7.2
|
||||
*
|
||||
*/
|
||||
(function(a,b){$window=a(b),a.fn.lazyload=function(c){function f(){var b=0;d.each(function(){var c=a(this);if(e.skip_invisible&&!c.is(":visible"))return;if(!a.abovethetop(this,e)&&!a.leftofbegin(this,e))if(!a.belowthefold(this,e)&&!a.rightoffold(this,e))c.trigger("appear");else if(++b>e.failure_limit)return!1})}var d=this,e={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return c&&(undefined!==c.failurelimit&&(c.failure_limit=c.failurelimit,delete c.failurelimit),undefined!==c.effectspeed&&(c.effect_speed=c.effectspeed,delete c.effectspeed),a.extend(e,c)),$container=e.container===undefined||e.container===b?$window:a(e.container),0===e.event.indexOf("scroll")&&$container.bind(e.event,function(a){return f()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,c.one("appear",function(){if(!this.loaded){if(e.appear){var f=d.length;e.appear.call(b,f,e)}a("<img />").bind("load",function(){c.hide().attr("src",c.data(e.data_attribute))[e.effect](e.effect_speed),b.loaded=!0;var f=a.grep(d,function(a){return!a.loaded});d=a(f);if(e.load){var g=d.length;e.load.call(b,g,e)}}).attr("src",c.data(e.data_attribute))}}),0!==e.event.indexOf("scroll")&&c.bind(e.event,function(a){b.loaded||c.trigger("appear")})}),$window.bind("resize",function(a){f()}),f(),this},a.belowthefold=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.height()+$window.scrollTop():e=$container.offset().top+$container.height(),e<=a(c).offset().top-d.threshold},a.rightoffold=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.width()+$window.scrollLeft():e=$container.offset().left+$container.width(),e<=a(c).offset().left-d.threshold},a.abovethetop=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.scrollTop():e=$container.offset().top,e>=a(c).offset().top+d.threshold+a(c).height()},a.leftofbegin=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.scrollLeft():e=$container.offset().left,e>=a(c).offset().left+d.threshold+a(c).width()},a.inviewport=function(b,c){return!a.rightofscreen(b,c)&&!a.leftofscreen(b,c)&&!a.belowthefold(b,c)&&!a.abovethetop(b,c)},a.extend(a.expr[":"],{"below-the-fold":function(c){return a.belowthefold(c,{threshold:0,container:b})},"above-the-top":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-screen":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-screen":function(c){return!a.rightoffold(c,{threshold:0,container:b})},"in-viewport":function(c){return!a.inviewport(c,{threshold:0,container:b})},"above-the-fold":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-fold":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-fold":function(c){return!a.rightoffold(c,{threshold:0,container:b})}})})(jQuery,window);
|
@ -16,11 +16,6 @@ $(document).ready(function() {
|
||||
selectFirst: false
|
||||
});
|
||||
|
||||
$("IMG.lazy").show().lazyload({
|
||||
//effect: "fadeIn",
|
||||
threshold: 200
|
||||
});
|
||||
|
||||
$("TABLE.sortable").tablesorter();
|
||||
|
||||
$(".shm-clink").each(function(idx, elm) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user