Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mihkel Putrinš
panustaja
Commits
f3b80d03
Commit
f3b80d03
authored
Nov 23, 2015
by
Mihkel Putrinš
Browse files
fix
parent
0fbae700
Changes
2
Hide whitespace changes
Inline
Side-by-side
code/bytesToSize.js
View file @
f3b80d03
var
sizes
=
[
'
B
'
,
'
KB
'
,
'
MB
'
,
'
GB
'
,
'
TB
'
]
function
bytesToSize
(
bytes
)
{
if
(
bytes
===
undefined
or
bytes
===
0
)
{
return
'
0 B
'
}
if
(
bytes
===
undefined
||
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
)
...
...
code/panu.js
View file @
f3b80d03
...
...
@@ -132,7 +132,8 @@ function recurseLocal(parent_resource, paths, loadedCB) {
if
(
err
)
{
return
callback
()
}
if
(
stats
.
isFile
())
{
registerMime
(
parent_resource
,
_path
,
stats
.
size
,
callback
)
}
else
if
(
stats
.
isDirectory
())
{
}
else
if
(
stats
.
isDirectory
())
{
resource_stats
.
directories
.
count
++
var
directory
=
{
name
:
_path
}
op
.
push
(
parent_resource
,
'
resources
'
,
directory
)
...
...
@@ -159,12 +160,8 @@ document.getElementById('selectLocalButton').onclick = function selectLocal () {
resource
=
{
name
:
'
root
'
}
resource_stats
=
{
files
:
{
count
:
0
,
size
:
0
},
directories
:
{
count
:
0
},
mime
:{}}
dialog
.
showOpenDialog
({
properties
:[
'
openFile
'
,
'
openDirectory
'
,
'
multiSelections
'
]},
function
selectedPath
(
_paths
)
{
if
(
!
_paths
)
{
return
}
renderer_interval
=
setInterval
(
function
()
{
renderResource
()
},
100
)
if
(
!
_paths
)
{
return
}
renderer_interval
=
setInterval
(
function
()
{
renderResource
()
},
100
)
setFormState
(
'
loading
'
)
if
(
_paths
.
length
===
1
)
{
var
single_file
=
_paths
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment