Difference between revisions of "Widget:Twitter"

From WikiVet English
Jump to navigation Jump to search
(Created page with "<noinclude>__NOTOC__ This widget allows you to embed '''[http://twitter.com/widgets/html_widget Twitter feed]''' (HTML version) on your wiki page. Created by [http://www.medi...")
 
Line 9: Line 9:
 
== Copy to your site ==
 
== Copy to your site ==
 
To use this widget on your site, just install [http://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as '''{{FULLPAGENAME}}''' article.
 
To use this widget on your site, just install [http://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and copy [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki as '''{{FULLPAGENAME}}''' article.
</noinclude><includeonly><!--{counter name="twittercounter" assign="twitblogincluded"}--><!--{if $twitblogincluded eq 1}--><script type="text/javascript">function twitterCallback(id,C){var A=[];for(var D=0;D<C.length;D++){var E=C[D].user.screen_name;var B=C[D].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g,function(F){return'<a href="'+F+'">'+F+"</a>"}).replace(/\B@([_a-z0-9]+)/ig,function(F){return F.charAt(0)+'<a href="http://www.twitter.com/'+F.substring(1)+'">'+F.substring(1)+"</a>"});A.push("<li><span>"+B+'</span> <a style="font-size:85%" href="http://twitter.com/'+E+"/statuses/"+C[D].id+'">'+relative_time(C[D].created_at)+"</a></li>")}document.getElementById(id).innerHTML=A.join("")}function relative_time(C){var B=C.split(" ");C=B[1]+" "+B[2]+", "+B[5]+" "+B[3];var A=Date.parse(C);var D=(arguments.length>1)?arguments[1]:new Date();var E=parseInt((D.getTime()-A)/1000);E=E+(D.getTimezoneOffset()*60);if(E<60){return"less than a minute ago"}else{if(E<120){return"about a minute ago"}else{if(E<(60*60)){return(parseInt(E/60)).toString()+" minutes ago"}else{if(E<(120*60)){return"about an hour ago"}else{if(E<(24*60*60)){return"about "+(parseInt(E/3600)).toString()+" hours ago"}else{if(E<(48*60*60)){return"1 day ago"}else{return(parseInt(E/86400)).toString()+" days ago"}}}}}}};twitter=[];</script><!--{/if}--><ul id="tf<!--{$twitblogincluded}-->"></ul><script type="text/javascript">twitter[<!--{$twitblogincluded}-->]=function(data){twitterCallback('tf<!--{$twitblogincluded}-->', data);};s=document.createElement('script');s.type='text/javascript';s.id='twcall<!--{$twitblogincluded}-->';s.src='http://twitter.com/statuses/user_timeline/<!--{$user|escape:'urlpathinfo'}-->.json?callback=twitter[<!--{$twitblogincluded}-->]'+String.fromCharCode(38)+'count=<!--{$count|escape:'urlpathinfo'|default:5}-->';document.getElementsByTagName('head')[0].appendChild(s);</script></includeonly>
+
</noinclude>
 +
<includeonly><!--{counter name="twittercounter" assign="twitblogincluded"}--><!--{if $twitblogincluded eq 1}--><script type="text/javascript">function twitterCallback(id,C){var A=[];for(var D=0;D<C.length;D++){var E=C[D].user.screen_name;var B=C[D].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g,function(F){return'<a href="'+F+'">'+F+"</a>"}).replace(/\B@([_a-z0-9]+)/ig,function(F){return F.charAt(0)+'<a href="http://www.twitter.com/'+F.substring(1)+'">'+F.substring(1)+"</a>"});A.push("<li><span>"+B+'</span> <a style="font-size:85%" href="http://twitter.com/'+E+"/statuses/"+C[D].id+'">'+relative_time(C[D].created_at)+"</a></li>")}document.getElementById(id).innerHTML=A.join("")}function relative_time(C){var B=C.split(" ");C=B[1]+" "+B[2]+", "+B[5]+" "+B[3];var A=Date.parse(C);var D=(arguments.length>1)?arguments[1]:new Date();var E=parseInt((D.getTime()-A)/1000);E=E+(D.getTimezoneOffset()*60);if(E<60){return"less than a minute ago"}else{if(E<120){return"about a minute ago"}else{if(E<(60*60)){return(parseInt(E/60)).toString()+" minutes ago"}else{if(E<(120*60)){return"about an hour ago"}else{if(E<(24*60*60)){return"about "+(parseInt(E/3600)).toString()+" hours ago"}else{if(E<(48*60*60)){return"1 day ago"}else{return(parseInt(E/86400)).toString()+" days ago"}}}}}}};twitter=[];</script><!--{/if}--><ul id="tf<!--{$twitblogincluded}-->"></ul><script type="text/javascript">twitter[<!--{$twitblogincluded}-->]=function(data){twitterCallback('tf<!--{$twitblogincluded}-->', data);};s=document.createElement('script');s.type='text/javascript';s.id='twcall<!--{$twitblogincluded}-->';s.src='http://twitter.com/statuses/user_timeline/<!--{$user|escape:'urlpathinfo'}-->.json?callback=twitter[<!--{$twitblogincluded}-->]'+String.fromCharCode(38)+'count=<!--{$count|escape:'urlpathinfo'|default:5}-->';document.getElementsByTagName('head')[0].appendChild(s);</script></includeonly>

Revision as of 16:07, 22 July 2015

This widget allows you to embed Twitter feed (HTML version) on your wiki page.

Created by Sergey Chernyshev

Using this widget

For information on how to use this widget, see widget description page on MediaWikiWidgets.org.

Copy to your site

To use this widget on your site, just install MediaWiki Widgets extension and copy full source code of this page to your wiki as Widget:Twitter article.