-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
38 lines (27 loc) · 951 Bytes
/
renderer.js
File metadata and controls
38 lines (27 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var Dialogs = require('dialogs');
var dialogs = Dialogs({
ok: "Подтвердить",
cancel: "Отмена"
});
window.addEventListener("message", function (event) {
let messageEvent = JSON.parse(event.data);
console.info(messageEvent);
switch (messageEvent.type) {
case "close":
window.close()
break;
case "get-password":
var myFrame = document.getElementById("myFrame");
dialogs.prompt(
"Парольное ограничение (по умолчанию, наличие в начале кирилицы, затем латинские буквы)",
'^([а-яё]+[a-z]+)$',
function(result) {
myFrame.contentWindow.postMessage(JSON.stringify({
type: "set-password",
username: messageEvent.username,
regexp: result
}), "*");
});
break;
}
}, false);