Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- ! function () {
- function e() {
- 'darwin' == process['platform'] && n['dock']['setBadge']('');
- var e = g({
- defaultWidth: 800,
- defaultHeight: 600,
- path: n['getPath']('userData') + '/settings'
- }),
- t = {
- minWidth: 400,
- minHeight: 340,
- x: e['x'],
- y: e['y'],
- width: e['width'],
- height: e['height'],
- title: 'Franz',
- webPreferences: {
- plugins: true
- }
- //enable "plugins" for flash.
- };
- 'linux' == process['platform'] && (t['icon'] = f['join'](__dirname, 'assets', 'franz.png')), T = new o(t), e['manage'](T), T['loadURL']('file://' + __dirname + '/index.html'), T['webContents']['on']('will-navigate', function (e) {
- e['preventDefault']()
- }), d['register'](T, 'Ctrl+Tab', function () {
- T['webContents']['send']('shortcut', 'nextTab')
- }), d['register'](T, 'Ctrl+Shift+Tab', function () {
- T['webContents']['send']('shortcut', 'prevTab')
- }), d['register'](T, 'Ctrl+PageDown', function () {
- T['webContents']['send']('shortcut', 'nextTab')
- }), d['register'](T, 'Ctrl+PageUp', function () {
- T['webContents']['send']('shortcut', 'prevTab')
- }), 'darwin' == process['platform'] && (d['register'](T, 'Alt+Cmd+Right', function () {
- T['webContents']['send']('shortcut', 'nextTab')
- }), d['register'](T, 'Alt+Cmd+Left', function () {
- T['webContents']['send']('shortcut', 'prevTab')
- })), d['register'](T, 'Alt+Ctrl+Shift+PageUp', function () {
- T['webContents']['toggleDevTools']()
- }), T['on']('restore', function () {
- n['mainWindow']['setSkipTaskbar'](!1)
- }), T['on']('minimize', function () {
- n['wasMaximized'] = n['isMaximized']
- }), T['on']('maximize', function () {
- n['isMaximized'] = !0
- }), T['on']('unmaximize', function () {
- n['isMaximized'] = !1
- }), T['on']('restore', function () {
- n['wasMaximized'] && T['maximize']()
- }), n['mainWindow'] = T, n['isMaximized'] = T['isMaximized']()
- }
- if(!require('electron-squirrel-startup')) {
- var t = require('electron'),
- n = t['app'],
- o = t['BrowserWindow'],
- i = t['dialog'],
- a = t['ipcMain'],
- r = t['shell'],
- s = t['session'],
- c = require('console'),
- l = c['Console'],
- u = require('fs-extra'),
- d = require('electron-localshortcut'),
- g = require('electron-window-state'),
- f = require('path'),
- p = require('underscore'),
- h = require('i18n'),
- m = require('nconf'),
- w = require('auto-launch'),
- v = require(f['join'](__dirname, 'lib', 'services')),
- b = require(f['join'](__dirname, 'config', 'locales.json')),
- _ = require('./lib/tray'),
- x = new w({
- name: 'Franz'
- });
- n['appLauncher'] = x;
- var y = u['createWriteStream'](n['getPath']('userData') + '/user.log'),
- z = u['createWriteStream'](n['getPath']('userData') + '/error.log'),
- k = new l(y, z);
- process['on']('uncaughtException', function (e) {
- k['error'](e), console['log'](e)
- }), h['configure']({
- locales: Object['keys'](b),
- directory: __dirname + '/locales',
- defaultLocale: 'en_GB',
- register: global,
- updateFiles: !1,
- logErrorFn: function (e) {
- console['log']('error', e)
- }
- });
- var q = {},
- C = {},
- S = 2e3,
- j = ['services', 'appdata', 'settings'];
- j['forEach'](function (e) {
- q[e] = new m['Provider'];
- var t = f['join'](n['getPath']('userData'), 'settings', e + '.json'),
- o = f['join'](n['getPath']('userData'), 'settings', e + '.backup.json');
- try {
- q[e]['file'](e, t)
- } catch(i) {
- k['error'](new Date + ' ' + e + '.json corrupt, trying to use backup');
- try {
- u['unlinkSync'](t), u['copySync'](o, t)
- } catch(i) {
- k['error'](new Date + ' could not restore ' + e + '.backup.json')
- } finally {
- try {
- q[e]['file'](e, t)
- } catch(i) {
- console['log']('na seas die zweite', e), k['error'](new Date + ' could not run with restored ' + e + '.backup.json');
- try {
- u['unlinkSync'](t), u['unlinkSync'](o)
- } catch(i) {
- k['error'](new Date + ' could delete ' + e + '.json and ' + e + '.backup.json')
- };
- q[e]['file'](e, t)
- }
- }
- };
- C[e] = p['debounce'](function () {
- q[e]['save'](function () {
- console['log']('####### ' + e + ' settings saved #######')
- })
- }, S)
- });
- var D = q;
- if(n['settings'] = D, n['forceQuit'] = !1, n['manualUpdate'] = !1, n['systemTray'] = null, n['isMaximized'] = !1, n['wasMaximized'] = !1, 'darwin' == process['platform'] || 'win32' == process['platform']) {
- var M;
- ! function () {
- var e = require('electron'),
- t = e['autoUpdater'];
- t['setFeedURL']('darwin' == process['platform'] ? 'http://franz.adlk.io/update/osx/' + n['getVersion']() : 'win32' == process['platform'] ? 'http://franz.adlk.io/update/v2/' + process['platform'] + '/' + process['arch'] + '/' + n['getVersion']() : ''), M = !1, t['on']('update-downloaded', function (e) {
- M || (M = !0, i['showMessageBox']({
- type: 'question',
- buttons: [__('24-install'), __('25-later'), __('26-changelog')],
- defaultId: 0,
- cancelId: 1,
- title: __('23-franz-is-ready-to-update'),
- message: __('22-a-new-update-is-ready-do-you-want-to-restart-franz-and-install-the-update')
- }, function (e) {
- M = !1, 0 == e ? (n['forceQuit'] = !0, t['quitAndInstall']()) : 2 == e && r['openExternal']('http://www.meetfranz.com/changelog.html')
- }))
- }), t['on']('checking-for-update', function (e) {
- console['log']('checking for update')
- }), t['on']('update-not-available', function (e) {
- n['manualUpdate'] && (console['log']('no update available'), i['showMessageBox']({
- type: 'info',
- buttons: ['OK'],
- defaultId: 0,
- title: __('27-no-update-for-franz-available'),
- message: __('28-no-update-for-franz-available')
- }), n['manualUpdate'] = !1)
- }), setTimeout(function () {
- t['checkForUpdates']()
- }, 3e4), setInterval(function () {
- M || t['checkForUpdates']()
- }, 864e5), a['on']('download-update', function (e, n) {
- t['checkForUpdates']()
- })
- }()
- };
- void(0) === n['settings']['settings']['get']('settings:autoStartApp') && (console['log']('auto enable launch'), x['enable'](), n['settings']['settings']['set']('settings:autoStartApp', !0)), x['isEnabled']()['then'](function (e) {
- n['settings']['settings']['set']('settings:autoStartApp', !0)
- });
- var T = void(0),
- U = n['makeSingleInstance'](function (e, t) {
- return T && (T['isMinimized']() && T['restore'](), T['focus']()), !0
- });
- if(U) {
- return void(n)['quit']()
- };
- //ENABLE ADOBE FLASH PLUGIN (64-bit Windows)
- n.commandLine.appendSwitch('ppapi-flash-path', './resources/app/pepflashplayer64_23_0_0_207.dll');
- n.commandLine.appendSwitch('ppapi-flash-version', '23.0.0.207');
- //thats it.
- n['on']('ready', function () {
- var t = n['settings']['settings']['get']('settings'),
- o = n['getLocale']();
- if(void(0) !== t && void(0) !== t['locale'] && (o = t['locale']), void(0) === b[o]) {
- var i = void(0);
- for(var r in b) {
- if(o['substring'](0, 2) == r['substring'](0, 2)) {
- i = r;
- break
- }
- };
- void(0) !== i && (o = i)
- };
- return void(0) === b[o] && (o = 'en_GB'), D['settings']['set']('settings:locale', o), h['setLocale'](o), n['services'] = v['getServices'](), e(), _(), a['on']('saveSettings', function (e, t) {
- t = t['toLowerCase'](), C[t]()
- }), a['on']('clearServiceCache', function (e) {
- p['each'](n['settings']['services']['get']('services'), function (e, t) {
- var n = s['fromPartition']('persist:' + e['service'] + '_' + e['id']);
- n['clearCache'](function (e) {
- console['log']('cache deleted')
- }), n['clearStorageData']({
- storages: ['appcache', 'filesystem']
- }, function (e) {
- console['log']('storage data deleted')
- })
- })
- }), U ? void(n)['quit']() : void(0)
- }), n['on']('before-quit', function (e) {
- n['forceQuit'] = !0
- }), n['on']('window-all-closed', function () {
- var e = D['settings']['get']('settings:runInBackground') || !0;
- e || n['quit']()
- }), n['on']('activate', function () {
- null === T ? e() : n['show']()
- }), ('win32' == process['platform'] || 'linux' == process['platform']) && (n['visibleOnTaskbar'] = !0, a['on']('close-main-window', function () {
- n['quit']()
- }), a['on']('show-main-window', function () {
- null === T ? n['mainWindow'] = T : T['show']()
- })), a['on']('toggle-autostart', function () {
- var e = D['settings']['get']('settings:autoStartApp');
- e ? (console['log']('enable'), x['enable']()) : (console['log']('disable'), x['disable']())
- })
- }
- }()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement