Some clean-up in scattport.js

This commit is contained in:
Eike Foken
2011-08-08 00:00:01 +02:00
parent 197546b2ed
commit a0530ea6e8

View File

@@ -13,21 +13,19 @@ $.fn.alternateRowColors = function() {
}; };
$(document).ready(function() { $(document).ready(function() {
$(".tab_content").hide(); // hide all content
$("ul.tabs li:first").addClass("active").show(); // activate first tab
$(".tab_content:first").show(); // show first tab content
//When page loads... // onClick event
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function() { $("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); //Remove any "active" class $("ul.tabs li").removeClass("active"); // remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab $(this).addClass("active"); // add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content $(".tab_content").hide(); // hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn(); //Fade in the active ID content $(activeTab).fadeIn(); // fade in the active tab content
return false; return false;
}); });
@@ -36,17 +34,22 @@ $(document).ready(function() {
setInterval('get_notifications()', '5000'); setInterval('get_notifications()', '5000');
}); });
/*
* Tables
*/
$(document).ready(function() { $(document).ready(function() {
var settings = $.extend( { var settings = {
table_class : 'tableList' table_class : 'tableList'
}, settings); };
// add or delete "hover" class on mouseOver event
$('.' + settings.table_class + ' tbody tr').hover(function() { $('.' + settings.table_class + ' tbody tr').hover(function() {
$(this).addClass("hover"); $(this).addClass("hover");
}, function() { }, function() {
$(this).removeClass("hover"); $(this).removeClass("hover");
}); });
// add or delete "selected" class if a row is selected via checkbox
$('.' + settings.table_class + ' tbody input:checkbox').click(function() { $('.' + settings.table_class + ' tbody input:checkbox').click(function() {
if ($(this).attr('checked') == true) { if ($(this).attr('checked') == true) {
$(this).parent().parent().addClass('selected'); $(this).parent().parent().addClass('selected');
@@ -55,13 +58,15 @@ $(document).ready(function() {
} }
}); });
// alternate table rows
$('.' + settings.table_class).each(function() { $('.' + settings.table_class).each(function() {
var table = $(this); var table = $(this);
table.alternateRowColors(table); table.alternateRowColors(table);
}); });
});
$(document).ready(function() { /*
* Pagination
*/
$('.paginated').each(function() { $('.paginated').each(function() {
var currentPage = 0; var currentPage = 0;
var numPerPage = 6; var numPerPage = 6;
@@ -91,7 +96,7 @@ $(document).ready(function() {
} }
$pagelist.find('li.page-number:first').addClass('active'); $pagelist.find('li.page-number:first').addClass('active');
$pager.append($pagelist) $pager.append($pagelist);
$pager.insertAfter(table); $pager.insertAfter(table);
table.trigger('repaginate'); table.trigger('repaginate');