From 582e694e54a3a721e776c1930b9e995aba4223d5 Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Tue, 11 Feb 2014 16:27:01 -0300 Subject: [PATCH] modals: Replace thickbox with colorbox --- app/helpers/application_helper.rb | 2 -- app/helpers/boxes_helper.rb | 2 +- app/helpers/colorbox_helper.rb | 29 +++++++++++++++++++++++++---- app/helpers/thickbox_helper.rb | 11 ----------- app/views/account/login.html.erb | 6 +++--- app/views/layouts/_user.html.erb | 4 ++-- app/views/shared/user_menu.html.erb | 4 ++-- public/images/colorbox/controls.png | Bin 1249 -> 0 bytes public/javascripts/application.js | 25 ------------------------- public/javascripts/colorbox-helpers.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ public/javascripts/colorbox.js | 814 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public/javascripts/jquery.colorbox-min.js | 7 +++++++ public/javascripts/thickbox.js | 319 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public/stylesheets/colorbox.css | 70 +++++++++++++++++++++++++++++----------------------------------------- public/stylesheets/thickbox.css | 163 ------------------------------------------------------------------------------------------------------------------------------------------------------------------- test/unit/thickbox_helper_test.rb | 25 ------------------------- 16 files changed, 113 insertions(+), 1412 deletions(-) delete mode 100644 app/helpers/thickbox_helper.rb create mode 100644 public/javascripts/colorbox-helpers.js delete mode 100644 public/javascripts/colorbox.js create mode 100644 public/javascripts/jquery.colorbox-min.js delete mode 100644 public/javascripts/thickbox.js delete mode 100644 public/stylesheets/thickbox.css delete mode 100644 test/unit/thickbox_helper_test.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 531bdd9..8d736c2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -10,8 +10,6 @@ module ApplicationHelper include LightboxHelper - include ThickboxHelper - include ColorboxHelper include BoxesHelper diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index 41ad03f..e45f0e3 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -241,7 +241,7 @@ module BoxesHelper end if block.respond_to?(:help) - 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}") + 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}") end if block.embedable? diff --git a/app/helpers/colorbox_helper.rb b/app/helpers/colorbox_helper.rb index 24bedc5..6cfebb7 100644 --- a/app/helpers/colorbox_helper.rb +++ b/app/helpers/colorbox_helper.rb @@ -1,5 +1,21 @@ module ColorboxHelper + def colorbox_inline_link_to title, url, selector, options = {} + link_to title, url, colorbox_options(options.merge(:inline => selector)) + end + + def colorbox_inline_icon type, title, url, selector, options = {} + icon_button type, title, url, colorbox_options(options.merge(:inline => selector)) + end + + def colorbox_link_to title, url, options = {} + link_to title, url, colorbox_options(options) + end + + def colorbox_close_link text, options = {} + link_to text, '#', colorbox_options(options, :close) + end + def colorbox_close_button(text, options = {}) button(:close, text, '#', colorbox_options(options, :close)) end @@ -16,10 +32,15 @@ module ColorboxHelper # # returns a new hash with colorbox class added. Keeps existing classes. def colorbox_options(options, type=nil) - the_class = 'colorbox' - the_class += "-#{type.to_s}" unless type.nil? - the_class << " #{options[:class]}" if options.has_key?(:class) - options.merge(:class => the_class) + inline_selector = options.delete :inline + options[:onclick] = "return colorbox_helpers.inline('#{inline_selector}')" if inline_selector + + classes = if inline_selector then '' else 'colorbox' end + classes += "-#{type.to_s}" if type.present? + classes << " #{options[:class]}" if options.has_key? :class + options.merge!(:class => classes) + + options end end diff --git a/app/helpers/thickbox_helper.rb b/app/helpers/thickbox_helper.rb deleted file mode 100644 index 376dd4f..0000000 --- a/app/helpers/thickbox_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -module ThickboxHelper - def thickbox_inline_popup_link(title, url, id, options = {}) - link_to(title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => 'thickbox'}.merge(options)) - end - def thickbox_inline_popup_icon(type, title, url, id, options = {}) - icon_button(type, title, url_for(url) + "#TB_inline?height=300&width=500&inlineId=#{id}&modal=true", {:class => "thickbox"}.merge(options)) - end - def thickbox_close_button(title) - button_to_function(:close, title, 'tb_remove();') - end -end diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 5126c66..2726220 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -3,7 +3,7 @@

<%= _('Login') %>

<% @user ||= User.new %> -<% is_thickbox ||= false %> +<% is_popin ||= false %> <%= @message %> @@ -17,8 +17,8 @@ <% button_bar do %> <%= submit_button( 'login', _('Log in') )%> - <% if is_thickbox %> - <%= thickbox_close_button(_('Cancel')) %> + <% if is_popin %> + <%= colorbox_close_button(_('Cancel')) %> <% end %> <% end %> diff --git a/app/views/layouts/_user.html.erb b/app/views/layouts/_user.html.erb index d9521e1..dda041c 100644 --- a/app/views/layouts/_user.html.erb +++ b/app/views/layouts/_user.html.erb @@ -7,11 +7,11 @@ <% else %> - <%= _("") % thickbox_inline_popup_link('' + _('Login') + '', login_url, 'inlineLoginBox', :id => 'link_login') %> + <%= _("") % colorbox_inline_link_to('' + _('Login') + '', login_url, '#inlineLoginBox', :id => 'link_login') %> <%= @plugins.dispatch(:alternative_authentication_link).collect { |content| instance_exec(&content) }.join("") %> <% unless @plugins.dispatch(:allow_user_registration).include?(false) %> diff --git a/app/views/shared/user_menu.html.erb b/app/views/shared/user_menu.html.erb index 4a40cde..e94ffce 100644 --- a/app/views/shared/user_menu.html.erb +++ b/app/views/shared/user_menu.html.erb @@ -58,9 +58,9 @@ <% if theme_option( :menu_login ) == 'full_form' %> <%= render :file => 'account/login_block' %> <% else %> - <%= thickbox_inline_popup_link(''+ _('Login'), login_url, 'inlineLoginBox', :id => 'link_login') %> + <%= colorbox_inline_link_to(''+ _('Login'), login_url, '#inlineLoginBox', :id => 'link_login') %> <% end %> <% end %> diff --git a/public/images/colorbox/controls.png b/public/images/colorbox/controls.png index 9257176..dcfd6fb 100644 Binary files a/public/images/colorbox/controls.png and b/public/images/colorbox/controls.png differ diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 1961b40..f3c8cc1 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1005,31 +1005,6 @@ log.error = function() { window.log.apply(window, jQuery.merge(['error'], arguments)); } -jQuery(function($) { - $('.colorbox').live('click', function() { - $.colorbox({ - href: $(this).attr('href'), - maxWidth: $(window).width()-50, - height: $(window).height()-50, - open: true, - fixed: true, - close: 'Cancel', - onComplete: function(bt) { - var opt = {}, maxH = $(window).height()-50; - if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH; - $.colorbox.resize(opt); - } - }); - return false; - }); - - $('.colorbox-close').live('click', function() { - $.colorbox.close(); - return false; - }); - -}); - function showHideTermsOfUse() { if( jQuery("#article_has_terms_of_use").attr("checked") ) jQuery("#text_area_terms_of_use").show(); diff --git a/public/javascripts/colorbox-helpers.js b/public/javascripts/colorbox-helpers.js new file mode 100644 index 0000000..00b0be6 --- /dev/null +++ b/public/javascripts/colorbox-helpers.js @@ -0,0 +1,44 @@ +colorbox_helpers = { + + watchClass: function() { + jQuery(function($) { + $('.colorbox').live('click', function() { + $.colorbox({ + href: $(this).attr('href'), + maxWidth: $(window).width()-50, + height: $(window).height()-50, + open: true, + close: 'Cancel', + onComplete: function(bt) { + var opt = {}, maxH = $(window).height()-50; + if ($('#cboxLoadedContent *:first').height() > maxH) opt.height = maxH; + $.colorbox.resize(opt); + } + }); + return false; + }); + + $('.colorbox-close').live('click', function() { + $.colorbox.close(); + return false; + }); + + }); + }, + + inline: function(href) { + var href = jQuery(href); + + jQuery.colorbox({ + inline: true, href: href, + onLoad: function(){ href.show(); }, + onCleanup: function(){ href.hide(); }, + }); + + return false; + }, + +}; + +colorbox_helpers.watchClass(); + diff --git a/public/javascripts/colorbox.js b/public/javascripts/colorbox.js deleted file mode 100644 index 51ad367..0000000 --- a/public/javascripts/colorbox.js +++ /dev/null @@ -1,814 +0,0 @@ -// ColorBox v1.3.16 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ -// Copyright (c) 2011 Jack Moore - jack@colorpowered.com -// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -(function ($, document, window) { - var - // ColorBox Default Settings. - // See http://colorpowered.com/colorbox for details. - defaults = { - transition: "elastic", - speed: 300, - width: false, - initialWidth: "600", - innerWidth: false, - maxWidth: false, - height: false, - initialHeight: "450", - innerHeight: false, - maxHeight: false, - scalePhotos: true, - scrolling: true, - inline: false, - html: false, - iframe: false, - fastIframe: true, - photo: false, - href: false, - title: false, - rel: false, - opacity: 0.9, - preloading: true, - current: "image {current} of {total}", - previous: "previous", - next: "next", - close: "close", - open: false, - returnFocus: true, - loop: true, - slideshow: false, - slideshowAuto: true, - slideshowSpeed: 2500, - slideshowStart: "start slideshow", - slideshowStop: "stop slideshow", - onOpen: false, - onLoad: false, - onComplete: false, - onCleanup: false, - onClosed: false, - overlayClose: true, - escKey: true, - arrowKey: true - }, - - // Abstracting the HTML and event identifiers for easy rebranding - colorbox = 'colorbox', - prefix = 'cbox', - - // Events - event_open = prefix + '_open', - event_load = prefix + '_load', - event_complete = prefix + '_complete', - event_cleanup = prefix + '_cleanup', - event_closed = prefix + '_closed', - event_purge = prefix + '_purge', - - // Special Handling for IE - 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. - isIE6 = isIE && $.browser.version < 7, - event_ie6 = prefix + '_IE6', - - // Cached jQuery Object Variables - $overlay, - $box, - $wrap, - $content, - $topBorder, - $leftBorder, - $rightBorder, - $bottomBorder, - $related, - $window, - $loaded, - $loadingBay, - $loadingOverlay, - $title, - $current, - $slideshow, - $next, - $prev, - $close, - $groupControls, - - // Variables for cached values or use across multiple functions - settings = {}, - interfaceHeight, - interfaceWidth, - loadedHeight, - loadedWidth, - element, - index, - photo, - open, - active, - closing = false, - - publicMethod, - boxElement = prefix + 'Element'; - - // **************** - // HELPER FUNCTIONS - // **************** - - // jQuery object generator to reduce code size - function $div(id, cssText) { - var div = document.createElement('div'); - if (id) { - div.id = prefix + id; - } - div.style.cssText = cssText || false; - return $(div); - } - - // Convert % values to pixels - function setSize(size, dimension) { - dimension = dimension === 'x' ? $window.width() : $window.height(); - return (typeof size === 'string') ? Math.round((/%/.test(size) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size; - } - - // Checks an href to see if it is a photo. - // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. - function isImage(url) { - return settings.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(url); - } - - // Assigns function results to their respective settings. This allows functions to be used as values. - function process(settings) { - for (var i in settings) { - 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. - settings[i] = settings[i].call(element); - } - } - settings.rel = settings.rel || element.rel || 'nofollow'; - settings.href = $.trim(settings.href || $(element).attr('href')); - settings.title = settings.title || element.title; - } - - function trigger(event, callback) { - if (callback) { - callback.call(element); - } - $.event.trigger(event); - } - - // Slideshow functionality - function slideshow() { - var - timeOut, - className = prefix + "Slideshow_", - click = "click." + prefix, - start, - stop, - clear; - - if (settings.slideshow && $related[1]) { - start = function () { - $slideshow - .text(settings.slideshowStop) - .unbind(click) - .bind(event_complete, function () { - if (index < $related.length - 1 || settings.loop) { - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); - } - }) - .bind(event_load, function () { - clearTimeout(timeOut); - }) - .one(click + ' ' + event_cleanup, stop); - $box.removeClass(className + "off").addClass(className + "on"); - timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); - }; - - stop = function () { - clearTimeout(timeOut); - $slideshow - .text(settings.slideshowStart) - .unbind([event_complete, event_load, event_cleanup, click].join(' ')) - .one(click, start); - $box.removeClass(className + "on").addClass(className + "off"); - }; - - if (settings.slideshowAuto) { - start(); - } else { - stop(); - } - } - } - - function launch(elem) { - if (!closing) { - - element = elem; - - process($.extend(settings, $.data(element, colorbox))); - - $related = $(element); - - index = 0; - - if (settings.rel !== 'nofollow') { - $related = $('.' + boxElement).filter(function () { - var relRelated = $.data(this, colorbox).rel || this.rel; - return (relRelated === settings.rel); - }); - index = $related.index(element); - - // Check direct calls to ColorBox. - if (index === -1) { - $related = $related.add(element); - index = $related.length - 1; - } - } - - if (!open) { - open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. - - $box.show(); - - if (settings.returnFocus) { - try { - element.blur(); - $(element).one(event_closed, function () { - try { - this.focus(); - } catch (e) { - // do nothing - } - }); - } catch (e) { - // do nothing - } - } - - // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5' - $overlay.css({"opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto"}).show(); - - // Opens inital empty ColorBox prior to content being loaded. - settings.w = setSize(settings.initialWidth, 'x'); - settings.h = setSize(settings.initialHeight, 'y'); - publicMethod.position(0); - - if (isIE6) { - $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function () { - $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()}); - }).trigger('resize.' + event_ie6); - } - - trigger(event_open, settings.onOpen); - - $groupControls.add($title).hide(); - - $close.html(settings.close).show(); - } - - publicMethod.load(true); - } - } - - // **************** - // PUBLIC FUNCTIONS - // Usage format: $.fn.colorbox.close(); - // Usage from within an iframe: parent.$.fn.colorbox.close(); - // **************** - - publicMethod = $.fn[colorbox] = $[colorbox] = function (options, callback) { - var $this = this, autoOpen; - - if (!$this[0] && $this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit. - return $this; - } - - options = options || {}; - - if (callback) { - options.onComplete = callback; - } - - if (!$this[0] || $this.selector === undefined) { // detects $.colorbox() and $.fn.colorbox() - $this = $(''); - options.open = true; // assume an immediate open - } - - $this.each(function () { - $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options)); - $(this).addClass(boxElement); - }); - - autoOpen = options.open; - - if ($.isFunction(autoOpen)) { - autoOpen = autoOpen.call($this); - } - - if (autoOpen) { - launch($this[0]); - } - - return $this; - }; - - // Initialize ColorBox: store common calculations, preload the interface graphics, append the html. - // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only - // having to run once, instead of each time colorbox is opened. - publicMethod.init = function () { - // Create & Append jQuery Objects - $window = $(window); - $box = $div().attr({id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : ''}); - $overlay = $div("Overlay", isIE6 ? 'position:absolute' : '').hide(); - - $wrap = $div("Wrapper"); - $content = $div("Content").append( - $loaded = $div("LoadedContent", 'width:0; height:0; overflow:hidden'), - $loadingOverlay = $div("LoadingOverlay").add($div("LoadingGraphic")), - $title = $div("Title"), - $current = $div("Current"), - $next = $div("Next"), - $prev = $div("Previous"), - $slideshow = $div("Slideshow").bind(event_open, slideshow), - $close = $div("Close") - ); - $wrap.append( // The 3x3 Grid that makes up ColorBox - $div().append( - $div("TopLeft"), - $topBorder = $div("TopCenter"), - $div("TopRight") - ), - $div(false, 'clear:left').append( - $leftBorder = $div("MiddleLeft"), - $content, - $rightBorder = $div("MiddleRight") - ), - $div(false, 'clear:left').append( - $div("BottomLeft"), - $bottomBorder = $div("BottomCenter"), - $div("BottomRight") - ) - ).children().children().css({'float': 'left'}); - - $loadingBay = $div(false, 'position:absolute; width:9999px; visibility:hidden; display:none'); - - $('body').prepend($overlay, $box.append($wrap, $loadingBay)); - - $content.children() - .hover(function () { - $(this).addClass('hover'); - }, function () { - $(this).removeClass('hover'); - }).addClass('hover'); - - // Cache values needed for size calculations - interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height();//Subtraction needed for IE6 - interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); - loadedHeight = $loaded.outerHeight(true); - loadedWidth = $loaded.outerWidth(true); - - // Setting padding to remove the need to do size conversions during the animation step. - $box.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide(); - - // Setup button events. - $next.click(function () { - publicMethod.next(); - }); - $prev.click(function () { - publicMethod.prev(); - }); - $close.click(function () { - publicMethod.close(); - }); - - $groupControls = $next.add($prev).add($current).add($slideshow); - - // Adding the 'hover' class allowed the browser to load the hover-state - // background graphics. The class can now can be removed. - $content.children().removeClass('hover'); - - $('.' + boxElement).live('click', function (e) { - // checks to see if it was a non-left mouse-click and for clicks modified with ctrl, shift, or alt. - if (!((e.button !== 0 && typeof e.button !== 'undefined') || e.ctrlKey || e.shiftKey || e.altKey)) { - e.preventDefault(); - launch(this); - } - }); - - $overlay.click(function () { - if (settings.overlayClose) { - publicMethod.close(); - } - }); - - // Set Navigation Key Bindings - $(document).bind('keydown.' + prefix, function (e) { - var key = e.keyCode; - if (open && settings.escKey && key === 27) { - e.preventDefault(); - publicMethod.close(); - } - if (open && settings.arrowKey && $related[1]) { - if (key === 37) { - e.preventDefault(); - $prev.click(); - } else if (key === 39) { - e.preventDefault(); - $next.click(); - } - } - }); - }; - - publicMethod.remove = function () { - $box.add($overlay).remove(); - $('.' + boxElement).die('click').removeData(colorbox).removeClass(boxElement); - }; - - publicMethod.position = function (speed, loadedCallback) { - var - animate_speed, - // keeps the top and left positions within the browser's viewport. - posTop = Math.max(document.documentElement.clientHeight - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop(), - posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft(); - - // setting the speed to 0 to reduce the delay between same-sized content. - animate_speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed; - - // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, - // but it has to be shrank down around the size of div#colorbox when it's done. If not, - // it can invoke an obscure IE bug when using iframes. - $wrap[0].style.width = $wrap[0].style.height = "9999px"; - - function modalDimensions(that) { - // loading overlay height has to be explicitly set for IE6. - $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; - $loadingOverlay[0].style.height = $loadingOverlay[1].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; - } - - $box.dequeue().animate({width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: posTop, left: posLeft}, { - duration: animate_speed, - complete: function () { - modalDimensions(this); - - active = false; - - // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. - $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; - $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; - - if (loadedCallback) { - loadedCallback(); - } - }, - step: function () { - modalDimensions(this); - } - }); - }; - - publicMethod.resize = function (options) { - if (open) { - options = options || {}; - - if (options.width) { - settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; - } - if (options.innerWidth) { - settings.w = setSize(options.innerWidth, 'x'); - } - $loaded.css({width: settings.w}); - - if (options.height) { - settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; - } - if (options.innerHeight) { - settings.h = setSize(options.innerHeight, 'y'); - } - if (!options.innerHeight && !options.height) { - var $child = $loaded.wrapInner("
").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be. - settings.h = $child.height(); - $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation - } - $loaded.css({height: settings.h}); - - publicMethod.position(settings.transition === "none" ? 0 : settings.speed); - } - }; - - publicMethod.prep = function (object) { - if (!open) { - return; - } - - var speed = settings.transition === "none" ? 0 : settings.speed; - - $window.unbind('resize.' + prefix); - $loaded.remove(); - $loaded = $div('LoadedContent').html(object); - - function getWidth() { - settings.w = settings.w || $loaded.width(); - settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; - return settings.w; - } - function getHeight() { - settings.h = settings.h || $loaded.height(); - settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; - return settings.h; - } - - $loaded.hide() - .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. - .css({width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden'}) - .css({height: getHeight()})// sets the height independently from the width in case the new width influences the value of height. - .prependTo($content); - - $loadingBay.hide(); - - // 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. - //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); - - $(photo).css({'float': 'none'}); - - // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. - if (isIE6) { - $('select').not($box.find('select')).filter(function () { - return this.style.visibility !== 'hidden'; - }).css({'visibility': 'hidden'}).one(event_cleanup, function () { - this.style.visibility = 'inherit'; - }); - } - - function setPosition(s) { - publicMethod.position(s, function () { - var prev, prevSrc, next, nextSrc, total = $related.length, iframe, complete; - - if (!open) { - return; - } - - complete = function () { - $loadingOverlay.hide(); - trigger(event_complete, settings.onComplete); - }; - - if (isIE) { - //This fadeIn helps the bicubic resampling to kick-in. - if (photo) { - $loaded.fadeIn(100); - } - } - - $title.html(settings.title).add($loaded).show(); - - if (total > 1) { // handle grouping - if (typeof settings.current === "string") { - $current.html(settings.current.replace(/\{current\}/, index + 1).replace(/\{total\}/, total)).show(); - } - - $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); - $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); - - prev = index ? $related[index - 1] : $related[total - 1]; - next = index < total - 1 ? $related[index + 1] : $related[0]; - - if (settings.slideshow) { - $slideshow.show(); - } - - // Preloads images within a rel group - if (settings.preloading) { - nextSrc = $.data(next, colorbox).href || next.href; - prevSrc = $.data(prev, colorbox).href || prev.href; - - nextSrc = $.isFunction(nextSrc) ? nextSrc.call(next) : nextSrc; - prevSrc = $.isFunction(prevSrc) ? prevSrc.call(prev) : prevSrc; - - if (isImage(nextSrc)) { - $('')[0].src = nextSrc; - } - - if (isImage(prevSrc)) { - $('')[0].src = prevSrc; - } - } - } else { - $groupControls.hide(); - } - - if (settings.iframe) { - iframe = $('
"); - jQuery("#TB_overlay").click(tb_remove); - } - }else{//all others - if(document.getElementById("TB_overlay") === null){ - jQuery("body").append("
"); - jQuery("#TB_overlay").click(tb_remove); - } - } - - if(tb_detectMacXFF()){ - jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash - }else{ - jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity - } - - if(caption===null){caption="";} - jQuery("body").append("
");//add loader to the page - jQuery('#TB_load').show();//show loader - - var baseURL; - if(url.indexOf("?")!==-1){ //ff there is a query string involved - baseURL = url.substr(0, url.indexOf("?")); - }else{ - baseURL = url; - } - - var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/; - var urlType = baseURL.toLowerCase().match(urlString); - - if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images - - TB_PrevCaption = ""; - TB_PrevURL = ""; - TB_PrevHTML = ""; - TB_NextCaption = ""; - TB_NextURL = ""; - TB_NextHTML = ""; - TB_imageCount = ""; - TB_FoundURL = false; - if(imageGroup){ - TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get(); - for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) { - var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); - if (!(TB_TempArray[TB_Counter].href == url)) { - if (TB_FoundURL) { - TB_NextCaption = TB_TempArray[TB_Counter].title; - TB_NextURL = TB_TempArray[TB_Counter].href; - TB_NextHTML = "  
Next >
"; - } else { - TB_PrevCaption = TB_TempArray[TB_Counter].title; - TB_PrevURL = TB_TempArray[TB_Counter].href; - TB_PrevHTML = "  < Prev"; - } - } else { - TB_FoundURL = true; - TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); - } - } - } - - imgPreloader = new Image(); - imgPreloader.onload = function(){ - imgPreloader.onload = null; - - // Resizing large images - orginal by Christian Montoya edited by me. - var pagesize = tb_getPageSize(); - var x = pagesize[0] - 150; - var y = pagesize[1] - 150; - var imageWidth = imgPreloader.width; - var imageHeight = imgPreloader.height; - if (imageWidth > x) { - imageHeight = imageHeight * (x / imageWidth); - imageWidth = x; - if (imageHeight > y) { - imageWidth = imageWidth * (y / imageHeight); - imageHeight = y; - } - } else if (imageHeight > y) { - imageWidth = imageWidth * (y / imageHeight); - imageHeight = y; - if (imageWidth > x) { - imageHeight = imageHeight * (x / imageWidth); - imageWidth = x; - } - } - // End Resizing - - TB_WIDTH = imageWidth + 30; - TB_HEIGHT = imageHeight + 60; - jQuery("#TB_window").append(""+caption+"" + "
"+caption+"
" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "
close or Esc Key
"); - - jQuery("#TB_closeWindowButton").click(tb_remove); - - if (!(TB_PrevHTML === "")) { - function goPrev(){ - if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);} - jQuery("#TB_window").remove(); - jQuery("body").append("
"); - tb_show(TB_PrevCaption, TB_PrevURL, imageGroup); - return false; - } - jQuery("#TB_prev").click(goPrev); - } - - if (!(TB_NextHTML === "")) { - function goNext(){ - jQuery("#TB_window").remove(); - jQuery("body").append("
"); - tb_show(TB_NextCaption, TB_NextURL, imageGroup); - return false; - } - jQuery("#TB_next").click(goNext); - - } - - document.onkeydown = function(e){ - if (e == null) { // ie - keycode = event.keyCode; - } else { // mozilla - keycode = e.which; - } - if(keycode == 27){ // close - tb_remove(); - } else if(keycode == 190){ // display previous image - if(!(TB_NextHTML == "")){ - document.onkeydown = ""; - goNext(); - } - } else if(keycode == 188){ // display next image - if(!(TB_PrevHTML == "")){ - document.onkeydown = ""; - goPrev(); - } - } - }; - - tb_position(); - jQuery("#TB_load").remove(); - jQuery("#TB_ImageOff").click(tb_remove); - jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show - }; - - imgPreloader.src = url; - }else{//code to show html - - var queryString = url.replace(/^[^\?]+\??/,''); - var params = tb_parseQuery( queryString ); - - TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL - TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL - ajaxContentW = TB_WIDTH - 30; - ajaxContentH = TB_HEIGHT - 45; - - if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window - urlNoQuery = url.split('TB_'); - jQuery("#TB_iframeContent").remove(); - if(params['modal'] != "true"){//iframe no modal - jQuery("#TB_window").append("
"+caption+"
close or Esc Key
"); - }else{//iframe modal - jQuery("#TB_overlay").unbind(); - jQuery("#TB_window").append(""); - } - }else{// not an iframe, ajax - if(jQuery("#TB_window").css("display") != "block"){ - if(params['modal'] != "true"){//ajax no modal - jQuery("#TB_window").append("
"+caption+"
close or Esc Key
"); - }else{//ajax modal - jQuery("#TB_overlay").unbind(); - jQuery("#TB_window").append("
"); - } - }else{//this means the window is already up, we are just loading new content via ajax - jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px"; - jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px"; - jQuery("#TB_ajaxContent")[0].scrollTop = 0; - jQuery("#TB_ajaxWindowTitle").html(caption); - } - } - - jQuery("#TB_closeWindowButton").click(tb_remove); - - if(url.indexOf('TB_inline') != -1){ - jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children()); - jQuery("#TB_window").unload(function () { - jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished - }); - tb_position(); - jQuery("#TB_load").remove(); - jQuery("#TB_window").css({display:"block"}); - }else if(url.indexOf('TB_iframe') != -1){ - tb_position(); - if(jQuery.browser.safari){//safari needs help because it will not fire iframe onload - jQuery("#TB_load").remove(); - jQuery("#TB_window").css({display:"block"}); - } - }else{ - jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method - tb_position(); - jQuery("#TB_load").remove(); - tb_init("#TB_ajaxContent a.thickbox"); - jQuery("#TB_window").css({display:"block"}); - }); - } - - } - - if(!params['modal']){ - document.onkeyup = function(e){ - if (e == null) { // ie - keycode = event.keyCode; - } else { // mozilla - keycode = e.which; - } - if(keycode == 27){ // close - tb_remove(); - } - }; - } - - } catch(e) { - //nothing here - } -} - -//helper functions below -function tb_showIframe(){ - jQuery("#TB_load").remove(); - jQuery("#TB_window").css({display:"block"}); -} - -function tb_remove() { - jQuery("#TB_imageOff").unbind("click"); - jQuery("#TB_closeWindowButton").unbind("click"); - jQuery("#TB_window").fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); - jQuery("#TB_load").remove(); - if (typeof document.body.style.maxHeight == "undefined") {//if IE 6 - jQuery("body","html").css({height: "auto", width: "auto"}); - jQuery("html").css("overflow",""); - } - document.onkeydown = ""; - document.onkeyup = ""; - return false; -} - -function tb_position() { -jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'}); - if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6 - jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'}); - } -} - -function tb_parseQuery ( query ) { - var Params = {}; - if ( ! query ) {return Params;}// return empty object - var Pairs = query.split(/[;&]/); - for ( var i = 0; i < Pairs.length; i++ ) { - var KeyVal = Pairs[i].split('='); - if ( ! KeyVal || KeyVal.length != 2 ) {continue;} - var key = unescape( KeyVal[0] ); - var val = unescape( KeyVal[1] ); - val = val.replace(/\+/g, ' '); - Params[key] = val; - } - return Params; -} - -function tb_getPageSize(){ - var de = document.documentElement; - var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; - var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; - arrayPageSize = [w,h]; - return arrayPageSize; -} - -function tb_detectMacXFF() { - var userAgent = navigator.userAgent.toLowerCase(); - if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) { - return true; - } -} - - diff --git a/public/stylesheets/colorbox.css b/public/stylesheets/colorbox.css index ac5a3c2..d241c8f 100644 --- a/public/stylesheets/colorbox.css +++ b/public/stylesheets/colorbox.css @@ -1,51 +1,62 @@ /* - ColorBox Core Style: + Colorbox Core Style: The following CSS is consistent between example themes and should not be altered. */ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;} +#cboxWrapper {max-width:none;} #cboxOverlay{position:fixed; width:100%; height:100%;} #cboxMiddleLeft, #cboxBottomLeft{clear:left;} #cboxContent{position:relative;} -#cboxLoadedContent{overflow:auto;} +#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;} #cboxTitle{margin:0;} -#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;} +#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;} #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;} -.cboxPhoto{float:left; margin:auto; border:0; display:block;} +.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;} .cboxIframe{width:100%; height:100%; display:block; border:0;} +#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;} -/* +/* User Style: - Change the following styles to modify the appearance of ColorBox. They are + Change the following styles to modify the appearance of Colorbox. They are ordered & tabbed in a way that represents the nesting of the generated HTML. */ #cboxOverlay{background:url(../images/colorbox/overlay.png) repeat 0 0;} -#colorbox{} - #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px 0;} - #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px 0;} - #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -100px -29px;} - #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -129px -29px;} +#colorbox{outline:0;} + #cboxTopLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px 0;} + #cboxTopRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px 0;} + #cboxBottomLeft{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -101px -29px;} + #cboxBottomRight{width:21px; height:21px; background:url(../images/colorbox/controls.png) no-repeat -130px -29px;} #cboxMiddleLeft{width:21px; background:url(../images/colorbox/controls.png) left top repeat-y;} #cboxMiddleRight{width:21px; background:url(../images/colorbox/controls.png) right top repeat-y;} #cboxTopCenter{height:21px; background:url(../images/colorbox/border.png) 0 0 repeat-x;} #cboxBottomCenter{height:21px; background:url(../images/colorbox/border.png) 0 -29px repeat-x;} #cboxContent{background:#fff; overflow:hidden;} + .cboxIframe{background:#fff;} #cboxError{padding:50px; border:1px solid #ccc;} #cboxLoadedContent{margin-bottom:28px;} #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;} #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;} + #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;} + #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;} + + /* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */ + #cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; } + + /* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */ + #cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;} + #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;} #cboxPrevious{position:absolute; bottom:0; left:0; background:url(../images/colorbox/controls.png) no-repeat -75px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxPrevious.hover{background-position:-75px -25px;} + #cboxPrevious:hover{background-position:-75px -25px;} #cboxNext{position:absolute; bottom:0; left:27px; background:url(../images/colorbox/controls.png) no-repeat -50px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxNext.hover{background-position:-50px -25px;} - #cboxLoadingOverlay{background:url(../images/colorbox/loading_background.png) no-repeat center center;} - #cboxLoadingGraphic{background:url(../images/colorbox/loading.gif) no-repeat center center;} + #cboxNext:hover{background-position:-50px -25px;} #cboxClose{position:absolute; bottom:0; right:0; background:url(../images/colorbox/controls.png) no-repeat -25px 0; width:25px; height:25px; text-indent:-9999px;} - #cboxClose.hover{background-position:-25px -25px;} + #cboxClose:hover{background-position:-25px -25px;} /* - The following fixes a problem where IE7+ replaces a PNG's alpha transparency with a black fill - when an alpha filter (opacity change) is set on the element or ancestor element. + The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill + when an alpha filter (opacity change) is set on the element or ancestor element. This style is not applied to or needed in IE9. + See: http://jacklmoore.com/notes/ie-transparency-problems/ */ .cboxIE #cboxTopLeft, .cboxIE #cboxTopCenter, @@ -57,26 +68,3 @@ .cboxIE #cboxMiddleRight { filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF); } - -/* - The following provides PNG transparency support for IE6 -*/ -.cboxIE6 #cboxTopLeft{background:url(../images/colorbox/ie6/borderTopLeft.png);} -.cboxIE6 #cboxTopCenter{background:url(../images/colorbox/ie6/borderTopCenter.png);} -.cboxIE6 #cboxTopRight{background:url(../images/colorbox/ie6/borderTopRight.png);} -.cboxIE6 #cboxBottomLeft{background:url(../images/colorbox/ie6/borderBottomLeft.png);} -.cboxIE6 #cboxBottomCenter{background:url(../images/colorbox/ie6/borderBottomCenter.png);} -.cboxIE6 #cboxBottomRight{background:url(../images/colorbox/ie6/borderBottomRight.png);} -.cboxIE6 #cboxMiddleLeft{background:url(../images/colorbox/ie6/borderMiddleLeft.png);} -.cboxIE6 #cboxMiddleRight{background:url(../images/colorbox/ie6/borderMiddleRight.png);} - -.cboxIE6 #cboxTopLeft, -.cboxIE6 #cboxTopCenter, -.cboxIE6 #cboxTopRight, -.cboxIE6 #cboxBottomLeft, -.cboxIE6 #cboxBottomCenter, -.cboxIE6 #cboxBottomRight, -.cboxIE6 #cboxMiddleLeft, -.cboxIE6 #cboxMiddleRight { - _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')"); -} diff --git a/public/stylesheets/thickbox.css b/public/stylesheets/thickbox.css deleted file mode 100644 index ab42e0e..0000000 --- a/public/stylesheets/thickbox.css +++ /dev/null @@ -1,163 +0,0 @@ -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -/**{padding: 0; margin: 0;}*/ - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_window { - font: 12px Arial, Helvetica, sans-serif; - color: #333333; -} - -#TB_secondLine { - font: 10px Arial, Helvetica, sans-serif; - color:#666666; -} - -#TB_window a:link {color: #666666;} -#TB_window a:visited {color: #666666;} -#TB_window a:hover {color: #000;} -#TB_window a:active {color: #666666;} -#TB_window a:focus{color: #666666;} - -/* ----------------------------------------------------------------------------------------------------------------*/ -/* ---------->>> thickbox settings <<<-----------------------------------------------------------------------------*/ -/* ----------------------------------------------------------------------------------------------------------------*/ -#TB_overlay { - position: fixed; - z-index:200; - top: 0px; - left: 0px; - height:100%; - width:100%; -} - -.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;} -.TB_overlayBG { - background-color:#000; - filter:alpha(opacity=75); - -moz-opacity: 0.75; - opacity: 0.75; -} - -* html #TB_overlay { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_window { - position: fixed; - background: white; - z-index: 202; - color:#000000; - display:none; - border: 1px solid #000; - text-align:left; - top:50%; - left:50%; -} - -* html #TB_window { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_window img#TB_Image { - display:block; - margin: 15px 0 0 15px; - border-right: 1px solid #ccc; - border-bottom: 1px solid #ccc; - border-top: 1px solid #666; - border-left: 1px solid #666; -} - -#TB_caption{ - height:25px; - padding:7px 30px 10px 25px; - float:left; -} - -#TB_closeWindow{ - height:25px; - padding:11px 25px 10px 0; - float:right; -} - -#TB_closeAjaxWindow{ - padding:7px 10px 5px 0; - margin-bottom:1px; - text-align:right; - float:right; -} - -#TB_ajaxWindowTitle{ - float:left; - padding:7px 0 5px 10px; - margin-bottom:1px; -} - -#TB_title{ - background-color:#e8e8e8; - height:27px; -} - -#TB_ajaxContent{ - clear:both; - padding:2px 15px 15px 15px; - overflow:auto; - text-align:left; - line-height:1.4em; -} - -#TB_ajaxContent.TB_modal{ - padding:15px; -} - -#TB_ajaxContent p{ - padding:5px 0px 5px 0px; -} - -#TB_load{ - position: fixed; - display:none; - height:13px; - width:208px; - z-index:203; - top: 50%; - left: 50%; - margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */ -} - -* html #TB_load { /* ie6 hack */ -position: absolute; -margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px'); -} - -#TB_HideSelect{ - z-index:199; - position:fixed; - top: 0; - left: 0; - background-color:#fff; - border:none; - filter:alpha(opacity=0); - -moz-opacity: 0; - opacity: 0; - height:100%; - width:100%; -} - -* html #TB_HideSelect { /* ie6 hack */ - position: absolute; - height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); -} - -#TB_iframeContent{ - clear:both; - border:none; - margin-bottom:-1px; - margin-top:1px; - _margin-bottom:1px; -} diff --git a/test/unit/thickbox_helper_test.rb b/test/unit/thickbox_helper_test.rb deleted file mode 100644 index 501cea0..0000000 --- a/test/unit/thickbox_helper_test.rb +++ /dev/null @@ -1,25 +0,0 @@ -require_relative "../test_helper" - -class ThickboxHelperTest < ActiveSupport::TestCase - include ThickboxHelper - - def url_for(url) - url - end - - should 'create thickbox links correcly' do - expects(:link_to).with('Title', '/url#TB_inline?height=300&width=500&inlineId=inlineLoginBox&modal=true', :class => 'thickbox') - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox') - end - - should 'pass along extra options' do - expects(:link_to).with('Title', anything, :class => 'thickbox', :id => 'lalala', :title => 'lelele') - thickbox_inline_popup_link('Title', '/url', 'inlineLoginBox', :id => 'lalala', :title => 'lelele') - end - - should 'generate close button' do - expects(:button_to_function).with(:close, 'Title', 'tb_remove();').returns('[close-button]') - assert_equal '[close-button]', thickbox_close_button('Title') - end - -end -- libgit2 0.21.2