synergy_default_theme 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. data/LICENSE +23 -0
  2. data/README.md +4 -0
  3. data/Rakefile +31 -0
  4. data/app/controllers/home_controller.rb +10 -0
  5. data/app/controllers/products_controller_decorator.rb +3 -0
  6. data/app/helpers/base_helper_decorator.rb +14 -0
  7. data/app/helpers/orders_helper_decorator.rb +5 -0
  8. data/app/helpers/product_helper_decorator.rb +22 -0
  9. data/app/helpers/taxons_helper_decorator.rb +7 -0
  10. data/app/models/page_sweeper.rb +20 -0
  11. data/app/models/tracker_sweeper.rb +20 -0
  12. data/app/views/admin/reviews/index.html.erb +42 -0
  13. data/app/views/admin/taxonomies/_list.html.erb +19 -0
  14. data/app/views/admin/taxonomies/_show_on_homepage_field.html.erb +4 -0
  15. data/app/views/checkout/_delivery.html.erb +25 -0
  16. data/app/views/checkout/_payment.html.erb +34 -0
  17. data/app/views/gateway/robokassa/show.html.erb +22 -0
  18. data/app/views/home/index.html.erb +11 -0
  19. data/app/views/layouts/spree_application.html.erb +110 -0
  20. data/app/views/orders/_advanced_cart.html.erb +45 -0
  21. data/app/views/products/_cart_form.html.erb +59 -0
  22. data/app/views/products/_eot_includes.html.erb +27 -0
  23. data/app/views/products/_image.html.erb +8 -0
  24. data/app/views/products/_properties.html.erb +12 -0
  25. data/app/views/products/_thumbnails.html.erb +36 -0
  26. data/app/views/products/show.html.erb +146 -0
  27. data/app/views/shared/_like_buttons.html.erb +27 -0
  28. data/app/views/shared/_login_bar.html.erb +26 -0
  29. data/app/views/shared/_order_details.html.erb +50 -0
  30. data/app/views/shared/_products.html.erb +42 -0
  31. data/app/views/shared/_rating.html.erb +8 -0
  32. data/app/views/shared/_reviews.html.erb +40 -0
  33. data/app/views/shared/_search.html.erb +3 -0
  34. data/app/views/shared/_synergy_compare_products_js.html.erb +51 -0
  35. data/app/views/shared/_taxonomies.html.erb +16 -0
  36. data/config/initializers/advanced_cart.rb +3 -0
  37. data/config/initializers/constants.rb +3 -0
  38. data/config/initializers/like_buttons.rb +1 -0
  39. data/config/locales/ru.yml +22 -0
  40. data/config/routes.rb +4 -0
  41. data/db/migrate/20110330125354_add_show_on_main_page_flag_to_taxonomies.rb +9 -0
  42. data/db/migrate/20110404120925_change_column_title_in_reviews.rb +13 -0
  43. data/lib/spree_compare_products_hooks.rb +15 -0
  44. data/lib/spree_reviews_hook.rb +24 -0
  45. data/lib/synergy_default_theme.rb +39 -0
  46. data/lib/synergy_default_theme_hooks.rb +5 -0
  47. data/lib/tasks/install.rake +25 -0
  48. data/lib/tasks/synergy_default_theme.rake +1 -0
  49. data/public/images/bubblepopup_bg.png +0 -0
  50. data/public/images/bubblepopup_bottom.png +0 -0
  51. data/public/images/bubblepopup_top.png +0 -0
  52. data/public/images/button_long.png +0 -0
  53. data/public/images/button_short.png +0 -0
  54. data/public/images/cart.png +0 -0
  55. data/public/images/cart_th_bg.png +0 -0
  56. data/public/images/checkout.png +0 -0
  57. data/public/images/close_button.png +0 -0
  58. data/public/images/facebook_32.png +0 -0
  59. data/public/images/footer_panel.png +0 -0
  60. data/public/images/google_32.png +0 -0
  61. data/public/images/header_panel.png +0 -0
  62. data/public/images/libra.png +0 -0
  63. data/public/images/login_bar_bg.png +0 -0
  64. data/public/images/logo.png +0 -0
  65. data/public/images/noimage/product.jpg +0 -0
  66. data/public/images/noimage/small.jpg +0 -0
  67. data/public/images/red_button_bg.png +0 -0
  68. data/public/images/remove_comparable.png +0 -0
  69. data/public/images/search_button.png +0 -0
  70. data/public/images/search_textinput.png +0 -0
  71. data/public/images/search_textinput_active.png +0 -0
  72. data/public/images/star.png +0 -0
  73. data/public/images/star_orange.png +0 -0
  74. data/public/images/star_white.png +0 -0
  75. data/public/images/table_th1_34.png +0 -0
  76. data/public/images/twitter_32.png +0 -0
  77. data/public/images/vkontakte_32.png +0 -0
  78. data/public/images/zoom.png +0 -0
  79. data/public/javascripts/jquery.tools.min.js +23 -0
  80. data/public/javascripts/product.js +64 -0
  81. data/public/javascripts/product_simple.js +54 -0
  82. data/public/stylesheets/style.css +965 -0
  83. data/spec/spec_helper.rb +30 -0
  84. data/synergy_default_theme.gemspec +23 -0
  85. metadata +177 -0
@@ -0,0 +1,42 @@
1
+ <%
2
+ paginated_products = @searcher.products if params.key?(:keywords)
3
+ paginated_products ||= products
4
+ %>
5
+ <% if products.empty? %>
6
+ <%= t(:no_products_found) %>
7
+ <% elsif params.key?(:keywords) %>
8
+ <h3><%= t(:search_results, :keywords => h(params[:keywords])) %></h3>
9
+ <% end %>
10
+
11
+ <% if products.any? %>
12
+ <ul class="product-listing">
13
+ <% products.each do |product| %>
14
+ <% if Spree::Config[:show_zero_stock_products] || product.has_stock? %>
15
+ <li id="product_<%= product.id %>">
16
+ <%= hook :products_list_item, {:product => product} do %>
17
+ <%= link_to raw(product.name), product, :class => 'product-name' %>
18
+ <%= hook :products_list_item_image, {:product => product} do %>
19
+ <div class="product-image-wrapper">
20
+ <%= link_to small_image(product), product %>
21
+ </div>
22
+ <% end %>
23
+ <% if defined?(SpreeReviews) %>
24
+ <div align="center" style="height: 15px;"><%= render 'shared/rating', :product => product %></div>
25
+ <% end %>
26
+ <%= link_to raw("<span class='price selling'>#{product_price(product)}</span>"), product, :class => 'info' %>
27
+ <% end %>
28
+ </li>
29
+ <% end %>
30
+ <% end %>
31
+ </ul>
32
+ <% end %>
33
+
34
+ <% if paginated_products.respond_to?(:total_pages)
35
+ params.delete(:search)
36
+ params.delete(:taxon)
37
+ %>
38
+ <%= will_paginate(paginated_products,
39
+ :previous_label => "&#171; #{t('previous')}",
40
+ :next_label => "#{t('next')} &#187;") %>
41
+ <% end %>
42
+
@@ -0,0 +1,8 @@
1
+ <% content_for :head do %>
2
+ <%= stylesheet_link_tag 'reviews.css' %>
3
+ <% end %>
4
+ <% stars = product.get_stars %>
5
+ <div title="<%# txt_stars(stars[0]) %>" class="rating-stars-container">
6
+ <%= render :partial => "reviews/stars", :locals => {:stars => stars[0]} %>
7
+ </div>
8
+
@@ -0,0 +1,40 @@
1
+ <div id="reviews">
2
+ <a name="reviews_anc"></a>
3
+ <h3><%= t('review_header') %></h3>
4
+
5
+ <div style="margin-bottom: 2em">
6
+ <a id="add_review_link" href="#">Добавить отзыв</a>
7
+ </div>
8
+
9
+ <div id="add_review_container" style="display: none">
10
+ <%= render 'reviews/form', { :product => @product, :review => Review.new } %>
11
+ </div>
12
+
13
+ <hr class="review_hr" style="" />
14
+
15
+ <a name="reviews_list"></a>
16
+ <% for review in @product.reviews.approval_filter %>
17
+ <%= render :partial => 'shared/review', :locals => {:review => review} %>
18
+ <% end %>
19
+ </div>
20
+
21
+ <script type="text/javascript">
22
+ $(function() {
23
+ $('#new_review').validate({
24
+ rules: {
25
+ 'review[review]': {
26
+ required: true
27
+ },
28
+ 'review[rating]': {
29
+ required: true
30
+ }
31
+ },
32
+ messages: {
33
+ 'review[rating]': {
34
+ required: 'Оцените товар'
35
+ }
36
+ }
37
+ });
38
+ });
39
+ </script>
40
+
@@ -0,0 +1,3 @@
1
+ <%= form_tag products_url, :method => :get do %>
2
+ <%= text_field_tag :keywords, params[:keywords] %><%= submit_tag t(:search), :name => nil, :id => 'keywords_submit' %>
3
+ <% end %>
@@ -0,0 +1,51 @@
1
+ <%= javascript_include_tag 'http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js' %>
2
+
3
+ <script type="text/javascript">
4
+ $(function() {
5
+ var cp_wrapper = $('#comparable_products_wrapper').detach();
6
+ $('#tooltip_content').append(cp_wrapper);
7
+
8
+ jtooltip = $('#compare_products').tooltip({
9
+ position: 'bottom center',
10
+ events: { def: 'none,none' },
11
+ delay: 200000
12
+ }).data('tooltip');
13
+
14
+ $('#compare_products').click(function(e) {
15
+ if (jtooltip.isShown()) {
16
+ hideComparePopup();
17
+ }
18
+ else {
19
+ showComparePopup();
20
+ }
21
+ e.preventDefault();
22
+ });
23
+
24
+ $("#compare_products").html("<%= t(:compare_products, :scope => :compare_products, :count => @comparable_products.count) %>");
25
+
26
+ $("#compare_products_link a").addClass('button');
27
+ $("#log_in_link").overlay({
28
+ mask: {
29
+ color: 'black',
30
+ opacity: 0.3
31
+ }
32
+ });
33
+ });
34
+
35
+ function showComparePopup() {
36
+ jtooltip.show();
37
+ $("#compare_products").addClass('shown');
38
+ }
39
+
40
+ function hideComparePopup() {
41
+ jtooltip.hide();
42
+ $("#compare_products").removeClass('shown');
43
+ }
44
+
45
+ function onAddCompareProduct() {
46
+ showComparePopup();
47
+ }
48
+ function onRemoveCompareProduct() {
49
+ showComparePopup();
50
+ }
51
+ </script>
@@ -0,0 +1,16 @@
1
+ <% cache ['taxonomies', @taxon], :expires_in => SHORT_INTERVAL do %>
2
+ <div id="taxonomies" class="sidebar-item">
3
+ <% get_taxonomies.select{|t| !t.show_on_homepage? }.each do |taxonomy| %>
4
+ <h2<%== ' class="current"' if @taxon && @taxon == taxonomy.root %>>
5
+ <%= link_to taxonomy.name, seo_url(taxonomy.root), :class => 'root' %>
6
+ </h2>
7
+ <ul class="nav-list">
8
+ <% taxonomy.root.children.each do |taxon| %>
9
+ <li<%== ' class="current"' if @taxon and ([@taxon] + @taxon.ancestors).include?(taxon) %>>
10
+ <%= link_to taxon.name, seo_url(taxon) %>
11
+ </li>
12
+ <% end %>
13
+ </ul>
14
+ <% end %>
15
+ </div>
16
+ <% end %>
@@ -0,0 +1,3 @@
1
+ if defined?(Spree::AdvancedCart) && Spree::AdvancedCart::Config.instance
2
+ Spree::AdvancedCart::Config.set(:enable_shipping_cost_calculation => false)
3
+ end
@@ -0,0 +1,3 @@
1
+ # time intervals for memcached
2
+ LONG_INTERVAL = 30.minutes
3
+ SHORT_INTERVAL = 5.minutes
@@ -0,0 +1 @@
1
+ #Spree::Config.set(:vkontakte_app_id => 'VK_APP_ID')
@@ -0,0 +1,22 @@
1
+ ru:
2
+ activerecord:
3
+ attributes:
4
+ user:
5
+ email: "Электронная почта"
6
+
7
+ number:
8
+ # Used in number_to_currency()
9
+ currency:
10
+ format:
11
+ precision: 0
12
+ shipping_method: Способ доставки
13
+ order_processed_successfully: Ваш заказ был успешно оформлен
14
+ new_customer: Регистрация в магазине
15
+ add_to_cart: В корзину
16
+ compare_products:
17
+ сomparable_products: "Список товаров:"
18
+ subtotal: Стоимость товаров
19
+ recalculate: Пересчитать
20
+ save_and_continue: Продолжить
21
+ email: "Электронная почта"
22
+ email_address: "Адрес электронной почты"
@@ -0,0 +1,4 @@
1
+ Rails.application.routes.draw do
2
+ # Add your extension routes here
3
+ root :controller => "home", :action => "index"
4
+ end
@@ -0,0 +1,9 @@
1
+ class AddShowOnMainPageFlagToTaxonomies < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :taxonomies, :show_on_homepage, :boolean, :null => false, :default => false
4
+ end
5
+
6
+ def self.down
7
+ remove_column :taxonomies, :show_on_homepage
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ class ChangeColumnTitleInReviews < ActiveRecord::Migration
2
+ def self.up
3
+ if table_exists?(:reviews)
4
+ change_column(:reviews, :title, :string, :default => '-')
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ if table_exists?(:reviews)
10
+ change_column(:reviews, :title, :string, :default => nil)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ class SpreeCompareProductsHooks < Spree::ThemeSupport::HookListener
2
+
3
+ insert_after :admin_inside_taxonomy_form, 'admin/taxonomies/comparable_field'
4
+
5
+ replace :taxon_products, 'taxons/taxon_products'
6
+
7
+ #insert_after :products_list_item, 'shared/compare_product_field'
8
+
9
+ #insert_after :shared_login_bar, 'shared/comparable_products'
10
+
11
+ insert_after :inside_head, 'shared/compare_product_javascript'
12
+
13
+ #insert_after :cart_form, 'products/compare'
14
+
15
+ end
@@ -0,0 +1,24 @@
1
+ class SpreeReviewsHooks < Spree::ThemeSupport::HookListener
2
+
3
+ insert_after :inside_head do
4
+ %(<%= stylesheet_link_tag('reviews.css') %>)
5
+ end
6
+
7
+ insert_after :footer_right do
8
+ %(
9
+ <%= javascript_include_tag("jquery.rating.js") %>
10
+ <%= javascript_tag("$(document).ready(function(){$('.stars').rating({required:true});});") %>
11
+ )
12
+ end
13
+
14
+ insert_after :admin_product_sub_tabs do
15
+ %(
16
+ <%= tab(:reviews, :label => 'review_management') %>
17
+ )
18
+ end
19
+
20
+ insert_after :admin_configurations_menu do
21
+ %(<%= configurations_menu_item(t('reviews.review_settings'), admin_review_settings_path, t('reviews.manage_review_settings')) %>)
22
+ end
23
+
24
+ end
@@ -0,0 +1,39 @@
1
+ require 'spree_core'
2
+ require 'synergy_default_theme_hooks'
3
+ require 'spree_reviews_hook' if defined?(SpreeReviews)
4
+ require 'spree_compare_products_hooks' if defined?(SpreeCompareProducts)
5
+
6
+ module SynergyDefaultTheme
7
+ class Engine < Rails::Engine
8
+
9
+ config.autoload_paths += %W(#{config.root}/lib)
10
+
11
+ def self.activate
12
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
13
+ Rails.env.production? ? require(c) : load(c)
14
+ end
15
+
16
+ Admin::PagesController.cache_sweeper :page_sweeper
17
+ Admin::TrackersController.cache_sweeper :tracker_sweeper
18
+
19
+ if defined?(Spree::RecentlyViewed) && Spree::RecentlyViewed::Config.instance
20
+ Spree::RecentlyViewed::Config.set :recently_viewed_products_max_count => 3
21
+ end
22
+
23
+ if Spree::Config.instance
24
+ Spree::Config.set :products_per_page => 9
25
+ end
26
+
27
+ Image.attachment_definitions[:attachment].merge!({
28
+ :styles => {
29
+ :mini => '40x40>',
30
+ :small => '120x120>',
31
+ :product => '200x200>',
32
+ :large => '600x600>'
33
+ }
34
+ })
35
+ end
36
+
37
+ config.to_prepare &method(:activate).to_proc
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ class SynergyDefaultThemeHooks < Spree::ThemeSupport::HookListener
2
+ insert_after :admin_inside_taxonomy_form, 'admin/taxonomies/show_on_homepage_field'
3
+
4
+ remove :continue_shopping_or_empty_cart
5
+ end
@@ -0,0 +1,25 @@
1
+ namespace :synergy_default_theme do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ Rake::Task['synergy_default_theme:install:migrations'].invoke
5
+ Rake::Task['synergy_default_theme:install:assets'].invoke
6
+ end
7
+
8
+ namespace :install do
9
+ desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
10
+ task :migrations do
11
+ source = File.join(File.dirname(__FILE__), '..', '..', 'db')
12
+ destination = File.join(Rails.root, 'db')
13
+ Spree::FileUtilz.mirror_files(source, destination)
14
+ end
15
+
16
+ desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
17
+ task :assets do
18
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
19
+ destination = File.join(Rails.root, 'public')
20
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
21
+ Spree::FileUtilz.mirror_files(source, destination)
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1 @@
1
+ # add custom rake tasks here
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,23 @@
1
+ /*
2
+ * jQuery Tools 1.2.5 - The missing UI library for the Web
3
+ *
4
+ * [tooltip, tooltip.slide, tooltip.dynamic]
5
+ *
6
+ * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
7
+ *
8
+ * http://flowplayer.org/tools/
9
+ *
10
+ * File generated: Sat Mar 19 16:41:56 GMT 2011
11
+ */
12
+ (function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j=
13
+ 0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i=
14
+ setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow";
15
+ h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;
16
+ e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip=
17
+ {conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();
18
+ a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
19
+ (function(d){var i=d.tools.tooltip;d.extend(i.conf,{direction:"up",bounce:false,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!d.browser.msie});var e={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};i.addEffect("slide",function(g){var a=this.getConf(),f=this.getTip(),b=a.slideFade?{opacity:a.opacity}:{},c=e[a.direction]||e.up;b[c[1]]=c[0]+"="+a.slideOffset;a.slideFade&&f.css({opacity:0});f.show().animate(b,a.slideInSpeed,g)},function(g){var a=this.getConf(),f=a.slideOffset,
20
+ b=a.slideFade?{opacity:0}:{},c=e[a.direction]||e.up,h=""+c[0];if(a.bounce)h=h=="+"?"-":"+";b[c[1]]=h+"="+f;this.getTip().animate(b,a.slideOutSpeed,function(){d(this).hide();g.call()})})})(jQuery);
21
+ (function(g){function j(a){var c=g(window),d=c.width()+c.scrollLeft(),h=c.height()+c.scrollTop();return[a.offset().top<=c.scrollTop(),d<=a.offset().left+a.width(),h<=a.offset().top+a.height(),c.scrollLeft()>=a.offset().left]}function k(a){for(var c=a.length;c--;)if(a[c])return false;return true}var i=g.tools.tooltip;i.dynamic={conf:{classNames:"top right bottom left"}};g.fn.dynamic=function(a){if(typeof a=="number")a={speed:a};a=g.extend({},i.dynamic.conf,a);var c=a.classNames.split(/\s/),d;this.each(function(){var h=
22
+ g(this).tooltip().onBeforeShow(function(e,f){e=this.getTip();var b=this.getConf();d||(d=[b.position[0],b.position[1],b.offset[0],b.offset[1],g.extend({},b)]);g.extend(b,d[4]);b.position=[d[0],d[1]];b.offset=[d[2],d[3]];e.css({visibility:"hidden",position:"absolute",top:f.top,left:f.left}).show();f=j(e);if(!k(f)){if(f[2]){g.extend(b,a.top);b.position[0]="top";e.addClass(c[0])}if(f[3]){g.extend(b,a.right);b.position[1]="right";e.addClass(c[1])}if(f[0]){g.extend(b,a.bottom);b.position[0]="bottom";e.addClass(c[2])}if(f[1]){g.extend(b,
23
+ a.left);b.position[1]="left";e.addClass(c[3])}if(f[0]||f[2])b.offset[0]*=-1;if(f[1]||f[3])b.offset[1]*=-1}e.css({visibility:"visible"}).hide()});h.onBeforeShow(function(){var e=this.getConf();this.getTip();setTimeout(function(){e.position=[d[0],d[1]];e.offset=[d[2],d[3]]},0)});h.onHide(function(){var e=this.getTip();e.removeClass(a.classNames)});ret=h});return a.api?ret:this}})(jQuery);
@@ -0,0 +1,64 @@
1
+ var add_image_handlers = function() {
2
+ $('ul.thumbnails li').eq(0).addClass('selected');
3
+ $('ul.thumbnails li a').click(function(e) {
4
+ var selectedThumb = $(this);
5
+ $('#main-image img').attr('src', selectedThumb.attr('href'));
6
+ $('ul.thumbnails li').removeClass('selected');
7
+ $(this).parent('li').addClass('selected');
8
+
9
+ $('#main-image a').attr('large', selectedThumb.attr('large'));
10
+ $('#large_image_overlay .large_image img').attr('src', selectedThumb.attr('large'));
11
+ e.preventDefault();
12
+ });
13
+
14
+ $('#main-image a').click(function() {
15
+ var thumbs = getThumbnails();
16
+
17
+ if (thumbs.size() > 0) {
18
+ var large_image = $('#large_image_overlay .large_image img');
19
+ var overlay = $('#large_image_overlay').data('overlay');
20
+ var thumbnails = $('#large_image_overlay .thumbs_gallery ul');
21
+
22
+ $('#large_image_overlay .thumbs_gallery').show();
23
+ thumbnails.empty();
24
+ thumbs.each(function(index, thumb) {
25
+ thumbnails.append('<li><a href="' + thumb.large + '"><img src="' + thumb.thumb + '" /></a></li>');
26
+ });
27
+
28
+ large_image.load(function() {
29
+ large_image.animate({ 'opacity': 1 }, 200);
30
+ });
31
+
32
+
33
+ $('#large_image_overlay .thumbs_gallery a').click(function(e) {
34
+ var selectedThumb = $(this);
35
+ if (large_image.attr('src') != selectedThumb.attr('href'))
36
+ large_image.animate({ 'opacity': 0.01 }, 200, function() {
37
+ large_image.attr('src', selectedThumb.attr('href'));
38
+ });
39
+ e.preventDefault();
40
+ });
41
+ }
42
+ else {
43
+ $('#large_image_overlay .thumbs_gallery').hide();
44
+ }
45
+ }).overlay({
46
+ mask: {
47
+ color: 'black',
48
+ opacity: 0.3
49
+ },
50
+ onBeforeClose: function() {
51
+ $('#large_image_overlay .large_image img').unbind('load');
52
+ },
53
+ fixed: false
54
+ });
55
+ };
56
+
57
+ function getThumbnails() {
58
+ return $('ul.thumbnails li').map(function() {
59
+ return {
60
+ 'thumb': $(this).find('img').attr('src'),
61
+ 'large': $(this).find('a').attr('large')
62
+ };
63
+ });
64
+ }