1/* eslint-disable no-var, prefer-arrow-callback, semi */ 2(function () { 3 4 var apigeeClientSessionName = 'ClientId', 5 apigeeClientId = document.querySelector('[data-apigee-clientid]'); 6 7 if (apigeeClientId) { 8 document.cookie = `${apigeeClientSessionName}=${apigeeClientId.dataset.apigeeClientid}; path=/; SameSite=Lax; Secure`; 9 } 10 11 var reactSettings = window.reactSettings, 12 reactSettingsRecommendationList = window.reactSettingsRecommendationList, 13 reactSettingsProductDetails = window.reactSettingsProductDetails, 14 reactSettingsArtistDetails = window.reactSettingsArtistDetails, 15 reactSettingsZoomplayer = window.reactSettingsZoomplayer, 16 exhibitingOrganisationId = /\.(org-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 17 exhibitingId = /\.(exh-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 18 productId = /\.(pro-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 19 artistId = /\.(pdr-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 20 participationId = /\.(ptn-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 21 eventEditionIdSelector = /(eve-[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12})/.test(window.location.href) ? RegExp.$1 : null, 22 eventEditionIdRequestParam = /\.html?.*eventEditionId=([\w-]+)/.test(window.location.href) ? RegExp.$1 : null, 23 primaryLocale = /\.html?.*dataLocale=([\w-]+)/.test(window.location.href) ? RegExp.$1 : null, 24 uncategorisedData = /(\.[^.]+\.[^.]+\..*\.html)/.test(window.location.pathname) ? RegExp.$1 : null, 25 manualId = /\.(man-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 26 taskId = /\.(tsk-[\w-]+)\./.test(window.location.href) ? RegExp.$1 : null, 27 pageParam = /[?&]page=([^&]+)/.test(window.location.search) ? RegExp.$1 : null; 28 29 30 var canonical = document.querySelector('link[rel="canonical"]'); 31 32 if (!canonical) { 33 var headTagElement = document.querySelector('head'); 34 var canonicalNode = document.createElement('link'); 35 canonicalNode.setAttribute('rel', 'canonical'); 36 canonicalNode.setAttribute('href', window.location.href); 37 var alternateLinks = document.querySelectorAll('link[rel="alternate"]'); 38 var nextElement = alternateLinks[alternateLinks.length - 1]?.nextElementSibling; 39 nextElement ? headTagElement.insertBefore(canonicalNode, nextElement) : headTagElement.appendChild(canonicalNode); 40 canonical = document.querySelector('link[rel="canonical"]'); 41 } 42 43 if (pageParam) { 44 var canonicalURL = new URL(canonical.href); 45 var canonicalParams = canonicalURL.searchParams; 46 if (!canonicalParams.get('page')) { 47 canonicalParams.set('page', pageParam); 48 canonical.setAttribute('href',canonicalURL); 49 } 50 } 51 52 if (exhibitingOrganisationId && reactSettings) { 53 reactSettings.props.context.exhibitingOrganisationId = exhibitingOrganisationId; 54 } 55 56 if (exhibitingOrganisationId && reactSettingsRecommendationList) { 57 reactSettingsRecommendationList.props.context.exhibitingOrganisationId = exhibitingOrganisationId; 58 } 59 60 if (reactSettingsProductDetails) { 61 if (exhibitingId) { 62 reactSettingsProductDetails.props.context.exhibitingOrganisationId = exhibitingId; 63 } 64 65 if (productId) { 66 reactSettingsProductDetails.props.context.productId = productId; 67 } 68 } 69 70 if (uncategorisedData && reactSettings) { 71 var sessionDataArray = uncategorisedData.split('.').filter((el, i) => i > 0 && el !== 'html'); 72 73 if (sessionDataArray.length) { 74 sessionDataArray[0] && (reactSettings.props.context.programme.programmeId = sessionDataArray[0]); 75 sessionDataArray[1] && (reactSettings.props.context.programme.sessionId = sessionDataArray[1]); 76 77 sessionDataArray[0] || (reactSettings.props.context.programmeId = sessionDataArray[0]); 78 sessionDataArray[1] || (reactSettings.props.context.sessionId = sessionDataArray[1]); 79 } 80 } 81 82 if (artistId && reactSettingsArtistDetails) { 83 reactSettingsArtistDetails.props.context.artistId = artistId; 84 } 85 86 if (uncategorisedData && reactSettingsZoomplayer) { 87 var dataArray = uncategorisedData.split('.').filter((el, i) => i > 0 && el !== 'html'); 88 89 if (dataArray.length) { 90 dataArray[0] && (reactSettingsZoomplayer.props.context.digitalProductCode = dataArray[0]); 91 dataArray[1] && (reactSettingsZoomplayer.props.context.productType = dataArray[1]); 92 93 dataArray[2] && (reactSettingsZoomplayer.props.context.programmeId = dataArray[2]); 94 dataArray[2] && (reactSettingsZoomplayer.props.context.programme.programmeId = dataArray[2]); 95 } 96 } 97 98 if (participationId) { 99 var reactSettingsToAddParticipationId = [ 100 window.reactSettingsParticipantDetails, 101 window.reactSettingsParticipantProfile, 102 window.reactSettingsParticipantList, 103 window.reactSettingsParticipantRecommendations, 104 window.reactSettingsParticipantDirectory 105 ]; 106
107 reactSettingsToAddParticipationId.forEach(item => { 108 if (item) { 109 item.props.context.participant.participationId = participationId; 110 } 111 }) 112 } 113 114 var eventEditionId = eventEditionIdSelector || eventEditionIdRequestParam 115 if (eventEditionId || taskId || manualId) { 116 // Find all objects in the global scope which name starts with "reactSettings" 117 var reactSettingsToAddEventEditionId = Object.keys(window) 118 .map(function (key) { 119 if (key.indexOf('reactSettings') === 0) { 120 return window[key]; 121 } 122 }) 123 .filter(Boolean); // Remove empty 124 if (eventEditionId) { 125 reactSettingsToAddEventEditionId.forEach(item => { 126 if (item) { 127 item.props.context.eventEditionId = eventEditionId; 128 if (!item.props.context.primaryLocale) { 129 item.props.context.primaryLocale = primaryLocale || ''; 130 } 131 } 132 }); 133 } 134 135 if (taskId) { 136 reactSettingsToAddEventEditionId.forEach(item => { 137 if (typeof item !== 'undefined') { 138 item.props.context.taskId = taskId; 139 } 140 }) 141 } 142 143 if (manualId) { 144 reactSettingsToAddEventEditionId.forEach(item => { 145 if (typeof item !== 'undefined') { 146 item.props.context.manualId = manualId; 147 } 148 }) 149 } 150 151 if (exhibitingId) { 152 reactSettingsToAddEventEditionId.forEach(item => { 153 if (typeof item !== 'undefined') { 154 item.props.context.exhibitingOrganisationId = exhibitingId; 155 } 156 }) 157 } 158 } 159})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.