From e494bbdec3decda9b7fc1c77a37f6dbe27cb4502 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 14 Aug 2010 15:09:43 -0400 Subject: [PATCH] less obtrusive observing, allow more then one twitter block on a page --- horde/js/twitterclient.js | 6 ++++++ horde/lib/Block/twitter_timeline.php | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/horde/js/twitterclient.js b/horde/js/twitterclient.js index 2829c84d4..2640ed28c 100644 --- a/horde/js/twitterclient.js +++ b/horde/js/twitterclient.js @@ -25,6 +25,7 @@ var Horde_Twitter = Class.create({ * opts.strings.inreplyto * opts.strings.defaultText * opts.strings.justnow + * opts.getmore */ initialize: function(opts) { this.opts = Object.extend({ @@ -42,6 +43,11 @@ var Horde_Twitter = Class.create({ $(this.opts.counter).update(140 - $F(this.opts.input).length); }.bind(this)); + $(this.opts.getmore).observe('click', function(e) { + this.getOlderEntries(); + e.stop(); + }.bind(this)); + /* Get the first page */ this.getNewEntries(); }, diff --git a/horde/lib/Block/twitter_timeline.php b/horde/lib/Block/twitter_timeline.php index 90e23b2e2..52251c404 100644 --- a/horde/lib/Block/twitter_timeline.php +++ b/horde/lib/Block/twitter_timeline.php @@ -142,7 +142,8 @@ class Horde_Block_Horde_twitter_timeline extends Horde_Block Horde::addScriptFile('twitterclient.js'); $script = <<' - . '' . _("Tweet") . '140 ' + . '' . _("Tweet") . '140 ' . Horde::img('loading.gif', '', array('id' => $instance . '_loading', 'style' => 'display:none;')); $html .= '
' . _("Latest") . ' ' . $latestStatus . ' - ' . Horde_Date_Utils::relativeDateTime(strtotime($this->_profile->status->created_at), $GLOBALS['prefs']->getValue('date_format'), ($GLOBALS['prefs']->getValue('twentyFour') ? "%H:%M" : "%I:%M %P")) . '
'; $html .= '
'; $filter = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->getFilter('Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO)); $html .= '
'; - $html .= '
'; + $html .= '
'; $html .= ''; return $html; -- 2.11.0