(function () { var csrf_param = $('meta[name=csrf-param]').attr('content'), csrf_token = $('meta[name=csrf-token]').attr('content'), data = {}; data[csrf_param] = csrf_token; $.ajaxSetup({ data: data }); })(); $.fn.notify = function () { return this.stop(true, true).show('slow').delay(5000).hide('fast'); } $.fn.startLoading = function () { return this.delay(1000).queue(function (next) { $(this).addClass('loading'); next(); }); } $.fn.stopLoading = function () { return this.removeClass('loading').clearQueue(); } var Partial = {}, main_wardrobe, View = Wardrobe.getStandardView({ Preview: { swf_url: '/swfs/preview.swf?v=0.12', wrapper: $('#preview-swf'), placeholder: $('#preview-swf-container'), image_container: '#preview-image-container' } }); 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.getPetType()); 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 = $('