Add basic support for window.open's features.

This commit is contained in:
Cheng Zhao 2013-12-27 14:57:53 +08:00
parent 1701f572e2
commit 0de40febab

View file

@ -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