2010-07-12 19:09:02 +00:00
|
|
|
var BASE_URL = "http://padma.local/"
|
2009-06-14 14:51:10 +00:00
|
|
|
var padmaLists = []
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
callPadma("/list/get", initLists);
|
|
|
|
});
|
|
|
|
|
|
|
|
var padmaList = function(json) {
|
|
|
|
this.listId = json.listId;
|
|
|
|
this.description = json.description;
|
|
|
|
this.iconId = json.iconId;
|
2010-07-12 19:09:02 +00:00
|
|
|
this.iconPath = BASE_URL + this.iconId + "/poster.jpg";
|
2009-06-14 14:51:10 +00:00
|
|
|
this.title = json.title;
|
|
|
|
this.html = this.getHtml();
|
|
|
|
this.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
padmaList.prototype.init = function() {
|
|
|
|
var that = this;
|
|
|
|
$('#lists').append(that.html);
|
|
|
|
}
|
|
|
|
|
|
|
|
padmaList.prototype.getHtml = function() {
|
|
|
|
var that = this;
|
|
|
|
var wrapperElem = $("<div />");
|
|
|
|
wrapperElem.addClass("listWrapper");
|
|
|
|
var titleElem = $('<div />');
|
|
|
|
titleElem.attr("id", this.listId);
|
|
|
|
titleElem.addClass("listTitle");
|
|
|
|
var titleHtml = "<a href='/list?id=" + this.listId + "'>" + this.title + "</a>";
|
|
|
|
titleElem.html(titleHtml);
|
|
|
|
titleElem.hover(function() {
|
|
|
|
$(this).next().show();
|
|
|
|
}, function() {
|
|
|
|
$(this).next().hide();
|
|
|
|
});
|
|
|
|
wrapperElem.append(titleElem);
|
|
|
|
var innerElem = $('<div />');
|
|
|
|
innerElem.addClass("listDetail");
|
|
|
|
innerElem.hide();
|
|
|
|
var innerHtml = '';
|
|
|
|
innerHtml += "<div class='listImage'>";
|
|
|
|
innerHtml += "<img src='" + this.iconPath + "' />"
|
|
|
|
innerHtml += "</div>";
|
|
|
|
innerHtml += "<div class='listDescription'>";
|
|
|
|
innerHtml += this.description;
|
|
|
|
innerHtml += "</div>";
|
|
|
|
innerElem.html(innerHtml);
|
|
|
|
innerElem.css("min-height", "150px");
|
|
|
|
wrapperElem.append(innerElem);
|
|
|
|
return wrapperElem;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function initLists(json) {
|
|
|
|
var allLists = json['lists']
|
|
|
|
for (l in allLists) {
|
|
|
|
var list = new padmaList(allLists[l]);
|
|
|
|
// padmaLists.push(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|