moving default tab to new tabs object

10.3.x-maintenance
cTn 2014-07-10 18:14:17 +02:00
parent 7e67cccf96
commit 5efb1685a4
5 changed files with 21 additions and 11 deletions

View File

@ -51,7 +51,7 @@ $(document).ready(function() {
$('#content').empty();
// load default html
tab_initialize_default();
tabs.default.initialize();
}
$(this).data("clicks", !clicks);

12
main.js
View File

@ -47,8 +47,8 @@ $(document).ready(function() {
}
// Tabs
var tabs = $('#tabs > ul');
$('a', tabs).click(function() {
var ui_tabs = $('#tabs > ul');
$('a', ui_tabs).click(function() {
if ($(this).parent().hasClass('active') == false && !GUI.tab_switch_in_progress) { // only initialize when the tab isn't already active
var self = this;
var index = $(self).parent().index();
@ -64,7 +64,7 @@ $(document).ready(function() {
GUI.tab_switch_cleanup(function() {
// disable previously active tab highlight
$('li', tabs).removeClass('active');
$('li', ui_tabs).removeClass('active');
// Highlight selected tab
$(self).parent().addClass('active');
@ -74,10 +74,10 @@ $(document).ready(function() {
switch (tab) {
case 'tab_initial_setup':
tab_initialize_initial_setup();
tabs.initial_setup.initialize();
break;
case 'tab_pid_tuning':
tab_initialize_pid_tuning();
tabs.pid_tuning.initialize();
break;
case 'tab_receiver':
tab_initialize_receiver();
@ -110,7 +110,7 @@ $(document).ready(function() {
}
});
tab_initialize_default();
tabs.default.initialize();
// options
$('a#options').click(function() {

View File

@ -1,4 +1,8 @@
function tab_initialize_default(callback) {
tabs.default = function() {
};
tabs.default.initialize = function(callback) {
GUI.active_tab_ref = this;
GUI.active_tab = 'default';
$('#content').load("./tabs/default.html", function() {
@ -16,5 +20,11 @@ function tab_initialize_default(callback) {
$('div.welcome a').click(function() {
ga_tracker.sendEvent('ExternalUrls', 'Click', $(this).prop('href'));
});
if (callback) callback();
});
}
};
tabs.default.cleanup = function(callback) {
if (callback) callback();
};

View File

@ -222,7 +222,7 @@ function tab_initialize_firmware_flasher(callback) {
$('a.back').click(function() {
if (!GUI.connect_lock) { // button disabled while flashing is in progress
GUI.tab_switch_cleanup(function() {
tab_initialize_default();
tabs.default.initialize();
});
} else {
GUI.log(chrome.i18n.getMessage('firmwareFlasherWaitForFinish'));

View File

@ -119,7 +119,7 @@ function tab_initialize_logging(callback) {
GUI.tab_switch_cleanup(function() {
MSP_pass_through = false;
$('#tabs > ul li').removeClass('active');
tab_initialize_default();
tabs.default.initialize();
});
}
});