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AAQ1C,wBAAwBY,MAChF+B,EAA4B7D,SAAS2D,cAAc,UAAGF,EAAMG,IAAG,6BAC/DE,EAA8B9D,SAAS2D,cAAc,UAAGF,EAAMG,IAAG,+BACjEC,EAAaE,aAAa,WAAUF,EAAaG,MAAMC,SAAW,UAAGvB,KAAKwB,MAAMR,GAAS,OAC7FI,EAAeE,MAAMG,QAAU,SAIzC,IAAAjB,cAAa,CAAEC,UAAS,EAAEC,QAASC,O,kDCbvC,wBAA6B,G,IAAEF,EAAS,YAAEC,EAAO,UAC/CgB,QAAQC,IAAIlB,GACZiB,QAAQC,IAAIjB,GACZkB,SAASC,KAAK,WAAIpB,EAAS,KAAKC,MCd9BoB,EAA2B,GAG/B,SAASC,EAAoB7D,GAE5B,IAAI8D,EAAeF,EAAyB5D,GAC5C,QAAqB+D,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASL,EAAyB5D,GAAY,CAGjDgE,QAAS,IAOV,OAHAE,EAAoBlE,GAAUmE,KAAKF,EAAOD,QAASC,EAAQA,EAAOD,QAASH,GAGpEI,EAAOD,QCpBfH,EAAoBO,EAAKJ,IACH,oBAAXK,QAA0BA,OAAOC,aAC1CC,OAAOC,eAAeR,EAASK,OAAOC,YAAa,CAAEG,MAAO,WAE7DF,OAAOC,eAAeR,EAAS,aAAc,CAAES,OAAO,KCF7BZ,EAAoB,M","sources":["webpack://app-imagehotspots3/./src/ts/admin.ts","webpack://app-imagehotspots3/./src/ts/index.ts","webpack://app-imagehotspots3/./src/ts/lib-2sxc-fancybox.ts","webpack://app-imagehotspots3/webpack/bootstrap","webpack://app-imagehotspots3/webpack/runtime/make namespace object","webpack://app-imagehotspots3/webpack/startup"],"sourcesContent":["import { CommandNames } from '@2sic.com/2sxc-typings';\r\n\r\n/** Loader function for our Hotspot Admin */\r\nexport function activateAdmin() {\r\n // Hotspot image where marker should be added\r\n let hotSpotImage = document.querySelectorAll('.hotspot3-js-image');\r\n hotSpotImage.forEach((hsElem: HTMLElement, index) => {\r\n // add click listener only once\r\n if(!hsElem.classList.contains('added-listener')) {\r\n hsElem.addEventListener('click', () => { \r\n debugger;\r\n // if clicked element is hotspot - do nothing\r\n if(hsElem.classList.contains('hotspot3-marker')) {\r\n return false;\r\n }\r\n\r\n // get all needed information to create new hotspot\r\n const e = (event as MouseEvent);\r\n // Find the tag with class 'hotspots' because it contains more positioning data\r\n const tagWithData = hsElem.closest(\".hotspots\") as HTMLElement;\r\n const moduleId = parseInt(tagWithData.dataset.moduleId);\r\n const entityId = parseInt(tagWithData.dataset.entityId);\r\n const guid = tagWithData.dataset.guid;\r\n\r\n // get image dimensions\r\n const bounds = hsElem.getBoundingClientRect();\r\n\r\n // get hotspot icon offset\r\n const iconOffsetX = tagWithData.dataset.iconoffsetX;\r\n const iconOffsetY = tagWithData.dataset.iconoffsetY;\r\n\r\n // get exact position where hotspor marker shoul be added\r\n const x = e.clientX - bounds.left - parseInt(iconOffsetX);\r\n const y = e.clientY - bounds.top - parseInt(iconOffsetY);\r\n const xPercent = x / bounds.width * 100;\r\n const yPercent = y / bounds.height * 100;\r\n \r\n // open 2sxc mask with prefilled hotpot coordinates\r\n $2sxc(moduleId).cms.run({\r\n action: CommandNames.new,\r\n params: {\r\n entityId: entityId,\r\n parent: guid,\r\n fields: 'Hotspots',\r\n prefill: {\r\n X: Math.round(xPercent * 100) / 100,\r\n Y: Math.round(yPercent * 100) / 100 \r\n }\r\n }\r\n });\r\n });\r\n\r\n // added so click listener is only added once\r\n hsElem.classList.add('added-listener');\r\n }\r\n })\r\n}","\r\nrequire('../scss/_style.scss');\r\n\r\nimport { activateAdmin } from './admin';\r\nimport { initFancybox } from './lib-2sxc-fancybox';\r\nimport { FancyboxOptions } from './lib-2sxc-fancybox-options';\r\n\r\nconst winAny = (window as any);\r\nwinAny.appHotspot3 ??= {};\r\nwinAny.appHotspot3.activateAdmin ??= activateAdmin;\r\nwinAny.appHotspot3.initFancybox ??= initFancyboxCustom;\r\n\r\nfunction initFancyboxCustom({ attribute, options } : { attribute: string, options: FancyboxOptions }) {\r\n let customOptions = {\r\n ...options,\r\n on: { \r\n done: (fancybox: any, slide: any) => {\r\n const imgWidth = document.querySelector(`${slide.src} img`).getBoundingClientRect().width\r\n let fancyboxText: HTMLElement = document.querySelector(`${slide.src} .hotspot3-fancybox-text`)\r\n let hotspotContent: HTMLElement = document.querySelector(`${slide.src}.hotspot3-fancybox-content`)\r\n if(!fancyboxText.hasAttribute('style')) fancyboxText.style.maxWidth = `${Math.floor(imgWidth)}px`\r\n hotspotContent.style.opacity = \"1\"\r\n }\r\n }\r\n }\r\n initFancybox({ attribute, options: customOptions })\r\n}","declare let Fancybox: any;\r\nimport { FancyboxOptions } from './lib-2sxc-fancybox-options';\r\n\r\n/*\r\n This is a shared code used in various 2sxc apps. Make sure that they are in sync, so if you improve it, improve all 2sxc apps which use this. \r\n ATM they are:\r\n - Gallery7\r\n - Content\r\n The master with the newest / best version must always be the Gallery7, the others should then get a fresh copy.\r\n Because this is shared, all parameters like DOM-IDs etc. must be provided in the Init-call that it can work across apps\r\n*/ \r\n\r\nexport function initFancybox({ attribute, options } : { attribute: string, options: FancyboxOptions }) {\r\n console.log(attribute);\r\n console.log(options);\r\n Fancybox.bind(`[${attribute}]`, options);\r\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(294);\n"],"names":["document","querySelectorAll","forEach","hsElem","index","classList","contains","addEventListener","e","event","tagWithData","closest","moduleId","parseInt","dataset","entityId","guid","bounds","getBoundingClientRect","iconOffsetX","iconoffsetX","iconOffsetY","iconoffsetY","x","clientX","left","y","clientY","top","xPercent","width","yPercent","height","$2sxc","cms","run","action","params","parent","fields","prefill","X","Math","round","Y","add","winAny","window","appHotspot3","activateAdmin","initFancybox","attribute","options","customOptions","on","done","fancybox","slide","imgWidth","querySelector","src","fancyboxText","hotspotContent","hasAttribute","style","maxWidth","floor","opacity","console","log","Fancybox","bind","__webpack_module_cache__","__webpack_require__","cachedModule","undefined","exports","module","__webpack_modules__","call","r","Symbol","toStringTag","Object","defineProperty","value"],"sourceRoot":""}