Klipfolio
Hallo,
dafür brauchst du nicht mehrere Klips. Mit der folgenden Vorlage kannst du einen Klip mit beliebig vielen Kategorien (zB Beiträge und Kommentare) erstellen. Alles GROSSgeschriebenen Angaben musst du mit deinen ersetzen:
<!--
COPYRIGHT AND TRADEMARK NOTICE
The Klip File Format is copyright 2001-2003, Serence Inc.
Klip and associated marks are trademarks of Serence Inc.
All rights reserved.
For details visit http://www.serence.com/site.php?page=legal_tmip
-->
<klip>
<owner>
<author>
AUTOR
</author>
<copyright>
COPYRIGHT 2005
</copyright>
<email>
[email]XYZ@EXAMPLE.COM[/email]
</email>
<web>
HTTP://EXAMPLE.COM
</web>
</owner>
<identity>
<title>
TITEL
</title>
<version>
1.0
</version>
<lastmodified>
2003.12.02:1400
</lastmodified>
<description>
BESCHREIBUNG
</description>
<keywords>
KEYWORDS
</keywords>
</identity>
<locations>
<defaultlink>
HTTP://EXAMPLE.COM
</defaultlink>
<contentsource>
HTTP://EXAMPLE.COM/PFAD/ZUM/FEED
</contentsource>
<icon>
HTTP://EXAMPLE.COM/PFAD/ZUM/FAVICON.JPG
</icon>
<banner>
HTTP://EXAMPLE.COM/PFAD/ZUM/BANNER.GIF
</banner>
<kliplocation>
HTTP://EXAMPLE.COM/PFAD/ZUM/KLIP.KLIP
</kliplocation>
</locations>
<setup>
<refresh>
60
</refresh>
<referer>
HTTP://EXAMPLE.COM/PFAD/ZUM/KLIP.KLIP
</referer>
<country>
DE
</country>
<language>
de
</language>
</setup>
<messages>
<loading>
HOLE DATEN...
</loading>
<nodata>
ZUR ZEIT KEINE DATEN...
</nodata>
</messages>
<klipscript>
<![CDATA[
var categories = new Array (
"+NAME DES ERSTEN FEEDS", "HTTP://EXAMPLE.COM/PFAD/ZUM/FEED",
"NAME DES ZWEITEN FEEDS (zB KOMMENTARE)", "HTTP://EXAMPLE.COM/PFAD/ZUM/KOMMENTARFEED"
);
var checkbox_objects = new Array ();
function onLoad ()
{
Setup.addTab ("Categories");
Setup[0].addText ('Select from the following categories:');
configured = (Prefs.getPref ('configured') == 'true');
for (var i = 0; i < categories.length / 2; i++)
{
is_checked = (categories [2*i][0] == '+');
if (!configured && is_checked)
{
Prefs.setPref ("cbx"+i, 'true');
}
checkbox_objects[i] = Setup[0].addCheckbox (is_checked?categories [2*i].substring (1):categories [2*i]);
checkbox_objects[i].onClick = cbxClick;
checkbox_objects[i].idx = i;
checkbox_objects[i].checked = (configured?(Prefs.getPref ("cbx"+i) == 'true'):is_checked);
}
}
function cbxClick (state)
{
Prefs.setPref ('configured', 'true');
Prefs.setPref ("cbx"+this.idx, (state?"true":"false"));
for (var i = 0; i < Items.length; ++i)
{
if (Items[i].extra == '' + this.idx)
{
if (state)
{
Items[i].hidden = false;
}
else
{
Items[i].hidden = true;
}
}
}
if (state)
{
Klip.requestRefresh ();
}
}
function onRefresh ()
{
for (var i = 0; i < Items.length; i++)
{
Items[i].tagged = true;
}
result = false;
for (var i = 0; i < checkbox_objects.length; i++)
{
if (checkbox_objects[i].checked)
{
result = getData (categories[2*i+1], ''+i) || result;
}
}
return result;
}
function getData (url, idx)
{
req = Engines.HTTP.newRequest (url);
if (req.send ())
{
Engines.KlipFood.process (req.response);
for (var i = 0; i < Items.length; i++)
{
if (!Items[i].tagged)
{
Items[i].extra = idx;
Items[i].tagged = true;
}
}
return true;
}
return false;
}
]]>
</klipscript>
</klip>
Alles anzeigen