Commits

Mathias Panzenböck committed 52ea410

expand search results if only one result on current level

  • Participants
  • Parent commits 066fa86

Comments (0)

Files changed (1)

File javascripts/magnatune.js

 					}
 
 					var list = $(tag('ul',{'class':'genres'}));
+					var expanded = genres.length === 1;
 
 					for (var i = 0; i < genres.length; ++ i) {
 						var genre = genres[i];
 						var hash = '#/genre/'+encodeURIComponent(genre.genre);
 						list.append(tag.expander({
 							label: genre.genre,
+							expanded: expanded,
 							head_attrs: {
 								href: hash,
 								onclick: hashLoadClick(hash,{keeptab:true})
 			ArtistAlbum: {
 				render: function (parent, artists, album_filter) {
 					var list = $(tag('ul',{'class':'artists'}));
+					var expanded = artists.length === 1;
 
 					for (var i = 0; i < artists.length; ++ i) {
 						var artist = artists[i];
 						var hash = '#/artist/'+encodeURIComponent(artist.artist);
 						list.append(tag.expander({
 							label: artist.artist,
+							expanded: expanded,
 							head_attrs: {
 								href: hash,
 								onclick: hashLoadClick(hash,{keeptab:true}),
 					}
 
 					var list = $(tag('ul',{'class':'genres'}));
+					var expanded = genres.length === 1;
 
 					for (var i = 0; i < genres.length; ++ i) {
 						var genre = genres[i];
 						var hash = '#/genre/'+encodeURIComponent(genre.genre);
 						list.append(tag.expander({
 							label: genre.genre,
+							expanded: expanded,
 							head_attrs: {
 								href: hash,
 								onclick: hashLoadClick(hash,{keeptab:true})
 			Album: {
 				render: function (parent, albums) {
 					var list = $(tag('ul',{'class':'albums'}));
+					var expanded = albums.length === 1;
 
 					for (var i = 0; i < albums.length; ++ i) {
 						var album = albums[i];
 						var hash = '#/album/'+encodeURIComponent(album.albumname);
 						list.append(tag.expander({
 							label: label,
+							expanded: expanded,
 							head_attrs: {
 								'class': 'album-head',
 								href: hash,