Changeset 26871 in spip-zone


Ignore:
Timestamp:
Feb 22, 2009, 11:17:02 PM (10 years ago)
Author:
fil@…
Message:

bookmark ne fonctionne que sous IE
respecter link[rel=canonical] si indique http://www.seomoz.org/blog/canonical-url-tag-the-most-important-advancement-in-seo-practices-since-sitemaps
bug du fichier xml
echapper les caracteres malins

Location:
_plugins_/_stable_/socialtags
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/_stable_/socialtags/socialtags.js.html

    r26863 r26871  
    22// socialtags.js
    33
    4 ;(function($) { $(function(){
    5 
    6 var socialtags =
    7         [(#CONFIG{socialtags/tags}|socialtags_json)];
    8 
     4// 'ajouter un bookmark' ne marche que sous IE
     5// les tuyaux trouves pour FF ou Opera sont creves
     6;var socialtags_addfavorite = function(u,t){
     7        if(document.all)window.external.AddFavorite(u,t);
     8};
     9(function($) { $(function(){
     10var selector = $('[(#CONFIG{socialtags/jsselector})]');
     11if (!selector.length) return;
     12var socialtags = [(#CONFIG{socialtags/tags}|socialtags_json)];
    913var title = $('title').text() ||'';
    1014var description = ($('meta[name=description]').attr('content') || '').substr(0,250);
     15var cano = $('link[rel=canonical]')[0];
     16var url = cano ? cano.href : document.location.href;
    1117var ul = $('<ul><\/ul>');
    12 $.each(socialtags, function(){if (this.u) {
    13         $('<a rel="nofollow"><img class="socialtags-hovers" src="'+ this.i +'"\/></a>')
    14         .attr('href', this.u
    15                 .replace('%u', window.location)
    16                 .replace('%t', title)
    17                 .replace('%d',description)
    18                 )
     18var esc = function(x){return encodeURIComponent(x).replace(/\s/g,' ');};
     19
     20$.each(socialtags, function(){ if (this.u) {
     21        if (this.a == 'bookmark' && !document.all) return;
     22
     23        $('<a rel="nofollow"><img class="socialtags-hovers" src="'+ this.i +'"\/><\/a>')
     24        .attr('href',
     25                this.u
     26                .replace(/%u/g, esc(url))
     27                .replace(/%t/g, esc(title))
     28                .replace(/%d/g, esc(description))
     29        )
    1930        .attr('title', this.n)
    2031        .wrap('<li><\/li>')
     
    2233}});
    2334
    24 $('[(#CONFIG{socialtags/jsselector})]').after(ul.wrap('<div class="socialtags"><\/div>').parent());
    25 
     35selector.after(ul.wrap('<div class="socialtags"><\/div>').parent());
    2636
    2737}); })(jQuery);
  • _plugins_/_stable_/socialtags/socialtags.js_fonctions.php

    r26863 r26871  
    1717                $d = _q($service['descriptif']);
    1818                $i = _q(find_in_path('images/'.$a.'.png'));
    19                 $json[] = "{ n: {$t}, i: {$i}, u: {$u} }";
     19                $json[] = "{ a: '{$a}', n: {$t}, i: {$i}, u: {$u} }";
    2020        }
    2121
    22         return "[\n\t" . join(",\n\t", $json) . "\n]";
     22        return "[\n" . join(",\n", $json) . "\n]";
    2323}
  • _plugins_/_stable_/socialtags/socialtags.xml

    r26865 r26871  
    99<item>
    1010<title>Ajouter aux favoris</title>
    11 <link>javascript:if(jQuery.browser.ie)window.external.AddFavorite(document.location,document.title);else%20window.sidebar.addPanel(document.title,document.location,'');</link>
     11<link>javascript:socialtags_addfavorite('%u','%t');</link>
    1212<author>bookmark</author>
     13<description>(ne fonctionne et ne s'affiche que sur Internet Explorer)
    1314</item>
    1415
     
    114115<title>BlogMemes</title>
    115116<author>blogmemes</author>
    116 <link>http://www.blogmemes.fr/post.php?url=%u&amp;title=%t" />
     117<link>http://www.blogmemes.fr/post.php?url=%u&amp;title=%t</link>
     118</item>
     119
    117120<item>
    118121<title>Yahoo! Buzz</title>
Note: See TracChangeset for help on using the changeset viewer.