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
688c5219
Commit
688c5219
authored
12 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Patches
Plain Diff
fixed the toc/sidebar toggling script for real
parent
0c06a181
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/scripts/page.js
+31
-19
31 additions, 19 deletions
lib/scripts/page.js
lib/tpl/dokuwiki/script.js
+26
-8
26 additions, 8 deletions
lib/tpl/dokuwiki/script.js
with
57 additions
and
27 deletions
lib/scripts/page.js
+
31
−
19
View file @
688c5219
...
...
@@ -102,7 +102,7 @@ dw_page = {
* @param selector handle What should be clicked to toggle
* @param selector content This element will be toggled
*/
makeToggle
:
function
(
handle
,
content
){
makeToggle
:
function
(
handle
,
content
,
state
){
var
$handle
,
$content
,
$clicky
,
$child
,
setClicky
;
$handle
=
jQuery
(
handle
);
if
(
!
$handle
.
length
)
return
;
...
...
@@ -125,32 +125,44 @@ dw_page = {
}
};
// the state indicator
$clicky
=
jQuery
(
document
.
createElement
(
'
strong
'
));
$handle
[
0
].
setState
=
function
(
state
){
var
hidden
;
if
(
!
state
)
state
=
1
;
// click function
$handle
.
css
(
'
cursor
'
,
'
pointer
'
)
.
click
(
function
()
{
var
hidden
;
// Assert that content instantly takes the whole space
$content
.
css
(
'
height
'
,
$content
.
height
()).
show
();
// Assert that content instantly takes the whole space
$content
.
css
(
'
height
'
,
$content
.
height
()).
show
(
);
// stop any running animation
$child
.
stop
(
true
,
true
);
// stop any running animation and get current state
hidden
=
$child
.
stop
(
true
,
true
).
is
(
'
:hidden
'
);
// was a state given or do we toggle?
if
(
state
===
-
1
)
{
hidden
=
false
;
}
else
if
(
state
===
1
)
{
hidden
=
true
;
}
else
{
hidden
=
$child
.
is
(
'
:hidden
'
);
}
// update the state
setClicky
(
!
hidden
);
// update the state
setClicky
(
!
hidden
);
// Start animation and assure that $toc is hidden/visible
$child
.
dw_toggle
(
hidden
,
function
()
{
$content
.
toggle
(
hidden
);
});
})
// Start animation and assure that $toc is hidden/visible
$child
.
dw_toggle
(
hidden
,
function
()
{
$content
.
toggle
(
hidden
);
});
};
// the state indicator
$clicky
=
jQuery
(
document
.
createElement
(
'
strong
'
));
// click function
$handle
.
css
(
'
cursor
'
,
'
pointer
'
)
.
click
(
$handle
[
0
].
setState
)
.
prepend
(
$clicky
);
// initial state
setClicky
(
);
$handle
[
0
].
setState
(
state
);
}
};
...
...
This diff is collapsed.
Click to expand it.
lib/tpl/dokuwiki/script.js
+
26
−
8
View file @
688c5219
function
tpl_dokuwiki_mobile
(){
// check if we are in mobile or tablet mode be sure to adjust the number
// here when adjusting it in the css
if
(
document
.
body
.
clientWidth
>
979
)
return
;
var
$handle
=
jQuery
(
'
#dokuwiki__aside h3.toggle
'
);
var
$toc
=
jQuery
(
'
#dw__toc h3
'
);
if
(
document
.
body
.
clientWidth
>
979
)
{
console
.
log
(
'
desktop
'
);
// reset for desktop mode
$handle
[
0
].
setState
(
1
);
$handle
.
hide
();
$toc
[
0
].
setState
(
1
);
}
else
{
console
.
log
(
'
mobile
'
);
// toc and sidebar hiding
$handle
.
show
();
$handle
[
0
].
setState
(
-
1
);
$toc
[
0
].
setState
(
-
1
);
}
}
// toc and sidebar hiding
jQuery
(
function
(){
var
resizeTimer
;
dw_page
.
makeToggle
(
'
#dokuwiki__aside h3.toggle
'
,
'
#dokuwiki__aside div.content
'
);
jQuery
(
'
#dw__toc h3.toggle
'
).
click
();
jQuery
(
'
#dokuwiki__aside h3.toggle
'
).
show
().
click
();
}
jQuery
(
tpl_dokuwiki_mobile
);
jQuery
(
window
).
bind
(
'
resize
'
,
tpl_dokuwiki_mobile
);
tpl_dokuwiki_mobile
();
jQuery
(
window
).
bind
(
'
resize
'
,
function
(){
if
(
resizeTimer
)
clearTimeout
(
resizeTimer
);
resizeTimer
=
setTimeout
(
tpl_dokuwiki_mobile
,
200
);
}
);
});
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