Commit 582e694e54a3a721e776c1930b9e995aba4223d5

Authored by Braulio Bhavamitra
1 parent 9d1bd7a8

modals: Replace thickbox with colorbox

Colorbox was updated for the onCleanup callback
app/helpers/application_helper.rb
... ... @@ -10,8 +10,6 @@ module ApplicationHelper
10 10  
11 11 include LightboxHelper
12 12  
13   - include ThickboxHelper
14   -
15 13 include ColorboxHelper
16 14  
17 15 include BoxesHelper
... ...
app/helpers/boxes_helper.rb
... ... @@ -241,7 +241,7 @@ module BoxesHelper
241 241 end
242 242  
243 243 if block.respond_to?(:help)
244   - buttons << thickbox_inline_popup_icon(:help, _('Help on this block'), {}, "help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + thickbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}")
  244 + buttons << colorbox_inline_icon(:help, _('Help on this block'), {}, "#help-on-box-#{block.id}") << content_tag('div', content_tag('h2', _('Help')) + content_tag('div', block.help, :style => 'margin-bottom: 1em;') + colorbox_close_button(_('Close')), :style => 'display: none;', :id => "help-on-box-#{block.id}")
245 245 end
246 246  
247 247 if block.embedable?
... ...
app/helpers/colorbox_helper.rb
1 1 module ColorboxHelper
2 2  
  3 + def colorbox_inline_link_to title, url, selector, options = {}
  4 + link_to title, url, colorbox_options(options.merge(:inline => selector))
  5 + end
  6 +
  7 + def colorbox_inline_icon type, title, url, selector, options = {}
  8 + icon_button type, title, url, colorbox_options(options.merge(:inline => selector))
  9 + end
  10 +
  11 + def colorbox_link_to title, url, options = {}
  12 + link_to title, url, colorbox_options(options)
  13 + end
  14 +
  15 + def colorbox_close_link text, options = {}
  16 + link_to text, '#', colorbox_options(options, :close)
  17 + end
  18 +
3 19 def colorbox_close_button(text, options = {})
4 20 button(:close, text, '#', colorbox_options(options, :close))
5 21 end
... ... @@ -16,10 +32,15 @@ module ColorboxHelper
16 32 #
17 33 # returns a new hash with colorbox class added. Keeps existing classes.
18 34 def colorbox_options(options, type=nil)
19   - the_class = 'colorbox'
20   - the_class += "-#{type.to_s}" unless type.nil?
21   - the_class << " #{options[:class]}" if options.has_key?(:class)
22   - options.merge(:class => the_class)
  35 + inline_selector = options.delete :inline
  36 + options[:onclick] = "return colorbox_helpers.inline('#{inline_selector}')" if inline_selector
  37 +
  38 + classes = if inline_selector then '' else 'colorbox' end
  39 + classes += "-#{type.to_s}" if type.present?
  40 + classes << " #{options[:class]}" if options.has_key? :class
  41 + options.merge!(:class => classes)
  42 +
  43 + options
23 44 end
24 45  
25 46 end
... ...
app/helpers/thickbox_helper.rb
... ... @@ -1,11 +0,0 @@
1   -module ThickboxHelper
2   - def thickbox_inline_popup_link(title, url, id, options = {})
3   - link_to(title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options))
4   - end
5   - def thickbox_inline_popup_icon(type, title, url, id, options = {})
6   - icon_button(type, title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options))
7   - end
8   - def thickbox_close_button(title)
9   - button_to_function(:close, title, 'tb_remove();')
10   - end
11   -end
app/views/account/login.html.erb
... ... @@ -3,7 +3,7 @@
3 3 <h2><%= _('Login') %></h2>
4 4  
5 5 <% @user ||= User.new %>
6   -<% is_thickbox ||= false %>
  6 +<% is_popin ||= false %>
7 7  
8 8 <%= @message %>
9 9  
... ... @@ -17,8 +17,8 @@
17 17  
18 18 <% button_bar do %>
19 19 <%= submit_button( 'login', _('Log in') )%>
20   - <% if is_thickbox %>
21   - <%= thickbox_close_button(_('Cancel')) %>
  20 + <% if is_popin %>
  21 + <%= colorbox_close_button(_('Cancel')) %>
22 22 <% end %>
23 23 <% end %>
24 24  
... ...
app/views/layouts/_user.html.erb
... ... @@ -7,11 +7,11 @@
7 7 </span>
8 8 <% else %>
9 9 <span class='not-logged-in'>
10   - <%= _("<span class='login'>%s</span>") % thickbox_inline_popup_link('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, 'inlineLoginBox', :id => 'link_login') %>
  10 + <%= _("<span class='login'>%s</span>") % colorbox_inline_link_to('<i class="icon-menu-login"></i><strong>' + _('Login') + '</strong>', login_url, '#inlineLoginBox', :id => 'link_login') %>
11 11 <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %>
12 12  
13 13 <div id='inlineLoginBox' style='display: none;'>
14   - <%= render :file => 'account/login', :locals => { :is_thickbox => true } %>
  14 + <%= render :file => 'account/login', :locals => { :is_popin => true } %>
15 15 </div>
16 16  
17 17 <% unless @plugins.dispatch(:allow_user_registration).include?(false) %>
... ...
app/views/shared/user_menu.html.erb
... ... @@ -58,9 +58,9 @@
58 58 <% if theme_option( :menu_login ) == 'full_form' %>
59 59 <%= render :file => 'account/login_block' %>
60 60 <% else %>
61   - <%= thickbox_inline_popup_link('<span class="icon-menu-login"></span>'+ _('Login'), login_url, 'inlineLoginBox', :id => 'link_login') %>
  61 + <%= colorbox_inline_link_to('<span class="icon-menu-login"></span>'+ _('Login'), login_url, '#inlineLoginBox', :id => 'link_login') %>
62 62 <div id='inlineLoginBox' style='display: none;'>
63   - <%= render :file => 'account/login', :locals => { :is_thickbox => true } %>
  63 + <%= render :file => 'account/login', :locals => { :is_popin => true } %>
64 64 </div>
65 65 <% end %>
66 66 <% end %>
... ...
public/images/colorbox/controls.png

1.22 KB | W: | H:

2.83 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
public/javascripts/application.js
... ... @@ -1005,31 +1005,6 @@ log.error = function() {
1005 1005 window.log.apply(window, jQuery.merge(['error'], arguments));
1006 1006 }
1007 1007  
1008   -jQuery(function($) {
1009   - $('.colorbox').live('click', function() {
1010   - $.colorbox({
1011   - href: $(this).attr('href'),
1012   - maxWidth: $(window).width()-50,
1013   - height: $(window).height()-50,
1014   - open: true,
1015   - fixed: true,
1016   - close: 'Cancel',
1017   - onComplete: function(bt) {
1018   - var opt = {}, maxH = $(window).height()-50;
1019   - if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH;
1020   - $.colorbox.resize(opt);
1021   - }
1022   - });
1023   - return false;
1024   - });
1025   -
1026   - $('.colorbox-close').live('click', function() {
1027   - $.colorbox.close();
1028   - return false;
1029   - });
1030   -
1031   -});
1032   -
1033 1008 function showHideTermsOfUse() {
1034 1009 if( jQuery("#article_has_terms_of_use").attr("checked") )
1035 1010 jQuery("#text_area_terms_of_use").show();
... ...
public/javascripts/colorbox-helpers.js 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +colorbox_helpers = {
  2 +
  3 + watchClass: function() {
  4 + jQuery(function($) {
  5 + $('.colorbox').live('click', function() {
  6 + $.colorbox({
  7 + href: $(this).attr('href'),
  8 + maxWidth: $(window).width()-50,
  9 + height: $(window).height()-50,
  10 + open: true,
  11 + close: 'Cancel',
  12 + onComplete: function(bt) {
  13 + var opt = {}, maxH = $(window).height()-50;
  14 + if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH;
  15 + $.colorbox.resize(opt);
  16 + }
  17 + });
  18 + return false;
  19 + });
  20 +
  21 + $('.colorbox-close').live('click', function() {
  22 + $.colorbox.close();
  23 + return false;
  24 + });
  25 +
  26 + });
  27 + },
  28 +
  29 + inline: function(href) {
  30 + var href = jQuery(href);
  31 +
  32 + jQuery.colorbox({
  33 + inline: true, href: href,
  34 + onLoad: function(){ href.show(); },
  35 + onCleanup: function(){ href.hide(); },
  36 + });
  37 +
  38 + return false;
  39 + },
  40 +
  41 +};
  42 +
  43 +colorbox_helpers.watchClass();
  44 +
... ...
public/javascripts/colorbox.js
... ... @@ -1,814 +0,0 @@
1   -// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
2   -// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
3   -// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
4   -(function ($, document, window) {
5   - var
6   - // ColorBox Default Settings.
7   - // See http://colorpowered.com/colorbox for details.
8   - defaults = {
9   - transition: "elastic",
10   - speed: 300,
11   - width: false,
12   - initialWidth: "600",
13   - innerWidth: false,
14   - maxWidth: false,
15   - height: false,
16   - initialHeight: "450",
17   - innerHeight: false,
18   - maxHeight: false,
19   - scalePhotos: true,
20   - scrolling: true,
21   - inline: false,
22   - html: false,
23   - iframe: false,
24   - fastIframe: true,
25   - photo: false,
26   - href: false,
27   - title: false,
28   - rel: false,
29   - opacity: 0.9,
30   - preloading: true,
31   - current: "image {current} of {total}",
32   - previous: "previous",
33   - next: "next",
34   - close: "close",
35   - open: false,
36   - returnFocus: true,
37   - loop: true,
38   - slideshow: false,
39   - slideshowAuto: true,
40   - slideshowSpeed: 2500,
41   - slideshowStart: "start slideshow",
42   - slideshowStop: "stop slideshow",
43   - onOpen: false,
44   - onLoad: false,
45   - onComplete: false,
46   - onCleanup: false,
47   - onClosed: false,
48   - overlayClose: true,
49   - escKey: true,
50   - arrowKey: true
51   - },
52   -
53   - // Abstracting the HTML and event identifiers for easy rebranding
54   - colorbox = 'colorbox',
55   - prefix = 'cbox',
56   -
57   - // Events
58   - event_open = prefix + '_open',
59   - event_load = prefix + '_load',
60   - event_complete = prefix + '_complete',
61   - event_cleanup = prefix + '_cleanup',
62   - event_closed = prefix + '_closed',
63   - event_purge = prefix + '_purge',
64   -
65   - // Special Handling for IE
66   - isIE = $.browser.msie && !$.support.opacity, // feature detection alone gave a false positive on at least one phone browser and on some development versions of Chrome.
67   - isIE6 = isIE && $.browser.version < 7,
68   - event_ie6 = prefix + '_IE6',
69   -
70   - // Cached jQuery Object Variables
71   - $overlay,
72   - $box,
73   - $wrap,
74   - $content,
75   - $topBorder,
76   - $leftBorder,
77   - $rightBorder,
78   - $bottomBorder,
79   - $related,
80   - $window,
81   - $loaded,
82   - $loadingBay,
83   - $loadingOverlay,
84   - $title,
85   - $current,
86   - $slideshow,
87   - $next,
88   - $prev,
89   - $close,
90   - $groupControls,
91   -
92   - // Variables for cached values or use across multiple functions
93   - settings = {},
94   - interfaceHeight,
95   - interfaceWidth,
96   - loadedHeight,
97   - loadedWidth,
98   - element,
99   - index,
100   - photo,
101   - open,
102   - active,
103   - closing = false,
104   -
105   - publicMethod,
106   - boxElement = prefix + 'Element';
107   -
108   - // ****************
109   - // HELPER FUNCTIONS
110   - // ****************
111   -
112   - // jQuery object generator to reduce code size
113   - function $div(id, cssText) {
114   - var div = document.createElement('div');
115   - if (id) {
116   - div.id = prefix + id;
117   - }
118   - div.style.cssText = cssText || false;
119   - return $(div);
120   - }
121   -
122   - // Convert % values to pixels
123   - function setSize(size, dimension) {
124   - dimension = dimension === 'x' ? $window.width() : $window.height();
125   - return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
126   - }
127   -
128   - // Checks an href to see if it is a photo.
129   - // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
130   - function isImage(url) {
131   - return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url);
132   - }
133   -
134   - // Assigns function results to their respective settings. This allows functions to be used as values.
135   - function process(settings) {
136   - for (var i in settings) {
137   - if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
138   - settings[i] = settings[i].call(element);
139   - }
140   - }
141   - settings.rel = settings.rel || element.rel || 'nofollow';
142   - settings.href = $.trim(settings.href || $(element).attr('href'));
143   - settings.title = settings.title || element.title;
144   - }
145   -
146   - function trigger(event, callback) {
147   - if (callback) {
148   - callback.call(element);
149   - }
150   - $.event.trigger(event);
151   - }
152   -
153   - // Slideshow functionality
154   - function slideshow() {
155   - var
156   - timeOut,
157   - className = prefix + "Slideshow_",
158   - click = "click." + prefix,
159   - start,
160   - stop,
161   - clear;
162   -
163   - if (settings.slideshow && $related[1]) {
164   - start = function () {
165   - $slideshow
166   - .text(settings.slideshowStop)
167   - .unbind(click)
168   - .bind(event_complete, function () {
169   - if (index < $related.length - 1 || settings.loop) {
170   - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
171   - }
172   - })
173   - .bind(event_load, function () {
174   - clearTimeout(timeOut);
175   - })
176   - .one(click + ' ' + event_cleanup, stop);
177   - $box.removeClass(className + "off").addClass(className + "on");
178   - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed);
179   - };
180   -
181   - stop = function () {
182   - clearTimeout(timeOut);
183   - $slideshow
184   - .text(settings.slideshowStart)
185   - .unbind([event_complete, event_load, event_cleanup, click].join(' '))
186   - .one(click, start);
187   - $box.removeClass(className + "on").addClass(className + "off");
188   - };
189   -
190   - if (settings.slideshowAuto) {
191   - start();
192   - } else {
193   - stop();
194   - }
195   - }
196   - }
197   -
198   - function launch(elem) {
199   - if (!closing) {
200   -
201   - element = elem;
202   -
203   - process($.extend(settings, $.data(element, colorbox)));
204   -
205   - $related = $(element);
206   -
207   - index = 0;
208   -
209   - if (settings.rel !== 'nofollow') {
210   - $related = $('.' + boxElement).filter(function () {
211   - var relRelated = $.data(this, colorbox).rel || this.rel;
212   - return (relRelated === settings.rel);
213   - });
214   - index = $related.index(element);
215   -
216   - // Check direct calls to ColorBox.
217   - if (index === -1) {
218   - $related = $related.add(element);
219   - index = $related.length - 1;
220   - }
221   - }
222   -
223   - if (!open) {
224   - open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
225   -
226   - $box.show();
227   -
228   - if (settings.returnFocus) {
229   - try {
230   - element.blur();
231   - $(element).one(event_closed, function () {
232   - try {
233   - this.focus();
234   - } catch (e) {
235   - // do nothing
236   - }
237   - });
238   - } catch (e) {
239   - // do nothing
240   - }
241   - }
242   -
243   - // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5'
244   - $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show();
245   -
246   - // Opens inital empty ColorBox prior to content being loaded.
247   - settings.w = setSize(settings.initialWidth, 'x');
248   - settings.h = setSize(settings.initialHeight, 'y');
249   - publicMethod.position(0);
250   -
251   - if (isIE6) {
252   - $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () {
253   - $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
254   - }).trigger('resize.' + event_ie6);
255   - }
256   -
257   - trigger(event_open, settings.onOpen);
258   -
259   - $groupControls.add($title).hide();
260   -
261   - $close.html(settings.close).show();
262   - }
263   -
264   - publicMethod.load(true);
265   - }
266   - }
267   -
268   - // ****************
269   - // PUBLIC FUNCTIONS
270   - // Usage format: $.fn.colorbox.close();
271   - // Usage from within an iframe: parent.$.fn.colorbox.close();
272   - // ****************
273   -
274   - publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) {
275   - var $this = this, autoOpen;
276   -
277   - if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit.
278   - return $this;
279   - }
280   -
281   - options = options || {};
282   -
283   - if (callback) {
284   - options.onComplete = callback;
285   - }
286   -
287   - if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox()
288   - $this = $('<a/>');
289   - options.open = true; // assume an immediate open
290   - }
291   -
292   - $this.each(function () {
293   - $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options));
294   - $(this).addClass(boxElement);
295   - });
296   -
297   - autoOpen = options.open;
298   -
299   - if ($.isFunction(autoOpen)) {
300   - autoOpen = autoOpen.call($this);
301   - }
302   -
303   - if (autoOpen) {
304   - launch($this[0]);
305   - }
306   -
307   - return $this;
308   - };
309   -
310   - // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
311   - // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
312   - // having to run once, instead of each time colorbox is opened.
313   - publicMethod.init = function () {
314   - // Create & Append jQuery Objects
315   - $window = $(window);
316   - $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''});
317   - $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide();
318   -
319   - $wrap = $div("Wrapper");
320   - $content = $div("Content").append(
321   - $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'),
322   - $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")),
323   - $title = $div("Title"),
324   - $current = $div("Current"),
325   - $next = $div("Next"),
326   - $prev = $div("Previous"),
327   - $slideshow = $div("Slideshow").bind(event_open, slideshow),
328   - $close = $div("Close")
329   - );
330   - $wrap.append( // The 3x3 Grid that makes up ColorBox
331   - $div().append(
332   - $div("TopLeft"),
333   - $topBorder = $div("TopCenter"),
334   - $div("TopRight")
335   - ),
336   - $div(false, 'clear:left').append(
337   - $leftBorder = $div("MiddleLeft"),
338   - $content,
339   - $rightBorder = $div("MiddleRight")
340   - ),
341   - $div(false, 'clear:left').append(
342   - $div("BottomLeft"),
343   - $bottomBorder = $div("BottomCenter"),
344   - $div("BottomRight")
345   - )
346   - ).children().children().css({'float': 'left'});
347   -
348   - $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none');
349   -
350   - $('body').prepend($overlay, $box.append($wrap, $loadingBay));
351   -
352   - $content.children()
353   - .hover(function () {
354   - $(this).addClass('hover');
355   - }, function () {
356   - $(this).removeClass('hover');
357   - }).addClass('hover');
358   -
359   - // Cache values needed for size calculations
360   - interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6
361   - interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width();
362   - loadedHeight = $loaded.outerHeight(true);
363   - loadedWidth = $loaded.outerWidth(true);
364   -
365   - // Setting padding to remove the need to do size conversions during the animation step.
366   - $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
367   -
368   - // Setup button events.
369   - $next.click(function () {
370   - publicMethod.next();
371   - });
372   - $prev.click(function () {
373   - publicMethod.prev();
374   - });
375   - $close.click(function () {
376   - publicMethod.close();
377   - });
378   -
379   - $groupControls = $next.add($prev).add($current).add($slideshow);
380   -
381   - // Adding the 'hover' class allowed the browser to load the hover-state
382   - // background graphics. The class can now can be removed.
383   - $content.children().removeClass('hover');
384   -
385   - $('.' + boxElement).live('click', function (e) {
386   - // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt.
387   - if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) {
388   - e.preventDefault();
389   - launch(this);
390   - }
391   - });
392   -
393   - $overlay.click(function () {
394   - if (settings.overlayClose) {
395   - publicMethod.close();
396   - }
397   - });
398   -
399   - // Set Navigation Key Bindings
400   - $(document).bind('keydown.' + prefix, function (e) {
401   - var key = e.keyCode;
402   - if (open && settings.escKey && key === 27) {
403   - e.preventDefault();
404   - publicMethod.close();
405   - }
406   - if (open && settings.arrowKey && $related[1]) {
407   - if (key === 37) {
408   - e.preventDefault();
409   - $prev.click();
410   - } else if (key === 39) {
411   - e.preventDefault();
412   - $next.click();
413   - }
414   - }
415   - });
416   - };
417   -
418   - publicMethod.remove = function () {
419   - $box.add($overlay).remove();
420   - $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement);
421   - };
422   -
423   - publicMethod.position = function (speed, loadedCallback) {
424   - var
425   - animate_speed,
426   - // keeps the top and left positions within the browser's viewport.
427   - posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(),
428   - posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft();
429   -
430   - // setting the speed to 0 to reduce the delay between same-sized content.
431   - animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed;
432   -
433   - // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
434   - // but it has to be shrank down around the size of div#colorbox when it's done. If not,
435   - // it can invoke an obscure IE bug when using iframes.
436   - $wrap[0].style.width = $wrap[0].style.height = "9999px";
437   -
438   - function modalDimensions(that) {
439   - // loading overlay height has to be explicitly set for IE6.
440   - $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
441   - $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
442   - }
443   -
444   - $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, {
445   - duration: animate_speed,
446   - complete: function () {
447   - modalDimensions(this);
448   -
449   - active = false;
450   -
451   - // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
452   - $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px";
453   - $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px";
454   -
455   - if (loadedCallback) {
456   - loadedCallback();
457   - }
458   - },
459   - step: function () {
460   - modalDimensions(this);
461   - }
462   - });
463   - };
464   -
465   - publicMethod.resize = function (options) {
466   - if (open) {
467   - options = options || {};
468   -
469   - if (options.width) {
470   - settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
471   - }
472   - if (options.innerWidth) {
473   - settings.w = setSize(options.innerWidth, 'x');
474   - }
475   - $loaded.css({width: settings.w});
476   -
477   - if (options.height) {
478   - settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
479   - }
480   - if (options.innerHeight) {
481   - settings.h = setSize(options.innerHeight, 'y');
482   - }
483   - if (!options.innerHeight && !options.height) {
484   - var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
485   - settings.h = $child.height();
486   - $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
487   - }
488   - $loaded.css({height: settings.h});
489   -
490   - publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
491   - }
492   - };
493   -
494   - publicMethod.prep = function (object) {
495   - if (!open) {
496   - return;
497   - }
498   -
499   - var speed = settings.transition === "none" ? 0 : settings.speed;
500   -
501   - $window.unbind('resize.' + prefix);
502   - $loaded.remove();
503   - $loaded = $div('LoadedContent').html(object);
504   -
505   - function getWidth() {
506   - settings.w = settings.w || $loaded.width();
507   - settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
508   - return settings.w;
509   - }
510   - function getHeight() {
511   - settings.h = settings.h || $loaded.height();
512   - settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
513   - return settings.h;
514   - }
515   -
516   - $loaded.hide()
517   - .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations.
518   - .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'})
519   - .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height.
520   - .prependTo($content);
521   -
522   - $loadingBay.hide();
523   -
524   - // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
525   - //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'});
526   -
527   - $(photo).css({'float': 'none'});
528   -
529   - // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
530   - if (isIE6) {
531   - $('select').not($box.find('select')).filter(function () {
532   - return this.style.visibility !== 'hidden';
533   - }).css({'visibility': 'hidden'}).one(event_cleanup, function () {
534   - this.style.visibility = 'inherit';
535   - });
536   - }
537   -
538   - function setPosition(s) {
539   - publicMethod.position(s, function () {
540   - var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete;
541   -
542   - if (!open) {
543   - return;
544   - }
545   -
546   - complete = function () {
547   - $loadingOverlay.hide();
548   - trigger(event_complete, settings.onComplete);
549   - };
550   -
551   - if (isIE) {
552   - //This fadeIn helps the bicubic resampling to kick-in.
553   - if (photo) {
554   - $loaded.fadeIn(100);
555   - }
556   - }
557   -
558   - $title.html(settings.title).add($loaded).show();
559   -
560   - if (total > 1) { // handle grouping
561   - if (typeof settings.current === "string") {
562   - $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show();
563   - }
564   -
565   - $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next);
566   - $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous);
567   -
568   - prev = index ? $related[index - 1] : $related[total - 1];
569   - next = index < total - 1 ? $related[index + 1] : $related[0];
570   -
571   - if (settings.slideshow) {
572   - $slideshow.show();
573   - }
574   -
575   - // Preloads images within a rel group
576   - if (settings.preloading) {
577   - nextSrc = $.data(next, colorbox).href || next.href;
578   - prevSrc = $.data(prev, colorbox).href || prev.href;
579   -
580   - nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc;
581   - prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc;
582   -
583   - if (isImage(nextSrc)) {
584   - $('<img/>')[0].src = nextSrc;
585   - }
586   -
587   - if (isImage(prevSrc)) {
588   - $('<img/>')[0].src = prevSrc;
589   - }
590   - }
591   - } else {
592   - $groupControls.hide();
593   - }
594   -
595   - if (settings.iframe) {
596   - iframe = $('<iframe/>').addClass(prefix + 'Iframe')[0];
597   -
598   - if (settings.fastIframe) {
599   - complete();
600   - } else {
601   - $(iframe).load(complete);
602   - }
603   - iframe.name = prefix + (+new Date());
604   - iframe.src = settings.href;
605   -
606   - if (!settings.scrolling) {
607   - iframe.scrolling = "no";
608   - }
609   -
610   - if (isIE) {
611   - iframe.frameBorder=0;
612   - iframe.allowTransparency = "true";
613   - }
614   -
615   - $(iframe).appendTo($loaded).one(event_purge, function () {
616   - iframe.src = "//about:blank";
617   - });
618   - } else {
619   - complete();
620   - }
621   -
622   - if (settings.transition === 'fade') {
623   - $box.fadeTo(speed, 1, function () {
624   - $box[0].style.filter = "";
625   - });
626   - } else {
627   - $box[0].style.filter = "";
628   - }
629   -
630   - $window.bind('resize.' + prefix, function () {
631   - publicMethod.position(0);
632   - });
633   - });
634   - }
635   -
636   - if (settings.transition === 'fade') {
637   - $box.fadeTo(speed, 0, function () {
638   - setPosition(0);
639   - });
640   - } else {
641   - setPosition(speed);
642   - }
643   - };
644   -
645   - publicMethod.load = function (launched) {
646   - var href, setResize, prep = publicMethod.prep;
647   -
648   - active = true;
649   -
650   - photo = false;
651   -
652   - element = $related[index];
653   -
654   - if (!launched) {
655   - process($.extend(settings, $.data(element, colorbox)));
656   - }
657   -
658   - trigger(event_purge);
659   -
660   - trigger(event_load, settings.onLoad);
661   -
662   - settings.h = settings.height ?
663   - setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
664   - settings.innerHeight && setSize(settings.innerHeight, 'y');
665   -
666   - settings.w = settings.width ?
667   - setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
668   - settings.innerWidth && setSize(settings.innerWidth, 'x');
669   -
670   - // Sets the minimum dimensions for use in image scaling
671   - settings.mw = settings.w;
672   - settings.mh = settings.h;
673   -
674   - // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
675   - // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
676   - if (settings.maxWidth) {
677   - settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
678   - settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
679   - }
680   - if (settings.maxHeight) {
681   - settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
682   - settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
683   - }
684   -
685   - href = settings.href;
686   -
687   - $loadingOverlay.show();
688   -
689   - if (settings.inline) {
690   - // Inserts an empty placeholder where inline content is being pulled from.
691   - // An event is bound to put inline content back when ColorBox closes or loads new content.
692   - $div().hide().insertBefore($(href)[0]).one(event_purge, function () {
693   - $(this).replaceWith($loaded.children());
694   - });
695   - prep($(href));
696   - } else if (settings.iframe) {
697   - // IFrame element won't be added to the DOM until it is ready to be displayed,
698   - // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
699   - prep(" ");
700   - } else if (settings.html) {
701   - prep(settings.html);
702   - } else if (isImage(href)) {
703   - $(photo = new Image())
704   - .addClass(prefix + 'Photo')
705   - .error(function () {
706   - settings.title = false;
707   - prep($div('Error').text('This image could not be loaded'));
708   - })
709   - .load(function () {
710   - var percent;
711   - photo.onload = null; //stops animated gifs from firing the onload repeatedly.
712   -
713   - if (settings.scalePhotos) {
714   - setResize = function () {
715   - photo.height -= photo.height * percent;
716   - photo.width -= photo.width * percent;
717   - };
718   - if (settings.mw && photo.width > settings.mw) {
719   - percent = (photo.width - settings.mw) / photo.width;
720   - setResize();
721   - }
722   - if (settings.mh && photo.height > settings.mh) {
723   - percent = (photo.height - settings.mh) / photo.height;
724   - setResize();
725   - }
726   - }
727   -
728   - if (settings.h) {
729   - photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px';
730   - }
731   -
732   - if ($related[1] && (index < $related.length - 1 || settings.loop)) {
733   - photo.style.cursor = 'pointer';
734   - photo.onclick = function () {
735   - publicMethod.next();
736   - };
737   - }
738   -
739   - if (isIE) {
740   - photo.style.msInterpolationMode = 'bicubic';
741   - }
742   -
743   - setTimeout(function () { // A pause because Chrome will sometimes report a 0 by 0 size otherwise.
744   - prep(photo);
745   - }, 1);
746   - });
747   -
748   - setTimeout(function () { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise.
749   - photo.src = href;
750   - }, 1);
751   - } else if (href) {
752   - $loadingBay.load(href, function (data, status, xhr) {
753   - prep(status === 'error' ? $div('Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents());
754   - });
755   - }
756   - };
757   -
758   - // Navigates to the next page/image in a set.
759   - publicMethod.next = function () {
760   - if (!active && $related[1] && (index < $related.length - 1 || settings.loop)) {
761   - index = index < $related.length - 1 ? index + 1 : 0;
762   - publicMethod.load();
763   - }
764   - };
765   -
766   - publicMethod.prev = function () {
767   - if (!active && $related[1] && (index || settings.loop)) {
768   - index = index ? index - 1 : $related.length - 1;
769   - publicMethod.load();
770   - }
771   - };
772   -
773   - // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
774   - publicMethod.close = function () {
775   - if (open && !closing) {
776   -
777   - closing = true;
778   -
779   - open = false;
780   -
781   - trigger(event_cleanup, settings.onCleanup);
782   -
783   - $window.unbind('.' + prefix + ' .' + event_ie6);
784   -
785   - $overlay.fadeTo(200, 0);
786   -
787   - $box.stop().fadeTo(300, 0, function () {
788   -
789   - $box.add($overlay).css({'opacity': 1, cursor: 'auto'}).hide();
790   -
791   - trigger(event_purge);
792   -
793   - $loaded.remove();
794   -
795   - setTimeout(function () {
796   - closing = false;
797   - trigger(event_closed, settings.onClosed);
798   - }, 1);
799   - });
800   - }
801   - };
802   -
803   - // A method for fetching the current element ColorBox is referencing.
804   - // returns a jQuery object.
805   - publicMethod.element = function () {
806   - return $(element);
807   - };
808   -
809   - publicMethod.settings = defaults;
810   -
811   - // Initializes ColorBox when the DOM has loaded
812   - $(publicMethod.init);
813   -
814   -}(jQuery, document, this));
815 0 \ No newline at end of file
public/javascripts/jquery.colorbox-min.js 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +/*!
  2 + Colorbox v1.4.36 - 2014-02-01
  3 + jQuery lightbox and modal window plugin
  4 + (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox
  5 + license: http://www.opensource.org/licenses/mit-license.php
  6 +*/
  7 +(function(e,t,i){function o(i,o,n){var r=t.createElement(i);return o&&(r.id=Z+o),n&&(r.style.cssText=n),e(r)}function n(){return i.innerHeight?i.innerHeight:e(i).height()}function r(e){var t=k.length,i=(z+e)%t;return 0>i?t+i:i}function h(e,t){return Math.round((/%/.test(e)?("x"===t?E.width():n())/100:1)*parseInt(e,10))}function l(e,t){return e.photo||e.photoRegex.test(t)}function s(e,t){return e.retinaUrl&&i.devicePixelRatio>1?t.replace(e.photoRegex,e.retinaSuffix):t}function a(e){"contains"in g[0]&&!g[0].contains(e.target)&&(e.stopPropagation(),g.focus())}function d(){var t,i=e.data(N,Y);null==i?(B=e.extend({},X),console&&console.log&&console.log("Error: cboxElement missing settings object")):B=e.extend({},i);for(t in B)e.isFunction(B[t])&&"on"!==t.slice(0,2)&&(B[t]=B[t].call(N));B.rel=B.rel||N.rel||e(N).data("rel")||"nofollow",B.href=B.href||e(N).attr("href"),B.title=B.title||N.title,"string"==typeof B.href&&(B.href=e.trim(B.href))}function c(i,o){e(t).trigger(i),lt.triggerHandler(i),e.isFunction(o)&&o.call(N)}function u(i){q||(N=i,d(),k=e(N),z=0,"nofollow"!==B.rel&&(k=e("."+et).filter(function(){var t,i=e.data(this,Y);return i&&(t=e(this).data("rel")||i.rel||this.rel),t===B.rel}),z=k.index(N),-1===z&&(k=k.add(N),z=k.length-1)),w.css({opacity:parseFloat(B.opacity),cursor:B.overlayClose?"pointer":"auto",visibility:"visible"}).show(),J&&g.add(w).removeClass(J),B.className&&g.add(w).addClass(B.className),J=B.className,B.closeButton?K.html(B.close).appendTo(y):K.appendTo("<div/>"),U||(U=$=!0,g.css({visibility:"hidden",display:"block"}),H=o(st,"LoadedContent","width:0; height:0; overflow:hidden"),y.css({width:"",height:""}).append(H),O=x.height()+C.height()+y.outerHeight(!0)-y.height(),_=b.width()+T.width()+y.outerWidth(!0)-y.width(),D=H.outerHeight(!0),A=H.outerWidth(!0),B.w=h(B.initialWidth,"x"),B.h=h(B.initialHeight,"y"),H.css({width:"",height:B.h}),Q.position(),c(tt,B.onOpen),P.add(L).hide(),g.focus(),B.trapFocus&&t.addEventListener&&(t.addEventListener("focus",a,!0),lt.one(rt,function(){t.removeEventListener("focus",a,!0)})),B.returnFocus&&lt.one(rt,function(){e(N).focus()})),m())}function f(){!g&&t.body&&(V=!1,E=e(i),g=o(st).attr({id:Y,"class":e.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),w=o(st,"Overlay").hide(),F=e([o(st,"LoadingOverlay")[0],o(st,"LoadingGraphic")[0]]),v=o(st,"Wrapper"),y=o(st,"Content").append(L=o(st,"Title"),S=o(st,"Current"),I=e('<button type="button"/>').attr({id:Z+"Previous"}),R=e('<button type="button"/>').attr({id:Z+"Next"}),M=o("button","Slideshow"),F),K=e('<button type="button"/>').attr({id:Z+"Close"}),v.append(o(st).append(o(st,"TopLeft"),x=o(st,"TopCenter"),o(st,"TopRight")),o(st,!1,"clear:left").append(b=o(st,"MiddleLeft"),y,T=o(st,"MiddleRight")),o(st,!1,"clear:left").append(o(st,"BottomLeft"),C=o(st,"BottomCenter"),o(st,"BottomRight"))).find("div div").css({"float":"left"}),W=o(st,!1,"position:absolute; width:9999px; visibility:hidden; display:none; max-width:none;"),P=R.add(I).add(S).add(M),e(t.body).append(w,g.append(v,W)))}function p(){function i(e){e.which>1||e.shiftKey||e.altKey||e.metaKey||e.ctrlKey||(e.preventDefault(),u(this))}return g?(V||(V=!0,R.click(function(){Q.next()}),I.click(function(){Q.prev()}),K.click(function(){Q.close()}),w.click(function(){B.overlayClose&&Q.close()}),e(t).bind("keydown."+Z,function(e){var t=e.keyCode;U&&B.escKey&&27===t&&(e.preventDefault(),Q.close()),U&&B.arrowKey&&k[1]&&!e.altKey&&(37===t?(e.preventDefault(),I.click()):39===t&&(e.preventDefault(),R.click()))}),e.isFunction(e.fn.on)?e(t).on("click."+Z,"."+et,i):e("."+et).live("click."+Z,i)),!0):!1}function m(){var n,r,a,u=Q.prep,f=++at;$=!0,j=!1,N=k[z],d(),c(ht),c(it,B.onLoad),B.h=B.height?h(B.height,"y")-D-O:B.innerHeight&&h(B.innerHeight,"y"),B.w=B.width?h(B.width,"x")-A-_:B.innerWidth&&h(B.innerWidth,"x"),B.mw=B.w,B.mh=B.h,B.maxWidth&&(B.mw=h(B.maxWidth,"x")-A-_,B.mw=B.w&&B.w<B.mw?B.w:B.mw),B.maxHeight&&(B.mh=h(B.maxHeight,"y")-D-O,B.mh=B.h&&B.h<B.mh?B.h:B.mh),n=B.href,G=setTimeout(function(){F.show()},100),B.inline?(a=o(st).hide().insertBefore(e(n)[0]),lt.one(ht,function(){a.replaceWith(H.children())}),u(e(n))):B.iframe?u(" "):B.html?u(B.html):l(B,n)?(n=s(B,n),j=t.createElement("img"),e(j).addClass(Z+"Photo").bind("error",function(){B.title=!1,u(o(st,"Error").html(B.imgError))}).one("load",function(){var t;f===at&&(e.each(["alt","longdesc","aria-describedby"],function(t,i){var o=e(N).attr(i)||e(N).attr("data-"+i);o&&j.setAttribute(i,o)}),B.retinaImage&&i.devicePixelRatio>1&&(j.height=j.height/i.devicePixelRatio,j.width=j.width/i.devicePixelRatio),B.scalePhotos&&(r=function(){j.height-=j.height*t,j.width-=j.width*t},B.mw&&j.width>B.mw&&(t=(j.width-B.mw)/j.width,r()),B.mh&&j.height>B.mh&&(t=(j.height-B.mh)/j.height,r())),B.h&&(j.style.marginTop=Math.max(B.mh-j.height,0)/2+"px"),k[1]&&(B.loop||k[z+1])&&(j.style.cursor="pointer",j.onclick=function(){Q.next()}),j.style.width=j.width+"px",j.style.height=j.height+"px",setTimeout(function(){u(j)},1))}),setTimeout(function(){j.src=n},1)):n&&W.load(n,B.data,function(t,i){f===at&&u("error"===i?o(st,"Error").html(B.xhrError):e(this).contents())})}var w,g,v,y,x,b,T,C,k,E,H,W,F,L,S,M,R,I,K,P,B,O,_,D,A,N,z,j,U,$,q,G,Q,J,V,X={html:!1,photo:!1,iframe:!1,inline:!1,transition:"elastic",speed:300,fadeOut:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,className:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:void 0,closeButton:!0,fastIframe:!0,open:!1,reposition:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",photoRegex:/\.(gif|png|jp(e|g|eg)|bmp|ico|webp)((#|\?).*)?$/i,retinaImage:!1,retinaUrl:!1,retinaSuffix:"@2x.$1",current:"image {current} of {total}",previous:"previous",next:"next",close:"close",xhrError:"This content failed to load.",imgError:"This image failed to load.",returnFocus:!0,trapFocus:!0,onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1},Y="colorbox",Z="cbox",et=Z+"Element",tt=Z+"_open",it=Z+"_load",ot=Z+"_complete",nt=Z+"_cleanup",rt=Z+"_closed",ht=Z+"_purge",lt=e("<a/>"),st="div",at=0,dt={},ct=function(){function e(){clearTimeout(h)}function t(){(B.loop||k[z+1])&&(e(),h=setTimeout(Q.next,B.slideshowSpeed))}function i(){M.html(B.slideshowStop).unbind(s).one(s,o),lt.bind(ot,t).bind(it,e),g.removeClass(l+"off").addClass(l+"on")}function o(){e(),lt.unbind(ot,t).unbind(it,e),M.html(B.slideshowStart).unbind(s).one(s,function(){Q.next(),i()}),g.removeClass(l+"on").addClass(l+"off")}function n(){r=!1,M.hide(),e(),lt.unbind(ot,t).unbind(it,e),g.removeClass(l+"off "+l+"on")}var r,h,l=Z+"Slideshow_",s="click."+Z;return function(){r?B.slideshow||(lt.unbind(nt,n),n()):B.slideshow&&k[1]&&(r=!0,lt.one(nt,n),B.slideshowAuto?i():o(),M.show())}}();e.colorbox||(e(f),Q=e.fn[Y]=e[Y]=function(t,i){var o=this;if(t=t||{},f(),p()){if(e.isFunction(o))o=e("<a/>"),t.open=!0;else if(!o[0])return o;i&&(t.onComplete=i),o.each(function(){e.data(this,Y,e.extend({},e.data(this,Y)||X,t))}).addClass(et),(e.isFunction(t.open)&&t.open.call(o)||t.open)&&u(o[0])}return o},Q.position=function(t,i){function o(){x[0].style.width=C[0].style.width=y[0].style.width=parseInt(g[0].style.width,10)-_+"px",y[0].style.height=b[0].style.height=T[0].style.height=parseInt(g[0].style.height,10)-O+"px"}var r,l,s,a=0,d=0,c=g.offset();if(E.unbind("resize."+Z),g.css({top:-9e4,left:-9e4}),l=E.scrollTop(),s=E.scrollLeft(),B.fixed?(c.top-=l,c.left-=s,g.css({position:"fixed"})):(a=l,d=s,g.css({position:"absolute"})),d+=B.right!==!1?Math.max(E.width()-B.w-A-_-h(B.right,"x"),0):B.left!==!1?h(B.left,"x"):Math.round(Math.max(E.width()-B.w-A-_,0)/2),a+=B.bottom!==!1?Math.max(n()-B.h-D-O-h(B.bottom,"y"),0):B.top!==!1?h(B.top,"y"):Math.round(Math.max(n()-B.h-D-O,0)/2),g.css({top:c.top,left:c.left,visibility:"visible"}),v[0].style.width=v[0].style.height="9999px",r={width:B.w+A+_,height:B.h+D+O,top:a,left:d},t){var u=0;e.each(r,function(e){return r[e]!==dt[e]?(u=t,void 0):void 0}),t=u}dt=r,t||g.css(r),g.dequeue().animate(r,{duration:t||0,complete:function(){o(),$=!1,v[0].style.width=B.w+A+_+"px",v[0].style.height=B.h+D+O+"px",B.reposition&&setTimeout(function(){E.bind("resize."+Z,Q.position)},1),i&&i()},step:o})},Q.resize=function(e){var t;U&&(e=e||{},e.width&&(B.w=h(e.width,"x")-A-_),e.innerWidth&&(B.w=h(e.innerWidth,"x")),H.css({width:B.w}),e.height&&(B.h=h(e.height,"y")-D-O),e.innerHeight&&(B.h=h(e.innerHeight,"y")),e.innerHeight||e.height||(t=H.scrollTop(),H.css({height:"auto"}),B.h=H.height()),H.css({height:B.h}),t&&H.scrollTop(t),Q.position("none"===B.transition?0:B.speed))},Q.prep=function(i){function n(){return B.w=B.w||H.width(),B.w=B.mw&&B.mw<B.w?B.mw:B.w,B.w}function h(){return B.h=B.h||H.height(),B.h=B.mh&&B.mh<B.h?B.mh:B.h,B.h}if(U){var a,d="none"===B.transition?0:B.speed;H.empty().remove(),H=o(st,"LoadedContent").append(i),H.hide().appendTo(W.show()).css({width:n(),overflow:B.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(y),W.hide(),e(j).css({"float":"none"}),a=function(){function i(){e.support.opacity===!1&&g[0].style.removeAttribute("filter")}var n,h,a=k.length,u="frameBorder",f="allowTransparency";U&&(h=function(){clearTimeout(G),F.hide(),c(ot,B.onComplete)},L.html(B.title).add(H).show(),a>1?("string"==typeof B.current&&S.html(B.current.replace("{current}",z+1).replace("{total}",a)).show(),R[B.loop||a-1>z?"show":"hide"]().html(B.next),I[B.loop||z?"show":"hide"]().html(B.previous),ct(),B.preloading&&e.each([r(-1),r(1)],function(){var i,o,n=k[this],r=e.data(n,Y);r&&r.href?(i=r.href,e.isFunction(i)&&(i=i.call(n))):i=e(n).attr("href"),i&&l(r,i)&&(i=s(r,i),o=t.createElement("img"),o.src=i)})):P.hide(),B.iframe?(n=o("iframe")[0],u in n&&(n[u]=0),f in n&&(n[f]="true"),B.scrolling||(n.scrolling="no"),e(n).attr({src:B.href,name:(new Date).getTime(),"class":Z+"Iframe",allowFullScreen:!0,webkitAllowFullScreen:!0,mozallowfullscreen:!0}).one("load",h).appendTo(H),lt.one(ht,function(){n.src="//about:blank"}),B.fastIframe&&e(n).trigger("load")):h(),"fade"===B.transition?g.fadeTo(d,1,i):i())},"fade"===B.transition?g.fadeTo(d,0,function(){Q.position(0,a)}):Q.position(d,a)}},Q.next=function(){!$&&k[1]&&(B.loop||k[z+1])&&(z=r(1),u(k[z]))},Q.prev=function(){!$&&k[1]&&(B.loop||z)&&(z=r(-1),u(k[z]))},Q.close=function(){U&&!q&&(q=!0,U=!1,c(nt,B.onCleanup),E.unbind("."+Z),w.fadeTo(B.fadeOut||0,0),g.stop().fadeTo(B.fadeOut||0,0,function(){g.add(w).css({opacity:1,cursor:"auto"}).hide(),c(ht),H.empty().remove(),setTimeout(function(){q=!1,c(rt,B.onClosed)},1)}))},Q.remove=function(){g&&(g.stop(),e.colorbox.close(),g.stop().remove(),w.remove(),q=!1,g=null,e("."+et).removeData(Y).removeClass(et),e(t).unbind("click."+Z))},Q.element=function(){return e(N)},Q.settings=X)})(jQuery,document,window);
0 8 \ No newline at end of file
... ...
public/javascripts/thickbox.js
... ... @@ -1,319 +0,0 @@
1   -/*
2   - * Thickbox 3.1 - One Box To Rule Them All.
3   - * By Cody Lindley (http://www.codylindley.com)
4   - * Copyright (c) 2007 cody lindley
5   - * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
6   -*/
7   -
8   -var tb_pathToImage = "/images/loading.gif";
9   -
10   -/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
11   -
12   -//on page load call tb_init
13   -jQuery(document).ready(function(){
14   - tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
15   - imgLoader = new Image();// preload image
16   - imgLoader.src = noosfero_root() + tb_pathToImage;
17   -});
18   -
19   -//add thickbox to href & area elements that have a class of .thickbox
20   -function tb_init(domChunk){
21   - jQuery(domChunk).click(function(){
22   - var t = this.title || this.name || null;
23   - var a = this.href || this.alt;
24   - var g = this.rel || false;
25   - tb_show(t,a,g);
26   - this.blur();
27   - return false;
28   - });
29   -}
30   -
31   -function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
32   -
33   - try {
34   - if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
35   - jQuery("body","html").css({height: "100%", width: "100%"});
36   - jQuery("html").css("overflow","hidden");
37   - if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
38   - jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
39   - jQuery("#TB_overlay").click(tb_remove);
40   - }
41   - }else{//all others
42   - if(document.getElementById("TB_overlay") === null){
43   - jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
44   - jQuery("#TB_overlay").click(tb_remove);
45   - }
46   - }
47   -
48   - if(tb_detectMacXFF()){
49   - jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
50   - }else{
51   - jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
52   - }
53   -
54   - if(caption===null){caption="";}
55   - jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
56   - jQuery('#TB_load').show();//show loader
57   -
58   - var baseURL;
59   - if(url.indexOf("?")!==-1){ //ff there is a query string involved
60   - baseURL = url.substr(0, url.indexOf("?"));
61   - }else{
62   - baseURL = url;
63   - }
64   -
65   - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
66   - var urlType = baseURL.toLowerCase().match(urlString);
67   -
68   - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
69   -
70   - TB_PrevCaption = "";
71   - TB_PrevURL = "";
72   - TB_PrevHTML = "";
73   - TB_NextCaption = "";
74   - TB_NextURL = "";
75   - TB_NextHTML = "";
76   - TB_imageCount = "";
77   - TB_FoundURL = false;
78   - if(imageGroup){
79   - TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
80   - for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
81   - var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
82   - if (!(TB_TempArray[TB_Counter].href == url)) {
83   - if (TB_FoundURL) {
84   - TB_NextCaption = TB_TempArray[TB_Counter].title;
85   - TB_NextURL = TB_TempArray[TB_Counter].href;
86   - TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
87   - } else {
88   - TB_PrevCaption = TB_TempArray[TB_Counter].title;
89   - TB_PrevURL = TB_TempArray[TB_Counter].href;
90   - TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
91   - }
92   - } else {
93   - TB_FoundURL = true;
94   - TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
95   - }
96   - }
97   - }
98   -
99   - imgPreloader = new Image();
100   - imgPreloader.onload = function(){
101   - imgPreloader.onload = null;
102   -
103   - // Resizing large images - orginal by Christian Montoya edited by me.
104   - var pagesize = tb_getPageSize();
105   - var x = pagesize[0] - 150;
106   - var y = pagesize[1] - 150;
107   - var imageWidth = imgPreloader.width;
108   - var imageHeight = imgPreloader.height;
109   - if (imageWidth > x) {
110   - imageHeight = imageHeight * (x / imageWidth);
111   - imageWidth = x;
112   - if (imageHeight > y) {
113   - imageWidth = imageWidth * (y / imageHeight);
114   - imageHeight = y;
115   - }
116   - } else if (imageHeight > y) {
117   - imageWidth = imageWidth * (y / imageHeight);
118   - imageHeight = y;
119   - if (imageWidth > x) {
120   - imageHeight = imageHeight * (x / imageWidth);
121   - imageWidth = x;
122   - }
123   - }
124   - // End Resizing
125   -
126   - TB_WIDTH = imageWidth + 30;
127   - TB_HEIGHT = imageHeight + 60;
128   - jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
129   -
130   - jQuery("#TB_closeWindowButton").click(tb_remove);
131   -
132   - if (!(TB_PrevHTML === "")) {
133   - function goPrev(){
134   - if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
135   - jQuery("#TB_window").remove();
136   - jQuery("body").append("<div id='TB_window'></div>");
137   - tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
138   - return false;
139   - }
140   - jQuery("#TB_prev").click(goPrev);
141   - }
142   -
143   - if (!(TB_NextHTML === "")) {
144   - function goNext(){
145   - jQuery("#TB_window").remove();
146   - jQuery("body").append("<div id='TB_window'></div>");
147   - tb_show(TB_NextCaption, TB_NextURL, imageGroup);
148   - return false;
149   - }
150   - jQuery("#TB_next").click(goNext);
151   -
152   - }
153   -
154   - document.onkeydown = function(e){
155   - if (e == null) { // ie
156   - keycode = event.keyCode;
157   - } else { // mozilla
158   - keycode = e.which;
159   - }
160   - if(keycode == 27){ // close
161   - tb_remove();
162   - } else if(keycode == 190){ // display previous image
163   - if(!(TB_NextHTML == "")){
164   - document.onkeydown = "";
165   - goNext();
166   - }
167   - } else if(keycode == 188){ // display next image
168   - if(!(TB_PrevHTML == "")){
169   - document.onkeydown = "";
170   - goPrev();
171   - }
172   - }
173   - };
174   -
175   - tb_position();
176   - jQuery("#TB_load").remove();
177   - jQuery("#TB_ImageOff").click(tb_remove);
178   - jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
179   - };
180   -
181   - imgPreloader.src = url;
182   - }else{//code to show html
183   -
184   - var queryString = url.replace(/^[^\?]+\??/,'');
185   - var params = tb_parseQuery( queryString );
186   -
187   - TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
188   - TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
189   - ajaxContentW = TB_WIDTH - 30;
190   - ajaxContentH = TB_HEIGHT - 45;
191   -
192   - if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window
193   - urlNoQuery = url.split('TB_');
194   - jQuery("#TB_iframeContent").remove();
195   - if(params['modal'] != "true"){//iframe no modal
196   - jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
197   - }else{//iframe modal
198   - jQuery("#TB_overlay").unbind();
199   - jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
200   - }
201   - }else{// not an iframe, ajax
202   - if(jQuery("#TB_window").css("display") != "block"){
203   - if(params['modal'] != "true"){//ajax no modal
204   - jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
205   - }else{//ajax modal
206   - jQuery("#TB_overlay").unbind();
207   - jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
208   - }
209   - }else{//this means the window is already up, we are just loading new content via ajax
210   - jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
211   - jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
212   - jQuery("#TB_ajaxContent")[0].scrollTop = 0;
213   - jQuery("#TB_ajaxWindowTitle").html(caption);
214   - }
215   - }
216   -
217   - jQuery("#TB_closeWindowButton").click(tb_remove);
218   -
219   - if(url.indexOf('TB_inline') != -1){
220   - jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
221   - jQuery("#TB_window").unload(function () {
222   - jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
223   - });
224   - tb_position();
225   - jQuery("#TB_load").remove();
226   - jQuery("#TB_window").css({display:"block"});
227   - }else if(url.indexOf('TB_iframe') != -1){
228   - tb_position();
229   - if(jQuery.browser.safari){//safari needs help because it will not fire iframe onload
230   - jQuery("#TB_load").remove();
231   - jQuery("#TB_window").css({display:"block"});
232   - }
233   - }else{
234   - jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
235   - tb_position();
236   - jQuery("#TB_load").remove();
237   - tb_init("#TB_ajaxContent a.thickbox");
238   - jQuery("#TB_window").css({display:"block"});
239   - });
240   - }
241   -
242   - }
243   -
244   - if(!params['modal']){
245   - document.onkeyup = function(e){
246   - if (e == null) { // ie
247   - keycode = event.keyCode;
248   - } else { // mozilla
249   - keycode = e.which;
250   - }
251   - if(keycode == 27){ // close
252   - tb_remove();
253   - }
254   - };
255   - }
256   -
257   - } catch(e) {
258   - //nothing here
259   - }
260   -}
261   -
262   -//helper functions below
263   -function tb_showIframe(){
264   - jQuery("#TB_load").remove();
265   - jQuery("#TB_window").css({display:"block"});
266   -}
267   -
268   -function tb_remove() {
269   - jQuery("#TB_imageOff").unbind("click");
270   - jQuery("#TB_closeWindowButton").unbind("click");
271   - jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
272   - jQuery("#TB_load").remove();
273   - if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
274   - jQuery("body","html").css({height: "auto", width: "auto"});
275   - jQuery("html").css("overflow","");
276   - }
277   - document.onkeydown = "";
278   - document.onkeyup = "";
279   - return false;
280   -}
281   -
282   -function tb_position() {
283   -jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
284   - if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
285   - jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
286   - }
287   -}
288   -
289   -function tb_parseQuery ( query ) {
290   - var Params = {};
291   - if ( ! query ) {return Params;}// return empty object
292   - var Pairs = query.split(/[;&]/);
293   - for ( var i = 0; i < Pairs.length; i++ ) {
294   - var KeyVal = Pairs[i].split('=');
295   - if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
296   - var key = unescape( KeyVal[0] );
297   - var val = unescape( KeyVal[1] );
298   - val = val.replace(/\+/g, ' ');
299   - Params[key] = val;
300   - }
301   - return Params;
302   -}
303   -
304   -function tb_getPageSize(){
305   - var de = document.documentElement;
306   - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
307   - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
308   - arrayPageSize = [w,h];
309   - return arrayPageSize;
310   -}
311   -
312   -function tb_detectMacXFF() {
313   - var userAgent = navigator.userAgent.toLowerCase();
314   - if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
315   - return true;
316   - }
317   -}
318   -
319   -
public/stylesheets/colorbox.css
1 1 /*
2   - ColorBox Core Style:
  2 + Colorbox Core Style:
3 3 The following CSS is consistent between example themes and should not be altered.
4 4 */
5 5 #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
  6 +#cboxWrapper {max-width:none;}
6 7 #cboxOverlay{position:fixed; width:100%; height:100%;}
7 8 #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8 9 #cboxContent{position:relative;}
9   -#cboxLoadedContent{overflow:auto;}
  10 +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
10 11 #cboxTitle{margin:0;}
11   -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
  12 +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
12 13 #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13   -.cboxPhoto{float:left; margin:auto; border:0; display:block;}
  14 +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
14 15 .cboxIframe{width:100%; height:100%; display:block; border:0;}
  16 +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
15 17  
16   -/*
  18 +/*
17 19 User Style:
18   - Change the following styles to modify the appearance of ColorBox. They are
  20 + Change the following styles to modify the appearance of Colorbox. They are
19 21 ordered & tabbed in a way that represents the nesting of the generated HTML.
20 22 */
21 23 #cboxOverlay{background:url(../images/colorbox/overlay.png) repeat 0 0;}
22   -#colorbox{}
23   - #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px 0;}
24   - #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px 0;}
25   - #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px -29px;}
26   - #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px -29px;}
  24 +#colorbox{outline:0;}
  25 + #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px 0;}
  26 + #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px 0;}
  27 + #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px -29px;}
  28 + #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px -29px;}
27 29 #cboxMiddleLeft{width:21px; background:url(../images/colorbox/controls.png) left top repeat-y;}
28 30 #cboxMiddleRight{width:21px; background:url(../images/colorbox/controls.png) right top repeat-y;}
29 31 #cboxTopCenter{height:21px; background:url(../images/colorbox/border.png) 0 0 repeat-x;}
30 32 #cboxBottomCenter{height:21px; background:url(../images/colorbox/border.png) 0 -29px repeat-x;}
31 33 #cboxContent{background:#fff; overflow:hidden;}
  34 + .cboxIframe{background:#fff;}
32 35 #cboxError{padding:50px; border:1px solid #ccc;}
33 36 #cboxLoadedContent{margin-bottom:28px;}
34 37 #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
35 38 #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
  39 + #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;}
  40 + #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;}
  41 +
  42 + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
  43 + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
  44 +
  45 + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
  46 + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
  47 +
36 48 #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
37 49 #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../images/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;}
38   - #cboxPrevious.hover{background-position:-75px -25px;}
  50 + #cboxPrevious:hover{background-position:-75px -25px;}
39 51 #cboxNext{position:absolute; bottom:0; left:27px; background:url(../images/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;}
40   - #cboxNext.hover{background-position:-50px -25px;}
41   - #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;}
42   - #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;}
  52 + #cboxNext:hover{background-position:-50px -25px;}
43 53 #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;}
44   - #cboxClose.hover{background-position:-25px -25px;}
  54 + #cboxClose:hover{background-position:-25px -25px;}
45 55  
46 56 /*
47   - The following fixes a problem where IE7+ replaces a PNG's alpha transparency with a black fill
48   - when an alpha filter (opacity change) is set on the element or ancestor element.
  57 + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
  58 + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9.
  59 + See: http://jacklmoore.com/notes/ie-transparency-problems/
49 60 */
50 61 .cboxIE #cboxTopLeft,
51 62 .cboxIE #cboxTopCenter,
... ... @@ -57,26 +68,3 @@
57 68 .cboxIE #cboxMiddleRight {
58 69 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF);
59 70 }
60   -
61   -/*
62   - The following provides PNG transparency support for IE6
63   -*/
64   -.cboxIE6 #cboxTopLeft{background:url(../images/colorbox/ie6/borderTopLeft.png);}
65   -.cboxIE6 #cboxTopCenter{background:url(../images/colorbox/ie6/borderTopCenter.png);}
66   -.cboxIE6 #cboxTopRight{background:url(../images/colorbox/ie6/borderTopRight.png);}
67   -.cboxIE6 #cboxBottomLeft{background:url(../images/colorbox/ie6/borderBottomLeft.png);}
68   -.cboxIE6 #cboxBottomCenter{background:url(../images/colorbox/ie6/borderBottomCenter.png);}
69   -.cboxIE6 #cboxBottomRight{background:url(../images/colorbox/ie6/borderBottomRight.png);}
70   -.cboxIE6 #cboxMiddleLeft{background:url(../images/colorbox/ie6/borderMiddleLeft.png);}
71   -.cboxIE6 #cboxMiddleRight{background:url(../images/colorbox/ie6/borderMiddleRight.png);}
72   -
73   -.cboxIE6 #cboxTopLeft,
74   -.cboxIE6 #cboxTopCenter,
75   -.cboxIE6 #cboxTopRight,
76   -.cboxIE6 #cboxBottomLeft,
77   -.cboxIE6 #cboxBottomCenter,
78   -.cboxIE6 #cboxBottomRight,
79   -.cboxIE6 #cboxMiddleLeft,
80   -.cboxIE6 #cboxMiddleRight {
81   - _behavior: expression(this.src = this.src ? this.src : this.currentStyle.backgroundImage.split('"')[1], this.style.background = "none", this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + this.src + ", sizingMethod='scale')");
82   -}
... ...
public/stylesheets/thickbox.css
... ... @@ -1,163 +0,0 @@
1   -/* ----------------------------------------------------------------------------------------------------------------*/
2   -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
3   -/* ----------------------------------------------------------------------------------------------------------------*/
4   -/**{padding: 0; margin: 0;}*/
5   -
6   -/* ----------------------------------------------------------------------------------------------------------------*/
7   -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
8   -/* ----------------------------------------------------------------------------------------------------------------*/
9   -#TB_window {
10   - font: 12px Arial, Helvetica, sans-serif;
11   - color: #333333;
12   -}
13   -
14   -#TB_secondLine {
15   - font: 10px Arial, Helvetica, sans-serif;
16   - color:#666666;
17   -}
18   -
19   -#TB_window a:link {color: #666666;}
20   -#TB_window a:visited {color: #666666;}
21   -#TB_window a:hover {color: #000;}
22   -#TB_window a:active {color: #666666;}
23   -#TB_window a:focus{color: #666666;}
24   -
25   -/* ----------------------------------------------------------------------------------------------------------------*/
26   -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/
27   -/* ----------------------------------------------------------------------------------------------------------------*/
28   -#TB_overlay {
29   - position: fixed;
30   - z-index:200;
31   - top: 0px;
32   - left: 0px;
33   - height:100%;
34   - width:100%;
35   -}
36   -
37   -.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
38   -.TB_overlayBG {
39   - background-color:#000;
40   - filter:alpha(opacity=75);
41   - -moz-opacity: 0.75;
42   - opacity: 0.75;
43   -}
44   -
45   -* html #TB_overlay { /* ie6 hack */
46   - position: absolute;
47   - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
48   -}
49   -
50   -#TB_window {
51   - position: fixed;
52   - background: white;
53   - z-index: 202;
54   - color:#000000;
55   - display:none;
56   - border: 1px solid #000;
57   - text-align:left;
58   - top:50%;
59   - left:50%;
60   -}
61   -
62   -* html #TB_window { /* ie6 hack */
63   -position: absolute;
64   -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
65   -}
66   -
67   -#TB_window img#TB_Image {
68   - display:block;
69   - margin: 15px 0 0 15px;
70   - border-right: 1px solid #ccc;
71   - border-bottom: 1px solid #ccc;
72   - border-top: 1px solid #666;
73   - border-left: 1px solid #666;
74   -}
75   -
76   -#TB_caption{
77   - height:25px;
78   - padding:7px 30px 10px 25px;
79   - float:left;
80   -}
81   -
82   -#TB_closeWindow{
83   - height:25px;
84   - padding:11px 25px 10px 0;
85   - float:right;
86   -}
87   -
88   -#TB_closeAjaxWindow{
89   - padding:7px 10px 5px 0;
90   - margin-bottom:1px;
91   - text-align:right;
92   - float:right;
93   -}
94   -
95   -#TB_ajaxWindowTitle{
96   - float:left;
97   - padding:7px 0 5px 10px;
98   - margin-bottom:1px;
99   -}
100   -
101   -#TB_title{
102   - background-color:#e8e8e8;
103   - height:27px;
104   -}
105   -
106   -#TB_ajaxContent{
107   - clear:both;
108   - padding:2px 15px 15px 15px;
109   - overflow:auto;
110   - text-align:left;
111   - line-height:1.4em;
112   -}
113   -
114   -#TB_ajaxContent.TB_modal{
115   - padding:15px;
116   -}
117   -
118   -#TB_ajaxContent p{
119   - padding:5px 0px 5px 0px;
120   -}
121   -
122   -#TB_load{
123   - position: fixed;
124   - display:none;
125   - height:13px;
126   - width:208px;
127   - z-index:203;
128   - top: 50%;
129   - left: 50%;
130   - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
131   -}
132   -
133   -* html #TB_load { /* ie6 hack */
134   -position: absolute;
135   -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
136   -}
137   -
138   -#TB_HideSelect{
139   - z-index:199;
140   - position:fixed;
141   - top: 0;
142   - left: 0;
143   - background-color:#fff;
144   - border:none;
145   - filter:alpha(opacity=0);
146   - -moz-opacity: 0;
147   - opacity: 0;
148   - height:100%;
149   - width:100%;
150   -}
151   -
152   -* html #TB_HideSelect { /* ie6 hack */
153   - position: absolute;
154   - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
155   -}
156   -
157   -#TB_iframeContent{
158   - clear:both;
159   - border:none;
160   - margin-bottom:-1px;
161   - margin-top:1px;
162   - _margin-bottom:1px;
163   -}
test/unit/thickbox_helper_test.rb
... ... @@ -1,25 +0,0 @@
1   -require_relative "../test_helper"
2   -
3   -class ThickboxHelperTest < ActiveSupport::TestCase
4   - include ThickboxHelper
5   -
6   - def url_for(url)
7   - url
8   - end
9   -
10   - should 'create thickbox links correcly' do
11   - expects(:link_to).with('Title', '/url#TB_inline?height=300&width=500&inlineId=inlineLoginBox&modal=true', :class => 'thickbox')
12   - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox')
13   - end
14   -
15   - should 'pass along extra options' do
16   - expects(:link_to).with('Title', anything, :class => 'thickbox', :id => 'lalala', :title => 'lelele')
17   - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox', :id => 'lalala', :title => 'lelele')
18   - end
19   -
20   - should 'generate close button' do
21   - expects(:button_to_function).with(:close, 'Title', 'tb_remove();').returns('[close-button]')
22   - assert_equal '[close-button]', thickbox_close_button('Title')
23   - end
24   -
25   -end