Created
October 2, 2009 04:39
-
-
Save chrisforbes/199470 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function farmnet_init() | |
{ | |
jQuery.tag = function(e) { return $(document.createElement(e)); } | |
} | |
function do_expand() | |
{ | |
$(this).toggleClass('toggle_expanded'); | |
$(this).parent().next().toggleClass('details_expanded'); | |
} | |
function farmnet_spawn(desc) | |
{ | |
var itemSummary = $.tag("div").addClass("item").attr("id", desc.id) | |
.append($.tag("div").addClass("item_name").html(desc.name)) | |
.append($.tag("div").addClass("summary") | |
.append($.tag("div").addClass("light_" + desc.light)) | |
.append($.tag("div").html(desc.summary))) | |
.append($.tag("div").addClass("toggle").click(do_expand)); | |
var itemDetail = $.tag("div").addClass("details").attr("id", desc.id) | |
.html(desc.details); | |
if (desc.light == "red") | |
itemSummary.addClass("item_broken"); | |
$("#main").append(itemSummary); | |
$("#main").append(itemDetail); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment