minimal-autoindex/Autoindex/scripts/listing.js

30 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2014-01-13 21:47:53 +01:00
$(document).ready(function() {
$('#container').fadeIn(200);
var segment = document.location.pathname.split("/");
var link = '/';
var path = "/";
for (var i = 0; i < segment.length; i++) {
if (segment[i] != '') {
segment[i] = segment[i].replace(/%20/g, " ");
percors += segment[i] + '/';
link += '<a href="' + path + '">' + segment[i] + '</a>/';
}
}
$("h1").html(document.domain);
$('#path').html(link);
$('hr').parent().remove();
var columns = $('th');
$(columns[0]).addClass('icon');
$(columns[1]).addClass('name');
$(columns[columns.length - 1]).addClass('size');
$(columns[columns.length - 2]).addClass('date');
$('#refresh a').click(function() {
window.location.reload(true);
return false;
});
$('td[align="right"]').addClass('row');
$("tr:odd").css("background-color", "#fafafa");
$('[alt="[DIR]"]').parent().add('#path a, #home a, #up a').add($('[alt="[DIR]"]').parent().parent().next().children('a')).attr("href", function(i, href) {
return href.indexOf('?') === -1 ? href + document.location.search : href;
});
});