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 71: Line 12:
 
                     </div>
 
                     </div>
 
                     <div class="panel‐body">
 
                     <div class="panel‐body">
<div class="row">
+
                        <a class="twitter-timeline" href="https://twitter.com/hashtag/askigemheidelberg" data-widget-id="633947930844635136">#askigemheidelberg-Tweets</a>
                        <div class="col-lg-offset-3 col-lg-6">
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
                        <div id="my_widget_region">
+
                          
  <script src="http://widgets.twimg.com/j/2/widget.js"></script>
+
  <script>do_twitter_widget('"#winning" or "justin bieber"');</script>
+
</div>
+
</div>
+
                         </div> <!-- col-lg-offset-3 col-lg-6 -->
+
 
                     </div> <!-- panel-body -->
 
                     </div> <!-- panel-body -->
 
                 </div> <!-- panel panel-default -->
 
                 </div> <!-- panel panel-default -->

Revision as of 10:49, 19 August 2015

Short introduction