Difference between revisions of "Template:Heidelberg/pages/sandbox/stream"
Line 1: | Line 1: | ||
<html> | <html> | ||
− | <head></head> | + | <head> |
+ | <script> | ||
+ | function do_twitter_widget(search_query, title, subtitle) { | ||
+ | if (!window.widgetRef) { | ||
+ | window.widgetRef = new TWTR.Widget({ | ||
+ | version: 2, | ||
+ | type: 'search', | ||
+ | search: search_query, | ||
+ | interval: 6000, | ||
+ | title: title || 'Tweets related to', | ||
+ | subject: subtitle || search_query, | ||
+ | width: 'auto', | ||
+ | height: 500, | ||
+ | theme: { | ||
+ | shell: { | ||
+ | background: '#8EC1DA', | ||
+ | color: '#FFFFFF' | ||
+ | }, | ||
+ | tweets: { | ||
+ | background: '#FFFFFF', | ||
+ | color: '#444444', | ||
+ | links: '#1985B5' | ||
+ | } | ||
+ | }, | ||
+ | features: { | ||
+ | scrollbar: false, | ||
+ | loop: true, | ||
+ | live: true, | ||
+ | hashtags: true, | ||
+ | timestamp: true, | ||
+ | avatars: true, | ||
+ | behavior: 'default' | ||
+ | }, | ||
+ | ready: function() { | ||
+ | // when done rendering... | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | window.widgetRef | ||
+ | .render() | ||
+ | .start(); | ||
+ | } | ||
+ | else { | ||
+ | if (search_query != window.old_twitter_search) { | ||
+ | window.widgetRef | ||
+ | .stop() | ||
+ | .setSearch(search_query) | ||
+ | .setTitle(title || 'Tweets related to') | ||
+ | .setCaption(subtitle || search_query) | ||
+ | .render() | ||
+ | .start(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | window.old_twitter_search = search_query; | ||
+ | |||
+ | return window.widgetRef; | ||
+ | } | ||
+ | </script> | ||
+ | </head> | ||
<body> | <body> | ||
<div class="container"> | <div class="container"> | ||
Line 14: | Line 73: | ||
<div class="row"> | <div class="row"> | ||
<div class="col-lg-offset-3 col-lg-6"> | <div class="col-lg-offset-3 col-lg-6"> | ||
− | < | + | <div id="my_widget_region"> |
− | <script> | + | <script src="http://widgets.twimg.com/j/2/widget.js"></script> |
+ | <script>do_twitter_widget('"#winning" or "justin bieber"');</script> | ||
+ | </div> | ||
</div> | </div> | ||
</div> <!-- col-lg-offset-3 col-lg-6 --> | </div> <!-- col-lg-offset-3 col-lg-6 --> |
Revision as of 10:49, 19 August 2015