override window.confirm in devtools

This commit is contained in:
deepak1556 2016-11-28 01:08:48 +05:30
parent bbaab755e3
commit 3ac9858726

View file

@ -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' ? {