diff --git a/Gemfile b/Gemfile index 8c3001b..d4ebd4c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,19 +1,16 @@ source 'http://rubygems.org' -gem 'rake' #, '0.8.7' +gem 'rake' -gem 'rails', '3.0.5' -gem 'jquery-rails', '>= 0.2.6' - -gem 'sqlite3' -gem 'sqlite3-ruby', :require => 'sqlite3' +gem 'rails', '3.1.3' +gem 'jquery-rails', '1.0.12' # templating gem 'haml-rails' -gem "sass" -# for searching youtube -gem "youtube_it" +# for youtube and 7digital APIs +gem 'youtube_it' +gem '7digital' # for using last.fm api gem 'typhoeus' @@ -22,15 +19,6 @@ gem 'typhoeus' gem 'redis' gem 'redis-namespace' -# for using 7digital api -gem '7digital' - -# for asset packaging -gem 'closure' -gem 'jammit', :git => "git://github.com/documentcloud/jammit.git" -gem 'win32-open3-19' # win32-open3 in order to use POpen4 on Win32 (dependency of jammit) - - # for converting json/xml to object gem 'json' gem 'hashie' @@ -42,19 +30,23 @@ gem 'oa-openid', :require => 'omniauth/openid' # for file upload ( -> avatar ) gem 'paperclip', '~> 2.3' +gem 'jammit', '~> 0.6.5' #, :git => 'git://github.com/documentcloud/jammit.git' -# youtube search -gem 'youtube_it' - -group :development, :test do - # for html2haml - # gem 'hpricot' - gem 'ruby_parser' - - # alternative servers (because openID URIs are too long for WEBRick) - gem 'mongrel', '1.2.0.pre2' - +group :assets do + gem 'sass-rails', '~> 3.1.5' + gem 'coffee-rails', '~> 3.1.1' + gem 'uglifier', '>= 1.0.3' + gem 'closure' + gem 'win32-open3-19' # win32-open3 in order to use POpen4 on Win32 (dependency of jammit) end -# Deploy with Capistrano -# gem 'capistrano' +group :development, :test do + gem 'sqlite3' + gem 'sqlite3-ruby', :require => 'sqlite3' + + # gem 'hpricot' # for html2haml + gem 'ruby_parser' + + # alternative servers (because openID URIs are too long for WEBRick) + gem 'mongrel', '1.2.0.pre2' +end diff --git a/Gemfile.lock b/Gemfile.lock index c3645d5..8b4a021 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,190 +1,211 @@ GEM remote: http://rubygems.org/ specs: - 7digital (0.0.6) - peachy (>= 0.3.5) - will_paginate (>= 2.3.15) - POpen4 (0.1.4) - Platform (>= 0.4.0) - open4 - Platform (0.4.0) - abstract (1.0.0) - actionmailer (3.0.5) - actionpack (= 3.0.5) - mail (~> 2.2.15) - actionpack (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.4) - rack (~> 1.2.1) - rack-mount (~> 0.6.13) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.5) - activesupport (= 3.0.5) - builder (~> 2.1.2) - i18n (~> 0.4) - activerecord (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) - arel (~> 2.0.2) - tzinfo (~> 0.3.23) - activeresource (3.0.5) - activemodel (= 3.0.5) - activesupport (= 3.0.5) - activesupport (3.0.5) - addressable (2.2.6) - arel (2.0.10) - bcrypt-ruby (2.1.4) - bcrypt-ruby (2.1.4-x86-mingw32) - builder (2.1.2) - closure (1.3.0) - rack (>= 1.0.0) - cocaine (0.1.0) + 7digital (0.1.2) + nokogiri (>= 1.5.0) + oauth (>= 0.4.5) + actionmailer (3.2.8) + actionpack (= 3.2.8) + mail (~> 2.4.4) + actionpack (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.0) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.1.3) + activemodel (3.2.8) + activesupport (= 3.2.8) + builder (~> 3.0.0) + activerecord (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.8) + activemodel (= 3.2.8) + activesupport (= 3.2.8) + activesupport (3.2.8) + i18n (~> 0.6) + multi_json (~> 1.0) + arel (3.0.2) + bcrypt-ruby (3.0.1) + builder (3.0.4) + cocaine (0.4.2) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.4.0) daemons (1.0.10) - devise (1.4.1) - bcrypt-ruby (~> 2.1.2) - orm_adapter (~> 0.0.3) - warden (~> 1.0.3) - erubis (2.6.6) - abstract (>= 1.0.0) - faraday (0.6.1) - addressable (~> 2.2.4) - multipart-post (~> 1.1.0) - rack (< 2, >= 1.1.0) + devise (2.1.2) + bcrypt-ruby (~> 3.0) + orm_adapter (~> 0.1) + railties (~> 3.1) + warden (~> 1.2.1) + erubis (2.7.0) + ethon (0.5.7) + ffi (~> 1.2.0) + mime-types (~> 1.18) + execjs (1.4.0) + multi_json (~> 1.0) + faraday (0.8.4) + multipart-post (~> 1.1) + ffi (1.2.0) gem_plugin (0.2.3) - haml (3.1.2) - haml-rails (0.3.4) - actionpack (~> 3.0) - activesupport (~> 3.0) - haml (~> 3.0) - railties (~> 3.0) - hashie (1.0.0) - i18n (0.6.0) - jammit (0.6.3) - yui-compressor (>= 0.9.3) + haml (3.1.7) + haml-rails (0.3.5) + actionpack (>= 3.1, < 4.1) + activesupport (>= 3.1, < 4.1) + haml (~> 3.1) + railties (>= 3.1, < 4.1) + hashie (1.2.0) + hike (1.2.1) + httpauth (0.2.0) + i18n (0.6.1) + journey (1.0.4) jquery-rails (1.0.12) railties (~> 3.0) thor (~> 0.14) - json (1.5.3) - mail (2.2.19) - activesupport (>= 2.3.6) + json (1.7.5) + jwt (0.1.5) + multi_json (>= 1.0) + mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.16) + mime-types (1.19) mongrel (1.2.0.pre2) daemons (~> 1.0.10) gem_plugin (~> 0.2.3) - mongrel (1.2.0.pre2-x86-mingw32) - gem_plugin (~> 0.2.3) - multi_json (1.0.3) - multi_xml (0.2.2) - multipart-post (1.1.2) - oa-core (0.2.6) - oa-oauth (0.2.6) - faraday (~> 0.6.1) - multi_json (~> 1.0.0) - multi_xml (~> 0.2.2) - oa-core (= 0.2.6) - oauth (~> 0.4.0) - oauth2 (~> 0.4.1) - oa-openid (0.2.6) - oa-core (= 0.2.6) - rack-openid (~> 1.3.1) - ruby-openid-apps-discovery (~> 1.2.0) - oauth (0.4.5) - oauth2 (0.4.1) - faraday (~> 0.6.1) - multi_json (>= 0.0.5) - open4 (1.1.0) - orm_adapter (0.0.5) - paperclip (2.3.12) + multi_json (1.5.0) + multipart-post (1.1.5) + nokogiri (1.5.6) + oa-core (0.0.5) + rack (~> 1.1) + oa-oauth (0.0.1) + json + nokogiri + oa-core (~> 0.0.0) + oauth + oauth2 + oa-openid (0.0.5) + oa-core (= 0.0.5) + rack-openid (~> 1.1.1) + ruby-openid-apps-discovery + oauth (0.4.7) + oauth2 (0.8.0) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + orm_adapter (0.4.0) + paperclip (2.8.0) activerecord (>= 2.3.0) activesupport (>= 2.3.2) cocaine (>= 0.0.2) - peachy (0.4.1) - polyglot (0.3.1) - rack (1.2.3) - rack-mount (0.6.14) - rack (>= 1.0.0) - rack-openid (1.3.1) - rack (>= 1.1.0) - ruby-openid (>= 2.1.8) - rack-test (0.5.7) + mime-types + polyglot (0.3.3) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-openid (1.1.2) + rack (>= 0.4) + ruby-openid (>= 2.0.3) + rack-ssl (1.3.2) + rack + rack-test (0.6.2) rack (>= 1.0) - rails (3.0.5) - actionmailer (= 3.0.5) - actionpack (= 3.0.5) - activerecord (= 3.0.5) - activeresource (= 3.0.5) - activesupport (= 3.0.5) + rails (3.2.8) + actionmailer (= 3.2.8) + actionpack (= 3.2.8) + activerecord (= 3.2.8) + activeresource (= 3.2.8) + activesupport (= 3.2.8) bundler (~> 1.0) - railties (= 3.0.5) - railties (3.0.5) - actionpack (= 3.0.5) - activesupport (= 3.0.5) + railties (= 3.2.8) + railties (3.2.8) + actionpack (= 3.2.8) + activesupport (= 3.2.8) + rack-ssl (~> 1.3.2) rake (>= 0.8.7) - thor (~> 0.14.4) - rake (0.9.2) - redis (2.2.1) - redis-namespace (1.0.3) - redis (< 3.0.0) - ruby-openid (2.1.8) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + rake (10.0.3) + rdoc (3.12) + json (~> 1.4) + redis (3.0.2) + redis-namespace (1.2.1) + redis (~> 3.0.0) + ruby-openid (2.2.2) ruby-openid-apps-discovery (1.2.0) ruby-openid (>= 2.1.7) - ruby_parser (2.0.6) - sexp_processor (~> 3.0) - sass (3.1.3) - sexp_processor (3.0.5) - sqlite3 (1.3.3) - sqlite3 (1.3.3-x86-mingw32) + ruby_parser (3.1.1) + sexp_processor (~> 4.1) + sass (3.2.4) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + sexp_processor (4.1.3) + simple_oauth (0.1.9) + sprockets (2.1.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.6) sqlite3-ruby (1.3.3) sqlite3 (>= 1.3.3) - thor (0.14.6) - treetop (1.4.9) + thor (0.16.0) + tilt (1.3.3) + treetop (1.4.12) + polyglot polyglot (>= 0.3.1) - typhoeus (0.2.4) - mime-types - mime-types - tzinfo (0.3.29) - warden (1.0.4) + typhoeus (0.5.3) + ethon (~> 0.5.3) + tzinfo (0.3.35) + uglifier (1.3.0) + execjs (>= 0.3.0) + multi_json (~> 1.0, >= 1.0.2) + warden (1.2.1) rack (>= 1.0) - will_paginate (2.3.15) - win32-open3-19 (0.0.1) - youtube_it (1.4.3) + youtube_it (2.1.8) builder - oauth (>= 0.4.4) - yui-compressor (0.9.6) - POpen4 (>= 0.1.4) + faraday (~> 0.8) + nokogiri (~> 1.5.2) + oauth (~> 0.4.4) + oauth2 (~> 0.6) + simple_oauth (~> 0.1.5) PLATFORMS ruby - x86-mingw32 DEPENDENCIES 7digital - closure + coffee-rails (~> 3.2.1) devise haml-rails hashie - jammit - jquery-rails (>= 0.2.6) + jquery-rails (= 1.0.12) json mongrel (= 1.2.0.pre2) oa-oauth oa-openid paperclip (~> 2.3) - rails (= 3.0.5) + rails (= 3.2.8) rake redis redis-namespace ruby_parser - sass + sass-rails (~> 3.2.3) sqlite3 sqlite3-ruby typhoeus - win32-open3-19 + uglifier (>= 1.0.3) youtube_it diff --git a/app/assets/fonts/aauxnext/AauxNext-Blk.otf b/app/assets/fonts/aauxnext/AauxNext-Blk.otf new file mode 100644 index 0000000..f2012a5 Binary files /dev/null and b/app/assets/fonts/aauxnext/AauxNext-Blk.otf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-bd-webfont.eot b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.eot new file mode 100644 index 0000000..8a8b709 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.eot differ diff --git a/app/assets/fonts/aauxnext/aauxnext-bd-webfont.otf b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.otf new file mode 100644 index 0000000..3be3d82 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.otf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-bd-webfont.svg b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.svg new file mode 100644 index 0000000..0c57ad9 --- /dev/null +++ b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.svg @@ -0,0 +1,251 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c 2008 by Neil Summerour All rights reserved +Designer : Neil Summerour +Foundry : Neil Summerour +Foundry URL : wwwtypetrustcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/aauxnext/aauxnext-bd-webfont.ttf b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.ttf new file mode 100644 index 0000000..35832a8 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.ttf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-bd-webfont.woff b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.woff new file mode 100644 index 0000000..350d004 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-bd-webfont.woff differ diff --git a/app/assets/fonts/aauxnext/aauxnext-lt-webfont.eot b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.eot new file mode 100644 index 0000000..b25d9f5 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.eot differ diff --git a/app/assets/fonts/aauxnext/aauxnext-lt-webfont.otf b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.otf new file mode 100644 index 0000000..619650d Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.otf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-lt-webfont.svg b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.svg new file mode 100644 index 0000000..e817b0e --- /dev/null +++ b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.svg @@ -0,0 +1,251 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c 2008 by Neil Summerour All rights reserved +Designer : Neil Summerour +Foundry : Neil Summerour +Foundry URL : wwwtypetrustcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/aauxnext/aauxnext-lt-webfont.ttf b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.ttf new file mode 100644 index 0000000..e3348e6 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.ttf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-lt-webfont.woff b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.woff new file mode 100644 index 0000000..c4ccc30 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-lt-webfont.woff differ diff --git a/app/assets/fonts/aauxnext/aauxnext-md-webfont.eot b/app/assets/fonts/aauxnext/aauxnext-md-webfont.eot new file mode 100644 index 0000000..b51a005 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-md-webfont.eot differ diff --git a/app/assets/fonts/aauxnext/aauxnext-md-webfont.otf b/app/assets/fonts/aauxnext/aauxnext-md-webfont.otf new file mode 100644 index 0000000..09d3356 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-md-webfont.otf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-md-webfont.svg b/app/assets/fonts/aauxnext/aauxnext-md-webfont.svg new file mode 100644 index 0000000..940212b --- /dev/null +++ b/app/assets/fonts/aauxnext/aauxnext-md-webfont.svg @@ -0,0 +1,251 @@ + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Copyright c 2008 by Neil Summerour All rights reserved +Designer : Neil Summerour +Foundry : Neil Summerour +Foundry URL : wwwtypetrustcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/aauxnext/aauxnext-md-webfont.ttf b/app/assets/fonts/aauxnext/aauxnext-md-webfont.ttf new file mode 100644 index 0000000..abe0070 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-md-webfont.ttf differ diff --git a/app/assets/fonts/aauxnext/aauxnext-md-webfont.woff b/app/assets/fonts/aauxnext/aauxnext-md-webfont.woff new file mode 100644 index 0000000..de978d1 Binary files /dev/null and b/app/assets/fonts/aauxnext/aauxnext-md-webfont.woff differ diff --git a/app/assets/images/9minutes-logo.png b/app/assets/images/9minutes-logo.png new file mode 100644 index 0000000..aa934c6 Binary files /dev/null and b/app/assets/images/9minutes-logo.png differ diff --git a/app/assets/images/advertisment-placeholder.png b/app/assets/images/advertisment-placeholder.png new file mode 100644 index 0000000..dfa1c39 Binary files /dev/null and b/app/assets/images/advertisment-placeholder.png differ diff --git a/app/assets/images/backgrounds/dark.png b/app/assets/images/backgrounds/dark.png new file mode 100644 index 0000000..4ba9605 Binary files /dev/null and b/app/assets/images/backgrounds/dark.png differ diff --git a/app/assets/images/backgrounds/darker.png b/app/assets/images/backgrounds/darker.png new file mode 100644 index 0000000..c7e1b39 Binary files /dev/null and b/app/assets/images/backgrounds/darker.png differ diff --git a/app/assets/images/backgrounds/fuse.png b/app/assets/images/backgrounds/fuse.png new file mode 100644 index 0000000..5b1c471 Binary files /dev/null and b/app/assets/images/backgrounds/fuse.png differ diff --git a/app/assets/images/backgrounds/overallcrush.png b/app/assets/images/backgrounds/overallcrush.png new file mode 100644 index 0000000..fd972d1 Binary files /dev/null and b/app/assets/images/backgrounds/overallcrush.png differ diff --git a/app/assets/images/bing.png b/app/assets/images/bing.png new file mode 100644 index 0000000..18aeb8e Binary files /dev/null and b/app/assets/images/bing.png differ diff --git a/app/assets/images/examples/album-kl.jpg b/app/assets/images/examples/album-kl.jpg new file mode 100644 index 0000000..a10ced6 Binary files /dev/null and b/app/assets/images/examples/album-kl.jpg differ diff --git a/app/assets/images/examples/artist-big.jpg b/app/assets/images/examples/artist-big.jpg new file mode 100644 index 0000000..a7edc7b Binary files /dev/null and b/app/assets/images/examples/artist-big.jpg differ diff --git a/app/assets/images/examples/artist-big2.jpg b/app/assets/images/examples/artist-big2.jpg new file mode 100644 index 0000000..f4e8401 Binary files /dev/null and b/app/assets/images/examples/artist-big2.jpg differ diff --git a/app/assets/images/examples/artist.jpg b/app/assets/images/examples/artist.jpg new file mode 100644 index 0000000..cd2fc3b Binary files /dev/null and b/app/assets/images/examples/artist.jpg differ diff --git a/app/assets/images/examples/top-artist.jpg b/app/assets/images/examples/top-artist.jpg new file mode 100644 index 0000000..d2d7b6d Binary files /dev/null and b/app/assets/images/examples/top-artist.jpg differ diff --git a/app/assets/images/examples/top-artist2.jpg b/app/assets/images/examples/top-artist2.jpg new file mode 100644 index 0000000..d2733eb Binary files /dev/null and b/app/assets/images/examples/top-artist2.jpg differ diff --git a/app/assets/images/examples/user-big.jpg b/app/assets/images/examples/user-big.jpg new file mode 100644 index 0000000..d189f04 Binary files /dev/null and b/app/assets/images/examples/user-big.jpg differ diff --git a/app/assets/images/examples/video-big.jpg b/app/assets/images/examples/video-big.jpg new file mode 100644 index 0000000..77161da Binary files /dev/null and b/app/assets/images/examples/video-big.jpg differ diff --git a/app/assets/images/nine-minutes.png b/app/assets/images/nine-minutes.png new file mode 100644 index 0000000..f2c649d Binary files /dev/null and b/app/assets/images/nine-minutes.png differ diff --git a/app/assets/images/placeholder/advertisment.png b/app/assets/images/placeholder/advertisment.png new file mode 100644 index 0000000..dfa1c39 Binary files /dev/null and b/app/assets/images/placeholder/advertisment.png differ diff --git a/app/assets/images/placeholder/artist-big.png b/app/assets/images/placeholder/artist-big.png new file mode 100644 index 0000000..89c2da0 Binary files /dev/null and b/app/assets/images/placeholder/artist-big.png differ diff --git a/app/assets/images/placeholder/artist.png b/app/assets/images/placeholder/artist.png new file mode 100644 index 0000000..bc9a0b6 Binary files /dev/null and b/app/assets/images/placeholder/artist.png differ diff --git a/app/assets/images/placeholder/related.png b/app/assets/images/placeholder/related.png new file mode 100644 index 0000000..73ee510 Binary files /dev/null and b/app/assets/images/placeholder/related.png differ diff --git a/app/assets/images/startsite/adele.jpg b/app/assets/images/startsite/adele.jpg new file mode 100644 index 0000000..e0b9810 Binary files /dev/null and b/app/assets/images/startsite/adele.jpg differ diff --git a/app/assets/images/startsite/arctic-monkeys.jpg b/app/assets/images/startsite/arctic-monkeys.jpg new file mode 100644 index 0000000..2cff0fa Binary files /dev/null and b/app/assets/images/startsite/arctic-monkeys.jpg differ diff --git a/app/assets/images/startsite/beatles.jpg b/app/assets/images/startsite/beatles.jpg new file mode 100644 index 0000000..dd6202b Binary files /dev/null and b/app/assets/images/startsite/beatles.jpg differ diff --git a/app/assets/images/startsite/coldplay.jpg b/app/assets/images/startsite/coldplay.jpg new file mode 100644 index 0000000..277e436 Binary files /dev/null and b/app/assets/images/startsite/coldplay.jpg differ diff --git a/app/assets/images/startsite/foo-fighters.jpg b/app/assets/images/startsite/foo-fighters.jpg new file mode 100644 index 0000000..a2ed3eb Binary files /dev/null and b/app/assets/images/startsite/foo-fighters.jpg differ diff --git a/app/assets/images/startsite/katy-perry.jpg b/app/assets/images/startsite/katy-perry.jpg new file mode 100644 index 0000000..02504dd Binary files /dev/null and b/app/assets/images/startsite/katy-perry.jpg differ diff --git a/app/assets/images/startsite/lady-gaga.jpg b/app/assets/images/startsite/lady-gaga.jpg new file mode 100644 index 0000000..3e1dd23 Binary files /dev/null and b/app/assets/images/startsite/lady-gaga.jpg differ diff --git a/app/assets/images/startsite/muse.jpg b/app/assets/images/startsite/muse.jpg new file mode 100644 index 0000000..2544ec7 Binary files /dev/null and b/app/assets/images/startsite/muse.jpg differ diff --git a/app/assets/images/startsite/radiohead.jpg b/app/assets/images/startsite/radiohead.jpg new file mode 100644 index 0000000..a0084d7 Binary files /dev/null and b/app/assets/images/startsite/radiohead.jpg differ diff --git a/app/assets/images/startsite/red-hot-chili-peppers.jpg b/app/assets/images/startsite/red-hot-chili-peppers.jpg new file mode 100644 index 0000000..3e3584a Binary files /dev/null and b/app/assets/images/startsite/red-hot-chili-peppers.jpg differ diff --git a/app/assets/images/startsite/small/adele.jpg b/app/assets/images/startsite/small/adele.jpg new file mode 100644 index 0000000..dc0a2a5 Binary files /dev/null and b/app/assets/images/startsite/small/adele.jpg differ diff --git a/app/assets/images/startsite/small/arctic-monkeys.jpg b/app/assets/images/startsite/small/arctic-monkeys.jpg new file mode 100644 index 0000000..6ff480e Binary files /dev/null and b/app/assets/images/startsite/small/arctic-monkeys.jpg differ diff --git a/app/assets/images/startsite/small/beatles.jpg b/app/assets/images/startsite/small/beatles.jpg new file mode 100644 index 0000000..0c782da Binary files /dev/null and b/app/assets/images/startsite/small/beatles.jpg differ diff --git a/app/assets/images/startsite/small/coldplay.jpg b/app/assets/images/startsite/small/coldplay.jpg new file mode 100644 index 0000000..4c38cdc Binary files /dev/null and b/app/assets/images/startsite/small/coldplay.jpg differ diff --git a/app/assets/images/startsite/small/foo-fighters.jpg b/app/assets/images/startsite/small/foo-fighters.jpg new file mode 100644 index 0000000..cc221fd Binary files /dev/null and b/app/assets/images/startsite/small/foo-fighters.jpg differ diff --git a/app/assets/images/startsite/small/katy-perry.jpg b/app/assets/images/startsite/small/katy-perry.jpg new file mode 100644 index 0000000..17c13bb Binary files /dev/null and b/app/assets/images/startsite/small/katy-perry.jpg differ diff --git a/app/assets/images/startsite/small/lady-gaga.jpg b/app/assets/images/startsite/small/lady-gaga.jpg new file mode 100644 index 0000000..b6cc7ce Binary files /dev/null and b/app/assets/images/startsite/small/lady-gaga.jpg differ diff --git a/app/assets/images/startsite/small/muse.jpg b/app/assets/images/startsite/small/muse.jpg new file mode 100644 index 0000000..0b80308 Binary files /dev/null and b/app/assets/images/startsite/small/muse.jpg differ diff --git a/app/assets/images/startsite/small/radiohead.jpg b/app/assets/images/startsite/small/radiohead.jpg new file mode 100644 index 0000000..bf89e97 Binary files /dev/null and b/app/assets/images/startsite/small/radiohead.jpg differ diff --git a/app/assets/images/startsite/small/red-hot-chili-peppers.jpg b/app/assets/images/startsite/small/red-hot-chili-peppers.jpg new file mode 100644 index 0000000..1917888 Binary files /dev/null and b/app/assets/images/startsite/small/red-hot-chili-peppers.jpg differ diff --git a/app/assets/javascripts/ajax/album.js b/app/assets/javascripts/ajax/album.js new file mode 100644 index 0000000..5dee1a2 --- /dev/null +++ b/app/assets/javascripts/ajax/album.js @@ -0,0 +1,34 @@ + +function load_songs_from_album(obj){ + if($(obj).attr("loaded") == "true") + { + $('#album_box').fadeOut(200); + $(obj).removeAttr("loaded"); + } + else + { + $(obj).parent().parent().children().each(function(){ + $(this).children("a").removeAttr("loaded"); + }); + $(obj).attr("loaded", "true"); + artist = $(obj).parent().attr("artist"); + album = $(obj).parent().attr("album"); + + url = "/album_info"; + params = "artist="+artist+"&album="+album; + + album_request(url, params, obj); + } +} + +function show_songs_from_album(data, obj){ + $('#album_box').remove(); + $(obj).parent().prepend(data); + $('#album_box').fadeIn(200); + $('#album_box .wrap').jScrollPane(); + + $('#album_box li').each(function(){ + if(!$(this).has(".play").length) + $(this).prepend(''); + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/ajax/favourites.js b/app/assets/javascripts/ajax/favourites.js new file mode 100644 index 0000000..ab17c18 --- /dev/null +++ b/app/assets/javascripts/ajax/favourites.js @@ -0,0 +1,7 @@ +$(document).ready(function(){ + $('.heart').live("click", function(){ + var params = "id="+$('#content .tabs .content').attr('q'); + favourite_request(favourite_path, params); + }); + +}); \ No newline at end of file diff --git a/app/assets/javascripts/ajax/loadmore.js b/app/assets/javascripts/ajax/loadmore.js new file mode 100644 index 0000000..edb3475 --- /dev/null +++ b/app/assets/javascripts/ajax/loadmore.js @@ -0,0 +1,67 @@ +$(document).ready(function(){ + $('.more').live("click", function(){ + hide_flash(false); + hide_flash(true); + + more_hover_out(this); + loadmore(this); + }); +}); + + +function loadmore(obj){ + $(obj).parent().children('.list').attr("wanting","true"); + + size = $(obj).parent().find('li').size(); + tile = $(obj).parent().children('.list').attr("tile"); + artist = $(obj).parent().parent(".content").attr("artist"); + q = $(obj).parent().parent(".content").attr("q"); + + disable_more_button(obj); + + url = "/"+tile; + params = "size="+size+"&artist="+artist+"&q="+q; + + load_more_request(url, params); +} + +function append_to_list(ctnt){ + $list = $(".list[wanting=true]"); + var c=0; + $(ctnt).hide().appendTo($list); + + $list.children().each(function(){ + if($(this).is(":hidden")) + { + show_li(this, c); + c+=30; + } + }); + + $list.removeAttr("wanting"); + hide_flash(); + init_artist(); + enable_more_button(); +} + +function show_li(obj, c){ + setTimeout(function(){ + $(obj).show(); + }, 200+c); +} + + +function disable_more_button(obj){ + $(obj).die("click"); + $(obj).unbind('mouseenter mouseleave'); + $(obj).addClass("disabled"); + $(obj).html(''); +} + +function enable_more_button(){ + more_hover(); + $('.more').each(function(){ + $(this).removeClass("disabled"); + $(this).html('SHOW MORE'); + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/ajax/requests.js b/app/assets/javascripts/ajax/requests.js new file mode 100644 index 0000000..4cac973 --- /dev/null +++ b/app/assets/javascripts/ajax/requests.js @@ -0,0 +1,128 @@ +function load_more_request(link, params){ + cacheResponse = cacheRequest(link+params); + if(!cacheResponse) + { + console.info("=> Request to server"); + $.ajax({ + type: "GET", + dataType: "html", + url: link, + data: params, + error: function(){ + hide_flash(false); + show_flash(true); + enable_more_button(); + }, + success: function(data){ + cacheRequest(link+params, data); + append_to_list(data); + } + }); + } + else + { + console.info("=> Request to jQuery Object"); + append_to_list(cacheResponse); + } +} + +function favourite_request(link, params){ + $.ajax({ + type: "GET", + dataType: "html", + url: link, + data: params, + error: function(){ + hide_flash(false); + show_flash(true); + }, + success: function(data){ + $('#content .heart').addClass('loved'); + } + }); +} + +function load_site_request(link, params){ + changeDocumentTitle(link, params); + + // proof given params + params = (typeof params == "undefined" || typeof params == "boolean") ? "" : params; + show_flash(false); + + // request to object cache + if(link != user_path) + cacheResponse = cacheRequest(link+params); + else cacheResponse = false; + + hide_flash(true); // remove error messages if shown + if(!cacheResponse) + { + console.info("=> Request to server"); + $.ajax({ + type:"GET", + dataType:"html", + url: link + params, + data:"remote=true", + error: function(){ + hide_flash(false); + show_flash(true); + enable_more_button(); + }, + success: function(data){ + cacheRequest(link+params, data); + $("#content").html(data); + $("#content").ready(function(){ + hide_flash(false); + init_site(link); + }); + } + }); + } + else + { + console.info("=> Request to jQuery Object"); + $("#content").html(cacheResponse); + $("#content").ready(function(){ + hide_flash(false); + init_site(link); + }); + } +} + +function album_request(link, params, obj){ + hide_flash(true); + $.ajax({ + type: "GET", + dataType: "html", + url: link, + data: params, + error: function(){ + hide_flash(false); + show_flash(true); + //enable_more_button(); + }, + success: function(data){ + show_songs_from_album(data, obj); + } + }); +} + +function video_request(link, artist, track, play){ + var params = "artist="+artist+"&track="+track; + var dat; + $.ajax({ + type: "GET", + dataType: "html", + url: jQuery.trim(link), + data: params, + error: function(){ + hide_flash(false); + show_flash(true); + //enable_more_button(); + return null; + }, + success: function(data){ + videoRequestResponse(jQuery.trim(data), artist, track, play); + } + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/ajax/routes.js b/app/assets/javascripts/ajax/routes.js new file mode 100644 index 0000000..6338363 --- /dev/null +++ b/app/assets/javascripts/ajax/routes.js @@ -0,0 +1,39 @@ +// Artist Show Page +Path.map(hashbang+artist_path+":id").to(function(){ + load_site_request(artist_path, this.params['id']); +}); + +// Home Page +Path.map(hashbang+home_path).to(function(){ + load_site_request(home_path); +}); + +// Charts Page +Path.map(hashbang+charts_path).to(function(){ + load_site_request(charts_path); +}); + +// Search Page +Path.map(hashbang+search_path+":q").to(function(){ + load_site_request(search_path, this.params['q']); +}); + +// Sign Up Page +Path.map(hashbang+register_path).to(function(){ + load_site_request(register_path); +}); + +// Sign In Page +Path.map(hashbang+login_path).to(function(){ + load_site_request(login_path); +}); + +// Sign Out Page +Path.map(hashbang+logout_path).to(function(){ + load_site_request(logout_path); +}); + +// User Show Page +Path.map(hashbang+user_path+":id").to(function(){ + load_site_request(user_path, this.params['id']); +}); \ No newline at end of file diff --git a/app/assets/javascripts/animations/animations.js b/app/assets/javascripts/animations/animations.js new file mode 100644 index 0000000..10612ac --- /dev/null +++ b/app/assets/javascripts/animations/animations.js @@ -0,0 +1,53 @@ +function show_flash(error){ + $load = (error) ? $('#error') : $('#loading'); + if($load.is(":visible")) return false; + + $load.css({"top": "-40px", "opacity": "0"}).show(); + $load.animate({ + opacity: 1, + top: 0 + }, 300); + if (!error) $('#block').show().fadeTo(400, 0.3); +} + +function hide_flash(error){ + $load = (error) ? $('#error') : $('#loading'); + if($load.is(":hidden")) return false; + + $load.animate({ + opacity: 0, + top: -40 + }, 600, function(){$(this).hide()}); + + if (!error) $('#block').fadeTo(300, 0, function(){ $(this).hide();}); +} + + + +function more_hover(){ + $('.more').hover(function(){ + $(this).animate({ + backgroundColor: "#0086cc", + color: "#ffffff" + }, 200); + }, function(){ + more_hover_out(this); + }); +} + +function more_hover_out(obj){ + $(obj).stop().animate({ + backgroundColor: "#f4f6f9", + color: "#15191d" + }, 100); +} + +function init_playlist_scrollbar(){ + $('#fullscreen #playlist').jScrollPane(); + + $('#fullscreen #playlist').hover(function(){ + $('#fullscreen .jspVerticalBar').stop().fadeTo(300, 1); + }, function(){ + $('#fullscreen .jspVerticalBar').stop().fadeTo(200, 0.02); + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/animations/fullscreen.js b/app/assets/javascripts/animations/fullscreen.js new file mode 100644 index 0000000..6edd0d5 --- /dev/null +++ b/app/assets/javascripts/animations/fullscreen.js @@ -0,0 +1,52 @@ +$(document).ready(function() { + $('.full').live("click",function(){ + showFullscreen(false); + }); + $("#fullscreen_close").click(function(){ + showFullscreen(false); + }); +}); + +function showFullscreen(auto){ + /*if(auto && $('.full').hasClass("open")) + { + clearInterval(fullscreenInt); + return; + }*/ + + if($('.full').hasClass("open")) { + $('#fullscreen').css("top", 0); + $("#fullscreen").animate({ + marginTop: -400, + opacity: 0 + }, 500, function(){ + $('#ytPlayer').css("marginTop", -9999); + $("#site, #bg_stripe").show().animate({ + marginTop: 0, + opacity: 1 + }, 500); + $("#fullscreen_wrap").fadeTo(500, 0, function(){$(this).hide();}); + $("#fullscreen_close").fadeTo(500, 0); + }); + $('.full').removeClass("open"); + //fullscreenInt = setInterval ( "showFullscreen(true)", 15000 ); + } + else { + $('#fullscreen').css("top", 0); + $("#site, #bg_stripe").animate({ + marginTop: 400, + opacity: 0 + }, 500, function(){ + $(this).hide(); + $('#ytPlayer').css("marginTop", 0); + $("#fullscreen").css("marginTop", -100).show().animate({ + marginTop: 120, + opacity: 1 + }, 500); + init_playlist_scrollbar(); + $("#fullscreen_wrap").fadeTo(1000, 0.5); + $("#fullscreen_close").fadeTo(500, 1); + }); + $('.full').addClass("open"); + } +} \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..06e7710 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,18 @@ +//= require jquery +//= require jquery_ujs +//= require_tree ./helper +//= require_tree ./plugins + +//= require config +//= require pinify +//= require play +//= require playlist +//= require home +//= require player +//= require search +//= require store +//= require caching +//= require title +//= require_tree ./ajax +//= require_tree ./animations +//= require layout diff --git a/app/assets/javascripts/caching.js b/app/assets/javascripts/caching.js new file mode 100644 index 0000000..af43ad3 --- /dev/null +++ b/app/assets/javascripts/caching.js @@ -0,0 +1,9 @@ +function cacheRequest(key, value) +{ + value = (typeof value == "undefined" || typeof value == "boolean") ? false : value; + + if(!value) + return (jQuery.data(document.body, key) == null) ? false : jQuery.data(document.body, key); + else + return jQuery.data(document.body, key, value); +} \ No newline at end of file diff --git a/app/assets/javascripts/config.js b/app/assets/javascripts/config.js new file mode 100644 index 0000000..dcb50f7 --- /dev/null +++ b/app/assets/javascripts/config.js @@ -0,0 +1,42 @@ + +// Default paths for application +// DON'T CHANGE!!! +var hashbang = "#!"; +var artist_path = "/artists/"; +var home_path = "/home"; +var charts_path = "/charts"; +var search_path = "/search/"; +var search_autocomplete_path = "/autocomplete/"; +var user_path = "/users/"; +var profile_path = "/profile"; +var register_path = "/register"; +var login_path = "/login"; +var logout_path = "/logout"; +var favourite_path = "/favourize"; +var search_video_path = "/search_video"; + +// root title +var documentTitle = "9minutes"; + +$(document).ready(function(){ + // home site + Path.root("#!/home"); + + // initialize path listener + Path.listen(); + + // redirect non existent links + // to the 404 page + Path.rescue(function(){ + // TODO: link to 404 page + alert("404: Route Not Found"); + }); + + // Setup default AJAX values + // for future requests + $.ajaxSetup({ + + // 30sec timeout for each request + // timeout: 30000 + }); +}); \ No newline at end of file diff --git a/app/assets/javascripts/helper/fauxconsole.js b/app/assets/javascripts/helper/fauxconsole.js new file mode 100644 index 0000000..7079ce1 --- /dev/null +++ b/app/assets/javascripts/helper/fauxconsole.js @@ -0,0 +1 @@ +/* Faux Console by Chris Heilmann http://wait-till-i.com */ if(!window.console){var console={init:function(){console.d=document.createElement('div');document.body.appendChild(console.d);var a=document.createElement('a');a.href='javascript:console.hide()';a.innerHTML='close';console.d.appendChild(a);var a=document.createElement('a');a.href='javascript:console.clear();';a.innerHTML='clear';console.d.appendChild(a);var id='fauxconsole';if(!document.getElementById(id)){console.d.id=id;}console.hide();},hide:function(){console.d.style.display='none';},show:function(){console.d.style.display='block';},log:function(o){console.d.innerHTML+='
'+o;console.show();},clear:function(){console.d.parentNode.removeChild(console.d);console.init();console.show();},/*Simon Willison rules*/addLoadEvent:function(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}func();}};}};console.addLoadEvent(console.init);} \ No newline at end of file diff --git a/app/assets/javascripts/helper/foreach.js b/app/assets/javascripts/helper/foreach.js new file mode 100644 index 0000000..9848999 --- /dev/null +++ b/app/assets/javascripts/helper/foreach.js @@ -0,0 +1 @@ +Array.prototype.foreach = function( callback ) { for( var k=0; k
'); + }); + }); +} + + + +function init_artist(){ + add_controls(); + add_more_button(); + new_albums(); + margin_fixes(); + remove_links_from_description(); +} + + +// get index of an element +function get_index(obj){ + return $(obj).parent().children().index(obj); +} + + +// redirect to submit +function submit_redirect(obj){ + $(obj).next("input[type=submit]").click(); +} + + +function add_more_button(){ + $('.list').each(function(){ + if($(this).hasClass("andmore") && !$(this).parent().has(".more").length) + $(this).after('
SHOW MORE'); + }); + more_hover(); +} + + +function margin_fixes(){ + $('.list.related li:nth-child(3n)').css("marginRight", 0); + $('.list.related li img').each(function(){ + $(this).imgscale({ scale: "fill"}); + }); +} + + + +function remove_links_from_description(){ + $("#artist_info a").each(function(){ + $text = $(this).html(); + $(this).after($text).remove(); + }); +} + + +function new_albums(){ + album_hover(); + //album_add_show_songs_button(); +} + + +function album_hover(){ + $('.albums .img').hover(function(){ + if(!$(this).children(".playall").hasClass("playall")) + $(this).append('
'); + $(this).find('.playall').fadeIn(200); + }, function(){ + $(this).find('.playall').stop().fadeOut(300, function(){ $(this).remove(); }); + }); +} + +function album_add_show_songs_button(){ + $('.albums > li').each(function(){ + if(!$(this).has(".songsbtn").length) + $(this).append('Songs'); + }); +} + + +function init_site(link){ + Path.listen(); + + switch(link) { + case artist_path: + init_tabs(); + init_artist(); + break; + case home_path: + init_home(); + set_active_navigation(home_path); + break; + case charts_path: + case search_path: + init_tabs(); + add_more_button(); + add_controls(); + init_autocomplete(); + set_active_navigation(charts_path); + break; + case user_path: + init_tabs(); + set_active_navigation(profile_path); + break; + case register_path: + init_tabs(); + set_active_navigation(register_path); + break; + case login_path: + init_tabs(); + set_active_navigation(home_path); + break; + } +} + + +function set_active_navigation(text){ + text = text.replace("/",""); + $('#navigation li.active').removeClass("active"); + $('#navigation li').each(function(){ + if($(this).children("a").html() == text) + $(this).addClass("active"); + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/pinify.js b/app/assets/javascripts/pinify.js new file mode 100644 index 0000000..faab708 --- /dev/null +++ b/app/assets/javascripts/pinify.js @@ -0,0 +1,61 @@ + +// pinify 9minutes +// Jumplist entries, media controls, ... +// for IE9 + +$(document).ready(function(){ + + // Make site pinable + $("head").pinify({ + applicationName: "9minutes", + favIcon: "/favicon.ico", + navColor: "#0294df", + startUrl: "http://localhost:3000", + tooltip: "9minutes", + window: "width=1024;height=600" + }); + + // add jumplist + var stepsArray = ["Charts 1", "Charts 2"]; + gemerateJumplist(stepsArray, "Charts"); + + + // Media controls + $.pinify.createThumbbarButtons({ + buttons: [{ + icon: "/favicon.ico", + name: "Twitter", + click: function () { + alert("Link 1"); + } + }, + { + icon: "/favicon.ico", + name: "Facebook", + click: function () { + alert("Link 2"); + } + }] + }); +}); + + +function gemerateJumplist(arr, title){ + var stepsListArray = []; + + // Generate jumplist for navigation + arr.foreach(function (key, val) { + var item = { + 'name': val, + 'url': "http://localhost:3000", + 'icon': "/favicon.ico" + }; + stepsListArray.push(item); + }); + + // Apply jumplist entries + $.pinify.addJumpList({ + title: title, + items: stepsListArray + }); +} \ No newline at end of file diff --git a/app/assets/javascripts/play.js b/app/assets/javascripts/play.js new file mode 100644 index 0000000..f23856e --- /dev/null +++ b/app/assets/javascripts/play.js @@ -0,0 +1,31 @@ +$(document).ready(function(){ + + $('.playsong').live("click", function(){ + videoRequest(this, true); + }); + $('.addsong').live("click", function(){ + videoRequest(this, false); + }); + +}); + +function videoRequest(me, play) { + var artist = $(me).parent().attr("artist"); + var track = $(me).parent().attr("track"); + video_request(search_video_path, artist, track, play); +} + +function videoRequestResponse(data, artist, track, play) { + if(play) + playTrack(data, artist, track); + else + addTrack(data, artist, track, true); +} + + +function playTrack(url, artist, track){ + loadVideo(url); + $('#fullscreen h2').text(artist); + $('#fullscreen h1').text(track); + // $('#fullscreen +} \ No newline at end of file diff --git a/app/assets/javascripts/player.js b/app/assets/javascripts/player.js new file mode 100644 index 0000000..69f638e --- /dev/null +++ b/app/assets/javascripts/player.js @@ -0,0 +1,29 @@ +// CLICK HANDLER +$(document).ready(function(){ + $('.play').live('click', playVideo); + $('.pause').live('click', pauseVideo); + + $('.volume').live('click', muteVideo); + $('.novolume').live('click', unMuteVideo); + + + $('#scrubbar').rangeinput({ + progress: true, + speed: 200 + }); +}); + + +function playControl(play){ + if(play) + $('.play').addClass("pause").removeClass("play"); + else + $('.pause').addClass("play").removeClass("pause"); +} + +function volumeControl(mute){ + if(mute) + $('.volume').addClass("novolume").removeClass("volume"); + else + $('.novolume').addClass("volume").removeClass("novolume"); +} \ No newline at end of file diff --git a/app/assets/javascripts/playlist.js b/app/assets/javascripts/playlist.js new file mode 100644 index 0000000..2e706a0 --- /dev/null +++ b/app/assets/javascripts/playlist.js @@ -0,0 +1,73 @@ +var fullscreenInt; + +$(document).ready(function(){ + $('#playlist .el').live('click', function(){ + playTrack(getVid(this), getArtist(this), getTrack(this)); + }); + + $('.player .forward').live('click', function(){ + nextVideo(); + }); + $('.player .backward').live('click', function(){ + prevVideo(); + }); +}); + +function initPlaylist() { + storage = $.store.get("9minutesPlaylist"); + if(storage !== undefined) { + size = storage.length; + for(i = 0; i < size; i++) { + addTrack(storage[i].videoid, storage[i].artist, storage[i].title, false); + } + } + + //if($('#playlist .el').size() > 0) + // fullscreenInt = setInterval ( "showFullscreen(true)", 15000 ); +} + +function savePlaylist() { + var tracks = []; + $('#playlist .el').each(function(i) { + tracks[i] = { + title : getTrack(this), + artist : getArtist(this), + videoid : getVid(this) + } + }); + + $.store.set("9minutesPlaylist", tracks); +} + +function addTrack(url, artist, track, save){ + var appendData = "

"+track+"
"+artist+"

"; + if(save) + { + $('#playlist .jspPane').append(appendData); + savePlaylist(); + } + else + $('#playlist').append(appendData); +} + + + +function getArtist(obj) { + return $(obj).children('h3').children('span').text(); +} +function getTrack(obj) { + return $(obj).children('h3').children('div').text(); +} +function getVid(obj) { + return $(obj).attr('vid'); +} + + +function setCurrentSong(vid) { + var me = $('#playlist .el[vid="'+vid+'"]'); + var id = $(me).parent().children().index(me); + $('#playlist .el').each(function(){ + $(this).removeClass("active"); + }); + $('#playlist .el:eq('+id+')').addClass("active"); +} \ No newline at end of file diff --git a/app/assets/javascripts/plugins/autocomplete.js b/app/assets/javascripts/plugins/autocomplete.js new file mode 100644 index 0000000..73ccbb6 --- /dev/null +++ b/app/assets/javascripts/plugins/autocomplete.js @@ -0,0 +1,843 @@ +/* + * jQuery Autocomplete plugin 1.2.1 + * + * Copyright (c) 2009 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * With small modifications by Alfonso Gómez-Arzola. + * See changelog for details. + * + */ + +;(function($) { + +$.fn.extend({ + autocomplete: function(urlOrData, options) { + var isUrl = typeof urlOrData == "string"; + options = $.extend({}, $.Autocompleter.defaults, { + url: isUrl ? urlOrData : null, + data: isUrl ? null : urlOrData, + delay: isUrl ? $.Autocompleter.defaults.delay : 10, + max: options && !options.scroll ? 10 : 150 + }, options); + + // if highlight is set to false, replace it with a do-nothing function + options.highlight = options.highlight || function(value) { return value; }; + + // if the formatMatch option is not specified, then use formatItem for backwards compatibility + options.formatMatch = options.formatMatch || options.formatItem; + + return this.each(function() { + new $.Autocompleter(this, options); + }); + }, + result: function(handler) { + return this.bind("result", handler); + }, + search: function(handler) { + return this.trigger("search", [handler]); + }, + flushCache: function() { + return this.trigger("flushCache"); + }, + setOptions: function(options){ + return this.trigger("setOptions", [options]); + }, + unautocomplete: function() { + return this.trigger("unautocomplete"); + } +}); + +$.Autocompleter = function(input, options) { + + var KEY = { + UP: 38, + DOWN: 40, + DEL: 46, + TAB: 9, + RETURN: 13, + ESC: 27, + COMMA: 188, + PAGEUP: 33, + PAGEDOWN: 34, + BACKSPACE: 8 + }; + + var globalFailure = null; + if(options.failure != null && typeof options.failure == "function") { + globalFailure = options.failure; + } + + // Create $ object for input element + var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); + + var timeout; + var previousValue = ""; + var cache = $.Autocompleter.Cache(options); + var hasFocus = 0; + var lastKeyPressCode; + var config = { + mouseDownOnSelect: false + }; + var select = $.Autocompleter.Select(options, input, selectCurrent, config); + + var blockSubmit; + + // prevent form submit in opera when selecting with return key + $.browser.opera && $(input.form).bind("submit.autocomplete", function() { + if (blockSubmit) { + blockSubmit = false; + return false; + } + }); + + // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all + $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { + // a keypress means the input has focus + // avoids issue where input had focus before the autocomplete was applied + hasFocus = 1; + // track last key pressed + lastKeyPressCode = event.keyCode; + switch(event.keyCode) { + + case KEY.UP: + if ( select.visible() ) { + event.preventDefault(); + select.prev(); + } else { + onChange(0, true); + } + break; + + case KEY.DOWN: + if ( select.visible() ) { + event.preventDefault(); + select.next(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEUP: + if ( select.visible() ) { + event.preventDefault(); + select.pageUp(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEDOWN: + if ( select.visible() ) { + event.preventDefault(); + select.pageDown(); + } else { + onChange(0, true); + } + break; + + // matches also semicolon + case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: + case KEY.TAB: + case KEY.RETURN: + if( selectCurrent() ) { + // stop default to prevent a form submit, Opera needs special handling + event.preventDefault(); + blockSubmit = true; + return false; + } + break; + + case KEY.ESC: + select.hide(); + break; + + default: + clearTimeout(timeout); + timeout = setTimeout(onChange, options.delay); + break; + } + }).focus(function(){ + // track whether the field has focus, we shouldn't process any + // results if the field no longer has focus + hasFocus++; + }).blur(function() { + hasFocus = 0; + if (!config.mouseDownOnSelect) { + hideResults(); + } + }).click(function() { + // show select when clicking in a focused field + // but if clickFire is true, don't require field + // to be focused to begin with; just show select + if( options.clickFire ) { + if ( !select.visible() ) { + onChange(0, true); + } + } else { + if ( hasFocus++ > 1 && !select.visible() ) { + onChange(0, true); + } + } + }).bind("search", function() { + // TODO why not just specifying both arguments? + var fn = (arguments.length > 1) ? arguments[1] : null; + function findValueCallback(q, data) { + var result; + if( data && data.length ) { + for (var i=0; i < data.length; i++) { + if( data[i].result.toLowerCase() == q.toLowerCase() ) { + result = data[i]; + break; + } + } + } + if( typeof fn == "function" ) fn(result); + else $input.trigger("result", result && [result.data, result.value]); + } + $.each(trimWords($input.val()), function(i, value) { + request(value, findValueCallback, findValueCallback); + }); + }).bind("flushCache", function() { + cache.flush(); + }).bind("setOptions", function() { + $.extend(true, options, arguments[1]); + // if we've updated the data, repopulate + if ( "data" in arguments[1] ) + cache.populate(); + }).bind("unautocomplete", function() { + select.unbind(); + $input.unbind(); + $(input.form).unbind(".autocomplete"); + }); + + + function selectCurrent() { + var selected = select.selected(); + if( !selected ) + return false; + + var v = selected.result; + previousValue = v; + + if ( options.multiple ) { + var words = trimWords($input.val()); + if ( words.length > 1 ) { + var seperator = options.multipleSeparator.length; + var cursorAt = $(input).selection().start; + var wordAt, progress = 0; + $.each(words, function(i, word) { + progress += word.length; + if (cursorAt <= progress) { + wordAt = i; + return false; + } + progress += seperator; + }); + words[wordAt] = v; + // TODO this should set the cursor to the right position, but it gets overriden somewhere + //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); + v = words.join( options.multipleSeparator ); + } + v += options.multipleSeparator; + } + + $input.val(v); + hideResultsNow(); + $input.trigger("result", [selected.data, selected.value]); + return true; + } + + function onChange(crap, skipPrevCheck) { + if( lastKeyPressCode == KEY.DEL ) { + select.hide(); + return; + } + + var currentValue = $input.val(); + + if ( !skipPrevCheck && currentValue == previousValue ) + return; + + previousValue = currentValue; + + currentValue = lastWord(currentValue); + if ( currentValue.length >= options.minChars) { + $input.addClass(options.loadingClass); + if (!options.matchCase) + currentValue = currentValue.toLowerCase(); + request(currentValue, receiveData, hideResultsNow); + } else { + stopLoading(); + select.hide(); + } + $inval = escape($input.val()); + $input.next("a").attr("href", hashbang+search_path+$inval); + }; + + function trimWords(value) { + if (!value) + return [""]; + if (!options.multiple) + return [$.trim(value)]; + return $.map(value.split(options.multipleSeparator), function(word) { + return $.trim(value).length ? $.trim(word) : null; + }); + } + + function lastWord(value) { + if ( !options.multiple ) + return value; + var words = trimWords(value); + if (words.length == 1) + return words[0]; + var cursorAt = $(input).selection().start; + if (cursorAt == value.length) { + words = trimWords(value) + } else { + words = trimWords(value.replace(value.substring(cursorAt), "")); + } + return words[words.length - 1]; + } + + // fills in the input box w/the first match (assumed to be the best match) + // q: the term entered + // sValue: the first matching result + function autoFill(q, sValue){ + // autofill in the complete box w/the first match as long as the user hasn't entered in more data + // if the last user key pressed was backspace, don't autofill + if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { + // fill in the value (keep the case the user has typed) + $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); + // select the portion of the value not typed by the user (so the next character will erase) + $(input).selection(previousValue.length, previousValue.length + sValue.length); + } + }; + + function hideResults() { + clearTimeout(timeout); + timeout = setTimeout(hideResultsNow, 200); + }; + + function hideResultsNow() { + var wasVisible = select.visible(); + select.hide(); + clearTimeout(timeout); + stopLoading(); + if (options.mustMatch) { + // call search and run callback + $input.search( + function (result){ + // if no value found, clear the input box + if( !result ) { + if (options.multiple) { + var words = trimWords($input.val()).slice(0, -1); + $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); + } + else { + $input.val( "" ); + $input.trigger("result", null); + } + } + } + ); + } + }; + + function receiveData(q, data) { + if ( data && data.length && hasFocus ) { + stopLoading(); + select.display(data, q); + autoFill(q, data[0].value); + select.show(); + } else { + hideResultsNow(); + } + }; + + function request(term, success, failure) { + if (!options.matchCase) + term = term.toLowerCase(); + var data = cache.load(term); + // recieve the cached data + if (data && data.length) { + success(term, data); + // if an AJAX url has been supplied, try loading the data now + } else if( (typeof options.url == "string") && (options.url.length > 0) ){ + + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + $.ajax({ + // try to leverage ajaxQueue plugin to abort previous requests + mode: "abort", + // limit abortion to this input + port: "autocomplete" + input.name, + dataType: options.dataType, + url: options.url, + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams), + success: function(data) { + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed); + success(term, parsed); + } + }); + } else { + // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match + select.emptyList(); + if(globalFailure != null) { + globalFailure(); + } + else { + failure(term); + } + } + }; + + function parse(data) { + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: options.formatResult && options.formatResult(row, row[0]) || row[0] + }; + } + } + return parsed; + }; + + function stopLoading() { + $input.removeClass(options.loadingClass); + }; + +}; + +$.Autocompleter.defaults = { + inputClass: "ac_input", + resultsClass: "ac_results", + loadingClass: "ac_loading", + minChars: 1, + delay: 400, + matchCase: false, + matchSubset: true, + matchContains: false, + cacheLength: 100, + max: 1000, + mustMatch: false, + extraParams: {}, + selectFirst: true, + formatItem: function(row) { return row[0]; }, + formatMatch: null, + autoFill: false, + width: 0, + multiple: false, + multipleSeparator: " ", + inputFocus: true, + clickFire: false, + highlight: function(value, term) { + return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); + }, + scroll: true, + scrollHeight: 180, + scrollJumpPosition: true +}; + +$.Autocompleter.Cache = function(options) { + + var data = {}; + var length = 0; + + function matchSubset(s, sub) { + if (!options.matchCase) + s = s.toLowerCase(); + var i = s.indexOf(sub); + if (options.matchContains == "word"){ + i = s.toLowerCase().search("\\b" + sub.toLowerCase()); + } + if (i == -1) return false; + return i == 0 || options.matchContains; + }; + + function add(q, value) { + if (length > options.cacheLength){ + flush(); + } + if (!data[q]){ + length++; + } + data[q] = value; + } + + function populate(){ + if( !options.data ) return false; + // track the matches + var stMatchSets = {}, + nullData = 0; + + // no url was specified, we need to adjust the cache length to make sure it fits the local data store + if( !options.url ) options.cacheLength = 1; + + // track all options for minChars = 0 + stMatchSets[""] = []; + + // loop through the array and create a lookup structure + for ( var i = 0, ol = options.data.length; i < ol; i++ ) { + var rawValue = options.data[i]; + // if rawValue is a string, make an array otherwise just reference the array + rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; + + var value = options.formatMatch(rawValue, i+1, options.data.length); + if ( value === false ) + continue; + + var firstChar = value.charAt(0).toLowerCase(); + // if no lookup array for this character exists, look it up now + if( !stMatchSets[firstChar] ) + stMatchSets[firstChar] = []; + + // if the match is a string + var row = { + value: value, + data: rawValue, + result: options.formatResult && options.formatResult(rawValue) || value + }; + + // push the current match into the set list + stMatchSets[firstChar].push(row); + + // keep track of minChars zero items + if ( nullData++ < options.max ) { + stMatchSets[""].push(row); + } + }; + + // add the data items to the cache + $.each(stMatchSets, function(i, value) { + // increase the cache size + options.cacheLength++; + // add to the cache + add(i, value); + }); + } + + // populate any existing data + setTimeout(populate, 25); + + function flush(){ + data = {}; + length = 0; + } + + return { + flush: flush, + add: add, + populate: populate, + load: function(q) { + if (!options.cacheLength || !length) + return null; + /* + * if dealing w/local data and matchContains than we must make sure + * to loop through all the data collections looking for matches + */ + if( !options.url && options.matchContains ){ + // track all matches + var csub = []; + // loop through all the data grids for matches + for( var k in data ){ + // don't search through the stMatchSets[""] (minChars: 0) cache + // this prevents duplicates + if( k.length > 0 ){ + var c = data[k]; + $.each(c, function(i, x) { + // if we've got a match, add it to the array + if (matchSubset(x.value, q)) { + csub.push(x); + } + }); + } + } + return csub; + } else + // if the exact item exists, use it + if (data[q]){ + return data[q]; + } else + if (options.matchSubset) { + for (var i = q.length - 1; i >= options.minChars; i--) { + var c = data[q.substr(0, i)]; + if (c) { + var csub = []; + $.each(c, function(i, x) { + if (matchSubset(x.value, q)) { + csub[csub.length] = x; + } + }); + return csub; + } + } + } + return null; + } + }; +}; + +$.Autocompleter.Select = function (options, input, select, config) { + var CLASSES = { + ACTIVE: "ac_over" + }; + + var listItems, + active = -1, + data, + term = "", + needsInit = true, + element, + list; + + // Create results + function init() { + if (!needsInit) + return; + element = $("
") + .hide() + .addClass(options.resultsClass) + .css("position", "absolute") + .appendTo(document.body) + .hover(function(event) { + // Browsers except FF do not fire mouseup event on scrollbars, resulting in mouseDownOnSelect remaining true, and results list not always hiding. + if($(this).is(":visible")) { + input.focus(); + } + config.mouseDownOnSelect = false; + }); + + list = $("