diff options
author | Craig Andrews <candrews@integralblue.com> | 2009-08-05 17:09:19 -0400 |
---|---|---|
committer | Craig Andrews <candrews@integralblue.com> | 2009-08-05 17:09:19 -0400 |
commit | d77982b9b47b8b17051000cfcf3db1a8945d6279 (patch) | |
tree | 9f2549bc6d94c882527b9537e143d5cd257062c5 /plugins/InfiniteScroll/InfiniteScrollPlugin.php | |
parent | 83ff1cecd39e197e108ecdaba7139b59d22dbee0 (diff) |
added Infinite Scroll plugin
Diffstat (limited to 'plugins/InfiniteScroll/InfiniteScrollPlugin.php')
-rw-r--r-- | plugins/InfiniteScroll/InfiniteScrollPlugin.php | 66 |
1 files changed, 66 insertions, 0 deletions
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 @@ +<?php +/** + * Laconica, the distributed open-source microblogging tool + * + * Plugin to enable Infinite Scrolling + * + * PHP version 5 + * + * LICENCE: This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @category Plugin + * @package Laconica + * @author Craig Andrews <candrews@integralblue.com> + * @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 = <<<EOT +<script type="text/javascript"> +jQuery(document).ready(function($){ + $('notices_primary').infinitescroll({ + nextSelector : "li.nav_next a", + loadingImg : "$loading_image", + text : "<em>Loading the next set of posts...</em>", + donetext : "<em>Congratulations, you\'ve reached the end of the Internet.</em>", + navSelector : "div.pagination", + contentSelector : "#notices_primary", + itemSelector : "ol.notices" + }); +}); +</script> +EOT; + $action->raw($js_string); + } +} |