Twitter stream or tweets widget

NodeBB Plugins
  • I want to create a widget that displays either a twitter stream based on search terms or display tweets from specified twitter handles.

    It would probably be a process on the server that emits the tweets to widget clients. I am comfortable with javascript but I am relatively new to Node.js. Could someone please guide me on the best way to implement this?

    @julianlam @psychobunny @baris?

  • @pichalite ACP > Widgets > Add New HTML Widget into Home Sidebar or somewhere similar. Put the code that shows the twitter widget into the widget you just created, give it class from the right side menu and click save.

  • Thanks @a_5mith. Not sure why I was thinking that I need to create a NodeBB plugin for this.

  • If I do so, then the twitter widget is not regenerated (say the javascript is not running) if i change to "Recent" and the back to Main page. I have the twitter widget on homepage sidebar with this code:

    <a class="twitter-timeline"  href="https://twitter.com/3malG" data-widget-id="507843649955041282">Tweets von @3malG </a>
    <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>
    

    The Function seems not to run if I change the page on the nodebb topbar. Do I need to bind this code to some event, or what is required?

    I use the current development edition for nodebb directly from github.

  • Try this

    <a class="twitter-timeline"  href="https://twitter.com/3malG" data-widget-id="507843649955041282">Tweets von @3malG </a>
    <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>
    <script>
     if(window.twttr !== undefined) {
          window.twttr.widgets.load($('.motd')[0]);
     }
    </script>
    
  • @baris said:

    Try this

    <a class="twitter-timeline"  href="https://twitter.com/3malG" data-widget-id="507843649955041282">Tweets von @3malG </a>
    <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>
    <script>
     if(window.twttr !== undefined) {
          window.twttr.widgets.load($('.motd')[0]);
     }
    </script>
    

    Yes, now it works! Thank you very much!


Suggested Topics