diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-02-25 11:55:00 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-02-25 11:55:00 +0100 |
commit | 52c252809424f36c79ba182046681f750f6b1ded (patch) | |
tree | 51db814e3adffaa239d5cc1f5b3baee531fd91f9 /templates | |
parent | fe7f127d1c2ce5a77a9b4ad67ee8e272a0364a7b (diff) | |
download | Chimère - projet de référence-52c252809424f36c79ba182046681f750f6b1ded.tar.bz2 Chimère - projet de référence-52c252809424f36c79ba182046681f750f6b1ded.zip |
Change share icons
Diffstat (limited to 'templates')
-rw-r--r-- | templates/chimere/blocks/share_bar.html | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/templates/chimere/blocks/share_bar.html b/templates/chimere/blocks/share_bar.html new file mode 100644 index 0000000..5367628 --- /dev/null +++ b/templates/chimere/blocks/share_bar.html @@ -0,0 +1,39 @@ +{% load i18n %} + {% if share_networks %} + {% if simple %}{% trans "Share on"%}{% for share_network in share_networks %} + <a href='{{share_network.1}}'>{{share_network.0}}</a> + {% endfor %}{%else%} + <ul class='share'> + <li>{% trans "Share"%}</li>{% for share_network in share_networks %} + <li><a class='share_link share_id_{{share_network.0}}' href='{{share_network.1}}'><span class='fa fa-chimere fa-chimere-{{share_network.0}}'></span></a></li> + {% endfor %}</ul>{% endif %} + <script language='text/javascript'> + $(function(){ + $('.share_link').click(function(){ + var href = $(this).attr('href'); + var url = '{% url chimere:get-share-url %}'; + var classes = $(this).attr('class').split(' '); + prefix = 'share_id_'; + var share_id; + for (idx=0;idx<classes.length;idx++){ + if(classes[idx].substring(0, prefix.length) == prefix){ + var share_id = classes[idx].substring(prefix.length); + } + } + var params = $('#permalink a').attr('href').split('/'); + url += share_id + params[params.length-1]; + $.ajax({url: url, + dataType: "html", + success: function (url) { + window.open(url); + return false; + }, + error: function(){ + return false; + } + }); + return false; + }); + }); + </script> + {% endif %} |