var Partial = {}, main_wardrobe, View = Wardrobe.getStandardView({ Preview: { swf_url: '/swfs/preview.swf?v=0.12', wrapper: $('#preview'), placeholder: $('#preview-swf') } }); Partial.ItemSet = function ItemSet(wardrobe, selector) { var item_set = this, ul = $(selector), items = [], setClosetItems, setOutfitItems, setOutfitItemsControls, no_assets_full_message = $('#no-assets-full-message'), container = $('#container'); Partial.ItemSet.setWardrobe(wardrobe); function prepSetSpecificItems(type) { return function (specific_items) { var item, worn, li; for(var i = 0; i < items.length; i++) { item = items[i]; in_set = $.inArray(item, specific_items) != -1; li = $('li.object-' + item.id).toggleClass(type, in_set). data('item', item).data(type, in_set).children('ul'). children('li.control-set-for-' + type).remove().end() [type == 'worn' ? 'prepend' : 'append'] (Partial.ItemSet.CONTROL_SETS[type][in_set].clone()); } } } setClosetItems = prepSetSpecificItems('closeted'); setOutfitItemsControls = prepSetSpecificItems('worn'); setOutfitItems = function (specific_items) { setOutfitItemsControls(specific_items); setHasAssets(specific_items); } function setHasAssets(specific_items) { var item, no_assets, li, no_assets_message; for(var i = 0, l = specific_items.length; i < l; i++) { item = specific_items[i]; no_assets = item.couldNotLoadAssetsFitting(wardrobe.outfit.pet_type); li = $('li.object-' + item.id).toggleClass('no-assets', no_assets); (function (li) { no_assets_message = li.find('span.no-assets-message'); no_assets_message.remove(); if(no_assets) { $('', {'class': 'no-assets-message', text: 'No data yet'}).appendTo(li); } })(li); } } this.setItems = function (new_items) { var item, li, controls, info_link; items = new_items; ul.children().remove(); for(var i = 0; i < items.length; i++) { item = items[i]; li = $('
  • ', {'class': 'object object-' + item.id}); img = $('', { 'src': item.thumbnail_url, 'alt': item.description, 'title': item.description }); controls = $('