on remet au bon endroit

master
dwojylac@free.fr 11 years ago
commit 8e51a6d954

12
.gitattributes vendored

@ -0,0 +1,12 @@
* text=auto !eol
images/rssjs-128.png -text
images/rssjs-256.png -text
images/rssjs-32.png -text
images/rssjs-48.png -text
images/rssjs-64.png -text
images/rssjs-96.png -text
js/rssjs.js -text
modeles/rssjs.html -text
modeles/rssjs_site.html -text
/plugin.xml -text
/rssjs_pipeline.php -text

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@ -0,0 +1,28 @@
function initialize_rssjs(flux, entrees, recept, mode) {
/* spip remplace & par & et google feed api n'aime pas */
var flux = flux.replace(/&/g, '&');
var feed = new google.feeds.Feed(flux);
feed.setNumEntries(entrees);
feed.load(function(result) {
if (!result.error) {
var container = $('#'+recept);
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
/* dt par defaut */
var element = '<dt><a rel="external nofollow" class="spip_out" href="'+entry.link+'">'+entry.title+'</a></dt>';
container.append(element);
/* dd */
if (mode != 'no_content'){
if (mode == 'snippet')
var descr = entry.contentSnippet;
else
var descr = entry.content;
var element = '<dd>'+descr+'</dd>'
container.append(element);
}
}
}
});
}

@ -0,0 +1,5 @@
#SET{rel,(#VAL{rssjs}|uniqid)}
<dl id="#GET{rel}" class="rssjs[ (#ENV{class})]"></dl>
<script type="text/javascript">
google.setOnLoadCallback(initialize_rssjs('#ENV*{url}', #ENV{nbre_entrees,12}, '#GET{rel}', '#ENV{mode}'));
</script>

@ -0,0 +1,7 @@
<BOUCLE_a (SITES){id_syndic=#ENV{id,#ENV{id_site}}}>
[(#SET{rel,[(#VAL{rssjs}|uniqid)]})]
<dl id="#GET{rel}" class="rssjs[ (#ENV{class})]"></dl>
<script type="text/javascript">
google.setOnLoadCallback(initialize_rssjs('#URL_SYNDIC', #ENV{nbre_entrees,12}, '#GET{rel}', '#ENV{mode}'));
</script>
</BOUCLE_a>

@ -0,0 +1,33 @@
<plugin>
<nom>RSS-JS</nom>
<etat>test</etat>
<version>0.2.0</version>
<auteur>Dominique Wojylac</auteur>
<icon>images/rssjs-32.png</icon>
<licence>GPL 3 - &#169; 2013</licence>
<lien>http://www.spip-contrib.net/spip.php?article4359</lien>
<description>Affichage de flux Rss gr&acirc;ce &agrave; l'API Google Feed</description>
<prefix>rssjs</prefix>
<pipeline>
<nom>header_prive</nom>
<action>inclure_js</action>
<inclure>rssjs_pipeline.php</inclure>
</pipeline>
<pipeline>
<nom>header_prive</nom>
<action>inclure_css</action>
<inclure>rssjs_pipeline.php</inclure>
</pipeline>
<pipeline>
<nom>insert_head</nom>
<action>inclure_js</action>
<inclure>rssjs_pipeline.php</inclure>
</pipeline>
<pipeline>
<nom>insert_head_css</nom>
<action>inclure_css</action>
<inclure>rssjs_pipeline.php</inclure>
</pipeline>
<categorie>communication</categorie>
<necessite id="SPIP" version='[2.0.0;2.1.99]' />
</plugin>

@ -0,0 +1,22 @@
<?php
function rssjs_inclure_js($flux) {
$chemin_rssjs = find_in_path('js/rssjs.js');
if ($chemin_rssjs){
$flux .= '<!-- plugin rssjs -->'."\n";
$flux .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'."\n";
$flux .= '<script type="text/javascript">google.load("feeds", "1");</script>'."\n";
$flux .= '<script type="text/javascript" src="'.$chemin_rssjs.'"></script>'."\n";
}
return $flux;
}
function rssjs_inclure_css($flux) {
$chemin_rsscss = find_in_path('css/rssjs.css');
if ($chemin_rsscss){
$flux .= '<!-- plugin rssjs -->'."\n";
$flux .= '<link href="'.$chemin_rsscss.'" rel="stylesheet" type="text/css" media="projection, screen, tv" />'."\n";
}
return $flux;
}
?>
Loading…
Cancel
Save