Skip to content

Commit

Permalink
Merge pull request #2291 from ORCID/lmendoza/fix-js-loading-issues
Browse files Browse the repository at this point in the history
fix-js-loading-issues
  • Loading branch information
leomendoza123 authored Jun 26, 2024
2 parents 021fa81 + fcf9e02 commit 99850ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/app/core/wordpress/wordpress.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ export class WordpressService {
map((data: { html: string; url: string }) => {
const find = './assets/'
const regex = new RegExp(find, 'g')
const updatedHtml = data.html.replace(
let updateJs = data.html.replace(
regex,
`${data.url.replace(/wordpress-homepage\.js$/, '')}assets/`
)
return updatedHtml
// By default the script was intented to be executed after the event `DOMContentLoaded`
// but in Angular the event `DOMContentLoaded` is already fired, so we need to execute it
// the following line of code will load the code even if the DOMContentLoaded event is already fired
updateJs += `if (document.readyState === 'complete') {tabtoursInit(document)}`
return updateJs
})
)
}
Expand Down

0 comments on commit 99850ca

Please sign in to comment.