Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7afec498
authored
Feb 06, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: sorting algorithms added (by name, by date)
parent
29e04e59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
3 deletions
+58
-3
one/static/cloud.js
+58
-3
No files found.
one/static/cloud.js
View file @
7afec498
...
@@ -124,7 +124,14 @@ $(function() {
...
@@ -124,7 +124,14 @@ $(function() {
},
self
);
},
self
);
self
.
quota
.
softPos
=
ko
.
computed
(
function
()
{
self
.
quota
.
softPos
=
ko
.
computed
(
function
()
{
return
(
self
.
quota
.
rawSoft
()
/
self
.
quota
.
rawHard
()
*
100
).
toFixed
(
0
)
+
'%'
;
return
(
self
.
quota
.
rawSoft
()
/
self
.
quota
.
rawHard
()
*
100
).
toFixed
(
0
)
+
'%'
;
},
self
)
},
self
);
self
.
sortBy
=
ko
.
observable
(
'name'
);
$
(
'#current-location select'
).
on
(
'change'
,
function
(){
self
.
sortBy
(
$
(
'#current-location select'
).
val
());
sortOriginalFiles
();
sortFiles
();
})
/**
/**
* Returns throttled function
* Returns throttled function
...
@@ -170,6 +177,51 @@ $(function() {
...
@@ -170,6 +177,51 @@ $(function() {
loadFolder
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
loadFolder
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
}
}
var
sortFiles
=
function
(){
self
.
files
.
sort
({
name
:
function
(
a
,
b
){
if
(
a
.
type
===
b
.
type
){
return
a
.
originalName
.
localeCompare
(
b
.
originalName
);
}
if
(
a
.
type
===
'fájl'
){
return
1
;
}
return
-
1
;
},
date
:
function
(
a
,
b
){
if
(
a
.
type
===
b
.
type
){
return
new
Date
(
b
.
mTime
).
getTime
()
-
new
Date
(
a
.
mTime
).
getTime
();
}
if
(
a
.
type
===
'fájl'
){
return
1
;
}
return
-
1
;
}
}[
self
.
sortBy
()]);
}
var
sortOriginalFiles
=
function
(){
self
.
allFiles
.
sort
({
name
:
function
(
a
,
b
){
if
(
a
.
TYPE
===
b
.
TYPE
){
return
a
.
NAME
.
localeCompare
(
b
.
NAME
);
}
if
(
a
.
TYPE
===
'F'
){
return
1
;
}
return
-
1
;
},
date
:
function
(
a
,
b
){
if
(
a
.
TYPE
===
b
.
TYPE
){
return
new
Date
(
b
.
MTIME
).
getTime
()
-
new
Date
(
a
.
MTIME
).
getTime
();
}
if
(
a
.
TYPE
===
'F'
){
return
1
;
}
return
-
1
;
}
}[
self
.
sortBy
()]);
}
/**
/**
* Loads the specified folder
* Loads the specified folder
*/
*/
...
@@ -209,10 +261,12 @@ $(function() {
...
@@ -209,10 +261,12 @@ $(function() {
self
.
notInRoot
(
self
.
currentPath
().
lastIndexOf
(
'/'
)
!==
0
);
self
.
notInRoot
(
self
.
currentPath
().
lastIndexOf
(
'/'
)
!==
0
);
self
.
files
([]);
self
.
files
([]);
self
.
allFiles
=
data
;
self
.
allFiles
=
data
;
for
(
var
i
in
data
)
{
sortOriginalFiles
();
for
(
var
i
in
self
.
allFiles
)
{
added
++
;
added
++
;
if
(
added
<
6
)
addFile
(
data
[
i
]);
if
(
added
<
6
)
addFile
(
self
.
allFiles
[
i
]);
}
}
sortFiles
();
}
}
/**
/**
...
@@ -265,6 +319,7 @@ $(function() {
...
@@ -265,6 +319,7 @@ $(function() {
addFile
(
self
.
allFiles
[
i
]);
addFile
(
self
.
allFiles
[
i
]);
}
}
self
.
fileLimit
+=
5
;
self
.
fileLimit
+=
5
;
sortFiles
();
}
}
/**
/**
...
...
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