/*
*/
function _maincontent(module,parameter)
{
_hide_largesubmenus();
$.ajax( {
url:"/mod/_"+module+".php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
v:parameter
},
success: function(data) {
$('.orbit').hide();
$('#artdetails').hide();
$('#maincontent').html(data);
$('#maincontent').show();
$('#maincontent').foundation();
}
});
}
function _search(from,target)
{
$('#artdetails').hide();
$('#startsearch').css("background-color","#696969");
$('#startsearch').attr("disabled",true);
$.ajax( {
url:"/mod/_suche.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
term:$('#searchlight').val(),
artist:$('#sartist').val(),
location:$('#slocation').val(),
yearf:$('#syearf').val(),
yearu:$('#syearu').val(),
title:$('#stitle').val(),
technique:$('#stechnique').val(),
pricef:$('#spricef').val(),
priceu:$('#spriceu').val(),
sb:$('#sb').val(),
so:$('#so').val(),
from:from
},
success: function(data) {
$('#'+target).html(data);
$('#'+target).show();
$('#startsearch').attr("disabled",false);
$('#startsearch').css("background-color","#2e2e2e");
$('#'+target).foundation();
}
});
}
function _searchkw(from,target,kwid)
{
$('#artdetails').hide();
$('#startsearch').css("background-color","#696969");
$('#startsearch').attr("disabled",true);
$.ajax( {
url:"/mod/_suche.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
keywordid:kwid,
from:from
},
success: function(data) {
$('#'+target).html(data);
$('#'+target).show();
$('#startsearch').attr("disabled",false);
$('#startsearch').css("background-color","#2e2e2e");
$('#'+target).foundation();
}
});
}
function _change_search_so()
{
if ($('#so').val()=='asc') { $('#so').val('desc'); } else { $('#so').val('asc'); }
_search(0,'maincontent');
}
function _sc_delete(id)
{
if (confirm("Wollen Sie dieses Werk wirklich aus dem Warenkorb löschen?"))
{
$.ajax( {
url:"/callback/_delshopcart.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
delete:id
},
success: function(data) {
$('#scquant').html(data);
_maincontent('warenkorb',id)
}
});
}
}
function _show_article(artid)
{
$('#smallmenu').hide();
$('.largesubmenu').hide();
$('.indicator').hide();
$.ajax( {
url:"/mod/_artikel.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
artid:artid
},
success: function(data) {
$('#maincontent').hide();
$('#fullview').remove();
$('#artdetails').html(data);
$('#artdetails').show();
$('#artdetails').foundation();
$('.swiper-container').each(initSwiper);
}
});
}
function _show_category(cat, parent=0)
{
$('#smallmenu').hide();
$('.largesubmenu').hide();
$('.indicator').hide();
$('#largemenu span').removeClass('active');
$('.largesubmenucontent div').removeClass('active');
$.ajax( {
url:"/mod/_kategorie.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
cat:cat,
sb:$('#sb').val(),
so:$('#so').val(),
from:0
},
success: function(data) {
$('#artdetails').hide();
$('.orbit').hide();
$('#maincontent').html(data);
$('#maincontent').show();
$('#maincontent').foundation();
$("#m"+parent).addClass("active");
$("#sm"+cat).addClass("active");
}
});
}
function _change_cat_so()
{
if ($('#so').val()=='asc') { $('#so').val('desc'); } else { $('#so').val('asc'); }
_show_category($('#cat').val());
}
function _next_category(cat,from,divid)
{
$('#smallmenu').hide();
$('.largesubmenu').hide();
$('.indicator').hide();
$.ajax( {
url:"/mod/_kategorie.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
cat:cat,
sb:$('#sb').val(),
so:$('#so').val(),
from:from
},
success: function(data) {
$(divid).html(data);
$(divid).show();
$(divid).foundation();
window.scrollTo({top: 0, left: 0, behavior: 'smooth'});
}
});
}
function _back()
{
$('#artdetails').hide();
$('#maincontent').show();
}
function _show_largemenu()
{
$('#smallsearch').hide();
$('#extsearch').hide();
$('#largemenu').show();
}
function _show_search()
{
$('#largemenu').hide();
$('.largesubmenu').hide();
$('.indicator').hide();
$('#smallsearch').show();
}
function _hide_largesubmenus()
{
$('.largesubmenu').hide();
$('.indicator').hide();
}
function _show_submenu(id, event)
{
_hide_largesubmenus();
$('#submenu'+id).show();
$('#ind'+id).css('display','inline-block');
event.stopPropagation();
event.preventDefault();
}
function _show_subsubmenu(id)
{
$('#submenu'+id).show();
}
function _show_extsearch()
{
$('#smallsearch').hide();
// $('#largemenu').hide();
$('#extsearch').show();
$('#searchlight').focus();
}
function _clear_extsearch()
{
$('#searchlight').val("");
$('#sartist').val("");
$('#slocation').val("");
$('#syearf').val("");
$('#syearu').val("");
$('#stitle').val("");
$('#stechnique').val("");
$('#spricef').val("");
$('#spriceu').val("");
$('#extsearch').hide();
$('#smallsearch').show();
}
function _start_lang(lang)
{
$.ajax( {
url:"/callback/_setlang.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
lang:lang
},
success: function(data) {
window.location.href='/?setlang=yes&sess=1017202511071606294238';
}
});
}
function _putshopcart(artid,quant)
{
$.ajax( {
url:"/callback/_putshopcart.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
artid:artid
},
success: function(data) {
$('#scquant').html(data);
$('#scb1').html('Zum Warenkorb');
$('#scb2').html('Zum Warenkorb');
}
});
}
function _thumb_active(id,img)
{
$('[id^=artthumb]').removeClass('artthumbactive').addClass('artthumb');
$('#artthumb'+id).removeClass('artthumb').addClass('artthumbactive');
$('#bigview').html('
');
$('#fullviewimg').html('
');
}
function _show_deladdr()
{
$('#deladdrh').show();
$('#deladdrf').show();
$('#deladdr').val('1');
$('#showdeladdr').hide();
}
function _hide_deladdr()
{
$('#deladdrh').hide();
$('#deladdrf').hide();
$('#deladdr').val('0');
$('#showdeladdr').show();
}
function _checkout1()
{
$('#checkout2').hide();
$('#checkout3').hide();
$('#checkout4').hide();
$('#checkout1').show();
}
function _test_val(fid,cangoon)
{
$('#'+fid).removeClass("error");
if (cangoon) { res=true; } else { res=false; }
if ($('#'+fid).val()=='')
{
$('#'+fid).effect('highlight');
$('#'+fid).effect('shake');
$('#'+fid).addClass("error");
res=false;
}
return res;
}
var alertshown=0;
function _savesessdata()
{
$.ajax( {
url:"/callback/_savesessdata.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
isal:$('#isal').val(),
itit:$('#itit').val(),
ifna:$('#ifna').val(),
ilna:$('#ilna').val(),
icom:$('#icom').val(),
ivat:$('#ivat').val(),
istr:$('#istr').val(),
iadd:$('#iadd').val(),
izip:$('#izip').val(),
iloc:$('#iloc').val(),
icou:$('#icou').val(),
email:$('#email').val(),
phone:$('#phone').val(),
deladdr:$('#deladdr').val(),
dsal:$('#dsal').val(),
dtit:$('#dtit').val(),
dfna:$('#dfna').val(),
dlna:$('#dlna').val(),
dcom:$('#dcom').val(),
dstr:$('#dstr').val(),
dadd:$('#dadd').val(),
dzip:$('#dzip').val(),
dstr:$('#dstr').val(),
dzip:$('#dzip').val(),
dloc:$('#dloc').val(),
dcou:$('#dcou').val(),
paymethod:$('#paymethod').val(),
remarks:$('#remarks').val()
},
success: function(data) {}
});
}
function _checkout2()
{
cangoon=true;
cangoon=_test_val('ifna',cangoon);
cangoon=_test_val('ilna',cangoon);
cangoon=_test_val('istr',cangoon);
cangoon=_test_val('izip',cangoon);
cangoon=_test_val('iloc',cangoon);
cangoon=_test_val('email',cangoon);
if ($('#deladdr').val()=="1")
{
cangoon=_test_val('dfna',cangoon);
cangoon=_test_val('dlna',cangoon);
cangoon=_test_val('dstr',cangoon);
cangoon=_test_val('dzip',cangoon);
cangoon=_test_val('dloc',cangoon);
}
if (cangoon)
{
_savesessdata();
$('#checkout1').hide();
$('#checkout3').hide();
$('#checkout4').hide();
$('#checkout2').show();
} else
{
if (alertshown==0)
{
alert("Bitte füllen Sie alle notwendigen Felder (markiert mit einem *) aus!");
alertshown=1;
}
}
}
function _isval(fid,addln,colname)
{
res="";
if ($('#'+fid).val()!='')
{
if (colname=="")
{
res=$('#'+fid).val()+' ';
} else
{
res=colname+': '+$('#'+fid).val()+' ';
}
if (addln) res=res+'
';
}
return res;
}
function number_format(number, decimals, dec_point, thousands_sep)
{
number=number.toFixed(decimals);
var nstr=number.toString();
nstr+='';
x=nstr.split('.');
x1=x[0];
x2=x.length > 1 ? dec_point + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
{
x1 = x1.replace(rgx, '$1' + thousands_sep + '$2');
}
return x1+x2;
}
function _checkout3()
{
_savesessdata();
var inv="";
inv=inv+_isval('isal',true,'');
inv=inv+_isval('itit',false,'');
inv=inv+_isval('ifna',false,'');
inv=inv+_isval('ilna',true,'');
inv=inv+_isval('icom',true,'');
inv=inv+_isval('ivat',true,'');
inv=inv+_isval('istr',true,'');
inv=inv+_isval('iadd',true,'');
inv=inv+_isval('izip',false,'');
inv=inv+_isval('iloc',true,'');
inv=inv+_isval('icou',true,'');
inv=inv+_isval('email',true,'E-Mail');
inv=inv+_isval('phone',true,'Telefon');
$('#inv').html(inv);
country=$('#icou').val();
var del="";
if ($('#deladdr').val()=='1')
{
del=del+_isval('dsal',true,'');
del=del+_isval('dtit',false,'');
del=del+_isval('dfna',false,'');
del=del+_isval('dlna',true,'');
del=del+_isval('dcom',true,'');
del=del+_isval('dstr',true,'');
del=del+_isval('dadd',true,'');
del=del+_isval('dzip',false,'');
del=del+_isval('dloc',true,'');
del=del+_isval('dcou',true,'');
country=$('#dcou').val();
} else
{
del="Die Lieferadresse entpricht der Rechnungsadresse.";
}
$('#del').html(del);
sum=parseFloat($('#sum').val());
$.ajax( {
url:"/callback/_calcpnp.php",
dataType:"html",
data: {
sess:"1017202511071606294238",
callback:1,
icou:$('#icou').val(),
dcou:$('#dcou').val(),
paymethod:$('#paymethod').val()
},
success: function(data) {
pnp=parseFloat(data);
$('#delcosts').html(number_format(pnp,2,',','.'));
total=sum+pnp;
$('#total').html(number_format(total,2,',','.'));
}
});
$('#pay').html('Sie zahlen per '+$('#paymethod').val());
$('#checkout1').hide();
$('#checkout2').hide();
$('#checkout4').hide();
$('#checkout3').show();
}
function _checkout4()
{
$('#orderbutton').css("background-color","#696969");
$('#orderbutton').html("Bestellung verarbeiten...");
$('#orderbutton').attr("disabled",true);
$.ajax( {
url:"/callback/_order.php",
dataType:"html",
type:"post",
data: {
sess:"1017202511071606294238",
callback:1,
isal:$('#isal').val(),
itit:$('#itit').val(),
ifna:$('#ifna').val(),
ilna:$('#ilna').val(),
icom:$('#icom').val(),
ivat:$('#ivat').val(),
istr:$('#istr').val(),
iadd:$('#iadd').val(),
izip:$('#izip').val(),
iloc:$('#iloc').val(),
icou:$('#icou').val(),
email:$('#email').val(),
phone:$('#phone').val(),
deladdr:$('#deladdr').val(),
dsal:$('#dsal').val(),
dtit:$('#dtit').val(),
dfna:$('#dfna').val(),
dlna:$('#dlna').val(),
dcom:$('#dcom').val(),
dstr:$('#dstr').val(),
dadd:$('#dadd').val(),
dzip:$('#dzip').val(),
dstr:$('#dstr').val(),
dzip:$('#dzip').val(),
dloc:$('#dloc').val(),
dcou:$('#dcou').val(),
paymethod:$('#paymethod').val(),
remarks:$('#remarks').val()
},
statusCode: {
402: function(jqXHR, textStatus, paypalLocation) { // forward to paypal
window.location.replace(decodeURIComponent(paypalLocation));
}
},
success:function(data) {
$('#checkout1').hide();
$('#checkout2').hide();
$('#checkout3').hide();
$('#scquant').html(' ');
$('#ordernr').html(data);
$('#realordernr').val(data);
$('#orderlink').html('https://grafikliebhaber.de/bestellung/'+data+'/');
$('#orderbutton').attr("disabled",false);
$('#orderbutton').css("background-color","#2e2e2e");
$('#orderbutton').html("ZAHLUNGSPFLICHTIG BESTELLEN");
$('#checkout4').show();
}
});
}
function _print_order()
{
window.open("https://grafikliebhaber.de/print_order.php?bestellung="+$('#realordernr').val());
}
$("[data=searchformitem]").on('keyup', function (e)
{
if (e.key === 'Enter' || e.keyCode === 13)
{
_search(0,'maincontent');
}
});
var swipers = [];
const a11y = {
prevSlideMessage: 'Vorherige Seite',
nextSlideMessage: 'Nächste Seite',
firstSlideMessage: 'Das ist die erste Seite',
lastSlideMessage: 'Das ist die letzte Seite',
paginationBulletMessage: 'Zu Seite {{index}} springen',
enabled: true,
};
function initSwiper() {
var num = {xs: 1, sm: 1, md: 4, lg: 4, xl: 4};
var reduceMotion = true;
const mediaQuery = window.matchMedia("(prefers-reduced-motion: no-preference)");
if (mediaQuery && mediaQuery.matches) {
reduceMotion = false;
}
if (this.dataset.num) {
try {
num = JSON.parse(this.dataset.num);
} catch (e) {
}
}
var options = {
loop: false,
slidesPerView: num.xs,
slidesPerGroup: 1,
spaceBetween: 40,
watchOverflow: true,
centerInsufficientSlides: true,
passiveListeners: false,
a11y,
keyboard: true,
effect: (this.dataset.anim === "fade" || reduceMotion ? "fade" : "slide"),
fadeEffect: {
crossFade: true
},
// If we need pagination
pagination: {
el: (this.dataset.id ? '#swiper-pagination-' + this.dataset.id : '.swiper-pagination'),
clickable: true,
},
// Navigation arrows
navigation: {
addIcons: false,
nextEl: (this.dataset.id ? '#swiper-button-next-' + this.dataset.id : '.swiper-button-next'),
prevEl: (this.dataset.id ? '#swiper-button-prev-' + this.dataset.id : '.swiper-button-prev'),
},
// And if we need scrollbar
scrollbar: {
el: (this.dataset.id ? '#swiper-scrollbar-' + this.dataset.id : '.swiper-scrollbar'),
},
breakpoints: {
// when window width is > 576px
576: {
slidesPerView: num.sm,
slidesPerGroup: num.sm,
},
// when window width is > 768px
768: {
slidesPerView: num.md,
slidesPerGroup: num.md,
},
// when window width is > 992px
992: {
slidesPerView: num.lg,
slidesPerGroup: num.lg,
},
// when window width is > 1200px
1200: {
slidesPerView: num.xl,
slidesPerGroup: num.xl,
}
},
// on: {
// init: function (swiper) {
// var elements = swiper.el.getElementsByTagName('a');
// for (var n = 0; n < elements.length; ++n) {
// if (elements[n].className === "lightbox") {
// elements[n].onclick = function (event) {
// event.preventDefault();
// };
// }
// }
// },
// click: function (swiper, event) {
// var images = [];
// jQuery(this.slides).find("a.lightbox").each(function () {
// images.push({src: jQuery(this).attr("href")});
// });
// if (images.length > 0) {
// jQuery.magnificPopup.open({
// items: images,
// gallery: {
// enabled: true
// },
// type: 'image',
// closeBtnInside: false
// }, this.clickedIndex);
// }
// return false;
// }
// },
}
if (parseInt(this.dataset.swiperAutoplay, 10) > 0) {
options = Object.assign(options, {
autoplay: reduceMotion ? false : {
delay: parseInt(this.dataset.swiperAutoplay, 10),
disableOnInteraction: false,
},
speed: reduceMotion ? 0 : 750,
loop: true
});
}
swipers.push(new Swiper(this.getElementsByClassName("swiper")[0], options));
}
let thumbsSwiper, contentSwiper, selectedImageIndex=0;
function initDialogGallery() {
const element = document.getElementById('dialoggallery');
if (element) {
// galleryDialog.on('show', function () {
thumbsSwiper = new Swiper(".thumbsSwiper", {
initialSlide: selectedImageIndex,
slidesPerView: "auto",
spaceBetween: 4,
centeredSlides: true,
observer: true,
slideToClickedSlide: true,
a11y,
});
contentSwiper = new Swiper(".contentSwiper", {
initialSlide: selectedImageIndex,
slidesPerView: "auto",
spaceBetween: 100,
centeredSlides: true,
observer: true,
slideToClickedSlide: true,
a11y,
keyboard: true,
on: {
afterInit: function () {
jQuery("img", this.slides).each(function () {
const $t = jQuery(this);
$t.addClass($t.width() < $t.height() ? 'h' : 'q');
$t.closest("picture").width('auto');
$t.closest("picture").width($t.width());
$t.on("load",function() {
const $t = jQuery(this);
$t.addClass($t.width() < $t.height() ? 'h' : 'q');
$t.closest("picture").width('auto');
$t.closest("picture").width($t.width());
});
});
this.update();
},
resize: function () {
jQuery("img", this.slides).each(function () {
const $t = jQuery(this);
$t.closest("picture").width('auto');
$t.closest("picture").width($t.width());
});
this.update();
},
destroy: function () {
jQuery("img", this.slides).each(function () {
const $t = jQuery(this);
$t.closest("picture").width('auto');
});
}
}
});
thumbsSwiper.on("activeIndexChange", function () {
contentSwiper.slideTo(this.activeIndex);
});
contentSwiper.on("activeIndexChange", function () {
thumbsSwiper.slideTo(this.activeIndex);
});
// });
// galleryDialog.on("hide", function (event) {
// });
}
}
$(document).foundation();
$(document).ready(function(){
$('body').on('click', function(){
_hide_largesubmenus();
});
$('.swiper-container').each(initSwiper);
$('[data-reveal]').on('open.zf.reveal', function() {
console.log('reveal update');
$('#dialoggallery').each(initDialogGallery);
thumbsSwiper.update();
contentSwiper.update();
});
$('[data-reveal]').on('closed.zf.reveal', function() {
console.log('reveal close');
contentSwiper.destroy(true);
thumbsSwiper.destroy(true);
});
});
// Handle forward/back buttons
window.addEventListener("popstate", (event) => {
// If a state has been provided, we have a "simulated" page
// and we update the current page.
if (event.state) {
console.log(event.state);
// Simulate the loading of the previous page
id=event.state.id;
if(id) {
_show_article(id);
window.scrollTo({top:0, left: 0, behavior: "smooth"});
}
}
});
/*
*/