@abcnews/hash-scripts-loader 中文文档教程
hash-scripts-loader
在 Core 中使用 #hash 加载脚本。
Install
安装模块
npm install @abcnews/hash-scripts-loader
放入代码
import loadScripts from "@abcnews/hash-scripts-loader";
loadScripts();
Usage
在 CoreMedia 文章中放入类似 #interactivescriptsENCODEDldhgjldkjg3lk43nlkjbnsdlkfn
的内容。 编码字符串是 base-36-props 字符串。 使用 base 36 转换器获取字符串。
使用以下模式。
{"scripts": ["https://path.to.your.com/script.js"]}
支持多个脚本。 例如。
{
"scripts": [
"https://path.to.your.com/script.js",
"https://path.to.another.com/script.js"
]
}
Proxy
使用预览站点时,您可以使用 proxy
和 proxyencoded
查询字符串来代理本地脚本。
?proxy=https://ws204914.aus.aunty.abc.net.au:8000/index.js
seems to work only onhttps://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"] }
使用此base36 编码工具获取字符串。
Standalone loader
将这个独立的 JavaScript 文件附加到您的 CoreMedia 文章,以在表示层中使用此加载器。
为此,创建一个新的 JavaScript 文档并将 URL 粘贴到 URL 字段中并签入。然后在您的文章中附加 JS 文档。
https://www.abc.net.au/res/sites/news-projects/interactive-loader/1.1.2/index.js
注意:目前仅适用于 Odyssey PL JS也附在文章中
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 onhttps://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