Add basic support for window.open's features.
This commit is contained in:
parent
1701f572e2
commit
0de40febab
1 changed files with 19 additions and 2 deletions
|
@ -61,8 +61,25 @@ window.onerror = (error) ->
|
||||||
false
|
false
|
||||||
|
|
||||||
# Override default window.open.
|
# Override default window.open.
|
||||||
window.open = (url) ->
|
window.open = (url, name, features) ->
|
||||||
|
options = {}
|
||||||
|
for feature in features.split ','
|
||||||
|
[name, value] = feature.split '='
|
||||||
|
options[name] =
|
||||||
|
if value is 'yes'
|
||||||
|
true
|
||||||
|
else if value is 'no'
|
||||||
|
false
|
||||||
|
else
|
||||||
|
value
|
||||||
|
|
||||||
|
options.x ?= options.left
|
||||||
|
options.y ?= options.top
|
||||||
|
options.title ?= name
|
||||||
|
options.width ?= 800
|
||||||
|
options.height ?= 600
|
||||||
|
|
||||||
BrowserWindow = require('remote').require 'browser-window'
|
BrowserWindow = require('remote').require 'browser-window'
|
||||||
browser = new BrowserWindow width: 800, height: 600
|
browser = new BrowserWindow options
|
||||||
browser.loadUrl url
|
browser.loadUrl url
|
||||||
browser
|
browser
|
||||||
|
|
Loading…
Reference in a new issue