var sSelectOneZip = 'Bitte wählen Sie mindestens eine Postleitzahl.'; var sSelectAllZip = 'Es wurden [1] Postleitzahlen hinzugefügt.'; var sSelectNoneZip = 'Es wurden [1] Postleitzahlen entfernt.'; var sSelectClearZip = 'Es wurden [1] Postleitzahlen gelöscht.'; // Allgemine Funktionen //////////////////////////////////////////////////////////////////////////////////////////////////////////// var pViewer = null; function showImage(sFilename) { if(typeof(RapidPICTUREVIEW) == 'undefined') { return false; } if(pViewer == null) { if((pViewer = new RapidPICTUREVIEW()) == null) { return false; } pViewer.setOptions({ delay: 10, animate: true, left: false, top: false, keyboard: true, hideHTML: 'Schließen [ESC]', onClick: function() { pViewer.hide(); }, onShow: function() { } }); } return pViewer.show(sFilename, { onShow:function() { } }); } function redirectTo(sLocation, bNewWindow) { if(typeof(sLocation) != 'undefined') { if((typeof(bNewWindow) != 'undefined')&&(bNewWindow == true)) { window.open(sLocation); return true; } window.location.href = sLocation; return true; } return false; } function toggleLanguageNavi() { var sHide = (E('TopNaviUILanguage').isVisible()) ? 'TopNaviUILanguage':'TopNaviUl'; var sShow = (E('TopNaviUILanguage').isVisible()) ? 'TopNaviUl' :'TopNaviUILanguage'; return A(sHide).fadeTo(0, { type: 'default', delay: 10, onFinish: function(pElement) { E(sHide).hide(); E(sHide).setOpacity(100); E(sShow).setOpacity(100); E(sShow).show(); } }); } // Scrolling //////////////////////////////////////////////////////////////////////////////////////////////////////////// function scrollToTop(bAnimate) { try { var iScrollPosX = W().getScrollPositionX(); if((typeof(bAnimate) == 'undefined')||(bAnimate !== true)) { W().scrollToPosition(iScrollPosX, 0); return false; } var iScrollPosY = W().getScrollPositionY(); var iScrollToPosY = 0; if(iScrollPosY > iScrollToPosY) { var pTweener = new RapidTWEENER({ from: iScrollPosY, to: iScrollToPosY, tweentype: 'default', delay: 20, onTween: function(iValue) { W().scrollToPosition(iScrollPosX, iValue); } }); return pTweener.start(); } return false; } catch(e) { return false; } } function scrollToAnger(sAnger, bAnimate, bBlink, onFinish) { try { if(typeof(sAnger) != 'undefined') { if((pPageContent = E(sAnger).get()) != null) { if((typeof(bAnimate) == 'undefined')||(bAnimate !== true)) { pPageContent.scrollIntoView(true); return true; } var iScrollPosX = W().getScrollPositionX(); var iScrollPosY = W().getScrollPositionY(); var pOffset = E(pPageContent).getCumulativeOffset(); if(Math.abs(iScrollPosY - pOffset.top) >= 30) { var iScrollToPosY = pOffset.top - 30; var pTweener = new RapidTWEENER({ from: iScrollPosY, to: iScrollToPosY, tweentype: 'default', delay: 10, onTween: function(iValue) { W().scrollToPosition(iScrollPosX, iValue - 50); }, onFinish: function() { if((typeof(bBlink) == 'undefined')||(bBlink !== true)) { return; } $('#'+sAnger).pulse({opacity: 0.2}, {duration : 200, pulses : 3}, onFinish); } }); return pTweener.start(); } if((typeof(bBlink) != 'undefined')&&(bBlink == true)) { $('#'+sAnger).pulse({opacity: 0.2}, {duration : 200, pulses : 3}, onFinish); } } } return false; } catch(e) { return false; } } // JQuery Helper //////////////////////////////////////////////////////////////////////////////////////////////////////////// function installTabReload(pArguments, sMethod, onFinish) { $('a[data-toggle=\"tab\"]').on('show.bs.tab', function(pEvent) { try { var sFile = null; var sCommand = null; var sTarget = null; if(((sFile = E(pEvent.target).getAttribute('data-command-file', null)) != null)&&((sCommand = E(pEvent.target).getAttribute('data-command', null)) != null)&&((sTarget = E(pEvent.target).getAttribute('data-target-ajax', null)) != null)) { if(typeof(pArguments) == 'undefined') { pArguments = {}; } pArguments.command = sCommand; RapidPAGE.sendCommand(sFile, sTarget, pArguments); } } catch(e) { } }); } function installSpinner(sID, iMin, iMax, iStep) { try { $('#'+sID).spinner({ step: iStep, spin: function(pEvent, pInterface) { if(pInterface.value > iMax) { $(this).spinner('value', iMin); return false; } if(pInterface.value < iMin) { $(this).spinner('value', iMax); return false; } } }); return true; } catch(exception) { return false; } } function installDragTo(sContainerDiv, sUrl, sCommandDiv, pArguments) { if((typeof(sContainerDiv) == 'undefined')||(typeof(sUrl) == 'undefined')||(typeof(sCommandDiv) == 'undefined')) { return false; } try { $('#'+sContainerDiv+' div.dragSource').each(function(iInx, pElement) { $(pElement).draggable({ revert: true, start: function(pEvent, pInterface) { $(this).css('zIndex', 100000); switch($(this).attr('data-type')) { case 'sedcard': var sShow = $(this).attr('data-hover-show'); var sHide = $(this).attr('data-hover-hide'); if(sHide) { $(sHide).addClass('transparent50'); } if(sShow) { $(sShow).removeClass('transparent50'); } break; } }, stop: function(pEvent, pInterface) { $(this).css('zIndex', 'auto'); switch($(this).attr('data-type')) { case 'sedcard': var sHide = $(this).attr('data-hover-hide'); if(sHide) { $(sHide).removeClass('transparent50'); } break; } } }); }); $('#'+sContainerDiv+' div.dropTarget').each(function(iInx, pElement) { $(pElement).droppable({ drop: function(pEvent, pInterface) { var iFromId = 0; var iToId = 0; var sFromType = null; var sToType = null; if(((iToId = pInterface.draggable.attr('data-id')) > 0)&&((iFromId = E(this).getAttribute('data-id', 0)) > 0)) { if((sFromType = pInterface.draggable.attr('data-type'))&&(sToType = E(this).getAttribute('data-type', null))) { if(typeof(pArguments) == 'undefined') { pArguments = {}; } pArguments.iFromId = iFromId; pArguments.iToId = iToId; pArguments.sFromType = sFromType; pArguments.sToType = sToType; X(sCommandDiv).loadOnce(sUrl, { method: 'POST', scriptsfirst: false, globaleval: true, arguments: pArguments }); } } } }); }); return true; } catch(exception) { return false; } } function installSortable(sContainerDiv, sUrl, sCommandDiv, pArguments, sSortHandle, sPlaceHolder, onStart, onFinish) { if((typeof(sContainerDiv) == 'undefined')||(typeof(sUrl) == 'undefined')||(typeof(sCommandDiv) == 'undefined')) { return false; } try { $('#' + sContainerDiv).sortable({ opacity: 0.8, cursor: 'move', helper: 'clone', cancel: '.TeasUpload', scroll: true, scrollSensitivity: 250, scrollSpeed: 10, handle: (typeof(sSortHandle) == 'undefined') ? '.sortHandle':'.'+sSortHandle, placeholder: (typeof(sPlaceHolder) == 'undefined') ? 'col-md-3 col-sm-6 col-xs-12 TeasGal':sPlaceHolder, start: function (pEvent, pInterface) { if(typeof(onStart) == 'function') { onStart(); } }, stop: function(pEvent, pInterface) { if(typeof(onFinish) == 'function') { onFinish(); } var aOrder = []; var iOrder = 0; $(pEvent.target).children().each(function() { var sDataId = null; if((sDataId = $(this).attr("data-id")) != null) { aOrder.push(sDataId); } }); if(typeof(pArguments) == 'undefined') { pArguments = {}; } pArguments.sortorder = aOrder.join(','); X(sCommandDiv).loadOnce(sUrl, { method: 'POST', scriptsfirst: false, arguments: pArguments, onFinish: function(pAjax) { if(((sText = pAjax.getResponseText()) != null)&&(sText.length > 0)) { E(sCommandDiv).setText(sText); if(typeof(RapidPAGE.updateDynamic) != 'undefined') { RapidPAGE.updateDynamic(); } } } }); } }); return true; } catch(exception) { return false; } } var pMaps = []; var pMarker = []; function installLeaveLetMap(sID, dbLongitude, dbLatitude) { try { if(typeof(L) != 'undefined') { var pCenter = L.latLng(dbLatitude, dbLongitude); var pMapLayer = L.tileLayer('https://map.geodatamap.de/hot/{z}/{x}/{y}.png', { maxZoom: 21, id: 'mapbox.streets' }).setZIndex(1000).on('load', function() { pMap.invalidateSize(); }); var pMarkersLayer1 = L.layerGroup().setZIndex(1001); var pMap = L.map(sID, { attributionControl: false, layers: [ pMapLayer, pMarkersLayer1 ] }).setView(pCenter, 14); L.marker(pCenter).addTo(pMarkersLayer1); L.control.layers({ 'Karte': pMapLayer }, { 'Marker': pMarkersLayer1 }).addTo(pMap); return true; } } catch(e) { } return false; } function installOpenStreetMap(sID, dbLongitude, dbLatitude) { try { if((typeof(OpenLayers) != 'undefined')&&(typeof(OpenLayers.Map) != 'undefined')) { PROJECTION_4326 = new OpenLayers.Projection("EPSG:4326"); PROJECTION_MERC = new OpenLayers.Projection("EPSG:900913"); if((pMap = new OpenLayers.Map(sID, { controls : [ // new OpenLayers.Control.PanZoomBar(), new OpenLayers.Control.Navigation(), ], eventListeners : { 'click': function(pEvent) { }, 'move': function(pEvent) { }, 'zoomend': function(pEvent) { }, 'changelayer': function(pEvent) { } }, numZoomLevels : 18, maxResolution : 156543, maxExtent : new OpenLayers.Bounds(-200000, -200000, 200000, 200000), units : 'm', projection : PROJECTION_MERC, displayProjection : PROJECTION_4326 })) != null) { var pMarkersLayer = null; if(pMarkersLayer = new OpenLayers.Layer.Markers('Default')) { pMap.addLayer(pMarkersLayer); if((pMarker = new OpenLayers.Marker(new OpenLayers.LonLat(dbLongitude, dbLatitude).transform(PROJECTION_4326, PROJECTION_MERC), null)) != null) { pMarkersLayer.addMarker(pMarker); if((pOsmLayer = new OpenLayers.Layer.OSM('OpenStreetMap',['https://map.geodatamap.de/hot/${z}/${x}/${y}.png','https://map.geodatamap.de/hot/${z}/${x}/${y}.png','https://map.geodatamap.de/hot/${z}/${x}/${y}.png'])) != null) { pMap.addLayer(pOsmLayer); if((pCenter = new OpenLayers.LonLat(dbLongitude, dbLatitude)) != null) { pMap.setCenter(pCenter.transform(PROJECTION_4326, PROJECTION_MERC), 16); } pOsmLayer.setIsBaseLayer(true); return true; } } } } } return false; } catch(exception) { return false; } } function installGoogleMap(sID, dbLongitude, dbLatitude) { try { if((typeof(google) != 'undefined')&&(typeof(google.maps) != 'undefined')) { var pElement = null; if(((pElement = document.getElementById(sID)) != null)&&(E(sID).removeChilds())) { var pLatLng = null; if(pLatLng = new google.maps.LatLng(dbLatitude, dbLongitude)) { var pMap = null; if(pMap = new google.maps.Map(pElement, { zoom: 16, center: pLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP })) { var pMarker = new google.maps.Marker({ position: pLatLng, map: pMap }); pMap.setCenter(pLatLng); google.maps.event.trigger(pMap, 'resize'); google.maps.event.addDomListener(window, 'resize', function() { pMap.setCenter(pMarker.getPosition()); return true; }); } } } } return false; } catch(exception) { return false; } } function installDatePicker(sInput, sValue) { var pInput = null; if((typeof(sInput) == 'undefined')||((pInput = E(sInput).get()) == null)) { return false; } var sHRef = sInput + '_icon'; var sContainer = sInput + '_container'; if((E(sHRef).get())||(E(sContainer).get())) { if(typeof(sValue) != 'undefined') { E(sContainer).hide(); E(pInput).setText(sValue); E(pInput).setFocus(); } return true; } var pHRef = null; if(pHRef = D().createElement('a', sHRef)) { var pContainer = null; if(pContainer = D().createElement('div', sContainer)) { E(pInput).setStyle({width: '80%'}); E(pHRef).setClassName('calicon'); E(pHRef).setAttribute('href', 'javascript:void(0);'); E(pHRef).setText(''); E(pHRef).moveBehind(sInput); E(pHRef).show('inline'); E(pContainer).setClassName('caltab'); E(pContainer).moveBehind(pHRef); E(pContainer).hide(); E(pInput).registerEvent('click', function() { E(pContainer).hide(); }); E(pHRef).registerEvent('click', function() { if(E(pContainer).isVisible()) { E(pContainer).hide(); return; } X(pContainer).loadOnce('layer_datepicker.html', { method: 'POST', arguments: { datum: E(pInput).getText(), container: sContainer, input: sInput, }, onFinish:function(pAjax) { E(pContainer).setText(pAjax.getResponseText()); E(pContainer).show(); }, }); }); return true; } } return false; } // Dialoge //////////////////////////////////////////////////////////////////////////////////////////////////////////// function layerConfirm(pArguments) { return RapidPAGE.showLayer('layer_confirm.html', pArguments); } function layerPrompt(pArguments) { return RapidPAGE.showLayer('layer_prompt.html', pArguments); } // Überschreiben innerhalb der RapidPAGE.js //////////////////////////////////////////////////////////////////////////////////////////////////////////// RapidPAGE.showOn = function(sDiv, sTarget, bShow) { if((typeof(sDiv) != 'undefined')&&(typeof(sTarget) != 'undefined')) { if(E(sDiv).isVisible()) { E(sDiv).hide(); E(sDiv).setHeight(null); E(sTarget).setHeight(null); if((typeof(bShow) == 'undefined')||(bShow == false)) { return true; } } try { var iHeightPx = 0; if((iHeightPx = Math.max(E(sTarget).getHeight(),E(sDiv).getHeight())) > 0) { E(sDiv).setHeight(iHeightPx); E(sTarget).setHeight(iHeightPx); } } catch(e) { } E(sDiv).show(); return true; } return false; }; RapidPAGE.updateHelp = function () { var bVisible = $('#HelpNaviContent').is(':visible') ? true:false; if((bVisible)&&(C().getCookie('helpContent', 'faq') == 'ticket')) { RapidPAGE.sendForm('HelpNaviForm'); } }; RapidPAGE.toggleHelp = function () { var bVisible = $('#HelpNaviContent').is(':visible') ? true:false; if(!bVisible) { return RapidPAGE.sendForm('HelpNaviForm', null, function() { $('.HelpNavi_content').show('fast', function() { $('.HelpNavi_toggle').html(''); C().setCookie('helpVisible', 'true'); } ); }); } $('.HelpNavi_content').hide('fast', function() { $('.HelpNavi_toggle').html(''); C().setCookie('helpVisible', 'false'); }); }; RapidPAGE.updateDynamic = function () { $("[data-toggle='tooltip']").tooltip(); $("[data-toggle='errortip']").tooltip({ track: true }).tooltip(); $('.Info').popover(); $('.Disabled').popover(); $('.Enabled').popover(); $('.masonry-wrapper').masonry({itemSelector: '.item'}); $('.GoogleMap').each(function() { }); if(typeof(RC_ScreenShot) != 'undefined') { $('div.VideoImage').each(function() { if(typeof($(this).attr('data-loaded')) == 'undefined') { RC_ScreenShot.createScreenShotInstance(this); $(this).attr('data-loaded', true); } }); } var __onKeyUp = function(pElement) { var iMinLength = ((sTemp = $(pElement).attr('data-min-length'))&&((iTemp = parseInt(sTemp)) > 0)) ? iTemp:false; var iMaxLength = ((sTemp = $(pElement).attr('data-max-length'))&&((iTemp = parseInt(sTemp)) > 0)) ? iTemp:false; var sInfoTarget = (sTemp = $(pElement).attr('data-info-target')) ? sTemp:false; if((iMinLength !== false)||(iMaxLength !== false)) { var iLength = $(pElement).val().length; if((iMinLength != false)&&(iLength < iMinLength)) { var sMsg = 'Bitte geben Sie noch mindestens %d Zeichen ein.'; $('#'+sInfoTarget).html(sMsg.replace('%d', iMinLength - iLength)); $('#'+sInfoTarget).css('color', 'red'); return; } if((iMaxLength != false)&&(iLength > iMaxLength)) { var sMsg = 'Bitte reduzieren Sie Ihre Eingabe um mindestens %d Zeichen.'; $('#'+sInfoTarget).html(sMsg.replace('%d', iLength - iMaxLength)); $('#'+sInfoTarget).css('color', 'red'); return; } if((iMinLength != false)&&(iLength >= iMinLength)) { var sMsg = 'Sie haben mit %d Zeichen bereits genügend eingegeben.'; $('#'+sInfoTarget).html(sMsg.replace('%d', iLength)); $('#'+sInfoTarget).css('color', 'green'); return; } } }; $('.form-control').each(function() { if($(this).attr('data-info-target')) { __onKeyUp(this); $(this).keyup(function() { __onKeyUp(this); }); } }); return true; } function openPopup(sUrl, sTitle, iWidth, iHeight) { try { if(typeof(iWidth) == 'undefined') { iWidth = Math.floor(screen.width*.8); } if(typeof(iHeight) == 'undefined') { iHeight = Math.floor(screen.height*.7); } var pWindow = null; if(pWindow = window.open(sUrl, sTitle, "width="+iWidth+",height="+iHeight+",status=no,scrollbars=yes,resizable=yes")) { pWindow.focus(); return true; } return false; } catch(e) { return false; } } RapidPAGE.hideLayer = function(onFinish) { // Überschreiben vom Standard if((typeof(RapidPICTUREVIEW) !== 'undefined')&&(pViewer !== null)) { pViewer.hide(); } return RapidPAGE.pPopupLayer.hide({onFinish: onFinish}); } RapidPAGE.pPopupLayer.setOptions({delay: 0}); //////////////////////////////////////////////////////////////////////////////////////////////////////////// function uninstallRCVideoPlayer(sID) { var pContainer = null; var pInstance = null; if(typeof(sID) == 'undefined') { $('.RCVideoPlayer').each(function() { if(typeof(sID = $(this).attr('id')) != 'undefined') { uninstallRCVideoPlayer(sID); } }); return true; } if((typeof(pContainer = document.getElementById(sID)) !== 'undefined')&&(pInstance = RC_Player.getInstanceById(sID))) { pInstance.destroy(); return true; } return false; } function installRCVideoPlayer(sID) { var pContainer = null; var sInstance = null; if((typeof(pContainer = document.getElementById(sID)) !== 'undefined')&&(sInstance = RC_Player.createPlayerInstance(pContainer))) { var pInstance = null; if(pInstance = RC_Player.getInstanceById(sInstance)) { } return true; } return false; } INSERENTEN = { getAjaxUrl: function() { if(location.href.indexOf('sedcard_person_sonstiges') > -1) { return 'sedcard_person_sonstiges_command.html'; } if(location.href.indexOf('sedcard_person_kontaktdaten') > -1) { return 'sedcard_person_kontaktdaten_command.html'; } toDebug('Unknown Url '+location.href+' on INSERENTEN.getAjaxUrl() ?!'); return null; }, allPLZ: function(sContainerId) { var iChecked = 0; $('#'+sContainerId+' input[type="checkbox"]:not(:checked), #'+sContainerId+' input[type="radio"]:not(:checked)').each(function() { $(this).prop('checked', true); iChecked++; }); INSERENTEN.savePLZ(sContainerId); RapidPAGE.showInfoNotify(sSelectAllZip.replace('[1]', iChecked)); }, nonePLZ: function(sContainerId) { var iUnChecked = 0; $('#'+sContainerId+' input[type="checkbox"]:checked, #'+sContainerId+' input[type="radio"]:checked').each(function() { $(this).prop('checked', false); iUnChecked++; }); INSERENTEN.savePLZ(sContainerId); RapidPAGE.showInfoNotify(sSelectNoneZip.replace('[1]', iUnChecked)); }, savePLZ: function(sContainerId, sUrl) { var sSedcard = $('#'+sContainerId).attr('data-sedcard'); if(typeof(sSedcard) != 'undefined') { var sID = null; var aZipId = []; $('#'+sContainerId+' input[type="checkbox"]:checked, #'+sContainerId+' input[type="radio"]:checked').each(function() { if(typeof(sID = $(this).attr('data-id')) != 'undefined') { aZipId.push(sID) } }); switch(sContainerId) { case 'besucht_search': return RapidPAGE.sendCommand(INSERENTEN.getAjaxUrl(), sContainerId, { command: 'save_besucht_zip', sedcardId: sSedcard, zipIds: aZipId.join(',') }, 'post'); break; case 'empfaengt_search': return RapidPAGE.sendCommand(INSERENTEN.getAjaxUrl(), sContainerId, { command: 'save_empfaengt_zip', sedcardId: sSedcard, zipIds: aZipId.join(',') }, 'post'); break; } } }, cleanPLZ: function(sContainerId) { $('#'+sContainerId+' input[type="checkbox"]:not(:checked), #'+sContainerId+' input[type="radio"]:not(:checked)').each(function() { $(this).parents('.badge.badge-zip').remove(); }); }, clearPLZ: function(sContainerId) { var iRemoved = 0; $('#'+sContainerId+' input[type="checkbox"], #'+sContainerId+' input[type="radio"]').each(function() { iRemoved++; $(this).parents('.badge.badge-zip').remove(); }); RapidPAGE.showInfoNotify(sSelectClearZip.replace('[1]', iRemoved)); INSERENTEN.savePLZ(sContainerId); }, searchPLZ: function(sContainerId, sValue) { var iTimer = null; if((iTimer = $('#'+sContainerId).attr('data-retard-timer'))&&(typeof(iTimer) != 'undefined')) { window.clearTimeout(iTimer); $('#'+sContainerId).removeAttr('data-retard-timer'); } $('#'+sContainerId).attr('data-retard-timer', window.setTimeout(function() { $('#'+sContainerId).removeAttr('data-retard-timer'); var sSedcard = $('#'+sContainerId).attr('data-sedcard'); RapidPAGE.sendCommand(INSERENTEN.getAjaxUrl(), sContainerId, { command: 'search_zip', sedcardId: sSedcard, container: sContainerId, value: sValue }, 'post', function(pAjax) { }); }, 800)); return true; }, removePLZ: function(sContainerId, pThis) { var iChecked = $('#'+sContainerId+' input[type="checkbox"]:checked, #'+sContainerId+' input[type="radio"]:checked').length; /* if(iChecked <= 1) { RapidPAGE.showInfoNotify(sSelectOneZip); return; } */ $(pThis).parents('.badge.badge-zip').remove(); INSERENTEN.savePLZ(sContainerId); }, appendPLZ: function(sContainerId, sZipId, sText, bChecked, bAppend) { var sID = sContainerId+'zip'+sZipId; if($('#'+sID).length > 0) { return true; } switch(sContainerId) { case 'empfaengt_search': // ... RADIO var sName = 'inserent[empfang_plz]'; var sHTML = ''; sHTML += sName ? '':''; sHTML += ''; sHTML += ''; if((typeof(bAppend) == 'undefined')||(bAppend === true)) { $('#'+sContainerId).append(sHTML); } else { $('#'+sContainerId).prepend(sHTML); } break; case 'besucht_search': // ... CHECKBOXEN var sName = 'inserent[besucht_plz]['+sZipId+']'; var sHTML = ''; sHTML += sName ? '':''; sHTML += ''; sHTML += ''; if((typeof(bAppend) == 'undefined')||(bAppend === true)) { $('#'+sContainerId).append(sHTML); } else { $('#'+sContainerId).prepend(sHTML); } break; } return true; } };