Permalink
Browse files

Make the people widget configurable:

* User can set the number of messages of the widget.
  • Loading branch information...
1 parent 7149a4f commit 812fc3b1a170e1519b0f972ba65c4268c78c6ff9 YI Yu committed Oct 4, 2011
Showing with 15 additions and 2 deletions.
  1. +15 −2 widgets/people_0.1/index.html
@@ -10,6 +10,19 @@
<script type="text/javascript" src="cMD5.js"></script>
<script type="text/javascript" src="fXML.js"></script>
<script type="text/javascript">
+
+ var msgNum = 2;
+
+ var o, p;
+ o = location.href.split("?")[1];
+ if (o && o != "")
+ {
+ p = o.split("msgNum=")[1].split("&")[0];
+ if (p && p != "")
+ msgNum = p;
+ }
+
+
var vBridgePath = "http://localhost/bridge";
@@ -21,7 +34,7 @@
var news = JSONdata['item'];
- for (var i = 0; i< news.length; i++)
+ for (var i = 0; i< msgNum; i++)
{
// The title of the news
@@ -40,7 +53,7 @@
$(function() {
- var query = "select * from feed where url='"+rssUrl+"' LIMIT 20";
+ var query = "select * from feed where url='"+rssUrl+"' LIMIT "+Math.max(2, msgNum);
var yql_url = "http://query.yahooapis.com/v1/public/yql?q="+encodeURIComponent(query)+"&format=json&callback=?";

0 comments on commit 812fc3b

Please sign in to comment.