Шаблон:КатегорияDPL: различия между версиями

Материал из База знаний АО АСП
Перейти к навигации Перейти к поиску
Нет описания правки
Нет описания правки
Строка 1: Строка 1:
{{#ifeq:{{#tag:DynamicPageList|
<div id="section-header" style="font-weight: bold;">Разделы</div>
<ul id="sections-list">
{{#tag:DynamicPageList|
category={{{1|}}}
category={{{1|}}}
namespace=Category
namespace=Category
Строка 7: Строка 9:
order=ascending
order=ascending
suppresserrors=true
suppresserrors=true
noresultsheader=__NO__
noresultsheader=
}}|__NO__|
}}
|<div class="section-header" style="font-weight: bold;">Разделы</div>
</ul>
 
<div style="font-weight: bold;">Страницы</div>
<ul>
{{#tag:DynamicPageList|
{{#tag:DynamicPageList|
category={{{1|}}}
category={{{1|}}}
namespace=Category
namespace=!
mode=unordered
mode=unordered
shownamespace=false
ordermethod=sortkey
ordermethod=sortkey
order=ascending
order=ascending
suppresserrors=true
suppresserrors=true
resultsheader=<div style="font-weight: bold; margin-top: 10px;">Страницы</div>
noresultsheader=
}}
}}
}}
</ul>
 
<!-- Подключаем JS -->
<script>
document.addEventListener("DOMContentLoaded", function() {
    var sectionHeader = document.getElementById("section-header");
    var sectionList = document.getElementById("sections-list");
 
    // Проверяем, есть ли элементы <li> внутри <ul>
    if (sectionList && sectionList.children.length === 0) {
        sectionHeader.style.display = "none";
    }
});
</script>

Версия от 15:49, 6 марта 2025

Разделы
Страницы

<script> document.addEventListener("DOMContentLoaded", function() {

   var sectionHeader = document.getElementById("section-header");
   var sectionList = document.getElementById("sections-list");

// Проверяем, есть ли элементы

  • внутри
      if (sectionList && sectionList.children.length === 0) { sectionHeader.style.display = "none"; } }); </script>