js:select first

This commit is contained in:
Martijn Voncken 2008-07-12 13:30:12 +00:00
parent f247884e66
commit e27d8bacd4
1 changed files with 10 additions and 1 deletions

View File

@ -69,7 +69,9 @@ function select_row(id){
row.className = 'torrent_table_selected'; row.className = 'torrent_table_selected';
state.selected_rows[state.selected_rows.length] = id; state.selected_rows[state.selected_rows.length] = id;
setCookie('selected_rows',state.selected_rows); setCookie('selected_rows',state.selected_rows);
return true;
} }
return false;
} }
function deselect_row(id){ function deselect_row(id){
@ -96,9 +98,16 @@ function deselect_all_rows(){
} }
function reselect_rows(){ function reselect_rows(){
var selected = false;
var selected_rows = getCookie('selected_rows').split(','); var selected_rows = getCookie('selected_rows').split(',');
for (i in getCookie('selected_rows')) { for (i in getCookie('selected_rows')) {
select_row(selected_rows[i]); if (select_row(selected_rows[i])) {
selected = true;
}
}
if (!selected) {
/*select 1st*/
select_row(torrent_table.torrents[0]);
} }
} }