Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
874e42ad
authored
Feb 04, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cloud.js reindent
parent
13a3166b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
77 deletions
+116
-77
one/static/cloud.js
+116
-77
No files found.
one/static/cloud.js
View file @
874e42ad
var
toggleDetails
;
$
(
function
(){
$
(
function
()
{
function
getCookie
(
name
)
{
var
cookieValue
=
null
;
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
if
(
document
.
cookie
&&
document
.
cookie
!=
''
)
{
var
cookies
=
document
.
cookie
.
split
(
';'
);
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
cookies
.
length
;
i
++
)
{
var
cookie
=
jQuery
.
trim
(
cookies
[
i
]);
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
==
(
name
+
'='
))
{
if
(
cookie
.
substring
(
0
,
name
.
length
+
1
)
==
(
name
+
'='
))
{
cookieValue
=
decodeURIComponent
(
cookie
.
substring
(
name
.
length
+
1
));
break
;
}
...
...
@@ -15,165 +15,204 @@ $(function(){
return
cookieValue
;
}
var
csrftoken
=
getCookie
(
'csrftoken'
);
function
csrfSafeMethod
(
method
)
{
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
return
(
/^
(
GET|HEAD|OPTIONS|TRACE
)
$/
.
test
(
method
));
}
$
.
ajaxSetup
({
crossDomain
:
false
,
beforeSend
:
function
(
xhr
,
settings
)
{
if
(
!
csrfSafeMethod
(
settings
.
type
))
{
if
(
!
csrfSafeMethod
(
settings
.
type
))
{
xhr
.
setRequestHeader
(
"X-CSRFToken"
,
csrftoken
);
}
}
});
toggleDetails
=
function
()
{
if
(
$
(
this
).
next
(
'.details'
).
is
(
':hidden'
))
{
toggleDetails
=
function
()
{
if
(
$
(
this
).
next
(
'.details'
).
is
(
':hidden'
))
{
$
(
this
).
next
(
'.details'
).
slideDown
(
700
);
$
(
this
).
parent
(
'.wm'
).
addClass
(
'opened'
);
}
else
{
var
that
=
this
;
$
(
this
).
next
(
'.details'
).
slideUp
(
700
,
function
()
{
var
that
=
this
;
$
(
this
).
next
(
'.details'
).
slideUp
(
700
,
function
()
{
$
(
that
).
parent
(
'.wm'
).
removeClass
(
'opened'
);
});
}
}
$
(
'.wm .summary'
).
unbind
(
'click'
).
click
(
toggleDetails
);
$
(
'#load-more-files'
).
click
(
function
(){
$
(
'#load-more-files'
).
click
(
function
()
{
$
(
'.actions'
,
this
).
show
();
var
that
=
this
;
setTimeout
(
function
(){
$
(
that
).
prev
(
'li'
).
slideDown
(
500
,
function
()
{
var
that
=
this
;
setTimeout
(
function
()
{
$
(
that
).
prev
(
'li'
).
slideDown
(
500
,
function
()
{
$
(
'.actions'
,
that
).
hide
();
});
},
2000
);
},
2000
);
})
$
(
'#new-wm-button'
).
click
(
function
(){
$
(
'#new-wm-button'
).
click
(
function
()
{
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-wm'
).
html
());
$
(
'#modal-container .wm .summary'
).
each
(
function
(){
this
.
originalHeight
=
parseInt
(
$
(
this
).
next
(
'.details'
).
css
(
'height'
));
$
(
'#modal-container .wm .summary'
).
each
(
function
()
{
this
.
originalHeight
=
parseInt
(
$
(
this
).
next
(
'.details'
).
css
(
'height'
));
})
$
(
'#modal-container .wm .summary'
).
click
(
toggleDetails
);
});
$
(
'#new-template-button'
).
click
(
function
(){
});
$
(
'#new-template-button'
).
click
(
function
()
{
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-template'
).
html
());
});
$
(
'#shadow'
).
click
(
function
(){
$
(
'#shadow'
).
click
(
function
()
{
$
(
'#modal'
).
hide
();
})
$
(
'#new-template-button'
).
click
(
function
(){
$
.
get
(
'/ajax/templateWizard'
,
function
(
data
){
$
(
'#new-template-button'
).
click
(
function
()
{
$
.
get
(
'/ajax/templateWizard'
,
function
(
data
)
{
$
(
'#modal-container'
).
html
(
data
);
})
$
(
'#modal'
).
show
();
});
var
Model
=
function
(){
var
self
=
this
;
self
.
files
=
ko
.
observableArray
();
self
.
allFiles
=
[];
self
.
notInRoot
=
ko
.
observable
(
false
);
self
.
fileLimit
=
5
;
self
.
jumpUp
=
function
(){
var
s
=
self
.
currentPath
();
self
.
currentPath
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
loadFolder
(
self
.
currentPath
());
function
Model
()
{
var
self
=
this
;
self
.
files
=
ko
.
observableArray
();
self
.
allFiles
=
[];
self
.
notInRoot
=
ko
.
observable
(
false
);
self
.
fileLimit
=
5
;
var
disabled
=
false
;
function
throttle
(
f
)
{
return
function
()
{
if
(
disabled
)
{
console
.
log
(
'disabled'
);
return
};
disabled
=
true
;
setTimeout
(
function
()
{
disabled
=
false
;
},
700
);
f
.
apply
(
null
,
arguments
);
}
}
var
loadFolder
=
function
(
path
){
self
.
fileLimit
=
5
;
self
.
jumpUp
=
function
()
{
var
s
=
self
.
currentPath
();
loadFolder
(
s
.
substr
(
0
,
s
.
substr
(
0
,
s
.
length
-
1
).
lastIndexOf
(
'/'
)
+
1
));
}
var
loadFolder
=
throttle
(
function
(
path
)
{
self
.
currentPath
(
path
);
self
.
fileLimit
=
5
;
$
.
ajax
({
type
:
'POST'
,
data
:
'path='
+
path
,
data
:
'path='
+
path
,
url
:
'/ajax/store/list'
,
dataType
:
'json'
,
success
:
function
(
data
){
$
(
'.file-list .real'
).
css
({
left
:
0
,
position
:
'relative'
}).
animate
({
left
:
'-100%'
},
500
).
promise
().
done
(
function
(){
success
:
function
(
data
)
{
$
(
'.file-list .real'
).
css
({
left
:
0
,
position
:
'relative'
}).
animate
({
left
:
'-100%'
},
500
).
promise
().
done
(
function
()
{
loadFolderDone
(
data
);
$
(
'.file-list .real'
).
css
({
left
:
'-300%'
,
position
:
'relative'
}).
animate
({
left
:
0
},
500
);
$
(
'.file-list .real'
).
css
({
left
:
'-300%'
,
position
:
'relative'
}).
animate
({
left
:
0
},
500
);
});
},
})
}
var
loadFolderDone
=
function
(
data
){
})
function
loadFolderDone
(
data
)
{
var
viewData
=
[];
var
added
=
0
;
self
.
notInRoot
(
self
.
currentPath
().
lastIndexOf
(
'/'
)
!==
0
);
self
.
files
([]);
self
.
allFiles
=
data
;
var
viewData
=
[];
var
added
=
0
;
for
(
var
i
in
data
){
self
.
allFiles
=
data
;
for
(
var
i
in
data
)
{
added
++
;
if
(
added
<
6
)
addFile
(
data
[
i
]);
if
(
added
<
6
)
addFile
(
data
[
i
]);
}
}
var
addFile
=
function
(
d
)
{
function
addFile
(
d
)
{
var
viewData
;
if
(
d
.
TYPE
===
'D'
){
viewData
=
{
if
(
d
.
TYPE
===
'D'
)
{
viewData
=
{
originalName
:
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?
(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
)
:
d
.
NAME
,
size
:
'katalógus'
,
type
:
'katalógus'
,
mTime
:
d
.
MTIME
,
getTypeClass
:
'name filetype-folder'
,
clickHandler
:
function
(
item
){
self
.
currentPath
(
self
.
currentPath
()
+
item
.
originalName
+
'/'
);
loadFolder
(
self
.
currentPath
());
clickHandler
:
function
(
item
)
{
loadFolder
(
self
.
currentPath
()
+
item
.
originalName
+
'/'
);
}
};
}
else
{
viewData
=
{
viewData
=
{
originalName
:
d
.
NAME
,
name
:
d
.
NAME
.
length
>
30
?(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
):
d
.
NAME
,
size
:
d
.
SIZE
+
'K'
,
name
:
d
.
NAME
.
length
>
30
?
(
d
.
NAME
.
substr
(
0
,
27
)
+
'...'
)
:
d
.
NAME
,
size
:
d
.
SIZE
+
'K'
,
type
:
'fájl'
,
mTime
:
d
.
MTIME
,
getTypeClass
:
'name filetype-text'
,
clickHandler
:
function
(
item
,
event
){
}
clickHandler
:
function
(
item
,
event
)
{}
};
}
self
.
files
.
push
(
viewData
);
}
self
.
fadeIn
=
function
(
e
){
console
.
log
(
e
,
arguments
);
self
.
fadeIn
=
function
(
e
)
{
$
(
e
).
hide
().
slideDown
(
500
);
}
self
.
currentPath
=
ko
.
observable
(
'/'
);
self
.
showMore
=
function
()
{
for
(
var
i
=
self
.
fileLimit
;
i
<
self
.
fileLimit
+
5
;
i
++
)
{
self
.
currentPath
=
ko
.
observable
(
'/'
);
self
.
showMore
=
function
()
{
for
(
var
i
=
self
.
fileLimit
;
i
<
self
.
fileLimit
+
5
;
i
++
)
{
if
(
self
.
allFiles
[
i
]
===
undefined
)
break
;
addFile
(
self
.
allFiles
[
i
]);
}
self
.
fileLimit
+=
5
;
self
.
fileLimit
+=
5
;
}
self
.
download
=
function
(
item
)
{
self
.
download
=
function
(
item
)
{
$
.
ajax
({
type
:
'POST'
,
data
:
'dl='
+
self
.
currentPath
()
+
item
.
originalName
,
data
:
'dl='
+
self
.
currentPath
()
+
item
.
originalName
,
url
:
'/ajax/store/download'
,
dataType
:
'json'
,
success
:
function
(
data
){
window
.
location
.
href
=
data
.
url
;
success
:
function
(
data
)
{
window
.
location
.
href
=
data
.
url
;
}
})
}
self
.
delete
=
function
(
item
)
{
$
.
ajax
({
self
.
delete
=
function
(
item
)
{
$
.
ajax
({
type
:
'POST'
,
data
:
'rm='
+
self
.
currentPath
()
+
item
.
originalName
,
data
:
'rm='
+
self
.
currentPath
()
+
item
.
originalName
,
url
:
'/ajax/store/delete'
,
dataType
:
'json'
,
success
:
function
(
data
){
success
:
function
(
data
)
{
loadFolder
(
self
.
currentPath
());
}
})
}
loadFolder
(
self
.
currentPath
());
}
var
model
=
new
Model
();
var
model
=
new
Model
();
ko
.
applyBindings
(
model
);
document
.
addEventListener
(
'dragenter'
,
function
(
e
){
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;});
document
.
addEventListener
(
'dragover'
,
function
(
e
){
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;});
document
.
addEventListener
(
'drop'
,
function
(
e
){
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;});
document
.
addEventListener
(
'dragenter'
,
function
(
e
)
{
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;
});
document
.
addEventListener
(
'dragover'
,
function
(
e
)
{
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;
});
document
.
addEventListener
(
'drop'
,
function
(
e
)
{
console
.
log
(
e
);
e
.
stopPropagation
();
e
.
preventDefault
();
return
false
;
});
})
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