Dominik Paulus Bilder/Inhalte (c) GameStar.de Klip: mail(at)dpaulus(dot)de mail@dpaulus.de http://www.dpaulus.de Gamestar.de - one click ahead dpgs20070307310 3.1 07.03.2007 Gamestar.de - one click ahead - Die besten News rund um Games NEU: Mehrere Feeds wählbar: News, Downloads, Tipps, Hardware, Magazin und GameStar-Gesamt. gamestar spiele news downloads tipps tricks magazin hardware pc games german deutsch http://www.gamestar.de http://www.dpaulus.de/filebase/klips/gamestar_icon.gif http://www.dpaulus.de/filebase/klips/gamestar_banner.gif http://klips.dpaulus.de http://www.dpaulus.de/filebase/klips/gamestar.klip 30 KlipFolio dpgs20070307310 - See www.klips.dpaulus.de for Info de de Lade News... Keine News vorhanden Setup.addTab ("Information"); Setup[0].addText ("Informationen zu diesem Klip:"); Setup[0].addSpacer(true); Setup[0].addText ("Quelle: www.gamestar.de"); Setup[0].addText ("Klip: mail@dpaulus.de"); Setup[0].addSpacer(true); Setup[0].addText ("Mehr Information und Hilfe finden Sie im Klip Help Center:"); var help = Setup[0].addButton("Zum Klip Help Center"); help.url = "http://klips.dpaulus.de/"; // // The following multiFeeds[] array lets you specify multiple Feeds. The format is // // Initially selected Feed URL Name Icon URL // ------------------ ----------------------------------- -------------- ----------------------------------------------------------------------- // [0] [1] [2] [3] // false, "http://rss.cbc.ca/sportsnews.xml", "Sports News", "http://www.serence.com/serence_klips/pics/feedviewer_3/bullets/37.png" // // Using "-" as the first character for a URL causes the Klip to make a new Setup tab // using the Name string for the name of the tab. The text after the "-" character can // be anything, such as a tab label or a note to yourself. Note that the tabs are // added to the Setup window in reverse order - the last tab you specify in the array // will become the left-most tab. // // The icon URL is ignored for entries which specify tabs. If you don't want icons // beside the item headlines, use "" (an empty string) as the Icon URL entry for all // the entries in multiFeeds. The example icons below are from a set of icons on // the Serence website, with icons named from "0.png" to "69.png", but any URL to a // valid image can be used instead. // // The sample feeds in this template Klip are from http://www.cbc.ca/rss/ // var multiFeeds = [ [ false, "- Tab 1" , "Feeds" , "" ], [ true, "http://www.gamestar.de/news/rss/news.rss" , "Gamestar-Headlines" , "http://www.dpaulus.de/filebase/klips/gamestar_aktuell.gif" ], [ false, "http://www.gamestar.de/downloads/rss/downloads.rss" , "Gamestar-Downloads" , "http://www.dpaulus.de/filebase/klips/gamestar_downloads.gif" ], [ false, "http://www.gamestar.de/magazin/rss/magazin.rss" , "Gamestar-Magazin-Artikel" , "http://www.dpaulus.de/filebase/klips/gamestar_magazin.gif" ], [ false, "http://www.gamestar.de/hardware/rss/hardware.rss" , "Gamestar-Hardware-Tests" , "http://www.dpaulus.de/filebase/klips/gamestar_hardware.gif" ], [ false, "http://www.gamestar.de/tippstricks/rss/tippstricks.rss" , "Gamestar-Tipps&Tricks" , "http://www.dpaulus.de/filebase/klips/gamestar_tipps.gif" ], [ false, "http://www.gamestar.de/rss/gamestar.rss" , "Gamestar-Gesamt-RSS-Feed" , "http://www.dpaulus.de/filebase/klips/gamestar_gesamt.gif" ], ]; // Indexes for the multiFeeds array var INITIAL_STATE = 0; var URL = 1; var NAME = 2; var ICON = 3; // Array of KlipFolio List Control objects // See http://www.serence.com/developer/api/ListControl.html // var lcSource = new Array(); // Global variable to let onRefresh() optimize its refresh when // the user has clicked on an item in the ListControl var userClickedListControl = false; // User clicked on a name in the checkbox var g_current_feed; function onLoad() { _t( "onLoad()" ); var lc_index = -1; var tab; // // Loop through all the feeds and build the Klip Setup tab // for (var i = 0; i < multiFeeds.length; i++) { if ( multiFeeds[i][URL].indexOf("-") == 0 ) { // // Got a "-" character so create a new tab for subsequent URLs // lc_index++; tab = Setup.addTab( multiFeeds[i][NAME] ); tab.addText( "Gamestar Feeds:" ); lcSource[ lc_index ] = tab.addListControl( true, true ); lcSource[ lc_index ].onStateChange = lcSource_onStateChange; // // Every object in KlipFolio can have a custom property just by declaring it. // Here we store an index related to the entry in the array multiFeeds[] // lcSource[ lc_index ].offset = i + 1; lcSource[ lc_index ].name = multiFeeds[i][NAME]; } else { // // Add this URL to the current ListControl // var initial_state = multiFeeds[i][INITIAL_STATE]; // true or false var name = multiFeeds[i][NAME]; var url = multiFeeds[i][URL]; var checked; var prefs_name = lcSource[ lc_index ].name + "|" + name; if( Prefs.getPref( prefs_name ) == "" ) { // No initial state state = initial_state; Prefs.setPref( prefs_name, checked ); } else { // get saved checked/unchecked state state = Prefs.getPref( prefs_name ) == "true" ? true : false; } lcSource[ lc_index ].addItem( name, state ); multiFeeds[i].updated = state; } } for (var i = 0; i < Items.length; ++i) { Items[i].tagged = true; // These items have already been processed } UpdatePrefs(); // Set up callbacks to handle item creation Engines.KlipFood.onCreate = myCreate; Engines.KlipFood.onUpdate = myUpdate; if( gTrace ) // Add a debug tab in the Klip { button = tab.addButton( "Show State in Trace Window" ); button.onClick = show_state; } } // // Called when a ListControl was clicked. // // Because we are refreshing the Klip in between user events, it's possible for the // user to quickly click multiple items in the list control before we get an event // from KlipFolio that the list control was updated. // // So, we keep a shadow value for each list control item called .previous_state // // We use the property .offset to find the index of this entry // function lcSource_onStateChange( index ) { _t( "Item: " + this[index] ); _t( "Offset: " + this.offset ); _t( "State: " + this.getState(index) ); var name = multiFeeds[index + this.offset][NAME]; var state = this.getState(index); _t( "You clicked on: " + name ); UpdatePrefs(); // update the state of all visible items in the list. Use the Item's name, // which is stored in .extra, as a hash lookup for Prefs.getPref() for (var i = 0; i < Items.length; ++i) { Items[i].hidden = Prefs.getPref( Items[i].extra ) == "true" ? false : true; } // // Request a refresh to update any feeds the user has changed to // now show. // // Comment out these two lines to have the user click the Refresh button in the Klip setup // userClickedListControl = true; Klip.requestRefresh(); } function UpdatePrefs() { // // Store the state of the prefs for all listControls. // for (var lc_index = 0; lc_index < lcSource.length; lc_index++) { for (var i = 0; i < lcSource[lc_index].length; i++ ) { var prefs_name = lcSource[ lc_index ].name + "|" + lcSource[lc_index][i]; Prefs.setPref( prefs_name, lcSource[lc_index].getState( i ) ); } } } // // Mark all items in Items[] that have been marked as coming from // the feed of the given name // function items_mark( name ) { for (var i=0; i 1) { new_item.setData ("source", source); new_item.setData ("icon", multiFeeds[g_current_feed][ICON]); } new_item.setData ("banner", Klip.processEntities (Engines.KlipFood.getScratch ("Channel Image"))); // note that the replace on tags is to fix feedster's naive highlighting of search terms var data = Klip.processEntities (new_item.getData ("description")).replace (/(|<\/strong>)/g, ""); var index; var m; // // Retrieve an image from the news item and display it in the note // var imgdata = data; var done = false; while (!done && ((index = imgdata.indexOf ("')) != -1) {} if (index2 != -1) { img = m.substring (0, index2); } } } img = Klip.convertToText (img); if (img.length) { if (!imageBlacklisted (img)) { new_item.setData ("storyimage", img); done = true; } } } //while data = Klip.convertToText (data); new_item.setData ("description", data); // // Fix for livejournal entries without titles // var test_data = new_item.getData ("matchtitle"); if (test_data.length) { new_item.setData ("visibletitle", test_data) } else { var first_line_re = new RegExp (".........*?[.:?\r\n]"); if (m = first_line_re.exec (data)) { data = m[0]; if (data[data.length-1] == '\r' || data[data.length-1] == '\n') { data = data.substring (0, data.length); } } data = data.substring (0, 80); if (data.length == 80) { if ((index = data.lastIndexOf (' ')) > 25) { data = data.substring (0, index); } data += "..."; } new_item.setData ("visibletitle", data) } } return true; } function myUpdate (existing_item, properties) { // Update using the new properties _t( "myUpdate()" ); myCreate(properties); return true; } function imageBlacklisted (url) { if (url.indexOf ("r.feedster.net") != -1) { return true; } return false; } // ---------------- Useful Trace Code ------------------- function show_state() { _t( "show_state()" ); dumpItems(); dumpItemsDeleted(); show_all_prefs(); queryListControl(); } function dumpItems() { if( Items.length == 0 ) { trace( "There are no items in the Items[] array\r\n" ); return; } for( i = 0; i < Items.length; i++ ) { trace( "Items[" + i + "]: \r\n" ); queryItem( Items[i] ); } } function dumpItemsDeleted() { if( Items.Deleted.length == 0 ) { trace( "There are no items in the Items.Deleted[] array\r\n" ); return; } for( i = 0; i < Items.Deleted.length; i++ ) { trace( "Items.Deleted[" + i + "]: \r\n" ); queryItem( Items.Deleted[i] ); } } function queryItem( item ) { trace( "----\r\n" ); trace( " item.text = \"" + item.text + "\" (string)\r\n" ); trace( " item.url = \"" + item.url + "\" (string)\r\n" ); trace( " item.note = \"" + item.note + "\" (string)\r\n" ); trace( " item.iid = \"" + item.iid + "\" (string)\r\n" ); trace( " item.extra = \"" + item.extra + "\" (string)\r\n" ); trace( " item.hidden = " + item.hidden + " (boolean)\r\n" ); trace( " item.visited = " + item.visited + " (boolean)\r\n" ); trace( " item.canpurge = " + item.canpurge + " (boolean)\r\n" ); trace( " item.alerting = " + item.alerting + " (boolean)\r\n" ); trace( " item.creation = " + item.creation + " (double)\r\n" ); trace( " item.pubdate = " + item.pubdate + " (double)\r\n" ); trace( " item.lastmodified = " + item.lastmodified + " (double)\r\n" ); trace(" -- \r\n" ); trace( " item.tagged = " + item.tagged + " (text)\r\n" ); trace( "\r\n" ); } function queryListControl() { for (var lc_index = 0; lc_index < lcSource.length; lc_index++) { var index = lcSource[lc_index].offset + i; for (var i = 0; i < lcSource[lc_index].length; i++ ) { _t( "lcSource: " + lcSource[lc_index].getState( i ) + " multiFeeds: " + multiFeeds[i + lcSource[lc_index].offset].updated + " - name: " + multiFeeds[i + lcSource[lc_index].offset][NAME] ); } } } function show_all_prefs() { var i; trace( "------------------------\r\n" ); for (i = 0; i < Prefs.length; i++) { trace("Prefs["+i+"]: '"+Prefs[i].name+"' == '"+Prefs[i].value+"'\r\n"); } trace( "------------------------\r\n" ); } // // Trace code // var gTrace = false; // Turn on trace code function _t( s ) { if ( gTrace ) { trace( Prefs.title + ": " + s + "\r\n" ); } } ]]>