Commit a04ec861 authored by Mihkel Putrinš's avatar Mihkel Putrinš

refactor

parent 9ba26304
......@@ -29,25 +29,25 @@ app.on('ready', function() {
var web_preferences = {
'partition': 'persist:panustaja (build ' + (pjson.build) + ')',
}
windows['authWindow'] = new BrowserWindow({ width: 900, height: 600, show: true, 'web-preferences': web_preferences })
// windows['authWindow'].webContents.openDevTools(true)
windows.authWindow = new BrowserWindow({ width: 900, height: 600, show: true, 'web-preferences': web_preferences })
// windows.authWindow.webContents.openDevTools(true)
var title = pjson.name + ' v.' + pjson.version + (pjson.version.indexOf('-') > -1 ? pjson.build : '') + ' | Logi sisse'
windows['authWindow'].center()
windows['authWindow'].setTitle(title)
windows['authWindow'].loadUrl(auth_url)
windows['authWindow'].webContents.on('did-get-response-details', function(e, s, new_url) {
windows['authWindow'].setTitle(title)
windows.authWindow.center()
windows.authWindow.setTitle(title)
windows.authWindow.loadUrl(auth_url)
windows.authWindow.webContents.on('did-get-response-details', function(e, s, new_url) {
windows.authWindow.setTitle(title)
if (new_url === user_url || new_url === user_url + '#') {
windows['authWindow'].hide()
windows.authWindow.hide()
}
})
windows['authWindow'].webContents.on('did-finish-load', function() {
windows['authWindow'].setTitle(title)
var new_url = windows['authWindow'].webContents.getUrl()
windows.authWindow.webContents.on('did-finish-load', function() {
windows.authWindow.setTitle(title)
var new_url = windows.authWindow.webContents.getUrl()
if (new_url === user_url || new_url === user_url + '#') {
clipboard.clear()
windows['authWindow'].webContents.selectAll()
windows['authWindow'].webContents.copy()
windows.authWindow.webContents.selectAll()
windows.authWindow.webContents.copy()
var web_preferences = {
'partition': 'persist:panustaja (build ' + (pjson.build) + ')',
......@@ -62,8 +62,8 @@ app.on('ready', function() {
mainWindow.webContents.openDevTools(true)
if (IS_DEV) {
}
windows['authWindow'].close()
delete windows['authWindow']
windows.authWindow.close()
delete windows.authWindow
}, 1000)
} else {
return
......
function bytesToSize(bytes) {
if (bytes === undefined) bytes = 0
if (bytes === undefined) { bytes = 0 }
var sizes = ['B', 'KB', 'MB', 'GB', 'TB']
if (bytes === 0) return '0 B'
if (bytes === 0) { return '0 B' }
try {
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)), 10)
var decimals = Math.max(0, i-1)
......
......@@ -133,7 +133,6 @@ function recurseLocal(parent_resource, paths, loadedCB) {
resource_stats.files.count++
resource_stats.files.size += stats.size
op.push(parent_resource, 'files', _path)
var charset = ''
op.set(resource_stats, ['mime', mimetype, 'count'], op.get(resource_stats, ['mime', mimetype, 'count'], 0) + 1)
op.set(resource_stats, ['mime', mimetype, 'size'], op.get(resource_stats, ['mime', mimetype, 'size'], 0) + stats.size)
callback()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment