Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
aa
wiki
Commits
42fcd91b
Commit
42fcd91b
authored
Jan 03, 2013
by
Alexandre Leray
Browse files
Minor changes to jquery.wrapContent.js
parent
ef0fec26
Changes
1
Hide whitespace changes
Inline
Side-by-side
aawiki/static/aawiki/js/jquery.wrapContent.js
View file @
42fcd91b
...
...
@@ -19,17 +19,27 @@
(
function
(
$
)
{
/**
* function jQuery.fn.wrapContent (
selecto
r)
* function jQuery.fn.wrapContent (
wrappe
r)
*
* Wraps all the children of an element but the headers.
*
* >>> $('section').wrapContent('<section class="wrapper">');
*/
$
.
fn
.
wrapContent
=
function
(
selecto
r
)
{
var
selector
=
selecto
r
||
'
<div class="wrapper">
'
;
$
.
fn
.
wrapContent
=
function
(
wrappe
r
)
{
var
wrapper
=
wrappe
r
||
'
<div class="wrapper">
'
;
return
$
(
this
).
each
(
function
()
{
$
(
this
).
children
(
"
:not(:header)
"
).
wrapAll
(
selecto
r
);
$
(
this
).
children
(
"
:not(:header)
"
).
wrapAll
(
wrappe
r
);
});
};
})(
jQuery
);
//$("h2").each(function(i) {
//// for each header, take the header and all the elements up to the next header
//// and wrap them in a .box div
//$(this).css("cursor", "pointer").add($(this).nextUntil("h2")).wrapAll($('<div class="box"></div>'))
//// for each header, take the next element and all the elements up to the next header
//// and wrap them in a .collapsed div
//$(this).next().add($(this).next().nextUntil("h2")).wrapAll($('<div class="collapsed"></div>'))
//})
Write
Preview
Supports
Markdown
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