Initial release
* jquery * like * gitignore
This commit is contained in:
commit
94a8e64e80
6 changed files with 53 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
*.pyc
|
4
jquery/jquery.js
vendored
Normal file
4
jquery/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
48
like.py
Normal file
48
like.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# This program is free software. It comes without any warranty, to
|
||||
# the extent permitted by applicable law. You can redistribute it
|
||||
# and/or modify it under the terms of the Do What The Fuck You Want
|
||||
# To Public License, Version 2, as published by Sam Hocevar. See
|
||||
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
|
||||
# Author: Stefan Ritter <xeno@thehappy.de>
|
||||
# Description: Add social network buttons under your entry titles
|
||||
# Version: 1.0
|
||||
|
||||
print("""
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
blog_url = window.location;
|
||||
$("div.entry_title").after(" \\
|
||||
<a target='_blank' class='link_fb'><img src='plugins/like/icons/facebook.png' alt='facebook' /></a> \\
|
||||
<a target='_blank' class='link_gp'><img src='plugins/like/icons/google-plus.png' alt='google-plus' /></a> \\
|
||||
<a target='_blank' class='link_tw'><img src='plugins/like/icons/twitter.png' alt='twitter' /></a> \\
|
||||
");
|
||||
$('a.link_fb a.link_gp a.link_tw').each(function(i) { // Add index class to all icons
|
||||
$(this).addClass('link_' + i);
|
||||
});
|
||||
$('div.entry_title').each(function(i) { // Add index class to every entry title
|
||||
$(this).addClass('link_' + i);
|
||||
});
|
||||
$('a.link_fb').each(function(i) { // Generate href for facebook icons
|
||||
title = $('div.link_' + i).text().trim();
|
||||
url = blog_url + '?p=' + encodeURIComponent(title.replace(/\s/g, '-'));
|
||||
$(this).attr({'href': 'https://www.facebook.com/sharer.php?u=' + url + '&t=' + title});
|
||||
});
|
||||
$('a.link_gp').each(function(i) { // Generate href for google plus icons
|
||||
title = $('div.link_' + i).text().trim();
|
||||
url = blog_url + '?p=' + encodeURIComponent(title.replace(/\s/g, '-'));
|
||||
$(this).attr({'href': 'https://m.google.com/app/plus/x/?v=compose&content=' + title + '%20' + url});
|
||||
});
|
||||
$('a.link_tw').each(function(i) { // Generate href for twitter icons
|
||||
title = $('div.link_' + i).text().trim();
|
||||
url = blog_url + '?p=' + encodeURIComponent(title.replace(/\s/g, '-'));
|
||||
$(this).attr({'href': 'https://twitter.com/home?status=' + title + ' ' + url});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
""")
|
||||
|
||||
# vim: set sw=4 tw=0 ts=4 expandtab:
|
BIN
like/icons/facebook.png
Normal file
BIN
like/icons/facebook.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 433 B |
BIN
like/icons/google-plus.png
Normal file
BIN
like/icons/google-plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 597 B |
BIN
like/icons/twitter.png
Normal file
BIN
like/icons/twitter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 418 B |
Loading…
Reference in a new issue