diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index 5374618..4ba3f1b 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -4,9 +4,11 @@ class ArtistsController < ApplicationController def show @artist = LastFM::Artist.getInfo CGI.unescape(params[:id]) @tracks = LastFM::Artist.getTopTracks @artist.name, 10 - @albums = LastFM::Artist.getTopAlbums @artist.name, 8 @images = LastFM::Artist.getImages @artist.name, 18 @related= LastFM::Artist.getSimilar @artist.name, 6 + @albums = LastFM::Artist.getTopAlbums @artist.name, 8 + + end def index diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index 02c422f..949f06b 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -11,7 +11,6 @@ class SearchController < ApplicationController @albums = LastFM::Album.search(params[:q].to_s.lstrip, 16) end puts params - end end \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index a56832f..a540234 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -12,17 +12,16 @@ %body #playlist-container %ul#playlist - #site #head %h1 = link_to image_tag("9minutes.png"), "/" - = form_tag search_index_path, :method => 'get', :id => "search_form", :class => "right" do + = form_tag '/search', :method => 'get', :id => "search_form", :class => "right" do .wrap = text_field_tag 'q', params[:q], :class => "input", :placeholder => "Search for" -# TODO: image_submit_tag .selection{:dropping=>"true"} - %span ALL + %span.selected ALL .box %span.arr %ul @@ -30,8 +29,8 @@ %li Artists %li Albums %li Songs - = hidden_field_tag 'tab', 'all' - = submit_tag '', :class=>"submit" + = submit_tag '', :class=>"submit", :name => nil + #predefinedTab = yield #player #videoDiv Loading diff --git a/app/views/search/index.html.haml b/app/views/search/index.html.haml index 5518ace..efc8635 100644 --- a/app/views/search/index.html.haml +++ b/app/views/search/index.html.haml @@ -1,4 +1,3 @@ -#predefinedTab= params[:tab] %h2.headline =raw "Search for #{params[:q]}" %ul.navigation.hash.main{:steering => "search"} diff --git a/config/boot.rb b/config/boot.rb index 8331c00..7739d5b 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,4 +3,7 @@ require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) \ No newline at end of file +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) + +require 'yaml' +YAML::ENGINE.yamler= 'syck' \ No newline at end of file diff --git a/lib/LastFM/Artist.rb b/lib/LastFM/Artist.rb index a19996d..d0762e2 100644 --- a/lib/LastFM/Artist.rb +++ b/lib/LastFM/Artist.rb @@ -27,7 +27,11 @@ module LastFM # return: albums ( name, mbid, album url, image urls ( different sizes ) ) ordered by popularity def self.getTopAlbums artist, limit = nil, page = nil - artist_request "getTopAlbums", "topalbums", artist, limit, page + @albums = artist_request "getTopAlbums", "topalbums", artist, limit, page + if @albums["@attr"].total.to_i == 1 + @albums.album = [@albums.album] # wrap with Array + end + @albums end def self.getImages artist, limit = nil diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3e6c3c3..cb30626 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -286,7 +286,7 @@ function initSearchDropdown() { // hover and out $("div[dropping]").hoverIntent(function(){ - $(this).children(".box").fadeIn(500); + $(this).children(".box").fadeIn(300); }, function(){ $(this).children(".box").fadeOut(300); }); @@ -295,11 +295,14 @@ function initSearchDropdown() $("div[dropping] .box").live("click", function(){ $(this).fadeOut(300); }); - + + $fm = $("#search_form").attr("action"); + $fm = $fm.split("#",1); $("div[dropping] .box li").live("click", function(){ $("div[dropping] > span").html($(this).html()); - $("div[dropping] #tab").attr("value", $(this).html().toLowerCase()); + $("#search_form").attr("action", $fm+"#tab="+$(this).html().toLowerCase()); }); + } // list fixes @@ -316,11 +319,15 @@ function fixLists() function initNavigation() { // set hash if submitted by search form + $str = $.deparam.fragment(window.location.href); + $("#predefinedTab").text($str.tab); $searchTab = $("#predefinedTab").text(); if($searchTab != "") { - $("#search_form #tab").attr("value", $searchTab); - $("#search_form .selection > span").text($searchTab); + $fm = $("#search_form").attr("action"); + $fm = $fm.split("#",1); + $("#search_form .selection .selected").text($searchTab); + $("#search_form").attr("action", $fm+"#tab="+$searchTab.toLowerCase()); } // add positions and hash control $(".navigation").each(function(){ @@ -341,7 +348,7 @@ function initNavigation() if($(this).hasClass("main") && $searchTab != "") { $str = $searchTab; - $("#search_form .selection > span").text($searchTab); + $("#search_form .selection .selected").text($searchTab); } else { @@ -402,8 +409,10 @@ function handleNavigation() // for search bar if($(this).parent().hasClass("main")) { + $fm = $("#search_form").attr("action"); + $fm = $fm.split("#",1); $("#search_form .selection > span").text($settings['hash']); - $("#search_form #tab").attr("value", $settings['hash']); + $("#search_form").attr("action", $fm+"#tab="+$(this).html().toLowerCase()); } // get the width of the navigation elements which will fade out diff --git a/public/javascripts/jqueryPlugins.js b/public/javascripts/jqueryPlugins.js index 8f32a3e..f59e71f 100644 --- a/public/javascripts/jqueryPlugins.js +++ b/public/javascripts/jqueryPlugins.js @@ -636,3 +636,17 @@ jQuery.store = (function(){ return api })(); + + +/* + +$.fn.hilight = function(option) { + var opts = $.extend({}, $.fn.hilight.defaults, options); + + $fn.hilight.defaults = { + foreground: 'red', + background: 'yellow' + }; +}; + +*/ \ No newline at end of file diff --git a/public/javascripts/player.js b/public/javascripts/player.js index d2a9501..b432305 100644 --- a/public/javascripts/player.js +++ b/public/javascripts/player.js @@ -36,6 +36,9 @@ updateHTML("startBytes", ytplayer.getVideoStartBytes()); updateHTML("bytesLoaded", ytplayer.getVideoBytesLoaded());*/ + if(ytplayer.getPlayerState() == 1) $('#player .play').addClass('pause'); + else $('#player .play').removeClass('pause'); + if(!dragging) { var api = $("#scrubbar input").data("rangeinput"); @@ -113,18 +116,19 @@ clearInterval(updateInterval); } // Loads the selected video into the player. -function loadVideo(vid) { - var videoID = vid; - if(ytplayer) { - ytplayer.loadVideoById(videoID); - } - active = videoID; - $li = activeVid(); - $('#playlist li').each(function(){ - $(this).removeClass("active"); - }); - $li.addClass("active"); -} + function loadVideo(vid) { + var videoID = vid; + if(ytplayer) { + ytplayer.loadVideoById(videoID); + ytplayer.setPlaybackQuality("medium"); + } + active = videoID; + $li = activeVid(); + $('#playlist li').each(function(){ + $(this).removeClass("active"); + }); + $li.addClass("active"); + } // This function is automatically called by the player once it loads function onYouTubePlayerReady(playerId) { @@ -137,6 +141,7 @@ function loadVideo(vid) { ytplayer.addEventListener("onError", "onPlayerError"); //Load an initial video into the player ytplayer.cueVideoById("sCziT0ZWBDQ"); + ytplayer.setPlaybackQuality("medium"); } // The "main method" of this sample. Called when someone clicks "Run". diff --git a/public/stylesheets/layout.css b/public/stylesheets/layout.css index 24deb0e..6511efc 100644 --- a/public/stylesheets/layout.css +++ b/public/stylesheets/layout.css @@ -1,5 +1,5 @@ @charset "utf-8"; -/** FONTS **/ +/**FONTS */ @font-face{ font-family: AauxNextLight; @@ -182,6 +182,7 @@ a { text-decoration: none; color: #7d8791; } height: 29px; line-height: 29px; display: block; opacity: 0.85; + z-index: 800; } #search_form .selection > span { text-transform: uppercase;} #search_form .box