Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
e85b8799
Commit
e85b8799
authored
14 years ago
by
Pierre Spring
Browse files
Options
Downloads
Patches
Plain Diff
jQueryfied toggle function.
parent
231b8c34
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/scripts/media.js
+50
-39
50 additions, 39 deletions
lib/scripts/media.js
with
50 additions
and
39 deletions
lib/scripts/media.js
+
50
−
39
View file @
e85b8799
...
...
@@ -2,7 +2,55 @@
* JavaScript functionality for the media management popup
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Pierre Spring <pierre.spring@caillou.ch>
*/
(
function
(
$
)
{
/**
* Open or close a subtree using AJAX
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
toggle
=
function
(
event
)
{
var
clicky
,
listitem
,
sublist
,
link
,
ul
;
var
clicky
=
$
(
this
);
var
listitem
=
clicky
.
parent
();
// if already open, close by removing the sublist
var
sublist
=
listitem
.
find
(
'
ul
'
).
first
();
if
(
sublist
.
size
()){
sublist
.
remove
();
// TODO: really? we could just hide it, right?
clicky
.
attr
(
'
src
'
,
DOKU_BASE
+
'
lib/images/plus.gif
'
);
event
.
preventDefault
();
// TODO: really here?
return
;
}
// get the enclosed link (is always the first one)
link
=
listitem
.
find
(
'
a
'
).
first
();
//prepare the new ul
ul
=
$
(
'
<ul/>
'
);
//fixme add classname here
$
.
post
(
DOKU_BASE
+
'
lib/exe/ajax.php
'
,
link
.
attr
(
'
search
'
).
substr
(
1
)
+
'
&call=medians
'
,
function
(
data
)
{
ul
.
html
(
data
)
listitem
.
append
(
ul
);
},
'
html
'
);
clicky
.
attr
(
'
src
'
,
DOKU_BASE
+
'
lib/images/minus.gif
'
);
};
$
(
function
()
{
$
(
'
#media__tree
'
).
delegate
(
'
img
'
,
'
click
'
,
toggle
);
});
}(
jQuery
));
var
media_manager
=
{
keepopen
:
false
,
hide
:
false
,
...
...
@@ -29,7 +77,7 @@ var media_manager = {
// attach action to make the +/- clickable
var
clicky
=
elem
.
getElementsByTagName
(
'
img
'
)[
0
];
clicky
.
style
.
cursor
=
'
pointer
'
;
addEvent
(
clicky
,
'
click
'
,
function
(
event
){
return
media_manager
.
toggle
(
event
,
this
);
});
//
addEvent(clicky,'click',function(event){ return media_manager.toggle(event,this); });
// attach action load folder list via AJAX
var
link
=
elem
.
getElementsByTagName
(
'
a
'
)[
0
];
...
...
@@ -578,43 +626,6 @@ var media_manager = {
return
false
;
},
/**
* Open or close a subtree using AJAX
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
toggle
:
function
(
event
,
clicky
){
var
listitem
=
clicky
.
parentNode
;
// if already open, close by removing the sublist
var
sublists
=
listitem
.
getElementsByTagName
(
'
ul
'
);
if
(
sublists
.
length
){
listitem
.
removeChild
(
sublists
[
0
]);
clicky
.
src
=
DOKU_BASE
+
'
lib/images/plus.gif
'
;
return
false
;
}
// get the enclosed link (is always the first one)
var
link
=
listitem
.
getElementsByTagName
(
'
a
'
)[
0
];
// prepare an AJAX call to fetch the subtree
var
ajax
=
new
sack
(
DOKU_BASE
+
'
lib/exe/ajax.php
'
);
ajax
.
AjaxFailedAlert
=
''
;
ajax
.
encodeURIString
=
false
;
if
(
ajax
.
failed
)
return
true
;
//prepare the new ul
var
ul
=
document
.
createElement
(
'
ul
'
);
//fixme add classname here
listitem
.
appendChild
(
ul
);
ajax
.
elementObj
=
ul
;
ajax
.
afterCompletion
=
function
(){
media_manager
.
treeattach
(
ul
);
};
ajax
.
runAJAX
(
link
.
search
.
substr
(
1
)
+
'
&call=medians
'
);
clicky
.
src
=
DOKU_BASE
+
'
lib/images/minus.gif
'
;
return
false
;
},
/**
* Prefills the wikiname.
*
...
...
@@ -762,7 +773,7 @@ var media_manager = {
};
addInitEvent
(
function
(){
media_manager
.
treeattach
(
$
(
'
media__tree
'
));
//
media_manager.treeattach($('media__tree'));
media_manager
.
selectorattach
(
$
(
'
media__content
'
));
media_manager
.
confirmattach
(
$
(
'
media__content
'
));
media_manager
.
attachoptions
(
$
(
'
media__opts
'
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment