📜 ⬆️ ⬇️

Using Twitter technologies on your site

image
Not so long ago on Habré there was a post about Twitter Developers , dedicated to the creation of the @Anywhere service.
The main goal of @anywhere is the introduction of functions of working with Twitter to third-party sites using simple and universal methods. Technology support is included in just a few lines of Javascript code.
Functions @anywhere:

Read more here .
As well as a description of the use of the service can be found here .
Under a cat javascript example code.


UPD: First you need to get the APIKey application code by registering a new application here .
Then connect @Anywhere javascript with this code:


')
Now you can use the twttr object, which will call the function anywhere ().

<script type=«text/javascript»>

twttr.anywhere( function (twitter) {
//
twitter(«body»).linkifyUsers( ); //className:'red'
// hover
twitter(«body»).hovercards();
// hovercard
twitter( ".hovercard" ).hovercards({
username: function (node){
var twitter_regexp = /twitter\.com\/([a-z0-9_]*)\/?(.*)?/gi;
if (node.href.match(twitter_regexp) && (twitter_match = twitter_regexp.exec(node.href))){
return twitter_match[1];
}
return '' ;
}
});
// follow
twitter( "#main" ).followButton(«anywhere»);
//c tweetBox
twitter( ".comments" ).tweetBox();
twitter( ".comments" ).connectButton({ size: 'large' });
});
</script>




The working example is here .

Source: https://habr.com/ru/post/99398/


All Articles