mirror of
https://github.com/transmission/transmission.git
synced 2025-12-22 19:38:49 +00:00
(trunk web) simplify the prefs tab selection code
This commit is contained in:
@@ -171,30 +171,6 @@ String.prototype.compareTo = function(that) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Switch between different dialog tabs
|
||||
*/
|
||||
function changeTab(tab, id) {
|
||||
for (var x = 0, node; tab.parentNode.childNodes[x]; x++) {
|
||||
node = tab.parentNode.childNodes[x];
|
||||
if (node == tab) {
|
||||
node.className = "prefs_tab_enabled";
|
||||
} else {
|
||||
node.className = "prefs_tab_disabled";
|
||||
}
|
||||
}
|
||||
for (x = 0; tab.parentNode.parentNode.childNodes[x]; x++) {
|
||||
node = tab.parentNode.parentNode.childNodes[x];
|
||||
if (node.tagName == "DIV") {
|
||||
if (node.id == id) {
|
||||
node.style.display = "block";
|
||||
} else {
|
||||
node.style.display = "none";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
**** Preferences
|
||||
***/
|
||||
|
||||
@@ -54,10 +54,10 @@ Transmission.prototype =
|
||||
$('#upload_cancel_button').click(function(e) { tr.hideUploadDialog(); return false; });
|
||||
$('#turtle_button').click(function() { tr.toggleTurtleClicked(); return false; });
|
||||
$('#compact-button').click(function() { tr.toggleCompactClicked(); return false; });
|
||||
$('#prefs_tab_general_tab').click(function() { changeTab(this, 'prefs_tab_general'); });
|
||||
$('#prefs_tab_speed_tab').click(function() { changeTab(this, 'prefs_tab_speed'); });
|
||||
$('#prefs_tab_peers_tab').click(function() { changeTab(this, 'prefs_tab_peers'); });
|
||||
$('#prefs_tab_network_tab').click(function() { changeTab(this, 'prefs_tab_network');});
|
||||
$('#prefs-tab-general').click(function() { tr.selectPrefsTab('general'); });
|
||||
$('#prefs-tab-speed').click(function() { tr.selectPrefsTab('speed'); });
|
||||
$('#prefs-tab-peers').click(function() { tr.selectPrefsTab('peers'); });
|
||||
$('#prefs-tab-network').click(function() { tr.selectPrefsTab('network'); });
|
||||
$('#torrent_upload_form').submit(function() { $('#upload_confirm_button').click(); return false; });
|
||||
$('#torrent_container').bind('dragover', function(e) { return tr.dragenter(e); });
|
||||
$('#torrent_container').bind('dragenter', function(e) { return tr.dragenter(e); });
|
||||
@@ -140,6 +140,11 @@ Transmission.prototype =
|
||||
this.filterSetup();
|
||||
},
|
||||
|
||||
selectPrefsTab: function(name) {
|
||||
$('#prefs-tab-'+name).addClass('selected').siblings('.prefs-tab').removeClass('selected');
|
||||
$('#prefs-page-'+name).show().siblings('.prefs-page').hide();
|
||||
},
|
||||
|
||||
loadDaemonPrefs: function(async) {
|
||||
var tr = this;
|
||||
this.remote.loadDaemonPrefs(function(data) {
|
||||
|
||||
Reference in New Issue
Block a user