{"version":3,"sources":["../../dev/j/structured-data.js"],"names":["$","avm","require","$faq_holder","jsonInjection","contextType","content","el","document","createElement","jsonIntro","@context","@type","json","Object","assign","type","text","JSON","stringify","querySelector","appendChild","ready","each","$items","this","find","contentJson","push","name","replaceAll","acceptedAnswer","html"],"mappings":"CASA,WACC,YACA,IAAIA,GAAIC,IAAIC,QAAQ,UACnBC,EAAcH,EAAE,gCAGhBI,EAAgB,SAASC,EAAaC,GACrC,GAAIC,GAAKC,SAASC,cAAc,UAC5BC,GACFC,WAAY,oBACZC,QAASP,GAEVQ,EAAOC,OAAOC,OAAOL,EAAWJ,EAEjCC,GAAGS,KAAO,sBACVT,EAAGU,KAAOC,KAAKC,UAAUN,GAGzBL,SAASY,cAAc,QAAQC,YAAYd,GAI7CP,GAAEQ,UAAUc,MAAM,WAEbnB,GACHA,EAAYoB,KAAK,WAChB,GACCC,GAASxB,EAAEyB,MAAMC,KAAK,gBACtBpB,KACAqB,IAGDH,GAAOD,KAAK,WACXI,EAAYC,MACXhB,QAAS,WACTiB,KAAQ7B,EAAEyB,MAAMC,KAAK,MAAMT,OAAOa,WAAW,KAAK,IAAIA,WAAW,KAAK,IACtEC,gBACCnB,QAAS,SACTK,KAAQjB,EAAEyB,MAAMC,KAAK,KAAKM,OAAOF,WAAW,KAAK,IAAIA,WAAW,KAAK,SAIxExB,EAAoB,WAAIqB,EAExBvB,EAlBkB,UAkBSE","file":"structured-data.js","sourcesContent":["\n/*\nScript for adding Structured data to document head tag\nAuthor: Čeněk Hybler\nDate: December 2020\n\nComponents maintained: FAQ Accordion\n*/\n\n(function() {\n\t'use strict';\n\tvar $ = avm.require('jquery'),\n\t\t$faq_holder = $('[data-structured-type=\"faq\"]'),\n\n\t\t/* Function for JSON stringify and Script injection */\n\t\tjsonInjection = function(contextType, content){\n\t\t\tvar el = document.createElement('script');\n\t\t\tvar jsonIntro = {\n\t\t\t\t\t\"@context\": \"http://schema.org\",\n\t\t\t\t\t\"@type\": contextType\n\t\t\t\t},\n\t\t\t\tjson = Object.assign(jsonIntro, content);\n\n\t\t\tel.type = 'application/ld+json';\n\t\t\tel.text = JSON.stringify(json);\n\n\t\t\t//console.log(el);\n\t\t\tdocument.querySelector('head').appendChild(el);\n\t\t};\n\n\n\t$(document).ready(function(){\n\t\t//FAQ\n\t\tif ($faq_holder) {\n\t\t\t$faq_holder.each(function(){\n\t\t\t\tvar contextType = 'FAQPage',\n\t\t\t\t\t$items = $(this).find('.js-question'),\n\t\t\t\t\tcontent = {},\n\t\t\t\t\tcontentJson = [];\n\n\n\t\t\t\t$items.each(function() {\n\t\t\t\t\tcontentJson.push({\n\t\t\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\t\t\"name\": $(this).find('h5').text().replaceAll('\\t','').replaceAll('\\n',''),\n\t\t\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\t\t\"text\": $(this).find('p').html().replaceAll('\\t','').replaceAll('\\n','')\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t\t});\n\t\t\t\tcontent['mainEntity'] = contentJson;\n\n\t\t\t\tjsonInjection(contextType, content);\n\t\t\t});\n\t\t}\n\t});\n})();\n"]}