refinerycms 0.9.5.28 → 0.9.5.29

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5.28
1
+ 0.9.5.29
data/db/seeds.rb CHANGED
@@ -4,7 +4,6 @@
4
4
  {:name => "preferred_image_view", :value => :grid},
5
5
  {:name => "analytics_page_code", :value => "UA-xxxxxx-x"},
6
6
  {:name => "image_thumbnails", :value => {
7
- :lightbox => '500x500>',
8
7
  :dialog_thumb => 'c106x106',
9
8
  :grid => 'c135x135',
10
9
  :thumb => '50x50',
File without changes
@@ -1,6 +1,5 @@
1
- init_tooltips = function(){
2
- arguments = arguments.length > 0 ? arguments : ['a[title]', '#image_grid img[title]'];
3
- $$(arguments).each(function(element)
1
+ init_tooltips = function(args){
2
+ jQuery(jQuery(args != null ? args : 'a[title], #image_grid img[title]')).each(function(index, element)
4
3
  {
5
4
  new Tooltip(element, {mouseFollow:false, delay: 0, opacity: 1, appearDuration:0, hideDuration: 0, rounded: false});
6
5
  });
@@ -5,6 +5,7 @@ Tooltip.prototype = {
5
5
  this.el = $(el);
6
6
  // Removing title from DOM element to avoid showing it
7
7
  if ((this.content = this.el.title) != null && this.content.length > 0) {
8
+ this.el.title = '';
8
9
  this.el.tooltip = this;
9
10
  this.initialized = false;
10
11
  this.setOptions(options);
@@ -1193,9 +1193,13 @@ WYMeditor.editor.prototype.status = function(sMessage) {
1193
1193
  */
1194
1194
  WYMeditor.editor.prototype.update = function() {
1195
1195
 
1196
- var html = this.xhtml().gsub(/<\/([A-Za-z0-9]*)></, function(m){return "</" + m[1] +">\n<"}).gsub(/src=\"system\/images/, 'src="/system/images'); // make system/images calls absolute.
1196
+ var html = this.xhtml().gsub(/<\/([A-Za-z0-9]*)></, function(m){return "</" + m[1] +">\n<"});
1197
+ html = html.gsub(/src=\"system\/images/, 'src="/system/images'); // make system/images calls absolute.
1198
+ html = html.gsub(/(replace_me_with_wym-[0-9]*)/, ""); // get rid of replace_me_with_wym id tags that were forgotten about.
1199
+
1197
1200
  jQuery(this._element).val(html);
1198
1201
  jQuery(this._box).find(this._options.htmlValSelector).val(html);
1202
+
1199
1203
  };
1200
1204
 
1201
1205
  /* @name dialog
@@ -1353,7 +1357,7 @@ WYMeditor.editor.prototype.paste = function(sData) {
1353
1357
  sTmp = aP[x];
1354
1358
  //simple newlines are replaced by a break
1355
1359
  sTmp = sTmp.replace(rExp, "<br />");
1356
- if (x == aP.length-1 && jQuery(container).html().gsub(/<br\ ?\/?>/, "").length == 0) {
1360
+ if (x == 0 && jQuery(container).html().gsub(/<br\ ?\/?>/, "").length == 0) {
1357
1361
  jQuery(container).html(sTmp);
1358
1362
  } else {
1359
1363
  jQuery(container).after("<p>" + sTmp + "</p>");
@@ -2437,7 +2441,8 @@ WYMeditor.XhtmlValidator = {
2437
2441
  "allowscriptaccess",
2438
2442
  "wmode",
2439
2443
  "type",
2440
- "src"
2444
+ "src",
2445
+ "flashvars"
2441
2446
  ],
2442
2447
  "inside":"object"
2443
2448
  },
@@ -8,8 +8,8 @@
8
8
  </li>
9
9
  <% if Page.count > 1 and not searching? %>
10
10
  <li>
11
- <%= link_to "Reorder Pages", "", :id => "reorder_action", :class => "reorder_icon" %>
12
- <%= link_to "Done Reordering Pages", "", :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
11
+ <%= link_to "Reorder Pages", admin_pages_url, :id => "reorder_action", :class => "reorder_icon" %>
12
+ <%= link_to "Done Reordering Pages", admin_pages_url, :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
13
13
  </li>
14
14
  <% end %>
15
15
  </ul>
@@ -12,7 +12,7 @@
12
12
  google.load("jquery", "1.3");
13
13
  </script>
14
14
  <% end %>
15
- <%= javascript_include_tag('prototype', 'scriptaculous', 'jquery/jquery', :cache => (use_caching ? "cache/libraries" : false)) if !using_google_libs or local_request? %>
15
+ <%= javascript_include_tag('prototype', 'scriptaculous', 'jquery', :cache => (use_caching ? "cache/libraries" : false)) if !using_google_libs or local_request? %>
16
16
  <script type='text/javascript'>jQuery.noConflict();</script>
17
17
  <%= javascript_include_tag 'refinery/prototype.enhancements.js', 'fastinit', 'refinery/tooltips', 'livepipe', 'tabs', 'thickbox', "wymeditor/jquery.refinery.wymeditor.js", 'refinery/boot_wym', 'refinery/admin', :cache => (use_caching ? "cache/admin" : false) %>
18
18
  <%= "<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>" if RefinerySetting.find_or_set(:show_firebug_lite, false) == true -%>
@@ -5,6 +5,7 @@
5
5
  <title>
6
6
  <%= yield :title %> - <%= RefinerySetting.find_or_set(:site_name, "Company Name") %>
7
7
  </title>
8
+ <%= render :partial => 'shared/google_analytics' unless local_request? %>
8
9
  <%= stylesheet_link_tag 'application' %>
9
10
  <%= stylesheet_link_tag 'formatting', 'theme' %>
10
11
  <%= stylesheet_link_tag 'home' if @page.home? %>
@@ -12,7 +13,6 @@
12
13
  <link rel="shortcut icon" href="/favicon.ico" />
13
14
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
14
15
  <%= yield :head %>
15
- <%= render :partial => 'shared/google_analytics' unless local_request? %>
16
16
  </head>
17
17
  <body>
18
18
  <%= render :partial => "/shared/ie6check" if request.env['HTTP_USER_AGENT'] =~ /MSIE/ %>
@@ -8,8 +8,8 @@
8
8
  </li>
9
9
  <%% if !searching? and <%= class_name %>.count > 1 %>
10
10
  <li>
11
- <%%= link_to "Reorder <%= $title_name.pluralize %>", "", :id => "reorder_action", :class => "reorder_icon" %>
12
- <%%= link_to "Done Reordering <%= $title_name.pluralize %>", "", :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
11
+ <%%= link_to "Reorder <%= $title_name.pluralize %>", admin_<%= plural_name %>_url, :id => "reorder_action", :class => "reorder_icon" %>
12
+ <%%= link_to "Done Reordering <%= $title_name.pluralize %>", admin_<%= plural_name %>_url, :id => "reorder_action_done", :style => "display: none;", :class => "reorder_icon" %>
13
13
  </li>
14
14
  <%% end %>
15
15
  </ul>
@@ -2,7 +2,7 @@ class Refinery::AdminBaseController < ApplicationController
2
2
 
3
3
  layout proc { |controller| "admin#{"_dialog" if controller.from_dialog?}" }
4
4
 
5
- before_filter :login_required, :restrict_plugins, :restrict_controller
5
+ before_filter :correct_accept_header, :login_required, :restrict_plugins, :restrict_controller
6
6
 
7
7
  helper_method :searching?
8
8
 
@@ -35,8 +35,21 @@ protected
35
35
  logger.warn "'#{current_user.login}' tried to access '#{params[:controller]}'"
36
36
  end
37
37
  end
38
-
38
+
39
39
  # Override method from application_controller. Not needed in this controller.
40
40
  def find_pages_for_menu; end
41
41
 
42
+ private
43
+ # This fixes the issue where Internet Explorer browsers are presented with a basic auth dialogue
44
+ # rather than the xhtml one that they *can* accept but don't think they can.
45
+ def correct_accept_header
46
+ if request.user_agent =~ /MSIE (6|7|8)/
47
+ if request.accept == "*/*"
48
+ request.env["HTTP_ACCEPT"] = request.cookies[:http_accept] ||= "application/xml"
49
+ else
50
+ request.cookies[:http_accept] = (request.env["HTTP_ACCEPT"] = (["text/html"] | request.accept.split(', ')).join(', '))
51
+ end
52
+ end
53
+ end
54
+
42
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refinerycms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5.28
4
+ version: 0.9.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Resolve Digital
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-12-18 00:00:00 +13:00
14
+ date: 2009-12-24 00:00:00 +13:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
@@ -178,10 +178,9 @@ files:
178
178
  - public/javascripts/dragdrop.js
179
179
  - public/javascripts/effects.js
180
180
  - public/javascripts/fastinit.js
181
+ - public/javascripts/jquery.js
181
182
  - public/javascripts/jquery/GPL-LICENSE.txt
182
183
  - public/javascripts/jquery/MIT-LICENSE.txt
183
- - public/javascripts/jquery/jquery.js
184
- - public/javascripts/lightbox.js
185
184
  - public/javascripts/livepipe.js
186
185
  - public/javascripts/prototype.js
187
186
  - public/javascripts/refinery/admin.js
@@ -222,7 +221,6 @@ files:
222
221
  - public/stylesheets/home.css
223
222
  - public/stylesheets/ie6.css
224
223
  - public/stylesheets/ie7.css
225
- - public/stylesheets/lightbox.css
226
224
  - public/stylesheets/refinery/application.css
227
225
  - public/stylesheets/refinery/formatting.css
228
226
  - public/stylesheets/refinery/home.css
@@ -1,503 +0,0 @@
1
- // -----------------------------------------------------------------------------------
2
- //
3
- // Lightbox v2.04
4
- // by Lokesh Dhakar - http://www.lokeshdhakar.com
5
- // Last Modification: 2/9/08
6
- //
7
- // For more information, visit:
8
- // http://lokeshdhakar.com/projects/lightbox2/
9
- //
10
- // Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
11
- // - Free for use in both personal and commercial projects
12
- // - Attribution requires leaving author name, author link, and the license info intact.
13
- //
14
- // Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
15
- // Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
16
- //
17
- // -----------------------------------------------------------------------------------
18
- /*
19
-
20
- Table of Contents
21
- -----------------
22
- Configuration
23
-
24
- Lightbox Class Declaration
25
- - initialize()
26
- - updateImageList()
27
- - start()
28
- - changeImage()
29
- - resizeImageContainer()
30
- - showImage()
31
- - updateDetails()
32
- - updateNav()
33
- - enableKeyboardNav()
34
- - disableKeyboardNav()
35
- - keyboardAction()
36
- - preloadNeighborImages()
37
- - end()
38
-
39
- Function Calls
40
- - document.observe()
41
-
42
- */
43
- // -----------------------------------------------------------------------------------
44
-
45
- //
46
- // Configurationl
47
- //
48
- LightboxOptions = Object.extend({
49
- fileLoadingImage: '/images/lightbox/loading.gif',
50
- fileBottomNavCloseImage: '/images/lightbox/closelabel.gif',
51
-
52
- overlayOpacity: 0.8, // controls transparency of shadow overlay
53
-
54
- animate: true, // toggles resizing animations
55
- resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
56
-
57
- borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
58
-
59
- // When grouping images this is used to write: Image # of #.
60
- // Change it for non-english localization
61
- labelImage: "Image",
62
- labelOf: "of"
63
- }, window.LightboxOptions || {});
64
-
65
- // -----------------------------------------------------------------------------------
66
-
67
- var Lightbox = Class.create();
68
-
69
- Lightbox.prototype = {
70
- imageArray: [],
71
- activeImage: undefined,
72
-
73
- // initialize()
74
- // Constructor runs on completion of the DOM loading. Calls updateImageList and then
75
- // the function inserts html at the bottom of the page which is used to display the shadow
76
- // overlay and the image container.
77
- //
78
- initialize: function() {
79
-
80
- this.updateImageList();
81
-
82
- this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
83
-
84
- if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
85
- if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
86
-
87
- this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
88
- this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
89
-
90
- // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
91
- // If animations are turned off, it will be hidden as to prevent a flicker of a
92
- // white 250 by 250 box.
93
- var size = (LightboxOptions.animate ? 250 : 1) + 'px';
94
-
95
-
96
- // Code inserts html at the bottom of the page that looks similar to this:
97
- //
98
- // <div id="overlay"></div>
99
- // <div id="lightbox">
100
- // <div id="outerImageContainer">
101
- // <div id="imageContainer">
102
- // <img id="lightboxImage">
103
- // <div style="" id="hoverNav">
104
- // <a href="#" id="prevLink"></a>
105
- // <a href="#" id="nextLink"></a>
106
- // </div>
107
- // <div id="loading">
108
- // <a href="#" id="loadingLink">
109
- // <img src="/images/lightbox/loading.gif">
110
- // </a>
111
- // </div>
112
- // </div>
113
- // </div>
114
- // <div id="imageDataContainer">
115
- // <div id="imageData">
116
- // <div id="imageDetails">
117
- // <span id="caption"></span>
118
- // <span id="numberDisplay"></span>
119
- // </div>
120
- // <div id="bottomNav">
121
- // <a href="#" id="bottomNavClose">
122
- // <img src="/images/lightbox/close.gif">
123
- // </a>
124
- // </div>
125
- // </div>
126
- // </div>
127
- // </div>
128
-
129
-
130
- var objBody = $$('body')[0];
131
-
132
- objBody.appendChild(Builder.node('div',{id:'overlay'}));
133
-
134
- objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
135
- Builder.node('div',{id:'outerImageContainer'},
136
- Builder.node('div',{id:'imageContainer'}, [
137
- Builder.node('img',{id:'lightboxImage'}),
138
- Builder.node('div',{id:'hoverNav'}, [
139
- Builder.node('a',{id:'prevLink', href: '#' }),
140
- Builder.node('a',{id:'nextLink', href: '#' })
141
- ]),
142
- Builder.node('div',{id:'loading'},
143
- Builder.node('a',{id:'loadingLink', href: '#' },
144
- Builder.node('img', {src: LightboxOptions.fileLoadingImage})
145
- )
146
- )
147
- ])
148
- ),
149
- Builder.node('div', {id:'imageDataContainer'},
150
- Builder.node('div',{id:'imageData'}, [
151
- Builder.node('div',{id:'imageDetails'}, [
152
- Builder.node('span',{id:'caption'}),
153
- Builder.node('span',{id:'numberDisplay'})
154
- ]),
155
- Builder.node('div',{id:'bottomNav'},
156
- Builder.node('a',{id:'bottomNavClose', href: '#' },
157
- Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
158
- )
159
- )
160
- ])
161
- )
162
- ]));
163
-
164
-
165
- $('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
166
- $('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
167
- $('outerImageContainer').setStyle({ width: size, height: size });
168
- $('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
169
- $('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
170
- $('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
171
- $('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
172
-
173
- var th = this;
174
- (function(){
175
- var ids =
176
- 'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
177
- 'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
178
- $w(ids).each(function(id){ th[id] = $(id); });
179
- }).defer();
180
- },
181
-
182
- //
183
- // updateImageList()
184
- // Loops through anchor tags looking for 'lightbox' references and applies onclick
185
- // events to appropriate links. You can rerun after dynamically adding images w/ajax.
186
- //
187
- updateImageList: function() {
188
- this.updateImageList = Prototype.emptyFunction;
189
-
190
- document.observe('click', (function(event){
191
- var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
192
- if (target) {
193
- event.stop();
194
- this.start(target);
195
- }
196
- }).bind(this));
197
- },
198
-
199
- //
200
- // start()
201
- // Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
202
- //
203
- start: function(imageLink) {
204
-
205
- $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
206
-
207
- // stretch overlay to fill page and fade in
208
- var arrayPageSize = this.getPageSize();
209
- $('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
210
-
211
- new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
212
-
213
- this.imageArray = [];
214
- var imageNum = 0;
215
-
216
- if ((imageLink.rel == 'lightbox')){
217
- // if image is NOT part of a set, add single image to imageArray
218
- this.imageArray.push([imageLink.href, imageLink.title]);
219
- } else {
220
- // if image is part of a set..
221
- this.imageArray =
222
- $$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
223
- collect(function(anchor){ return [anchor.href, anchor.title]; }).
224
- uniq();
225
-
226
- while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
227
- }
228
-
229
- // calculate top and left offset for the lightbox
230
- var arrayPageScroll = document.viewport.getScrollOffsets();
231
- var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
232
- var lightboxLeft = arrayPageScroll[0];
233
- this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
234
-
235
- this.changeImage(imageNum);
236
- },
237
-
238
- //
239
- // changeImage()
240
- // Hide most elements and preload image in preparation for resizing image container.
241
- //
242
- changeImage: function(imageNum) {
243
-
244
- this.activeImage = imageNum; // update global var
245
-
246
- // hide elements during transition
247
- if (LightboxOptions.animate) this.loading.show();
248
- this.lightboxImage.hide();
249
- this.hoverNav.hide();
250
- this.prevLink.hide();
251
- this.nextLink.hide();
252
- // HACK: Opera9 does not currently support scriptaculous opacity and appear fx
253
- this.imageDataContainer.setStyle({opacity: .0001});
254
- this.numberDisplay.hide();
255
-
256
- var imgPreloader = new Image();
257
-
258
- // once image is preloaded, resize image container
259
-
260
-
261
- imgPreloader.onload = (function(){
262
- this.lightboxImage.src = this.imageArray[this.activeImage][0];
263
- this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
264
- }).bind(this);
265
- imgPreloader.src = this.imageArray[this.activeImage][0];
266
- },
267
-
268
- //
269
- // resizeImageContainer()
270
- //
271
- resizeImageContainer: function(imgWidth, imgHeight) {
272
-
273
- // get current width and height
274
- var widthCurrent = this.outerImageContainer.getWidth();
275
- var heightCurrent = this.outerImageContainer.getHeight();
276
-
277
- // get new width and height
278
- var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
279
- var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
280
-
281
- // ensure the lightbox is wide enough for the close image.
282
- if (widthNew < 80)
283
- {
284
- widthNew = 80
285
- }
286
-
287
- // scalars based on change from old to new
288
- var xScale = (widthNew / widthCurrent) * 100;
289
- var yScale = (heightNew / heightCurrent) * 100;
290
-
291
- // calculate size difference between new and old image, and resize if necessary
292
- var wDiff = widthCurrent - widthNew;
293
- var hDiff = heightCurrent - heightNew;
294
-
295
- if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
296
- if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
297
-
298
- // if new and old image are same size and no scaling transition is necessary,
299
- // do a quick pause to prevent image flicker.
300
- var timeout = 0;
301
- if ((hDiff == 0) && (wDiff == 0)){
302
- timeout = 100;
303
- if (Prototype.Browser.IE) timeout = 250;
304
- }
305
-
306
- (function(){
307
- this.prevLink.setStyle({ height: imgHeight + 'px' });
308
- this.nextLink.setStyle({ height: imgHeight + 'px' });
309
- this.imageDataContainer.setStyle({ width: widthNew + 'px' });
310
-
311
- this.showImage();
312
- }).bind(this).delay(timeout / 1000);
313
- },
314
-
315
- //
316
- // showImage()
317
- // Display image and begin preloading neighbors.
318
- //
319
- showImage: function(){
320
- this.loading.hide();
321
- new Effect.Appear(this.lightboxImage, {
322
- duration: this.resizeDuration,
323
- queue: 'end',
324
- afterFinish: (function(){ this.updateDetails(); }).bind(this)
325
- });
326
- this.preloadNeighborImages();
327
- },
328
-
329
- //
330
- // updateDetails()
331
- // Display caption, image number, and bottom nav.
332
- //
333
- updateDetails: function() {
334
-
335
- // if caption is not null
336
- if (this.imageArray[this.activeImage][1] != ""){
337
- this.caption.update(this.imageArray[this.activeImage][1]).show();
338
- }
339
-
340
- // if image is part of set display 'Image x of x'
341
- if (this.imageArray.length > 1){
342
- this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
343
- }
344
-
345
- new Effect.Parallel(
346
- [
347
- new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
348
- new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
349
- ],
350
- {
351
- duration: this.resizeDuration,
352
- afterFinish: (function() {
353
- // update overlay size and update nav
354
- var arrayPageSize = this.getPageSize();
355
- this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
356
- this.updateNav();
357
- }).bind(this)
358
- }
359
- );
360
- },
361
-
362
- //
363
- // updateNav()
364
- // Display appropriate previous and next hover navigation.
365
- //
366
- updateNav: function() {
367
-
368
- this.hoverNav.show();
369
-
370
- // if not first image in set, display prev image button
371
- if (this.activeImage > 0) this.prevLink.show();
372
-
373
- // if not last image in set, display next image button
374
- if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
375
-
376
- this.enableKeyboardNav();
377
- },
378
-
379
- //
380
- // enableKeyboardNav()
381
- //
382
- enableKeyboardNav: function() {
383
- document.observe('keydown', this.keyboardAction);
384
- },
385
-
386
- //
387
- // disableKeyboardNav()
388
- //
389
- disableKeyboardNav: function() {
390
- document.stopObserving('keydown', this.keyboardAction);
391
- },
392
-
393
- //
394
- // keyboardAction()
395
- //
396
- keyboardAction: function(event) {
397
- var keycode = event.keyCode;
398
-
399
- var escapeKey;
400
- if (event.DOM_VK_ESCAPE) { // mozilla
401
- escapeKey = event.DOM_VK_ESCAPE;
402
- } else { // ie
403
- escapeKey = 27;
404
- }
405
-
406
- var key = String.fromCharCode(keycode).toLowerCase();
407
-
408
- if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
409
- this.end();
410
- } else if ((key == 'p') || (keycode == 37)){ // display previous image
411
- if (this.activeImage != 0){
412
- this.disableKeyboardNav();
413
- this.changeImage(this.activeImage - 1);
414
- }
415
- } else if ((key == 'n') || (keycode == 39)){ // display next image
416
- if (this.activeImage != (this.imageArray.length - 1)){
417
- this.disableKeyboardNav();
418
- this.changeImage(this.activeImage + 1);
419
- }
420
- }
421
- },
422
-
423
- //
424
- // preloadNeighborImages()
425
- // Preload previous and next images.
426
- //
427
- preloadNeighborImages: function(){
428
- var preloadNextImage, preloadPrevImage;
429
- if (this.imageArray.length > this.activeImage + 1){
430
- preloadNextImage = new Image();
431
- preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
432
- }
433
- if (this.activeImage > 0){
434
- preloadPrevImage = new Image();
435
- preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
436
- }
437
-
438
- },
439
-
440
- //
441
- // end()
442
- //
443
- end: function() {
444
- this.disableKeyboardNav();
445
- this.lightbox.hide();
446
- new Effect.Fade(this.overlay, { duration: this.overlayDuration });
447
- $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
448
- },
449
-
450
- //
451
- // getPageSize()
452
- //
453
- getPageSize: function() {
454
-
455
- var xScroll, yScroll;
456
-
457
- if (window.innerHeight && window.scrollMaxY) {
458
- xScroll = window.innerWidth + window.scrollMaxX;
459
- yScroll = window.innerHeight + window.scrollMaxY;
460
- } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
461
- xScroll = document.body.scrollWidth;
462
- yScroll = document.body.scrollHeight;
463
- } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
464
- xScroll = document.body.offsetWidth;
465
- yScroll = document.body.offsetHeight;
466
- }
467
-
468
- var windowWidth, windowHeight;
469
-
470
- if (self.innerHeight) { // all except Explorer
471
- if(document.documentElement.clientWidth){
472
- windowWidth = document.documentElement.clientWidth;
473
- } else {
474
- windowWidth = self.innerWidth;
475
- }
476
- windowHeight = self.innerHeight;
477
- } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
478
- windowWidth = document.documentElement.clientWidth;
479
- windowHeight = document.documentElement.clientHeight;
480
- } else if (document.body) { // other Explorers
481
- windowWidth = document.body.clientWidth;
482
- windowHeight = document.body.clientHeight;
483
- }
484
-
485
- // for small pages with total height less then height of the viewport
486
- if(yScroll < windowHeight){
487
- pageHeight = windowHeight;
488
- } else {
489
- pageHeight = yScroll;
490
- }
491
-
492
- // for small pages with total width less then width of the viewport
493
- if(xScroll < windowWidth){
494
- pageWidth = xScroll;
495
- } else {
496
- pageWidth = windowWidth;
497
- }
498
-
499
- return [pageWidth,pageHeight];
500
- }
501
- }
502
-
503
- document.observe('dom:loaded', function () { new Lightbox(); });
@@ -1,27 +0,0 @@
1
- #lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
2
- #lightbox img{ width: auto; height: auto;}
3
- #lightbox a img{ border: none; }
4
-
5
- #outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
6
- #imageContainer{ padding: 10px; }
7
-
8
- #loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
9
- #hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
10
- #imageContainer>#hoverNav{ left: 0;}
11
- #hoverNav a{ outline: none;}
12
-
13
- #prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
14
- #prevLink { left: 0; float: left;}
15
- #nextLink { right: 0; float: right;}
16
- #prevLink:hover, #prevLink:visited:hover { background: url(/images/lightbox/prevlabel.gif) left 15% no-repeat; }
17
- #nextLink:hover, #nextLink:visited:hover { background: url(/images/lightbox/nextlabel.gif) right 15% no-repeat; }
18
-
19
- #imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
20
-
21
- #imageData{ padding:0 10px; color: #666; }
22
- #imageData #imageDetails{ width: 70%; float: left; text-align: left; }
23
- #imageData #caption{ font-weight: bold; }
24
- #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
25
- #imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none;}
26
-
27
- #overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }