You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
2.1 KiB
10 lines
2.1 KiB
1 year ago
|
/*===============================================*\
|
||
|
|| ############################################# ||
|
||
|
|| # JAKWEB.CH / Version 1.1 # ||
|
||
|
|| # ----------------------------------------- # ||
|
||
|
|| # Copyright 2020 JAKWEB All Rights Reserved # ||
|
||
|
|| ############################################# ||
|
||
|
\*===============================================*/
|
||
|
|
||
|
function lcjak_faqWidget(data,origdomain){if(data.widgethtml){var lcj_container=document.getElementById('jaklcp-faq-container');lcj_container.innerHTML=data.widgethtml}return true}function extractFAQDomain(url){var domain;if(url.indexOf("://")>-1){domain=url.split('/')[2]}else{domain=url.split('/')[0]}domain=domain.split(':')[0];return domain}function createCORSRequestFAQ(method,url){var xhr=new XMLHttpRequest();xhr.withCredentials=true;if("withCredentials"in xhr){xhr.open(method,url,true)}else if(typeof XDomainRequest!="undefined"){xhr=new XDomainRequest();xhr.open(method,url)}else{xhr=null}return xhr}(function(w){faqloc=JSON.parse(JSON.stringify(w.lcjUrl));lcjakfaqid=w.id;var catid=0;if(w.catID!='')catid=w.catID;if(extractFAQDomain(w.lcjUrl)==window.location.hostname){var request=new XMLHttpRequest();request.open('GET',faqloc+'include/loadiframefaq.php?oid='+lcjakfaqid+'&catid='+catid);request.timeout=3000;request.onload=function(){if(request.status>=200&&request.status<400){var data=JSON.parse(request.responseText);if(data.status){lcjak_faqWidget(data,extractFAQDomain(w.lcjUrl));return true}else{console.log(data.error)}}else{}};request.onerror=function(){};request.ontimeout=function(e){};request.send()}else{var url=faqloc+'include/loadiframefaq_cross.php?oid='+lcjakfaqid+'&catid='+catid+'&crossurl='+window.location+'&callback=LiveChatJAK';var request=createCORSRequestFAQ('GET',url);if(!request){console.log('CORS not supported');return}request.onload=function(){var data=JSON.parse(request.responseText);if(data.status){lcjak_faqWidget(data,extractFAQDomain(w.lcjUrl));return true}else{console.log(data.error)}};request.onerror=function(){console.log('Woops, there was an error making the request.')};request.send()}}(window));
|