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sE,UAAUC,iBAAmB,CAClCC,OAAQA,CAACC,EAASC,KAChB,MAAM,SAAEvE,GAAauE,EACrBxE,EAAKC,EAAS,EAInB,EAhPA,CAgPEwE,OAAQ3E,O","sources":["webpack://tcm-digital/./docroot/themes/custom/bacall/js/global/modal.js","webpack://tcm-digital/./docroot/modules/custom/tcm-frontend-pages/js/index.js"],"sourcesContent":["/**\n * Initializes TCM Modals\n */\nexport default class Modal {\n\n /**\n * Runs when an instance of the class is created\n * @param data\n * @param options\n */\n constructor(data, options) {\n // Initialize modal with structure markup\n // main--carousel was main--archive\n this.modal_template = \n `
\n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
`;\n\n // If options is not passed in, create defaults\n options = options || {onOpen: null, onClose: null};\n\n // Add custom events if they exist\n if (options.onOpen !== null)\n this.custom_open_callback = options.onOpen.bind(this);\n\n if (options.onClose !== null)\n this.custom_close_callback = options.onClose.bind(this);\n\n // Initialize other defaults and default event listeners\n this.modal_selector = '#modal-overlay';\n this.modal_open_class = 'modal-open';\n this.modal_close_selector = '.modal-overlay__close-button';\n this.modal_sidebar_close_selector = '.modal-overlay__content__sidebar__close-button';\n this.modal_player_close_selector = '.watch__player__return';\n this.data = data;\n this.is_open = false;\n\n this._setupEventListeners();\n }\n\n /**\n * Opens the modal called before Tiles.js\n */\n open() { \n // check if there is an already present modal on the page and close it if so\n if ($(`body > ${this.modal_selector}`).length) {\n this.close();\n }\n\n // append the modal to the body and pass in template\n $('body').addClass(this.modal_open_class).append(this.modal_template);\n \n // if player modal type, inject player into modal and hide default close button\n if ( this.data.type === 'player' ) {\n \n $('.modal-overlay__content__main').append(this.data.template);\n\n $(this.modal_close_selector).hide();\n }\n // if sidebar modal type, inject sidebar and toggleable content\n else if ( this.data.type === 'sidebar' ) {\n \n $('.modal-overlay__content__sidebar').append(this.data.sidebarTemplate);\n $('.modal-overlay__content__main').append(this.data.toggleTemplate);\n // add close button to sidebar\n $('.modal-overlay__content__main').append('');\n\n $(this.modal_close_selector).hide();\n } else if ( this.data.type === 'text' ) {\n \n $('.modal-overlay__content__main--text').append(this.data.fullText);\n }else if (this.data.overlay_type === 'slider'){\n $('.modal-overlay__content__main').prepend('');\n }\n\n this.is_open = true;\n // console.log(this.data);\n\n // Call additional custom onOpen callback if it exists\n if ( typeof this.custom_open_callback === \"function\") {\n this.custom_open_callback(this.data);\n }\n };\n\n /**\n * Closes the modal\n */\n close() {\n\n // remove modal\n $(this.modal_selector).detach();\n $('body').removeClass(this.modal_open_class);\n this.is_open = false;\n\n // Call additional custom onClose callback if it exists\n if (this.custom_close_callback !== undefined) {\n this.custom_close_callback(this.data);\n } \n }\n\n /**\n * Returns TRUE if the current instance of the modal is open.\n */\n getIsOpen() {\n return this.is_open;\n }\n\n /**\n * Sets up event listeners for modal\n * @private\n */\n _setupEventListeners(){\n $(document).on('click', this.modal_close_selector + ', ' + this.modal_player_close_selector + ', ' + this.modal_sidebar_close_selector, (e) => {\n this.close();\n \n });\n }\n}\n","import Modal from '../../../../themes/custom/bacall/js/global/modal';\n\n((($, Drupal) => {\n\n let initialized;\n\n const init = api_base => {\n if (!initialized) {\n initialized = true;\n $.ajax({\n url: api_base + '/tcmws/contentApi/photoVideo',\n type: 'GET',\n success: function(data) {\n $.each(data.tcm.galleries, function(index, item) {\n // garbage collection for galleries with no images.\n if (!item.images) {\n item.images = [];\n item.images[0].url = undefined;\n item.images[0].description = undefined;\n }\n else if (item.images.length === 0) {\n let obj = {};\n obj.url = 'https://via.placeholder.com/377x213.png?text=Archive+Gallery+created+without=images';\n obj.description = 'Someones creating galleries with no content';\n item.description = 'Someones creating galleries with no content';\n obj.title = 'Someones creating galleries with no content';\n let testArray = [];\n testArray.push(obj);\n item.images = testArray;\n\n }\n\n let imageArray = [];\n let imageCopyArray = [];\n // adding identification seperators to the content arrays\n for (let i = 0, len = item.images.length; i < len; i++) {\n let singleDescription = item.images[i].description ?\n item.images[i].description.replace(/\"/gi, '@#') :\n ' ';\n if (i === 0) {\n imageArray.push(item.images[i].url);\n imageCopyArray.push(\n singleDescription ? singleDescription : ' ');\n }\n else if (i === item.images.length) {\n imageArray.push(item.images[i].url);\n imageCopyArray.push(\n singleDescription ? '|||' + singleDescription : ' ');\n }\n else {\n imageArray.push(' ' + item.images[i].url);\n imageCopyArray.push(\n singleDescription ? '|||' + singleDescription : '|||');\n }\n }\n\n $('#photo-container').append(`\n
\n
\n \n
\n
${item.title}
\n
${item.description}
\n
`,\n );\n\n truncata('.photo-collections__title', { lines: 2, percentage: 93 });\n truncata('.photo-collections__description',\n { lines: 3, percentage: 75 });\n\n $('.tcm-modal').on('click', function() {\n const inputData = {\n overlay_type: this.getAttribute('data-overlay-type'),\n overlay_img: this.getAttribute('data-overlay-img-array'),\n overlay_copy: this.getAttribute('data-overlay-img-copy'),\n overlay_title: this.getAttribute('data-overlay-title'),\n overlay_subtitle: this.getAttribute('data-overlay-subtitle'),\n };\n\n modalCreation(inputData);\n\n function modalCreation(vodData) {\n // Build modal player sub template\n vodData.modal_player_template = '\\\n
\\\n
\\\n
DONE
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n
\\\n \\\n
\\\n

' +\n inputData.title + '

\\\n
\\\n

' + inputData.des + '

\\\n
';\n\n inputData.template = vodData.modal_player_template;\n\n const custom_options_that_are_not_required = {\n onClose: function(inputData) {\n $('.modal-overlay__header-offset').\n removeClass('visually-hidden');\n },\n // called after Modal.js\n onOpen: function(inputData) {\n if (inputData.overlay_type === 'slider') {\n //initiate slick slider\n populateOverlayCarousel(inputData);\n }\n else if (inputData.overlay_type === 'video') {\n alert('initiate Video player');\n }\n else {\n alert('Not slider');\n }\n\n // header offset has odd bg, correct with addclass\n $('.modal-overlay__header-offset').\n addClass('visually-hidden');\n },\n };\n\n const modal = new Modal(inputData,\n custom_options_that_are_not_required);\n modal.open(inputData);\n }\n });\n\n function populateOverlayCarousel(inputData) {\n let carouselImageArray = inputData.overlay_img.split(', ');\n let carouselImageCopyArray = inputData.overlay_copy.split(',|||');\n let carouselImageCopyArrayEscaped = carouselImageCopyArray.map(\n item => item.replace(/@#/g, '\"'));\n\n $('.modal-overlay__content__main').\n prepend(\n `
${inputData.overlay_subtitle}
`);\n $('.modal-overlay__content__main').\n prepend(\n `
${inputData.overlay_title}
`);\n // removes last of array that is empty ... yeah sloppy, should\n // have been done in twig\n\n let count = 0;\n carouselImageArray.forEach(img => {\n $('.modal-overlay__content__main--carousel').\n append(\n `
${carouselImageCopyArrayEscaped[count] ?\n carouselImageCopyArrayEscaped[count] :\n ' '}
`);\n count++;\n });\n\n $('.modal-overlay__content__main--carousel').slick({\n lazyLoad: 'ondemand',\n dots: true,\n customPaging: function(slider, i) {\n const thumb = $(slider.$slides[i]).data();\n if (i < 9) { // adds a preceding ZERO to slider count if below 9\n return '0' + (i + 1) + '';\n }\n else { // removes preceding ZERO to slider count if above 9\n return '' + (i + 1) + '';\n }\n },\n nextArrow: '',\n prevArrow: '',\n infinite: false,\n //dotsClass: 'overlay-carousel-dots'\n //appendDots:\n });\n }\n });\n\n $.each(data.tcm.videos, function(index, item) {\n // strip html from description as it breaks the layout.\n //let description = item.description.replace(/<[^>]+>/g, '') // not\n // really what we want replaces ascii chars We’ve with an apos\n let description = item.description.replace(/’/g, '\\'');\n\n // garbage collecton on images\n item.imageUrl === 'null' ?\n item.imageUrl = undefined :\n item.imageUrl;\n let publishedDate = new Date(item.publishedDate);\n publishedDate = publishedDate.toLocaleDateString('en-US',\n { year: 'numeric', month: 'short' });\n const introTag = $(this)[0].category === 'Host' ?\n `
Intro Aired: ${publishedDate}
` :\n '';\n // loop for seperate into\n $('#video-container').append(`\n \n
\n
\n ${introTag}\n \n
\n
\n
${item.titleConsumer}
\n
${description}
\n
\n
`,\n );\n truncata('.video-collections__title', { lines: 2, percentage: 93 });\n truncata('.video-collections__description',\n { lines: 3, percentage: 75 });\n });\n },\n error: function(error) {\n console.log('API connection error: ' + api_base +\n '/tcmws/MonthSchedule\\nPage schedule-daily.js \\n' + error);\n },\n });\n }\n };\n\n Drupal.behaviors.photoVideoRender = {\n attach: (context, settings) => {\n const { api_base } = settings;\n init(api_base);\n },\n };\n\n})(jQuery, Drupal));\n"],"names":["Modal","constructor","data","options","this","modal_template","onOpen","onClose","custom_open_callback","bind","custom_close_callback","modal_selector","modal_open_class","modal_close_selector","modal_sidebar_close_selector","modal_player_close_selector","is_open","_setupEventListeners","open","$","length","close","addClass","append","type","template","hide","sidebarTemplate","toggleTemplate","fullText","overlay_type","prepend","detach","removeClass","undefined","getIsOpen","document","on","e","Drupal","initialized","init","api_base","ajax","url","success","each","tcm","galleries","index","item","images","obj","description","title","testArray","push","imageArray","imageCopyArray","i","len","singleDescription","replace","truncata","lines","percentage","inputData","getAttribute","overlay_img","overlay_copy","overlay_title","overlay_subtitle","vodData","modal_player_template","des","custom_options_that_are_not_required","carouselImageArray","split","carouselImageCopyArrayEscaped","map","count","forEach","img","slick","lazyLoad","dots","customPaging","slider","$slides","nextArrow","prevArrow","infinite","populateOverlayCarousel","alert","modalCreation","videos","imageUrl","publishedDate","Date","toLocaleDateString","year","month","introTag","category","urlHtml","titleConsumer","error","console","log","behaviors","photoVideoRender","attach","context","settings","jQuery"],"sourceRoot":""}