script: add openUrl function

This commit is contained in:
bordun 2021-03-01 17:39:41 +01:00
parent c32c268f16
commit 3f75756fda
4 changed files with 25 additions and 5 deletions

View file

@ -373,8 +373,17 @@ class ScriptVm extends Vm {
}
this.sandbox.contentWindow.openUrl = (url)=>{
var options = this.getValueOptions()
if (options.send) window.open(url, '_blank')
}
for (var imports of ['set', 'get', 'getProp', 'getIndex', 'updateProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage',
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout', 'setFocus', 'unfocus', 'setScroll', 'getScroll', 'toolbar']) {
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout', 'setFocus', 'unfocus', 'setScroll', 'getScroll', 'toolbar',
'openUrl']) {
this.sanitize(this.sandbox.contentWindow[imports])
}