autocat3/templates/social-functions.html

67 lines
1.7 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:py="http://genshi.edgewall.org/"
xmlns:i18n="http://genshi.edgewall.org/i18n"
xmlns:og="http://opengraphprotocol.org/schema/"
py:strip="">
<?python
from six.moves import urllib
def p(params):
return urllib.parse.urlencode(params).replace('+', '%20')
?>
<py:def function="fb_share(url)">
<?python
params = {
'u': url,
}
?>
<div class="social-button fb-share-button">
<a href="https://www.facebook.com/sharer.php?${p(params)}"
title="Share on Facebook"
onclick="open_share_popup(this.href, this.target, 640, 320)"
target="_top">
<span class="icon icon_facebook" />
</a>
</div>
</py:def>
<py:def function="tw_share(url, text)">
<!-- tweet without javascript -->
<?python
params = {
'url': url,
'text': text.encode('utf-8'),
'count': 'none',
'lang': os.twitter_lang,
'related': "gutenberg_new:Project Gutenberg New Books"
}
?>
<div class="social-button twitter-share-button">
<a href="https://twitter.com/share?${p(params)}"
title="Share on Twitter"
onclick="open_share_popup(this.href, this.target, 640, 320)"
target="_top">
<span class="icon icon_twitter" />
</a>
</div>
</py:def>
<py:def function="rss_follow()">
<div class="social-button rss-follow-button">
<a href="/feeds/today.rss"
title="Subscribe to the New Books RSS feed.">
<span class="icon icon_rss" />
<span class="alt" i18n:comment="Subscribe to RSS feed.">Subscribe</span>
</a>
</div>
</py:def>
</html>