Dzięki, mam tak:
var expandables = {
init: function()
{
var expanders = $(".expcolimage .expander");
if(expanders.length)
{
expanders.each(function()
{
var expander = $(this);
if(expander.attr("id") == false)
{
return;
}
expander.click(function()
{
controls = expander.attr("id").replace("_img", "");
expandables.expandCollapse(this, controls);
});
if(MyBB.browser == "ie")
{
expander.css("cursor", "hand");
}
else
{
expander.css("cursor", "pointer");
}
});
}
},
expandCollapse: function(e, controls)
{
element = $(e);
if(!element || controls == false)
{
return false;
}
var expandedItem = $("#"+controls+"_e");
var collapsedItem = $("#"+controls+"_c");
if(expandedItem.length && collapsedItem.length)
{
// Expanding
if(expandedItem.is(":hidden"))
{
expandedItem.slideToggle("fast");
collapsedItem.slideToggle("fast");
this.saveCollapsed(controls);
}
// Collapsing
else
{
expandedItem.slideToggle("fast");
collapsedItem.slideToggle("fast");
this.saveCollapsed(controls, 1);
}
}
else if(expandedItem.length && !collapsedItem.length)
{
// Expanding
if(expandedItem.is(":hidden"))
{
expandedItem.slideToggle("fast");
element.attr("src", element.attr("src").replace(<i class="fa fa-plus-square"></i>$/i, "collapse.$1"))
.attr("alt", "[-]")
.attr("title", "[-]");
element.parent().parent('td').removeClass('tcat_collapse_collapsed');
element.parent().parent('.thead').removeClass('thead_collapsed');
this.saveCollapsed(controls);
}
// Collapsing
else
{
expandedItem.slideToggle("fast");
element.attr("src", element.attr("src").replace(<i class="fa fa-minus-square"></i>$/i, "collapse_collapsed.$1"))
.attr("alt", "[+]")
.attr("title", "[+]");
element.parent().parent('td').addClass('tcat_collapse_collapsed');
element.parent().parent('.thead').addClass('thead_collapsed');
this.saveCollapsed(controls, 1);
}
}
return true;
},
saveCollapsed: function(id, add)
{
var saved = [];
var newCollapsed = [];
var collapsed = Cookie.get('collapsed');
if(collapsed)
{
saved = collapsed.split("|");
$.each(saved, function(intIndex, objValue)
{
if(objValue != id && objValue != "")
{
newCollapsed[newCollapsed.length] = objValue;
}
});
}
if(add == 1)
{
newCollapsed[newCollapsed.length] = id;
}
Cookie.set('collapsed', newCollapsed.join("|"));
}
};
i nie działa