(function($) { var requestTimer = null; var requestPool = []; var teaserURL = 'https://cct.check24.de/api'; var datainterfaceURL = 'https://cct.check24.de/datainterface'; var timeout = 5500; var haveIframe = false; var debugLog = []; var JSON = window.JSON; if (JSON === undefined) { JSON = { stringify: function (vContent) { if (vContent instanceof Object) { var sOutput = ""; if (vContent.constructor === Array) { for (var nId = 0; nId < vContent.length; sOutput += this.stringify(vContent[nId]) + ",", nId++); return "[" + sOutput.substr(0, sOutput.length - 1) + "]"; } if (vContent.toString !== Object.prototype.toString) { return "\"" + vContent.toString().replace(/"/g, "\\$&") + "\""; } for (var sProp in vContent) { sOutput += "\"" + sProp.replace(/"/g, "\\$&") + "\":" + this.stringify(vContent[sProp]) + ","; } return "{" + sOutput.substr(0, sOutput.length - 1) + "}"; } return typeof vContent === "string" ? "\"" + vContent.replace(/"/g, "\\$&") + "\"" : String(vContent); } }; } function Spinner(element) { var self = this; var cSpeed = 9; var cWidth = 50; var cHeight = 50; var cTotalFrames = 18; var cFrameWidth = 50; var cImageSrc = 'https://cct.check24.de/images/main/loading.png'; var cIndex = 0; var cXpos = 0; var cPreloaderTimeout = false; var SECONDS_BETWEEN_FRAMES = 0; this.startAnimation = function() { element.style.backgroundImage='url('+cImageSrc+')'; element.style.width=cWidth+'px'; element.style.height=cHeight+'px'; var FPS = Math.round(100/cSpeed); SECONDS_BETWEEN_FRAMES = 1 / FPS; cPreloaderTimeout=setTimeout(function() { self.continueAnimation(); }, SECONDS_BETWEEN_FRAMES/1000); }; this.continueAnimation = function() { cXpos += cFrameWidth; cIndex += 1; if (cIndex >= cTotalFrames) { cXpos =0; cIndex=0; } element.style.backgroundPosition = (-cXpos)+'px 0'; cPreloaderTimeout = setTimeout(function() { self.continueAnimation(); }, SECONDS_BETWEEN_FRAMES*1000); }; this.stopAnimation = function() { clearTimeout(cPreloaderTimeout); cPreloaderTimeout=false; }; } $.fn.cctSpinner = function(start) { for (var id = 0; id < this.length; id++) { var element = this[id]; if (element.spinner === undefined && start === true) { element.spinner = new Spinner(element); element.spinner.startAnimation(); } if (typeof element.spinner === 'object' && start === false) { element.spinner.stopAnimation(); element.spinner = undefined; } } return this; }; (function() { $.fn.cctClickTip = function(displayClass) { displayClass = displayClass === undefined ? 'clicktip-trigger' : displayClass; if ($('#c24cct-clicktip').length === 0) { $(document.body).append($('
', { id: 'c24cct-clicktip', style: 'display: none; position: absolute;' })); $(document.body).on('click', function() { hide(); }); } for (var id = 0; id < this.length; id++) { (function(that) { that.cctClickTipContent = $(that).html(); $(that).html(''); $(that).addClass(displayClass); $(that).on('click', function(e) { e.stopPropagation(); if (currentOwner === that) { hide(); } else { show(that); } }); }(this[id])); } }; var currentOwner = null; var getOverlayPosition = function($owner, $clicktip) { var $window = $(window); var position = $owner.offset(); var toLeft = position.left + $clicktip.outerWidth() >= $window.width() ? true : false; var toTop = position.top + $clicktip.outerHeight() - $window.scrollTop() >= $window.height() ? true : false; var x = toLeft ? position.left - $clicktip.outerWidth() : position.left + $owner.outerWidth(); var y = toTop ? position.top - $clicktip.outerHeight() + $owner.outerHeight() : position.top; return { x: x, y: y, toTop: toTop, toLeft: toLeft }; }; var show = function(owner) { var $clickTip = $('#c24cct-clicktip'); var $owner = $(owner); currentOwner = owner; var prefix = $owner.prop('class').match(/(c[a-zA-Z0-9]+\-)clicktip/); prefix = prefix instanceof Array ? prefix[1] : 'c24cct-'; $clickTip.prop('class', $clickTip.prop('class').replace(/\s*c[a-zA-Z0-9]+\-clicktip\-overlay/, '')); $clickTip.addClass(prefix + 'clicktip-overlay'); $clickTip.html(owner.cctClickTipContent); $clickTip.show(); var position = getOverlayPosition($owner, $clickTip); $clickTip.css({ left: position.x, top: position.y }); }; var hide = function() { var $clickTip = $('#c24cct-clicktip'); currentOwner = null; $clickTip.hide(); }; })(); $.fn.cctFade = function(type, duration) { duration = duration !== undefined ? duration : 250; type = type === 'in' ? 'in' : 'out'; for (var id = 0; id < this.length; id++) { var element = this[id]; var $element = $(element); if (element.cctFadeTimer === undefined) { $element.css({ transition: 'opacity ' + duration + 'ms', opacity: 0, display: 'none' }); } if (type === 'out') { $element.css('opacity', 0); clearTimeout(element.cctFadeTimer); element.cctFadeTimer = setTimeout(function() { $element.css('display', 'none'); }, duration); } else { $element.css('display', 'block'); setTimeout(function() { $element.css('opacity', 1); }, 0); clearTimeout(element.cctFadeTimer); element.cctFadeTimer = setTimeout(function() { $element.css('display', 'block'); }, duration); } } }; $.fn.cctOverlay = function(overlaySelector, watchTriggerOnly, duration) { duration = duration !== undefined ? duration : 250; watchTriggerOnly = watchTriggerOnly !== undefined ? watchTriggerOnly : false; var trigger = this[0]; var $overlay = $($(overlaySelector).get(0)); var $watch = watchTriggerOnly ? $(trigger) : $([ this[0], $(overlaySelector).get(0) ]); var lastTarget = ''; $watch.on('mouseenter mouseleave', function(e) { var type = e.type; var target = e.target === trigger ? 'trigger' : 'overlay'; if (type === 'mouseleave') { $overlay.cctFade('out', duration); } else { if (target !== 'overlay' || lastTarget !== 'overlay') { $overlay.cctFade('in', duration); } } lastTarget = target; }); }; $.fn.cctToolTip = function(html, className, watchTriggerOnly, duration) { duration = duration !== undefined ? duration : 250; for (var id = 0; id < this.length; id++) { var $element = $(this[id]); var $tip = $('', { 'class': className }); $tip.css({ 'display': 'none', 'position': 'absolute' }); $tip.html('