Clean-up javascript files

This commit is contained in:
Eike Foken
2011-08-15 23:25:24 +02:00
parent e1f3b8da54
commit cc134691ac
2 changed files with 46 additions and 45 deletions

View File

@@ -67,35 +67,35 @@ $.fn.nl2br = function() {
return $(this).html().replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
};
/*
* Tabs
*/
$(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
// onClick event
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active"); // remove any "active" class
$(this).addClass("active"); // add "active" class to selected tab
$(".tab_content").hide(); // hide all tab content
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn(); // fade in the active tab content
return false;
});
$('#notifications').hide();
getNotifications();
setInterval('getNotifications()', '5000');
});
/**
* Do some stuff if document is ready.
*/
$(document).ready(function() {
/*
* Tabs
*/
$('.tab_content').hide(); // hide all content
$('ul.tabs li:first').addClass('active').show(); // activate first tab
$('.tab_content:first').show(); // show first tab content
// onClick event
$('ul.tabs li').click(function() {
$('ul.tabs li').removeClass('active'); // remove any 'active' class
$(this).addClass('active'); // add 'active' class to selected tab
$('.tab_content').hide(); // hide all tab content
var activeTab = $(this).find('a').attr('href');
$(activeTab).fadeIn(); // fade in the active tab content
return false;
});
/*
* Notification stuff
*/
$('#notifications').hide();
getNotifications();
setInterval('getNotifications()', '5000');
/*
* Tables
*/
@@ -103,14 +103,14 @@ $(document).ready(function() {
table_class : 'tableList'
};
// add or delete "hover" class on mouseOver event
// add or delete 'hover' class on mouseOver event
$('.' + settings.table_class + ' tbody tr').hover(function() {
$(this).addClass("hover");
$(this).addClass('hover');
}, function() {
$(this).removeClass("hover");
$(this).removeClass('hover');
});
// add or delete "selected" class if a row is selected via checkbox
// add or delete 'selected' class if a row is selected via checkbox
$('.' + settings.table_class + ' tbody input:checkbox').click(function() {
if ($(this).attr('checked') == true) {
$(this).parent().parent().addClass('selected');
@@ -198,6 +198,9 @@ $(document).ready(function() {
$(this).removeClass('editable');
});
/*
* Active project selection
*/
$('select[name="activeProject"]').bind('change', function () {
var url = $(this).val();
if (url) {

View File

@@ -136,7 +136,7 @@ jQuery.tableDnD = {
}
return false;
});
})
});
} else {
// For backwards compatibility, we add the event to the whole row
var rows = jQuery("tr", table); // get all the rows as a wrapped set
@@ -167,7 +167,7 @@ jQuery.tableDnD = {
if (this.tableDnDConfig) {
jQuery.tableDnD.makeDraggable(this);
}
})
});
},
/** Get the mouse coordinates from the event (allowing for browser differences) */
@@ -371,12 +371,10 @@ jQuery.tableDnD = {
return result;
}
}
};
jQuery.fn.extend(
{
jQuery.fn.extend({
tableDnD : jQuery.tableDnD.build,
tableDnDUpdate : jQuery.tableDnD.updateTables,
tableDnDSerialize: jQuery.tableDnD.serializeTables
}
);
});