<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs
title="&#22823;&#39118;&#36710;Online Games"
title_url="http://bbs.cnnas.com/"
description="Very interesting online games."
author="Tomlee"
screenshot="http://bbs.cnnas.com/games.jpg"
thumbnail="http://bbs.cnnas.com/sgames.jpg"
author_link="http://bbs.cnnas.com/"
author_email="csxtu@163.com"
height="320"
width="300"
scrolling="false">
<Require feature="setprefs" />
<Require feature="analytics"/>
</ModulePrefs>
<UserPref name="feedurl" display_name="Feed Url" datatype="string" default_value="http://bbs.cnnas.com/cn/rss.php?fid=22" />
<UserPref name="num_entries" display_name="Number of Entries:" default_value="10" />
<UserPref name="show_summ" display_name="Summary Length:" default_value="200" />
<UserPref name="link_target" display_name="Link Target" datatype="enum" default_value="_blank">
<EnumValue value="_blank" display_value="Blank" />
<EnumValue value="_top" display_value="Top" />
<EnumValue value="_self" display_value="Self" />
</UserPref>
<Content type="html"><![CDATA[

<style type="text/css">
<!--

body {margin:0px; padding:0px;font-family:verdana,sans-serif; font-size:8pt; background:#fff; color:#000;}
#content_div {font-size:8pt; margin:5px; color:#004; background:#FFFFFF;}
.feed-title {font-weight:bold;color:#7476BD; background:#FFFFFF;}

ul {
list-style-type: none;
padding:2px;
margin:0px;
height:200px;
overflow:auto;
background:#EFEFEF;
color:inherit;
border:solid #C0C0C0 1px;
}

.close {
background-image: url('http://bbs.cnnas.com/cn/images/boygj1/tree_plus.gif');
background-repeat: no-repeat;
background-position: 0 .4em;
padding-left: .8em;
height:18px;
}

.open {
background-image: url('http://bbs.cnnas.com/cn/images/boygj1/tree_minus.gif');
background-repeat: no-repeat;
background-position: 0 .4em;
padding-left: .8em;
}

.close span {display:none;}
.open span {display:block;}

-->
</style>

<div id="displayId">Loading Feed...</div>

<script type="text/javascript">
<!--

function vj_dh(id) {
var vj_x = document.getElementById(id);
if (vj_x.className == "close") {vj_x.className= "open";}
else {vj_x.className= "close";}
}

// Get userprefs
var prefs = new _IG_Prefs(__MODULE_ID__);

// Get Link Target Pref
var link_target = prefs.getString("link_target");

// Get Feed Url
var feedurl = _trim(prefs.getString("feedurl"));

// Show Summaries
var summary = prefs.getInt("show_summ");

// Number of entries
var entries = prefs.getInt("num_entries");

// If user wants to display more than 100 entries, display an error
// and set the value to 10.
if (entries > 100)
{
alert("You cannot display more than 100 entries.");
entries = 10;
}

// Set Summary user pref and limit restriction
if (summary >= 0 && summary <=500) {
summary = summary;
}
else {
alert("Please keep the summary length between 0-500. \n 0 (zero) would be no summary.");
summary = 500;
}

function init() {

// Use the _IG_FetchFeedAsJSON() function to retrieve core feed data from
// the specified URL. Then combine the data with HTML markup for display in
// the gadget.
_IG_FetchFeedAsJSON(feedurl,
function(feed) {
// Check for Feed content
if (typeof feed == "undefined" || typeof feed.Entry == "undefined"){
_gel('displayId').innerHTML = '<div class="loading"><span>Oops! Invalid feed URL:</span><br>' + feedurl + '</div>';
}
else {

// Start building HTML string that will be displayed in gadget.
var html = "";

// Display the feed title and description
html += "<div class='feed-title'>" + feed.Title + "</div><i>"+_hesc(feed.Description)+"</i><hr><div><ul>";

// Access the data for a given entry
if (feed.Entry) {

for (var i = 0; i < feed.Entry.length; i++) {
html += "<li id=\"vj_li"+i+"\" class=\"close\">&nbsp;<a target='"+link_target+"' href='" + _hesc(feed.Entry[i].Link) + "' title='Read More'>";
html += _hesc(feed.Entry[i].Title)
html += "</a> "

if (summary >= 1) {
// Strip HTML from summaries - (Suggestions Appreciated here)
var temp = feed.Entry[i].Summary.substr(0, summary);
var cleansumm = _hesc(temp.replace(/<V?[^>]+>/gi,""));

html += "<span><i>" + cleansumm + "... <a target='"+link_target+"' href='" + _hesc(feed.Entry[i].Link) + "' title='Read More'>Read More</a></i></span><br>";
}

html += "</li>";
}
}
// Finish the results and Output the HTML into the Tab
html += "</ul><br><i><a target='_blank' href='http://www.cnnas.com/'>Gadgets by www.cnnas.com</a></i><hr><br></div>";
_gel('displayId').innerHTML = html;
}

// Finish JSON function and set entires and summarys
}, entries, (summary > 0));
// See if people like my little gadget
_IG_Analytics("UA-1287524-4", "/Games");

}
// Call init function to initialize.
_IG_RegisterOnloadHandler(init);

-->
</script>


]]>
</Content>
</Module>
