rails-gallery 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d3bbbfe32714ce66e9f34e83fa55312155a6c74
4
+ data.tar.gz: 75cf3f4cbd2a06df2ab57bfd6780077922f9177b
5
+ SHA512:
6
+ metadata.gz: 66b2b73fff3ab721db06dbd9d77775f1424edc3db622786e9afb12d2c4a38b92099d476593ee5818d7cdaed1c1477ce4b84975bab2f6c4dba1c392a45ca1eed0
7
+ data.tar.gz: 1f8dce493034ad19917e969781d91639bebef69017408d5b505a11911547f1f93ef9c2a99bc266f638d684213e498527bb75d157bde232424952f5ec00e20d7e
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ spec/dummy/logs
5
+ spec/dummy/public
6
+ spec/dummy/temp
7
+
8
+ *.gem
9
+
10
+ Gemfile.lock
11
+ .DS_Store
data/.rspec CHANGED
@@ -1 +1 @@
1
- --color
1
+ --color --format nested
data/CHANGELOG ADDED
@@ -0,0 +1,5 @@
1
+ ## CHANGELOG
2
+
3
+ ### 0.3.2
4
+
5
+ - Using bundler for gem management :)
data/Gemfile CHANGED
@@ -1,12 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'rails'
4
- gem 'hashie', '~> 1.2.0'
5
-
6
- group :development do
7
- gem "rspec", ">= 2.8.0"
8
- gem "rdoc", ">= 3.12"
9
- gem "bundler", ">= 1.0.0"
10
- gem "jeweler", ">= 1.8.4"
11
- gem "simplecov",">= 0.5"
12
- end
3
+ gemspec
File without changes
data/README.md CHANGED
@@ -159,18 +159,51 @@ See [galleria.io](http://galleria.io) for more info.
159
159
 
160
160
  [quick start](http://galleria.io/docs/getting_started/quick_start/)
161
161
 
162
- ```javascript
163
- Galleria.loadTheme('gallery/galleria/classic.min.js');
162
+ ```css
163
+ #galleria {
164
+ width: 700px;
165
+ height: 400px;
166
+ background: white
167
+ }
168
+ ```
164
169
 
165
- // configure
166
- Galleria.configure({
167
- imageCrop: true,
168
- transition: 'fade'
169
- });
170
+ Important: You need to specify the width and height of the galleria container object in your CSS (here the `#galleria` DOM node). Otherwise you will get a trace error!
170
171
 
171
- Galleria.run('#galleria');
172
+ ```javascript
173
+ Galleria.loadTheme('gallery/galleria/classic.js');
174
+
175
+ // or simply
176
+ Galleria.loadNamedTheme('classic');
177
+
178
+ // or for asset path
179
+ Galleria.loadAssetTheme('classic');
180
+
181
+ // Then configure
182
+ Galleria.configure({
183
+ imageCrop: true,
184
+ transition: 'fade',
185
+ log: true,
186
+ // better handle image paths in assets folder!
187
+ assets: true,
188
+ // if pic can't be loaded use this one as fallback
189
+ dummy: '/assets/photos/dummy.png'
190
+ });
191
+
192
+ Galleria.run('#galleria');
172
193
  ```
173
194
 
195
+ *Troubleshooting a javascript gallery*
196
+
197
+ Many of the Javascript galleries don't play very well with Rails and the asset pipeline as they expect a pretty simple application file structure/setup.
198
+
199
+ As an example, in order to make *galleria* work, I had to add a `normalizeSrc` method, which ensures that it looks for an image of the form `/assets/...` when configured with `assets: true` (See `Galleria.configure` options).
200
+
201
+ You might well encounter similar troubles. Another potential problem is browser caching, where you might well have to add a timestamp to the image url. Something like:
202
+
203
+ `my/image.png?235325325323232`
204
+
205
+ In some cases you might wanna hide the image tags and only execute/initialize the gallery when the images have finished loading, fx via the `imagesLoaded` jQuery plugin. Good luck!
206
+
174
207
  ### Model Configuration
175
208
 
176
209
  The engine comes with a RGallery::Photos` model which can encapsulate your photos for display and allows you to group photos in multiple pages.
data/Rakefile CHANGED
@@ -1,49 +1 @@
1
- # encoding: utf-8
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "rails-gallery"
18
- gem.homepage = "http://github.com/kristianmandrup/rails-gallery"
19
- gem.license = "MIT"
20
- gem.summary = %Q{Javascript galleries & carousels for instant use with Rails 3+ :)}
21
- gem.description = %Q{Adds popular javascript galleries to asset pipeline and includes a few Rails Gallery utils and helpers}
22
- gem.email = "kmandrup@gmail.com"
23
- gem.authors = ["Kristian Mandrup"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rspec/core'
29
- require 'rspec/core/rake_task'
30
- RSpec::Core::RakeTask.new(:spec) do |spec|
31
- spec.pattern = FileList['spec/**/*_spec.rb']
32
- end
33
-
34
- RSpec::Core::RakeTask.new(:rcov) do |spec|
35
- spec.pattern = 'spec/**/*_spec.rb'
36
- spec.rcov = true
37
- end
38
-
39
- task :default => :spec
40
-
41
- require 'rdoc/task'
42
- Rake::RDocTask.new do |rdoc|
43
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
-
45
- rdoc.rdoc_dir = 'rdoc'
46
- rdoc.title = "rails-gallery #{version}"
47
- rdoc.rdoc_files.include('README*')
48
- rdoc.rdoc_files.include('lib/**/*.rb')
49
- end
1
+ require "bundler/gem_tasks"
@@ -2,8 +2,7 @@ module RailsGallery
2
2
  module Rails
3
3
  class Engine < ::Rails::Engine
4
4
  initializer 'rails gallery' do
5
- puts "Adding RailsGallery::ViewHelper"
6
-
5
+ # puts "Adding RailsGallery::ViewHelper"
7
6
  ActionView::Base.send :include, RailsGallery::ViewHelper
8
7
  end
9
8
  end
@@ -0,0 +1,3 @@
1
+ module RailsGallery
2
+ VERSION = '0.3.2'
3
+ end
@@ -1,232 +1,24 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ $:.push File.expand_path("../lib", __FILE__)
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = "rails-gallery"
8
- s.version = "0.3.1"
3
+ # Maintain your gem's version:
4
+ require "rails-gallery/version"
9
5
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Kristian Mandrup"]
12
- s.date = "2012-12-06"
13
- s.description = "Adds popular javascript galleries to asset pipeline and includes a few Rails Gallery utils and helpers"
14
- s.email = "kmandrup@gmail.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".rspec",
22
- "Gemfile",
23
- "Gemfile.lock",
24
- "LICENSE.txt",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION",
28
- "app/views/gallery/_galleria.html.haml",
29
- "app/views/gallery/_responsive.html.haml",
30
- "app/views/gallery/_slideshow.html.haml",
31
- "app/views/gallery/template/_responsive.html.haml",
32
- "config/locales/rails_gallery.yml",
33
- "lib/rails-gallery.rb",
34
- "lib/rails-gallery/engine.rb",
35
- "lib/rails-gallery/photo_validation.rb",
36
- "lib/rails-gallery/rgallery.rb",
37
- "lib/rails-gallery/rgallery/page.rb",
38
- "lib/rails-gallery/rgallery/pages.rb",
39
- "lib/rails-gallery/rgallery/photo.rb",
40
- "lib/rails-gallery/rgallery/photo_config.rb",
41
- "lib/rails-gallery/rgallery/photos.rb",
42
- "lib/rails-gallery/view_helper.rb",
43
- "lib/rails-gallery/view_helper/galleria.rb",
44
- "lib/rails-gallery/view_helper/responsive.rb",
45
- "lib/rails-gallery/view_helper/slideshow.rb",
46
- "lib/rails-gallery/view_helper/touch_touch.rb",
47
- "rails-gallery.gemspec",
48
- "spec/galleria_snippet.html",
49
- "spec/galleria_snippet.html.haml",
50
- "spec/images/photo_gallery/icons/IconsByGentleface.txt",
51
- "spec/images/photo_gallery/icons/grid.png",
52
- "spec/images/photo_gallery/icons/loading.gif",
53
- "spec/images/photo_gallery/icons/next.png",
54
- "spec/images/photo_gallery/icons/next_thumb.png",
55
- "spec/images/photo_gallery/icons/pause.png",
56
- "spec/images/photo_gallery/icons/play.png",
57
- "spec/images/photo_gallery/icons/prev.png",
58
- "spec/images/photo_gallery/icons/prev_thumb.png",
59
- "spec/images/photo_gallery/icons/up.png",
60
- "spec/images/photo_gallery/images/1.jpg",
61
- "spec/images/photo_gallery/images/10.jpg",
62
- "spec/images/photo_gallery/images/11.jpg",
63
- "spec/images/photo_gallery/images/12.jpg",
64
- "spec/images/photo_gallery/images/2.jpg",
65
- "spec/images/photo_gallery/images/3.jpg",
66
- "spec/images/photo_gallery/images/4.jpg",
67
- "spec/images/photo_gallery/images/5.jpg",
68
- "spec/images/photo_gallery/images/6.jpg",
69
- "spec/images/photo_gallery/images/7.jpg",
70
- "spec/images/photo_gallery/images/8.jpg",
71
- "spec/images/photo_gallery/images/9.jpg",
72
- "spec/images/photo_gallery/images/ImagesByTibchris.txt",
73
- "spec/images/photo_gallery/images/thumbs/1.jpg",
74
- "spec/images/photo_gallery/images/thumbs/10.jpg",
75
- "spec/images/photo_gallery/images/thumbs/11.jpg",
76
- "spec/images/photo_gallery/images/thumbs/12.jpg",
77
- "spec/images/photo_gallery/images/thumbs/2.jpg",
78
- "spec/images/photo_gallery/images/thumbs/3.jpg",
79
- "spec/images/photo_gallery/images/thumbs/4.jpg",
80
- "spec/images/photo_gallery/images/thumbs/5.jpg",
81
- "spec/images/photo_gallery/images/thumbs/6.jpg",
82
- "spec/images/photo_gallery/images/thumbs/7.jpg",
83
- "spec/images/photo_gallery/images/thumbs/8.jpg",
84
- "spec/images/photo_gallery/images/thumbs/9.jpg",
85
- "spec/images/property/1.jpg",
86
- "spec/images/property/2.jpg",
87
- "spec/images/property/3.jpg",
88
- "spec/images/property/4.jpg",
89
- "spec/images/property/5.jpg",
90
- "spec/images/property/6.jpg",
91
- "spec/images/property/7.jpg",
92
- "spec/images/property/ads/ad1.jpg",
93
- "spec/images/property/ads/ad2.jpg",
94
- "spec/images/property/ads/ad3.jpg",
95
- "spec/images/property/thumbs/1.jpg",
96
- "spec/images/property/thumbs/2.jpg",
97
- "spec/images/property/thumbs/3.jpg",
98
- "spec/images/property/thumbs/4.jpg",
99
- "spec/images/property/thumbs/5.jpg",
100
- "spec/images/property/thumbs/6.jpg",
101
- "spec/images/property/thumbs/7.jpg",
102
- "spec/images/responsive-gallery/icons/ajax-loader.gif",
103
- "spec/images/responsive-gallery/icons/black.png",
104
- "spec/images/responsive-gallery/icons/nav.png",
105
- "spec/images/responsive-gallery/icons/nav_thumbs.png",
106
- "spec/images/responsive-gallery/icons/pattern.png",
107
- "spec/images/responsive-gallery/icons/views.png",
108
- "spec/images/responsive-gallery/images/1.jpg",
109
- "spec/images/responsive-gallery/images/10.jpg",
110
- "spec/images/responsive-gallery/images/11.jpg",
111
- "spec/images/responsive-gallery/images/12.jpg",
112
- "spec/images/responsive-gallery/images/13.jpg",
113
- "spec/images/responsive-gallery/images/14.jpg",
114
- "spec/images/responsive-gallery/images/15.jpg",
115
- "spec/images/responsive-gallery/images/16.jpg",
116
- "spec/images/responsive-gallery/images/17.jpg",
117
- "spec/images/responsive-gallery/images/18.jpg",
118
- "spec/images/responsive-gallery/images/19.jpg",
119
- "spec/images/responsive-gallery/images/2.jpg",
120
- "spec/images/responsive-gallery/images/20.jpg",
121
- "spec/images/responsive-gallery/images/21.jpg",
122
- "spec/images/responsive-gallery/images/22.jpg",
123
- "spec/images/responsive-gallery/images/23.jpg",
124
- "spec/images/responsive-gallery/images/24.jpg",
125
- "spec/images/responsive-gallery/images/3.jpg",
126
- "spec/images/responsive-gallery/images/4.jpg",
127
- "spec/images/responsive-gallery/images/5.jpg",
128
- "spec/images/responsive-gallery/images/6.jpg",
129
- "spec/images/responsive-gallery/images/7.jpg",
130
- "spec/images/responsive-gallery/images/8.jpg",
131
- "spec/images/responsive-gallery/images/9.jpg",
132
- "spec/images/responsive-gallery/images/thumbs/1.jpg",
133
- "spec/images/responsive-gallery/images/thumbs/10.jpg",
134
- "spec/images/responsive-gallery/images/thumbs/11.jpg",
135
- "spec/images/responsive-gallery/images/thumbs/12.jpg",
136
- "spec/images/responsive-gallery/images/thumbs/13.jpg",
137
- "spec/images/responsive-gallery/images/thumbs/14.jpg",
138
- "spec/images/responsive-gallery/images/thumbs/15.jpg",
139
- "spec/images/responsive-gallery/images/thumbs/16.jpg",
140
- "spec/images/responsive-gallery/images/thumbs/17.jpg",
141
- "spec/images/responsive-gallery/images/thumbs/18.jpg",
142
- "spec/images/responsive-gallery/images/thumbs/19.jpg",
143
- "spec/images/responsive-gallery/images/thumbs/2.jpg",
144
- "spec/images/responsive-gallery/images/thumbs/20.jpg",
145
- "spec/images/responsive-gallery/images/thumbs/21.jpg",
146
- "spec/images/responsive-gallery/images/thumbs/22.jpg",
147
- "spec/images/responsive-gallery/images/thumbs/23.jpg",
148
- "spec/images/responsive-gallery/images/thumbs/24.jpg",
149
- "spec/images/responsive-gallery/images/thumbs/3.jpg",
150
- "spec/images/responsive-gallery/images/thumbs/4.jpg",
151
- "spec/images/responsive-gallery/images/thumbs/5.jpg",
152
- "spec/images/responsive-gallery/images/thumbs/6.jpg",
153
- "spec/images/responsive-gallery/images/thumbs/7.jpg",
154
- "spec/images/responsive-gallery/images/thumbs/8.jpg",
155
- "spec/images/responsive-gallery/images/thumbs/9.jpg",
156
- "spec/rails-gallery/view_helper_spec.rb",
157
- "spec/rgallery/photos_spec.rb",
158
- "spec/rgallery/property_photo.rb",
159
- "spec/spec_helper.rb",
160
- "vendor/assets/images/gallery/galleria/classic/loader.gif",
161
- "vendor/assets/images/gallery/galleria/classic/map.png",
162
- "vendor/assets/images/gallery/responsive/icons/ajax-loader.gif",
163
- "vendor/assets/images/gallery/responsive/icons/black.png",
164
- "vendor/assets/images/gallery/responsive/icons/nav.png",
165
- "vendor/assets/images/gallery/responsive/icons/nav_thumbs.png",
166
- "vendor/assets/images/gallery/responsive/icons/pattern.png",
167
- "vendor/assets/images/gallery/responsive/icons/views.png",
168
- "vendor/assets/images/gallery/slideshow/icons/grid.png",
169
- "vendor/assets/images/gallery/slideshow/icons/loading.gif",
170
- "vendor/assets/images/gallery/slideshow/icons/next.png",
171
- "vendor/assets/images/gallery/slideshow/icons/next_thumb.png",
172
- "vendor/assets/images/gallery/slideshow/icons/pause.png",
173
- "vendor/assets/images/gallery/slideshow/icons/play.png",
174
- "vendor/assets/images/gallery/slideshow/icons/prev.png",
175
- "vendor/assets/images/gallery/slideshow/icons/prev_thumb.png",
176
- "vendor/assets/images/gallery/slideshow/icons/up.png",
177
- "vendor/assets/images/gallery/touch_touch/arrows.png",
178
- "vendor/assets/images/gallery/touch_touch/preloader.gif",
179
- "vendor/assets/javascripts/gallery/galleria-1.2.8.js",
180
- "vendor/assets/javascripts/gallery/galleria-1.2.8.min.js",
181
- "vendor/assets/javascripts/gallery/galleria.js",
182
- "vendor/assets/javascripts/gallery/galleria/classic.js",
183
- "vendor/assets/javascripts/gallery/galleria/classic.min.js",
184
- "vendor/assets/javascripts/gallery/responsive.js",
185
- "vendor/assets/javascripts/gallery/slideshow.js",
186
- "vendor/assets/javascripts/gallery/touch_touch.js",
187
- "vendor/assets/javascripts/jquery/jquery.easing-1.3.js",
188
- "vendor/assets/javascripts/jquery/jquery.elastislide.js",
189
- "vendor/assets/javascripts/jquery/jquery.tmpl.min.js",
190
- "vendor/assets/stylesheets/gallery/galleria/classic.css",
191
- "vendor/assets/stylesheets/gallery/responsive.css",
192
- "vendor/assets/stylesheets/gallery/responsive/elastislide.css",
193
- "vendor/assets/stylesheets/gallery/slideshow.css",
194
- "vendor/assets/stylesheets/gallery/touch_touch.css"
195
- ]
196
- s.homepage = "http://github.com/kristianmandrup/rails-gallery"
197
- s.licenses = ["MIT"]
198
- s.require_paths = ["lib"]
199
- s.rubygems_version = "1.8.24"
200
- s.summary = "Javascript galleries & carousels for instant use with Rails 3+ :)"
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rails-gallery"
8
+ spec.version = RailsGallery::VERSION
9
+ spec.authors = ["Kristian Mandrup"]
10
+ spec.date = "2012-10-11"
11
+ spec.summary = "Gallery functionality for Rails apps"
12
+ spec.description = "Add photo galleries to your Rails apps :)"
13
+ spec.email = "kmandrup@gmail.com"
14
+ spec.homepage = "https://github.com/kristianmandrup/rails-gallery"
15
+ spec.license = "MIT"
201
16
 
202
- if s.respond_to? :specification_version then
203
- s.specification_version = 3
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
204
21
 
205
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
206
- s.add_runtime_dependency(%q<rails>, [">= 0"])
207
- s.add_runtime_dependency(%q<hashie>, ["~> 1.2.0"])
208
- s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
209
- s.add_development_dependency(%q<rdoc>, [">= 3.12"])
210
- s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
211
- s.add_development_dependency(%q<jeweler>, [">= 1.8.4"])
212
- s.add_development_dependency(%q<simplecov>, [">= 0.5"])
213
- else
214
- s.add_dependency(%q<rails>, [">= 0"])
215
- s.add_dependency(%q<hashie>, ["~> 1.2.0"])
216
- s.add_dependency(%q<rspec>, [">= 2.8.0"])
217
- s.add_dependency(%q<rdoc>, [">= 3.12"])
218
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
219
- s.add_dependency(%q<jeweler>, [">= 1.8.4"])
220
- s.add_dependency(%q<simplecov>, [">= 0.5"])
221
- end
222
- else
223
- s.add_dependency(%q<rails>, [">= 0"])
224
- s.add_dependency(%q<hashie>, ["~> 1.2.0"])
225
- s.add_dependency(%q<rspec>, [">= 2.8.0"])
226
- s.add_dependency(%q<rdoc>, [">= 3.12"])
227
- s.add_dependency(%q<bundler>, [">= 1.0.0"])
228
- s.add_dependency(%q<jeweler>, [">= 1.8.4"])
229
- s.add_dependency(%q<simplecov>, [">= 0.5"])
230
- end
22
+ spec.add_dependency 'rails', '>= 3.1'
23
+ spec.add_dependency 'hashie', '>= 2.0.0'
231
24
  end
232
-
@@ -815,6 +815,7 @@ var undef,
815
815
  },
816
816
 
817
817
  loadCSS : function( href, id, callback ) {
818
+ Galleria.log('load CSS:', href, id);
818
819
 
819
820
  var link,
820
821
  length;
@@ -889,6 +890,7 @@ var undef,
889
890
  error: function() {
890
891
  $loader.remove();
891
892
 
893
+ Galleria.log("Theme CSS likely didn't include the dummy #galleria-loader marker introduced and required since Galleria 1.2.8");
892
894
  // If failed, tell the dev to download the latest theme
893
895
  Galleria.raise( 'Theme CSS could not load after 20 sec. Please download the latest theme at http://galleria.io/customer/', true );
894
896
 
@@ -5036,6 +5038,8 @@ Galleria.addTheme = function( theme ) {
5036
5038
 
5037
5039
  // look for manually added CSS
5038
5040
  $('link').each(function( i, link ) {
5041
+ Galleria.log('Trying to load Galleria theme from manually added CSS');
5042
+
5039
5043
  reg = new RegExp( theme.css );
5040
5044
  if ( reg.test( link.href ) ) {
5041
5045
 
@@ -5051,12 +5055,23 @@ Galleria.addTheme = function( theme ) {
5051
5055
 
5052
5056
  // else look for the absolute path and load the CSS dynamic
5053
5057
  if ( !css ) {
5058
+ Galleria.log('Trying to load Galleria theme CSS from absolute path');
5054
5059
 
5055
5060
  $('script').each(function( i, script ) {
5061
+ var themeName = theme.name.toLowerCase();
5062
+ Galleria.log('Looking for Galleria theme:', themeName);
5063
+
5064
+ var matchExpr1 = 'galleria\\.' + themeName + '\\.';
5065
+ var matchExpr2 = 'galleria\\/' + themeName + '\\.';
5066
+
5067
+ Galleria.log('Find match for:', matchExpr1, matchExpr2);
5068
+ Galleria.log('In script src:', script.src);
5056
5069
 
5057
5070
  // look for the theme script
5058
- reg = new RegExp( 'galleria\\.' + theme.name.toLowerCase() + '\\.' );
5059
- if( reg.test( script.src )) {
5071
+ reg1 = new RegExp( matchExpr1 );
5072
+ reg2 = new RegExp( matchExpr2 );
5073
+ if( reg1.test(script.src) || reg2.test(script.src) ) {
5074
+ Galleria.log('Theme match found!');
5060
5075
 
5061
5076
  // we have a match
5062
5077
  css = script.src.replace(/[^\/]*$/, '') + theme.css;
@@ -5094,6 +5109,15 @@ Galleria.addTheme = function( theme ) {
5094
5109
 
5095
5110
  @returns Galleria
5096
5111
  */
5112
+ Galleria.loadNamedTheme = function(name, options) {
5113
+ var prefix = 'gallery/galleria/';
5114
+ Galleria.loadTheme(prefix + name + '.js');
5115
+ }
5116
+
5117
+ Galleria.loadAssetTheme = function(name, options) {
5118
+ var prefix = '/assets/gallery/galleria/';
5119
+ Galleria.loadTheme(prefix + name + '.js');
5120
+ }
5097
5121
 
5098
5122
  Galleria.loadTheme = function( src, options ) {
5099
5123
 
@@ -5296,6 +5320,9 @@ Galleria.utils = Utils;
5296
5320
  */
5297
5321
 
5298
5322
  Galleria.log = function() {
5323
+ if (Galleria.configure.options['log'] != true) {
5324
+ return null;
5325
+ }
5299
5326
  var args = Utils.array( arguments );
5300
5327
  if( 'console' in window && 'log' in window.console ) {
5301
5328
  try {
@@ -5467,6 +5494,35 @@ Galleria.Picture.prototype = {
5467
5494
  // the inherited cache object
5468
5495
  cache: {},
5469
5496
 
5497
+ normalizeSrc: function(src) {
5498
+ Galleria.log('attempt normalize', src);
5499
+
5500
+ var normalizedSrc = src;
5501
+
5502
+ if (Galleria.configure.options.assets == true) {
5503
+ var regAsAs = new RegExp('assets\\/assets');
5504
+
5505
+ if (regAsAs.test(src)) {
5506
+ Galleria.log('Replace double assets/assets in image path');
5507
+ normalizedSrc = src.replace("assets\/assets", "assets")
5508
+ } else {
5509
+ var regAs = new RegExp('assets\\/');
5510
+ if (!regAs.test(src)) {
5511
+ Galleria.log('Add missing assets in image path:', src);
5512
+ normalizedSrc = 'assets/' + src;
5513
+ }
5514
+ }
5515
+ // ensure image path is never relative to current page!
5516
+ if (!new RegExp('^\\/').test(normalizedSrc)) {
5517
+ normalizedSrc = '/' + normalizedSrc;
5518
+ }
5519
+ }
5520
+ Galleria.log('normalized src to', normalizedSrc);
5521
+
5522
+ // var srcStamp = src + '?' + Utils.timestamp();
5523
+ return normalizedSrc;
5524
+ },
5525
+
5470
5526
  // show the image on stage
5471
5527
  show: function() {
5472
5528
  Utils.show( this.image );
@@ -5502,6 +5558,12 @@ Galleria.Picture.prototype = {
5502
5558
  */
5503
5559
 
5504
5560
  preload: function( src ) {
5561
+ Galleria.log('attempt preload', src);
5562
+
5563
+ var src = this.normalizeSrc(src);
5564
+
5565
+ Galleria.log('normalized', src);
5566
+
5505
5567
  $( new Image() ).load((function(src, cache) {
5506
5568
  return function() {
5507
5569
  cache[ src ] = src;
@@ -5521,11 +5583,17 @@ Galleria.Picture.prototype = {
5521
5583
  */
5522
5584
 
5523
5585
  load: function(src, size, callback) {
5586
+ Galleria.log('load image:', src, size);
5587
+
5588
+ var src = this.normalizeSrc(src);
5589
+
5590
+ Galleria.log('load normalized image:', src, size);
5524
5591
 
5525
5592
  if ( typeof size == 'function' ) {
5526
5593
  callback = size;
5527
5594
  size = null;
5528
5595
  }
5596
+
5529
5597
 
5530
5598
  if( this.isIframe ) {
5531
5599
  var id = 'if'+new Date().getTime();
@@ -5856,6 +5924,7 @@ Galleria.Picture.prototype = {
5856
5924
  }
5857
5925
  };
5858
5926
 
5927
+
5859
5928
  // our own easings
5860
5929
  $.extend( $.easing, {
5861
5930