'use strict';function BW_IMGWIG_fillGalWrappers(e){BW_IMGWIG_setInnerHTML("gallery-top-wrapper",e),BW_IMGWIG_setInnerHTML("gallery-thumb-wrapper",e)}function BW_IMGWIG_showGallery(){BW_IMGWIG_imgcode_isAdmin?BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv','inline-block'):BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv','none'),BW_IMGWIG_imgcode_isFreedGallery?(BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_freegal_galwin','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_unfreegal_galwin','inline-block')):(BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_freegal_galwin','inline-block'),BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_unfreegal_galwin','none')),BW_IMGWIG_setDisplay('BW_IMGWIG_galwin','inline'),BW_IMGWIG_imgcode_actualSubimg=BW_IMGWIG_imgcode_subimg[0];var e=BW_IMGWIG_imgcode_subimg.reduce(function(e,_){return e+"
"},'');BW_IMGWIG_setInnerHTML("gallery-top-wrapper",e),BW_IMGWIG_setInnerHTML("gallery-thumb-wrapper",e.replace(/getpic.php\?/g,'getpic.php?preview&')),BW_IMGWIG_galleryTop=new Swiper(".gallery-top",{nextButton:".swiper-button-next",prevButton:".swiper-button-prev",spaceBetween:10,preloadImages:!1,lazyLoading:!0,lazyLoadingInPrevNext:!0,simulateTouch:!0,keyboardControl:!0,effect:'slide',direction:'horizontal',onSlideChangeStart:function(){BW_IMGWIG_imgcode_actualSubimg=BW_IMGWIG_imgcode_subimg[BW_IMGWIG_galleryTop.realIndex]}}),BW_IMGWIG_galleryThumbs=new Swiper(".gallery-thumbs",{spaceBetween:10,centeredSlides:!0,slidesPerView:"auto",touchRatio:.2,slideToClickedSlide:!0,preloadImages:!1,lazyLoading:!0,lazyLoadingInPrevNext:!0,lazyLoadingInPrevNextAmount:5,simulateTouch:!0,keyboardControl:!0,onTouchEnd:function(e,_){var I=e.touches.diff=e.isHorizontal()?e.touches.currentX-e.touches.startX:e.touches.currentY-e.touches.startY;(I<5||I>-5)&&(e.allowClick=!0)}}),BW_IMGWIG_galleryTop.params.control=BW_IMGWIG_galleryThumbs,BW_IMGWIG_galleryThumbs.params.control=BW_IMGWIG_galleryTop}function BW_IMGWIG_freeGal(e){BW_IMGWIG_freeGal_base(e,'galwin')}function BW_IMGWIG_freeTileGal(e){BW_IMGWIG_freeGal_base(e,'tilewin')}function BW_IMGWIG_freeGal_base(e,_){BW_IMGWIG_showConfirmPopup(e?'Wirklich die GESAMTE Galerie freischalten ? ':'Wirklich die GESAMTE Galerie sperren ?',function(){BW_IMGWIG_get('https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+(e?'&freegal':'&unfreegal'),function(e){var I=e.responseText.split(';');'freed'==I[0]?(BW_IMGWIG_showAlertPopup("Die Galerie wurde freigegeben mit Code: "+I[1]),BW_IMGWIG_imgcode_isFreedGallery=!0,BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_freegal_'+_,'none'),BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_unfreegal_'+_,'inline-block')):'unfreed'==e.responseText?(BW_IMGWIG_showAlertPopup("Die Galerie wurde gesperrt"),BW_IMGWIG_imgcode_isFreedGallery=!1,BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_freegal_'+_,'inline-block'),BW_IMGWIG_setDisplay('BW_IMGWIG_admindiv_unfreegal_'+_,'none')):console.error(e.responseText)})})}function BW_IMGWIG_delImageSuccess(){var e=BW_IMGWIG_galleryTop.realIndex;BW_IMGWIG_imgcode_subimg.splice(e,1),BW_IMGWIG_galleryTop.removeSlide(e),BW_IMGWIG_galleryThumbs.removeSlide(e)}function BW_IMGWIG_delImage(e){BW_IMGWIG_showConfirmPopup('Dieses Foto wirklich löschen ?',function(){BW_IMGWIG_get('https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+'&subimg='+BW_IMGWIG_imgcode_actualSubimg+'&delimg',function(_){'deleted'==_.responseText?e():console.error(_.responseText)})})}function BW_IMGWIG_closeGal(){BW_IMGWIG_setDisplay('BW_IMGWIG_galwin','none'),BW_IMGWIG_galleryTop.destroy(!0,!0),BW_IMGWIG_galleryThumbs.destroy(!0,!0),BW_IMGWIG_fillGalWrappers('')}function BW_IMGWIG_startMailer(){return BW_IMGWIG_setDisplay('BW_IMGWIG_mailer','inline'),!1}function BW_IMGWIG_closeMailer(){BW_IMGWIG_setDisplay('BW_IMGWIG_mailer','none'),BW_IMGWIG_toogleFlexDisplay('BW_IMGWIG_mailerdiv',!0),BW_IMGWIG_setDisplay('BW_IMGWIG_mailerdiv_msg','none')}function BW_IMGWIG_sendmail(){var e=BW_IMGWIG_imgcode_subimg.length>0?'&subimg='+BW_IMGWIG_imgcode_actualSubimg:'';return BW_IMGWIG_get('https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+'&email='+document.getElementById('BW_IMGWIG_email').value+e,function(e){BW_IMGWIG_toogleFlexDisplay('BW_IMGWIG_mailerdiv',!1),BW_IMGWIG_setDisplay('BW_IMGWIG_mailerdiv_msg','inline'),'!code'==e.responseText?BW_IMGWIG_setInnerHTML('BW_IMGWIG_mailerdiv_msg','Der Code für das Foto ist abgelaufen, bitte neu laden zum Versenden
'):'send'==e.responseText?BW_IMGWIG_setInnerHTML('BW_IMGWIG_mailerdiv_msg','Das Foto wurde erfolgreich versendet
'):BW_IMGWIG_setInnerHTML('BW_IMGWIG_mailerdiv_msg','Es ist ein unbekannter Fehler aufgetreten.
')}),!1}function BW_IMGWIG_startZIPMailer(){return BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailer','inline'),BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv','inline'),!1}function BW_IMGWIG_closeZIPMailer(){BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailer','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv_msg','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv_msg_loader','none')}function BW_IMGWIG_sendZIPmail(){return BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv_msg','inline'),BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv_msg_loader','inline'),BW_IMGWIG_get('https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+'&zipemail='+document.getElementById('BW_IMGWIG_zipemail').value+'&ms='+Date.now(),function(e){BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv_msg_loader','none'),'!code'==e.responseText?(BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv','inline'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_zipmailerdiv_msg','Der Code für das Foto ist abgelaufen, bitte neu laden zum Versenden
')):'send'==e.responseText?(BW_IMGWIG_setInnerHTML('BW_IMGWIG_zipmailerdiv_msg','Der ZIP-Link wurde erfolgreich versendet
'),document.getElementById('BW_IMGWIG_zipemail').value=''):(BW_IMGWIG_setDisplay('BW_IMGWIG_zipmailerdiv','inline'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_zipmailerdiv_msg','Es ist ein unbekannter Fehler aufgetreten.
'))}),!1}function BW_IMGWIG_toogleFlexDisplay(e,_){var I=document.getElementById(e);I.className=_?'BW_IMGWIG_mailerdiv display-flex':'BW_IMGWIG_mailerdiv display-none'}function BW_IMGWIG_setDisplay(e,_){document.getElementById(e).style.display=_}function BW_IMGWIG_setInnerHTML(e,_){document.getElementById(e).innerHTML=_}function BW_IMGWIG_setMsg(e){BW_IMGWIG_setInnerHTML('BW_IMGWIG_msg',e)}function BW_IMGWIG_get(e,_){try{var I=window.XMLHttpRequest||ActiveXObject,i=new I('MSXML2.XMLHTTP.3.0');i.open('GET',e,1),i.setRequestHeader('X-Requested-With','XMLHttpRequest'),i.setRequestHeader('Content-type','application/x-www-form-urlencoded'),i.onreadystatechange=function(){4==i.readyState&&(200==i.status?_(i):window.console&&console.error(i.statusText))},i.send()}catch(e){window.console&&console.error(e)}}function BW_IMWIG_submit(){return BW_IMGWIG_imgcode_isAdmin=!1,BW_IMGWIG_imgcode_isFreedGallery=!1,BW_IMGWIG_setDisplay('BW_IMGWIG_msgimg','inline'),BW_IMGWIG_setMsg('Überprüfe Code'),BW_IMGWIG_imgid=encodeURIComponent(document.getElementById('BW_IMGWIG_imgcode').value),BW_IMGWIG_get('https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid,function(e){if(BW_IMGWIG_setDisplay('BW_IMGWIG_msgimg','none'),'!exist'==e.responseText)BW_IMGWIG_setMsg('Foto existiert nicht!');else if(e.responseText.match(/^!ip-(\d+)$/))BW_IMGWIG_setMsg('Bitte noch '+RegExp.$1+' Sekunden warten!');else{var _=e.responseText.split(';');1===_.length?(BW_IMGWIG_imgcode=encodeURIComponent(e.responseText),BW_IMGWIG_imgcode_subimg=[],document.getElementById('BW_IMGWIG_img').src='https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode,BW_IMGWIG_setDisplay('BW_IMGWIG_imgwin','inline')):(BW_IMGWIG_imgcode=encodeURIComponent(_.shift()),BW_IMGWIG_imgcode_isAdmin='1'===_.shift(),BW_IMGWIG_imgcode_isFreedGallery='1'===_.shift(),BW_IMGWIG_imgcode_subimg=_,BW_IMGWIG_imgcode_subimg.length>=10?BW_IMGWIG_showTiles():BW_IMGWIG_showGallery()),BW_IMGWIG_setMsg('')}}),!1}function BW_IMGWIG_closeImg(){BW_IMGWIG_setDisplay('BW_IMGWIG_imgwin','none'),document.getElementById('BW_IMGWIG_img').src=''}function BW_IMGWIG_startDownload(e){var _=BW_IMGWIG_imgcode_subimg.length>0?'&subimg='+BW_IMGWIG_imgcode_actualSubimg:'';e.href='https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+_+'&full'}function BW_IMGWIG_showAlertPopup(e){BW_IMGWIG_setDisplay('BW_IMGWIG_alertpopup','inline'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_alertpopup_msg',e)}function BW_IMGWIG_closeAlertPopup(){BW_IMGWIG_setDisplay('BW_IMGWIG_alertpopup','none'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_alertpopup_msg','')}function BW_IMGWIG_showConfirmPopup(e,_){BW_IMGWIG_confirmPopupSuccess=function(){BW_IMGWIG_closeConfirmPopup(),_()},BW_IMGWIG_setDisplay('BW_IMGWIG_confirmpopup','inline'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_confirmpopup_msg',e)}function BW_IMGWIG_closeConfirmPopup(){BW_IMGWIG_setDisplay('BW_IMGWIG_confirmpopup','none'),BW_IMGWIG_setInnerHTML('BW_IMGWIG_confirmpopup_msg','')}function BW_IMGWIG_delTileImageSuccess(){BW_IMGWIG_deletedTiles.push(BW_IMGWIG_imgcode_actualSubimg),document.getElementById('subimg_'+BW_IMGWIG_imgcode_actualSubimg).src='https://www.weddingperfekt.de/imgwidget/deleted.png',BW_IMGWIG_closeTileImg()}function BW_IMGWIG_closeTileImg(){BW_IMGWIG_setDisplay('BW_IMGWIG_tileSingleImgContainer','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_tileContainer','block'),document.getElementById('BW_IMGWIG_imgTile').src=''}function showImgTileCloser(){var e=document.getElementById('BW_IMGWIG_imgTile'),_=document.getElementById('BW_IMGWIG_imgTileCloser');_.style.top=10+(e.clientHeight-_.clientHeight)/2+'px',_.style.visibility='visible'}function hideImgTileCloser(){document.getElementById('BW_IMGWIG_imgTileCloser').style.visibility='hidden'}function BW_IMGWIG_showTileDetails(e){return-1!==BW_IMGWIG_deletedTiles.indexOf(e)?BW_IMGWIG_showAlertPopup("Dieses Bild wurde schon gelöscht"):(BW_IMGWIG_imgcode_actualSubimg=e,BW_IMGWIG_imgcode_isAdmin?BW_IMGWIG_setDisplay('BW_IMGWIG_admindivTileSingle','inline-block'):BW_IMGWIG_setDisplay('BW_IMGWIG_admindivTileSingle','none'),document.getElementById('BW_IMGWIG_imgTile').src='https://www.weddingperfekt.de/imgwidget/getpic.php?id='+BW_IMGWIG_imgid+'&code='+BW_IMGWIG_imgcode+'&subimg='+e,BW_IMGWIG_setDisplay('BW_IMGWIG_tileContainer','none'),BW_IMGWIG_setDisplay('BW_IMGWIG_tileSingleImgContainer','block')),!1}function BW_IMGWIG_showTiles(){function e(e,_,I){var i,W=I%4+1;return i=1===W?'5px 0 5px 0':'5px 0 5px 10px',e+='
Bitte geben Sie die eMail-Adresse an, an welche das Bild gesendet werden soll.

Teilen vorbereiten fehlgeschlagen.
'); return; } BW_IMGWIG_social=data.social||{promo_text:'',instagram_handle:'',facebook_handle:''}; BW_IMGWIG_share_url=data.share_url||''; document.getElementById('BW_IMGWIG_photoshare_text').value=''; BW_IMGWIG_share_updatePreview(); // Mobile: nativen Submit anzeigen, Desktop: nur die Buttons var canNative=(navigator.share&&navigator.canShare); BW_IMGWIG_setDisplay('BW_IMGWIG_photoshare_submit_native', canNative?'inline-block':'none'); // Insta-Button nur wenn Handle gesetzt BW_IMGWIG_setDisplay('BW_IMGWIG_photoshare_submit_ig', BW_IMGWIG_social.instagram_handle?'inline-block':'none'); BW_IMGWIG_setDisplay('BW_IMGWIG_photoshare','inline'); }); return false; } function BW_IMGWIG_share_composeCaption(){ var user=(document.getElementById('BW_IMGWIG_photoshare_text').value||'').trim(); var s=BW_IMGWIG_social||{}; var tail=[]; if(s.promo_text)tail.push(s.promo_text); var hs=[]; if(s.instagram_handle)hs.push(s.instagram_handle); if(s.facebook_handle && s.facebook_handle!==s.instagram_handle)hs.push(s.facebook_handle); if(hs.length)tail.push(hs.join(' · ')); var parts=[]; if(user)parts.push(user); if(tail.length)parts.push(tail.join('\n')); return parts.join('\n\n'); } function BW_IMGWIG_share_updatePreview(){ document.getElementById('BW_IMGWIG_photoshare_preview').textContent=BW_IMGWIG_share_composeCaption(); } function BW_IMGWIG_share_send(ev){ if(ev&&ev.preventDefault)ev.preventDefault(); var caption=BW_IMGWIG_share_composeCaption(); var url=BW_IMGWIG_share_url||window.location.href; if(navigator.share){ // Versuche Files zu sharen (iOS/Android). Falls nicht moeglich, fallback auf URL+Text. var f=fetch(url).then(function(r){return r.blob()}).then(function(b){ var file=new File([b],'foto.jpg',{type:b.type||'image/jpeg'}); var data={text:caption,url:url,files:[file]}; if(navigator.canShare&&!navigator.canShare(data)){data={text:caption,url:url}} return navigator.share(data); }).then(function(){BW_IMGWIG_closePhotoShare()}) .catch(function(e){if(e&&e.name!=='AbortError')console.error(e)}); }else{ BW_IMGWIG_share_to('fb'); } return false; } function BW_IMGWIG_share_to(platform){ var caption=BW_IMGWIG_share_composeCaption(); var url=BW_IMGWIG_share_url||window.location.href; if(platform==='fb'){ // Facebook Sharer-Popup var fbUrl='https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url)+'"e='+encodeURIComponent(caption); window.open(fbUrl,'fbshare','width=600,height=600'); }else if(platform==='ig'){ // Instagram: kein Direct-Share von externer URL möglich. Caption in Clipboard, // Bild als Download — User postet manuell in der App. var doCopy=function(){ if(navigator.clipboard&&navigator.clipboard.writeText){ return navigator.clipboard.writeText(caption); } // Fallback: textarea var ta=document.createElement('textarea');ta.value=caption;document.body.appendChild(ta);ta.select();document.execCommand('copy');document.body.removeChild(ta); return Promise.resolve(); }; doCopy().then(function(){ BW_IMGWIG_setInnerHTML('BW_IMGWIG_mailerdiv_msg_photoshare','Caption in die Zwischenablage kopiert. Bild wird heruntergeladen — danach in Instagram posten und Text einfuegen.
'); var a=document.createElement('a');a.href=url;a.download='foto.jpg';document.body.appendChild(a);a.click();document.body.removeChild(a); }); } return false; } // Preview live aktualisieren bei Texteingabe document.addEventListener('input',function(e){ if(e.target&&e.target.id==='BW_IMGWIG_photoshare_text')BW_IMGWIG_share_updatePreview(); });