From 5033e0688a1235f6da258728a093cbe63c429556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carsten=20G=C3=B6tzinger?= Date: Mon, 29 Jun 2015 09:12:27 +0200 Subject: [PATCH] Update auf Colorbox 1.6.1 --- public/js/jquery/colorbox/colorbox-rateit.js | 258 ++++++++++-------- .../js/jquery/colorbox/colorbox-rateit.min.js | 35 +-- 2 files changed, 156 insertions(+), 137 deletions(-) diff --git a/public/js/jquery/colorbox/colorbox-rateit.js b/public/js/jquery/colorbox/colorbox-rateit.js index fd5dc4e..b413434 100644 --- a/public/js/jquery/colorbox/colorbox-rateit.js +++ b/public/js/jquery/colorbox/colorbox-rateit.js @@ -1,8 +1,7 @@ /*! - Colorbox v1.5.8 - 2014-04-15 - jQuery lightbox and modal window plugin - (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox - license: http://www.opensource.org/licenses/mit-license.php + Colorbox 1.6.1 + license: MIT + http://www.jacklmoore.com/colorbox */ (function ($, document, window) { var @@ -86,15 +85,47 @@ }, title: function() { return this.title; + }, + createImg: function() { + var img = new Image(); + var attrs = $(this).data('cbox-img-attrs'); + + if (typeof attrs === 'object') { + $.each(attrs, function(key, val){ + img[key] = val; + }); + } + + return img; + }, + createIframe: function() { + var iframe = document.createElement('iframe'); + var attrs = $(this).data('cbox-iframe-attrs'); + + if (typeof attrs === 'object') { + $.each(attrs, function(key, val){ + iframe[key] = val; + }); + } + + if ('frameBorder' in iframe) { + iframe.frameBorder = 0; + } + if ('allowTransparency' in iframe) { + iframe.allowTransparency = "true"; + } + iframe.name = (new Date()).getTime(); // give the iframe a unique name to prevent caching + iframe.allowFullScreen = true; + + return iframe; } }, - // Abstracting the HTML and event identifiers for easy rebranding colorbox = 'colorbox', prefix = 'cbox', boxElement = prefix + 'Element', - + // Events event_open = prefix + '_open', event_load = prefix + '_load', @@ -130,7 +161,7 @@ $ratingDescription, $groupControls, $events = $(''), // $({}) would be prefered, but there is an issue with jQuery 1.4.2 - + // Variables for cached values or use across multiple functions settings, interfaceHeight, @@ -152,7 +183,7 @@ // **************** // HELPER FUNCTIONS // **************** - + // Convenience function for creating new jQuery objects function $tag(tag, id, css) { var element = document.createElement(tag); @@ -167,7 +198,7 @@ return $(element); } - + // Get the window height using innerHeight when available to avoid an issue with iOS // http://bugs.jquery.com/ticket/6724 function winheight() { @@ -211,7 +242,7 @@ var max = $related.length, newIndex = (index + increment) % max; - + return (newIndex < 0) ? max + newIndex : newIndex; } @@ -219,7 +250,7 @@ function setSize(size, dimension) { return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : winheight()) / 100) : 1) * parseInt(size, 10)); } - + // 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 the regex. function isImage(settings, url) { @@ -246,15 +277,15 @@ function getRelated(rel) { index = 0; - - if (rel && rel !== false) { + + if (rel && rel !== false && rel !== 'nofollow') { $related = $('.' + boxElement).filter(function () { var options = $.data(this, colorbox); var settings = new Settings(this, options); return (settings.get('rel') === rel); }); index = $related.index(settings.el); - + // Check direct calls to Colorbox. if (index === -1) { $related = $related.add(settings.el); @@ -304,7 +335,7 @@ function stop() { clear(); - + $events .unbind(event_complete, set) .unbind(event_load, clear); @@ -358,20 +389,20 @@ if (!closing) { - options = $(element).data('colorbox'); + options = $(element).data(colorbox); settings = new Settings(element, options); - + getRelated(settings.get('rel')); if (!open) { open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. setClass(settings.get('className')); - + // Show colorbox so the sizes can be calculated in older versions of jQuery $box.css({visibility:'hidden', display:'block', opacity:''}); - + $loaded = $tag(div, 'LoadedContent', 'width:0; height:0; overflow:hidden; visibility:hidden'); $content.css({width:'', height:''}).append($loaded); @@ -399,14 +430,14 @@ $groupControls.add($title).hide(); $box.focus(); - + if (settings.get('trapFocus')) { // Confine focus to the modal // Uses event capturing that is not supported in IE8- if (document.addEventListener) { document.addEventListener('focus', trapFocus, true); - + $events.one(event_closed, function () { document.removeEventListener('focus', trapFocus, true); }); @@ -421,12 +452,13 @@ } } + var opacity = parseFloat(settings.get('opacity')); $overlay.css({ - opacity: parseFloat(settings.get('opacity')) || '', + opacity: opacity === opacity ? opacity : '', cursor: settings.get('overlayClose') ? 'pointer' : '', visibility: 'visible' }).show(); - + if (settings.get('closeButton')) { $close.html(settings.get('close')).appendTo($content); } else { @@ -440,7 +472,7 @@ // Colorbox's markup needs to be added to the DOM prior to being called // so that the browser will go ahead and load the CSS background images. function appendHTML() { - if (!$box && document.body) { + if (!$box) { init = false; $window = $(window); $box = $tag(div).attr({ @@ -454,7 +486,7 @@ $wrap = $tag(div, "Wrapper"); $content = $tag(div, "Content").append( $title = $tag(div, "Title"), - // Beginn Anpassungen für RateIt + // Beginn Anpassungen für RateIt $rating = $tag(div, "mbRating").attr({"class": "mbrateItRating"}) .css({'bottom': '-20px', 'position': 'absolute'}).append( $ratingWrapper = $tag(div, "mbrateItRating").attr({"class": "wrapper"}).append( @@ -464,7 +496,7 @@ $ratingDescription = $tag(div, "mbRatingDescription").attr({"class": "mbratingText ratingText"}) .css({'margin-left': '10px'}) ), - // Ende Anpassungen für RateIt + // Ende Anpassungen für RateIt $current = $tag(div, "Current"), $prev = $('