$(function() {
//function toggle_src(a, img){
// var href = $(a).attr('href');
// var src = $(img).attr('src');
// $(img).attr('src', href);
// $(a).attr('href', src);
// return false
//};
function sort_by(attribute) {
function sort_by_attr(a, b){
return $(a).attr(attribute) > $(b).attr(attribute) ? 1 : -1;
};
$('div#outer ul li').sort(sort_by_attr).appendTo('div#outer ul');
$('.tag').remove();
var current_attr;
$('div#outer ul li').each(function() {
var this_attr = $(this).attr(attribute);
if (this_attr !== current_attr) {
current_attr = this_attr;
var foo = $('
');
foo.addClass('tag');
foo.text(this_attr);
foo.prependTo(this);
};
});
return false
}
function spread_by(attribute) {
var offset = 30;
var values = []
$('div#outer ul li').each(function() {
var attr = $(this).attr(attribute);
var index = $.inArray(attr, values);
if (index === -1) {
values.push(attr);
index = values.length - 1;
};
$(this).css('margin-top', 50 + index * offset);
//$(this).css('padding-bottom', 3000);
});
$('.tag2').remove();
var current_attr;
$('div#outer ul li').each(function() {
var this_attr = $(this).attr(attribute);
if (this_attr !== current_attr) {
current_attr = this_attr;
var foo = $('');
foo.addClass('tag2');
foo.text(this_attr);
foo.prependTo(this);
};
});
}
(function() {
var keys = [];
$('div#outer ul li').each(function() {
$.each(this.attributes, function(i, attr) {
if ($.inArray(attr.name, keys) === -1) {
keys.push(attr.name);
};
});
});
//var nav = $('