diff options
author | Leif Johansson <leifj@sunet.se> | 2011-10-11 21:07:08 +0200 |
---|---|---|
committer | Leif Johansson <leifj@sunet.se> | 2011-10-11 21:07:08 +0200 |
commit | 2f635c01d74b4e5a14be3ebc60c9dcd8e97641bf (patch) | |
tree | 44258ed9cb451356ba40353f62cdf03c5109f301 /src | |
parent | 9d4dc9297992696032b00eb6173a5f72814c5055 (diff) |
more skinning-support
Diffstat (limited to 'src')
-rw-r--r-- | src/site-media/js/jquery.meetingtools.js | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/site-media/js/jquery.meetingtools.js b/src/site-media/js/jquery.meetingtools.js index b48ff2f..0141c38 100644 --- a/src/site-media/js/jquery.meetingtools.js +++ b/src/site-media/js/jquery.meetingtools.js @@ -5,18 +5,23 @@ jQuery.fn.meetingtools = function(options) { + var defaults = { + onAdd: function() {}, + onChange: function() {}, + url: 'http://localhost:8000'; + }; + var options = $.extend({}, defaults, options); + this.each(function() { var tags = options.tags; var url = options.url; - if (!url) { - url = 'http://localhost:8000'; - } - var url = url+'/room/+'+tags+'.json'; + var url = options.url+'/room/+'+tags+'.json'; var div = $(this); + div.html(''); // stop any spinners; $.getJSON(url,function(data) { - html = "<ul class=\"meeting-list\">"; + div.append("<ul class=\"meeting-list\">"); $.each(data,function(i,room) { - html += "<li class=\"meeting\"><h4>"+room['name']+"</h4><div class=\"meeting-info\">"; + var html += "<li class=\"meeting\"><h4>"+room['name']+"</h4><div class=\"meeting-info\">"; if (room['description']) { html += "<div class=\"meeting-description\">"; html += room['description']; @@ -29,9 +34,11 @@ jQuery.fn.meetingtools = function(options) { html += "<div class=\"meeting-url\">" + room['url'] + "</a></div>"; html += "</div>"; html += "</li>"; + div.append(html); + options.onAdd(); }); - html += "</ul>"; - div.html(html); + div.append("</ul>"); + options.onUpdate(); }); |