From d77982b9b47b8b17051000cfcf3db1a8945d6279 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 5 Aug 2009 17:09:19 -0400 Subject: added Infinite Scroll plugin --- plugins/InfiniteScroll/InfiniteScrollPlugin.php | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 plugins/InfiniteScroll/InfiniteScrollPlugin.php (limited to 'plugins/InfiniteScroll/InfiniteScrollPlugin.php') diff --git a/plugins/InfiniteScroll/InfiniteScrollPlugin.php b/plugins/InfiniteScroll/InfiniteScrollPlugin.php new file mode 100644 index 000000000..6738dc760 --- /dev/null +++ b/plugins/InfiniteScroll/InfiniteScrollPlugin.php @@ -0,0 +1,66 @@ +. + * + * @category Plugin + * @package Laconica + * @author Craig Andrews + * @copyright 2009 Craig Andrews http://candrews.integralblue.com + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ + +if (!defined('LACONICA')) { + exit(1); +} + +class InfiniteScrollPlugin extends Plugin +{ + function __construct() + { + parent::__construct(); + } + + function onEndShowScripts($action) + { + $action->element('script', + array('type' => 'text/javascript', + 'src' => common_path('plugins/InfiniteScroll/jquery.infinitescroll.min.js')), + ''); + + $loading_image = common_path('plugins/InfiniteScroll/ajax-loader.gif'); + $js_string = << +jQuery(document).ready(function($){ + $('notices_primary').infinitescroll({ + nextSelector : "li.nav_next a", + loadingImg : "$loading_image", + text : "Loading the next set of posts...", + donetext : "Congratulations, you\'ve reached the end of the Internet.", + navSelector : "div.pagination", + contentSelector : "#notices_primary", + itemSelector : "ol.notices" + }); +}); + +EOT; + $action->raw($js_string); + } +} -- cgit v1.2.3-54-g00ecf