@abcnews/hash-scripts-loader

Load scripts with a #hash in Core.

Usage no npm install needed!

<script type="module">
  import abcnewsHashScriptsLoader from 'https://cdn.skypack.dev/@abcnews/hash-scripts-loader';
</script>

README

hash-scripts-loader

Load scripts with a #hash in Core.

Install

Install module

npm install @abcnews/hash-scripts-loader

Put in code

import loadScripts from "@abcnews/hash-scripts-loader";
loadScripts();

Usage

Put something like #interactivescriptsENCODEDldhgjldkjg3lk43nlkjbnsdlkfn in a CoreMedia article. With the encoded string being a base-36-props string. Use the base 36 converter to get the string.

Use the following pattern.

{"scripts": ["https://path.to.your.com/script.js"]}

Multiple scripts supported. eg.

{
  "scripts": [
    "https://path.to.your.com/script.js",
    "https://path.to.another.com/script.js"
  ]
}

Proxy

When using the preview site you can proxy a local script using proxy and proxyencoded query strings.

  • ?proxy=https://ws204914.aus.aunty.abc.net.au:8000/index.js seems to work only on https://master-news-web.news-web-preview.presentation-layer.abc-prod.net.au domain NOT nucwed
  • ?proxyencoded=5flhz4us1jwv2ryyloaj9zytj0scx2zv3at3b2mgy8p2gnwf1xw1araikd8atfti1h6hfse65289hftsamn2oco3e5tcin6trz542ef1 with the encoded string something like the following (works in nucwed preview):
{ "scripts": ["https://ws246352.aus.aunty.abc.net.au:8000/index.js"] }

Use this base36 encoding tool to get the string.

Standalone loader

Attach this standalone JavaScript file to your CoreMedia article to use this loader in Presentation Layer.

To do this, create a new JavaScript document and paste the URL into the URL field and check it in. Then attach the JS document in your article.

https://www.abc.net.au/res/sites/news-projects/interactive-loader/1.1.2/index.js

Note: Currently only works if Odyssey PL JS is also attached to the article