From 3ac98587269ab4620008b3a44d8ab22835473edb Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Mon, 28 Nov 2016 01:08:48 +0530 Subject: [PATCH 1/2] override window.confirm in devtools --- lib/renderer/inspector.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/renderer/inspector.js b/lib/renderer/inspector.js index 3192aa160ed..fdb14b71701 100644 --- a/lib/renderer/inspector.js +++ b/lib/renderer/inspector.js @@ -6,6 +6,22 @@ window.onload = function () { window.WebInspector.createFileSelectorElement = createFileSelectorElement } +window.confirm = function (message, title) { + const {dialog} = require('electron').remote + let buttons, cancelId + if (title == null) { + title = '' + } + buttons = ['OK', 'Cancel'] + cancelId = 1 + return !dialog.showMessageBox({ + message: message, + title: title, + buttons: buttons, + cancelId: cancelId + }) +} + const convertToMenuTemplate = function (items) { return items.map(function (item) { const transformed = item.type === 'subMenu' ? { From 72e559458f8e7df10b51a40f87b35e9f47991642 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 29 Nov 2016 13:30:28 -0800 Subject: [PATCH 2/2] Inline buttons and cancelId values --- lib/renderer/inspector.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/renderer/inspector.js b/lib/renderer/inspector.js index fdb14b71701..81642dd6cf0 100644 --- a/lib/renderer/inspector.js +++ b/lib/renderer/inspector.js @@ -8,17 +8,14 @@ window.onload = function () { window.confirm = function (message, title) { const {dialog} = require('electron').remote - let buttons, cancelId if (title == null) { title = '' } - buttons = ['OK', 'Cancel'] - cancelId = 1 return !dialog.showMessageBox({ message: message, title: title, - buttons: buttons, - cancelId: cancelId + buttons: ['OK', 'Cancel'], + cancelId: 1 }) }