-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
25 lines (20 loc) · 890 Bytes
/
index.js
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
const $ = window.jQuery = window.$ = require('jquery')
require('bootstrap')
const {ipcRenderer, shell} = require('electron')
const personalAuthForm = document.querySelector('#personal-auth-form')
const accessTokenInput = document.querySelector('#access-token-input')
$('#personal-auth-form').on('submit', (event) => {
event.preventDefault()
ipcRenderer.send('personal-auth-token', $('#access-token-input').val() || ' ')
})
$(document).on('click', 'a[href^="http"]', (event) => {
event.preventDefault()
shell.openExternal(event.target.href)
})
ipcRenderer.on('personal-auth-error', (event, error) => {
$('#error').html(`
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Error</strong>: ${error}
</div>`)
})