Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
www
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finnv
www
Commits
fb7e9d99
Commit
fb7e9d99
authored
Aug 25, 2023
by
Михаил Ливач
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
зарефакторил скрипт в шаблоне левого меню
parent
9553b57b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
63 deletions
+54
-63
template.php
.../components/bitrix/menu/side_menu_multilevel/template.php
+54
-63
No files found.
bitrix/templates/aspro-scorp/components/bitrix/menu/side_menu_multilevel/template.php
View file @
fb7e9d99
<?
if
(
!
defined
(
"B_PROLOG_INCLUDED"
)
||
B_PROLOG_INCLUDED
!==
true
)
die
();
?>
<?
if
(
!
empty
(
$arResult
))
:?>
<
ul
id
=
"side_menu_multilevel"
>
<
ul
id
=
"side_menu_multilevel"
>
<?
$previousLevel
=
0
;
foreach
(
$arResult
as
$arItem
)
:?>
<?
$previousLevel
=
0
;
foreach
(
$arResult
as
$arItem
)
:?>
<?
if
(
$previousLevel
&&
$arItem
[
"DEPTH_LEVEL"
]
<
$previousLevel
)
:?>
<?=
str_repeat
(
"</ul></li>"
,
(
$previousLevel
-
$arItem
[
"DEPTH_LEVEL"
]));
?>
<?
endif
?>
<?
if
(
$previousLevel
&&
$arItem
[
"DEPTH_LEVEL"
]
<
$previousLevel
)
:?>
<?=
str_repeat
(
"</ul></li>"
,
(
$previousLevel
-
$arItem
[
"DEPTH_LEVEL"
]));
?>
<?
endif
?>
<?
if
(
$arItem
[
"IS_PARENT"
])
:?>
<?
if
(
$arItem
[
"IS_PARENT"
])
:?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="
parent
<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
<span
class=
"roll-out"
>
</span></a>
<ul
class=
"root-item"
>
<?
else
:?>
<
li
class
="
parent
<?
if
(
$arItem
[
"SELECTED"
])
:?>
item
-
selected
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a>
<ul>
<?
endif
?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="
parent
<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
<span
class=
"roll-out"
>
</span></a>
<ul
class=
"root-item"
>
<?
else
:?>
<
li
class
="
parent
<?
if
(
$arItem
[
"SELECTED"
])
:?>
item
-
selected
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a>
<ul>
<?
endif
?>
<?
else
:?>
<?
else
:?>
<?
if
(
$arItem
[
"PERMISSION"
]
>
"D"
)
:?>
<?
if
(
$arItem
[
"PERMISSION"
]
>
"D"
)
:?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
else
:?>
<
li
<?
if
(
$arItem
[
"SELECTED"
])
:?>
class
="
item
-
selected
"<?endif?>><a rel="
nofollow
" href="
<?=
$arItem
[
"LINK"
]
?>
" >
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
endif
?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
"
<?=
$arItem
[
"LINK"
]
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
else
:?>
<
li
<?
if
(
$arItem
[
"SELECTED"
])
:?>
class
="
item
-
selected
"<?endif?>><a rel="
nofollow
" href="
<?=
$arItem
[
"LINK"
]
?>
" >
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
endif
?>
<?
else
:?>
<?
else
:?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
""
title=
"
<?=
GetMessage
(
"MENU_ITEM_ACCESS_DENIED"
)
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
else
:?>
<
li
><
a
rel
=
"nofollow"
href
=
""
class
="
denied
" title="
<?=
GetMessage
(
"MENU_ITEM_ACCESS_DENIED"
)
?>
">
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
endif
?>
<?
if
(
$arItem
[
"DEPTH_LEVEL"
]
==
1
)
:?>
<
li
class
="<?
if
(
$arItem
[
"SELECTED"
])
:?>
root
-
item
-
selected
opened
<?
else
:?>
root
-
item
<?
endif
?>
">
<a
rel=
"nofollow"
href=
""
title=
"
<?=
GetMessage
(
"MENU_ITEM_ACCESS_DENIED"
)
?>
"
>
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
else
:?>
<
li
><
a
rel
=
"nofollow"
href
=
""
class
="
denied
" title="
<?=
GetMessage
(
"MENU_ITEM_ACCESS_DENIED"
)
?>
">
<?=
$arItem
[
"TEXT"
]
?>
</a></li>
<?
endif
?>
<?
endif
?>
<?
endif
?>
<?
endif
?>
<?
endif
?>
<?
$previousLevel
=
$arItem
[
"DEPTH_LEVEL"
];
?>
<?
$previousLevel
=
$arItem
[
"DEPTH_LEVEL"
];
?>
<?
endforeach
?>
<?
endforeach
?>
<?
if
(
$previousLevel
>
1
)
://
close
last
item
tags
?>
<?=
str_repeat
(
"</ul></li>"
,
(
$previousLevel
-
1
)
);
?>
<?
endif
?>
<?
if
(
$previousLevel
>
1
)
://
close
last
item
tags
?>
<?=
str_repeat
(
"</ul></li>"
,
(
$previousLevel
-
1
)
);
?>
<?
endif
?>
</ul>
</ul>
<?
endif
?>
<script>
$
(
document
).
ready
(
function
()
{
if
(
$
(
"#side_menu_multilevel li"
).
is
(
".item-selected"
))
{
$
(
"#side_menu_multilevel li.root-item-selected"
).
addClass
(
"hide_selection"
)}
//$("#side_menu_multilevel li.item-selected").parent('#side_menu_multilevel').find("li.root-item-selected").addClass("hide_selection");
//console.log("!!!!!!!!!!111234!!!!!!!!!!!!!"+$("#side_menu_multilevel li.item-selected").parent('#side_menu_multilevel'));
$
(
'#side_menu_multilevel li.root-item a span.roll-out'
).
click
(
function
(){
if
(
$
(
this
).
parent
(
'a'
).
next
(
'ul'
).
is
(
'.root-item'
))
{
$
(
this
).
parent
(
'a'
).
parent
().
toggleClass
(
"opened"
);
$
(
this
).
parent
(
'a'
).
next
(
"ul.root-item"
).
toggle
(
150
);
return
false
;
}
}
);
$
(
'#side_menu_multilevel li.root-item-selected a span.roll-out'
).
click
(
function
(){
if
(
$
(
this
).
parent
(
'a'
).
next
(
'ul'
).
is
(
'.root-item'
))
{
$
(
this
).
parent
(
'a'
).
parent
().
toggleClass
(
"opened"
);
$
(
this
).
parent
(
'a'
).
next
(
"ul.root-item"
).
toggle
(
150
);
return
false
;
}
}
);
});
$
(
document
).
ready
(
function
()
{
const
$menu
=
$
(
"#side_menu_multilevel"
);
if
(
$
(
"li"
,
$menu
).
is
(
".item-selected"
))
{
$
(
"li.root-item-selected"
,
$menu
).
addClass
(
"hide_selection"
)}
const
clickHandler
=
function
(){
const
$a
=
$
(
this
).
parent
(
'a'
);
if
(
$a
.
next
(
'ul'
).
is
(
'.root-item'
))
{
$a
.
parent
().
toggleClass
(
"opened"
);
$a
.
next
(
"ul.root-item"
).
toggle
(
150
);
return
false
;
}
};
$
(
'li.root-item a span.roll-out'
,
$menu
).
click
(
clickHandler
);
$
(
'li.root-item-selected a span.roll-out'
,
$menu
).
click
(
clickHandler
);
});
</script>
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