tablesorter/docs/js/docs.js

56 lines
1.5 KiB
JavaScript
Raw Normal View History

2011-06-22 23:19:27 +00:00
/* Stop IE flicker */
if ($.browser.msie == true) document.execCommand('BackgroundImageCache', false, true);
jQuery.fn.antispam = function() {
return this.each(function(){
var email = $(this).text().toLowerCase().replace(/\sdot/g,'.').replace(/\sat/g,'@').replace(/\s+/g,'');
var URI = "mailto:" + email;
$(this).hide().before(
$("<a></a>").attr("href",URI).addClass("external").text(email)
);
});
};
2011-07-17 15:01:18 +00:00
$(function(){
2011-09-22 22:32:58 +00:00
$("a.external").each(function() {this.target = '_new'});
2011-06-22 23:19:27 +00:00
$("span.email").antispam();
2011-07-17 15:01:18 +00:00
// get javascript source
if ($("#js").length) {
$("#javascript pre").text( $("#js").html().replace(/\t/g, " ") );
}
if ($("#css").length) {
$("pre.css").text( $("#css").html().replace(/\t/g, " ") );
}
if ($("#demo").length) {
2011-09-22 22:32:58 +00:00
$("#html pre").text( $("#demo").html().replace(/\t/g, " ") );
2011-07-17 15:01:18 +00:00
}
// hide child rows
$('#root .expand-child').hide();
// toggle child row content, not hiding the row since we are using rowspan
$('#root .toggle').click(function(){
$(this).closest('tr').nextUntil('tr:not(.expand-child)').toggle();
return false;
});
$('.collapsible').hide();
$('.toggle2').click(function(){
$(this).closest('tr').find('.collapsible').slideToggle();
return false;
});
$('.toggleAll, .showAll, .hideAll').click(function(){
var t = $.trim($(this).text());
$(this).parent().next('table').find('.collapsible')[t]();
return false;
});
});
$(window).load(function(){
$(".js").chili();
$(".html").chili();
$(".css").chili();
2011-06-22 23:19:27 +00:00
});