11'use strict'
22
3- var electron = require ( 'electron' )
4- var app = electron . app
5- var globalShortcut = electron . globalShortcut
6- var AutoLaunch = require ( 'auto-launch' )
7- var menubar = require ( 'menubar' )
8- var Menu = electron . Menu
9- var dialog = electron . dialog
10- var ipcMain = electron . ipcMain
11- var shell = electron . shell
3+ const electron = require ( 'electron' )
4+ const app = electron . app
5+ const globalShortcut = electron . globalShortcut
6+ const AutoLaunch = require ( 'auto-launch' )
7+ const menubar = require ( 'menubar' )
8+ const Menu = electron . Menu
9+ const dialog = electron . dialog
10+ const ipcMain = electron . ipcMain
11+ const shell = electron . shell
1212const superagent = require ( 'superagent' )
1313const semver = require ( 'semver' )
1414const config = require ( './package.json' )
1515
16- var autoLaunch = true
16+ let autoLaunch = true
1717
1818// Quit when all windows are closed.
1919app . on ( 'window-all-closed' , function ( ) {
@@ -29,7 +29,7 @@ app.on('will-quit', function () {
2929 globalShortcut . unregisterAll ( )
3030} )
3131
32- var mb = menubar ( {
32+ const mb = menubar ( {
3333 index : 'file://' + __dirname + '/index.html' ,
3434 icon : __dirname + '/assets/IconTemplate.png' ,
3535 width : 280 ,
@@ -73,7 +73,7 @@ mb.on('ready', function ready () {
7373 } )
7474
7575 ipcMain . on ( 'set-title' , function ( event , args ) {
76- var temperature = Math . round ( args . temperature ) + '°'
76+ const temperature = Math . round ( args . temperature ) + '°'
7777 mb . tray . setToolTip ( args . location + ' - ' + temperature )
7878 mb . tray . setTitle ( temperature )
7979 if ( process . platform === 'darwin' ) {
@@ -87,6 +87,11 @@ mb.on('ready', function ready () {
8787 app . quit ( )
8888 } )
8989
90+ ipcMain . on ( 'will-navigate' , function ( event , args ) {
91+ const url = args . url
92+ electron . shell . openExternal ( url )
93+ } )
94+
9095 ipcMain . on ( 'auto-launch' , function ( event , args ) {
9196
9297 // ToDo: appLauncher.isEnabled() not working for now
@@ -114,7 +119,7 @@ mb.on('show', function show () {
114119 mb . window . webContents . send ( 'show' )
115120} )
116121
117- var appLauncher = new AutoLaunch ( {
122+ const appLauncher = new AutoLaunch ( {
118123 name : 'temps'
119124} )
120125
@@ -128,7 +133,7 @@ appLauncher.isEnabled().then(function (enabled) {
128133appLauncher . enable ( )
129134
130135// Menu template and shortcuts
131- var template = [ {
136+ const template = [ {
132137 label : 'Temps' ,
133138 submenu : [
134139 { label : 'About Temps' , selector : 'orderFrontStandardAboutPanel:' } ,
0 commit comments