script: add openUrl function
This commit is contained in:
parent
c32c268f16
commit
3f75756fda
4 changed files with 25 additions and 5 deletions
|
|
@ -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])
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue