From 49d0bd08d7e811ecf350c241d43f0ec260422eae Mon Sep 17 00:00:00 2001 From: ScottDowne Date: Thu, 23 Dec 2010 13:38:40 -0500 Subject: [PATCH] [#159] tightened up twitter widget --- plugins/twitter/popcorn.twitter.js | 103 ++++++++++------------------- 1 file changed, 36 insertions(+), 67 deletions(-) diff --git a/plugins/twitter/popcorn.twitter.js b/plugins/twitter/popcorn.twitter.js index c30ff91..ed1df8f 100644 --- a/plugins/twitter/popcorn.twitter.js +++ b/plugins/twitter/popcorn.twitter.js @@ -58,80 +58,49 @@ width = options.width || 250, height = options.height || 200, profile = /^@/.test( src ), - hash = /^#/.test( src ); + hash = /^#/.test( src ), + widgetOptions = { + version: 2, + type: ( profile ? 'profile' : 'search' ), + id: options.container.getAttribute( 'id' ), // use this id to connect it to the div + rpp: 30, + width: width, + height: height, + interval: 6000, + theme: { + shell: { + background: '#ffffff', + color: '#000000' + }, + tweets: { + background: '#ffffff', + color: '#444444', + links: '#1985b5' + } + }, + features: { + loop: true, + timestamp: true, + avatars: true, + hashtags: true, + toptweets: true, + live: true, + scrollbar: false, + behavior: 'default' + } + }; // create widget if ( profile ) { - var widget = new TWTR.Widget({ - version: 2, - type: 'profile', - id: options.container.getAttribute( 'id' ), // use this id to connect it to the div - rpp: 30, - width: width, - height: height, - interval: 6000, - - theme: { - shell: { - background: '#ffffff', - color: '#000000' - }, - tweets: { - background: '#ffffff', - color: '#444444', - links: '#1985b5' - } - }, - - features: { - loop: true, - timestamp: true, - avatars: true, - hashtags: true, - toptweets: true, - live: true, - scrollbar: false, - behavior: 'default' - } - }).render().setUser( src.replace( /^@/, "" ) ).start(); + new TWTR.Widget( widgetOptions ).render().setUser( src ).start(); - } else if ( hash ) { - - var widget = new TWTR.Widget({ - version: 2, - type: 'search', - id: options.container.getAttribute( 'id' ), // use this id to connect it to the div - search: src, - subject: src, - rpp: 30, - width: width, - height: height, - interval: 6000, + } else if ( hash ) { - theme: { - shell: { - background: '#ffffff', - color: '#000000' - }, - tweets: { - background: '#ffffff', - color: '#444444', - links: '#1985b5' - } - }, + widgetOptions.search = src; + widgetOptions.subject = src; - features: { - loop: true, - timestamp: true, - avatars: true, - hashtags: true, - toptweets: true, - live: true, - scrollbar: false, - behavior: 'default' - } - }).render().start(); + new TWTR.Widget( widgetOptions ).render().start(); } }, -- 2.43.0