Merge pull request #37 from pivchanskiy/master

add searchUrl option for searching shared url in social networks.
master
Artem Sapegin 2013-10-28 13:20:39 -07:00
commit f60f00fb99
3 changed files with 28 additions and 4 deletions

View File

@ -174,6 +174,18 @@ var socialLikesButtons = {
};
```
If you know the social network search page's url, you can make a link to results of searching in this network. There are search urls for Twitter and VKontakte by default.
```javascript
var socialLikesButtons = {
twitter: {
...
searchUrl: 'https://twitter.com/search?src=typd&q={url}'
}
};
```
Add some CSS:
```css

View File

@ -49,7 +49,8 @@ var services = {
// Add colon to improve readability
if (!/[\.:\-–—]\s*$/.test(this.options.pageTitle)) this.options.pageTitle += ':';
return true;
}
},
searchUrl: 'https://twitter.com/search?src=typd&q={url}'
},
mailru: {
counterUrl: 'http://connect.mail.ru/share_count?url_list={url}&callback=1&func=?',
@ -85,7 +86,8 @@ var services = {
},
popupUrl: 'http://vk.com/share.php?url={url}&title={title}',
popupWidth: 550,
popupHeight: 330
popupHeight: 330,
searchUrl: 'http://vk.com/feed?section=search&q=url%3A{url}'
},
odnoklassniki: {
counterUrl: 'http://www.odnoklassniki.ru/dk?st.cmd=shareData&ref={url}&cb=?',
@ -419,10 +421,13 @@ Button.prototype = {
number = parseInt(number, 10);
if (!number) return;
var counterElem = $('<span>', {
var searchUrl = this.options.searchUrl ? makeUrl(this.options.searchUrl, {url: this.options.pageUrl}) : null;
var counterElem = $((this.options.searchUrl ? '<a>' : '<span>'), {
'class': this.getElementClassNames('counter'),
'text': number
'text': number,
'href': searchUrl
});
this.widget.append(counterElem);
this.widget.trigger('counter.social-likes', [this.service, number]);

View File

@ -207,6 +207,13 @@
.social-likes__counter_single:after {
border-right-color:#f6f6f6;
}
a.social-likes__counter {
cursor: pointer;
text-decoration:none;
&:hover{
text-decoration:underline;
}
}
// Facebook