Dmitriy427 Posted January 13, 2014 Share Posted January 13, 2014 Мод позволяет сворачивать блоки со списком подфорумов. Сделан по просьбе @justme. В начало шаблона forumIndexTemplate, группа шаблонов "Forum View", добавляем скрипт:<script type="text/javascript"> var isEnabled = !Prototype.Browser.IE6; var toggleCookieName = 'subforumsToggle'; var toggleRun = false; if (isEnabled) { document.observe("dom:loaded", toggleInitialize); } function toggleSubforums(obj) { if (!isEnabled || toggleRun) { return false; } var wrapper = obj.up('.category_block').down('.table_wrap'); var catblock = obj.up('.category_block'); Effect.toggle( wrapper, 'blind', { duration: 0.4, beforeStart: function() { toggleRun = true; }, afterFinish: function() { toggleRun = false; if ( catblock.hasClassName('collapsed') ) { catblock.removeClassName('collapsed'); toggleSetOpenBlocks(obj.id, false); } else { catblock.addClassName('collapsed'); toggleSetOpenBlocks(obj.id, true); } } } ); } function toggleGetOpenBlocks() { var cookies = ipb.Cookie.get(toggleCookieName); if (cookies) { return cookies.split(','); } return []; } function toggleSetOpenBlocks(id, isClose) { var openBlocks = toggleGetOpenBlocks(); if (isClose) { openBlocks.push(id); } else { openBlocks = openBlocks.uniq().without(id); } ipb.Cookie.set(toggleCookieName, openBlocks.join(','), 1); } function toggleInitialize() { $$('.category_block').each(function(block) { var id = block.down('.toggle').id; } ); toggleGetOpenBlocks().each( function(id) { if ( $(id) ) { var block = $(id).up('.category_block'); } if (block) { block.addClassName('collapsed'); block.down('.table_wrap').hide(); } } ); } </script>Далее ищем код: <h3 class='maintitle'>{$this->lang->words['sub_forum_title']}</h3>Заменяем на: <h3 class='maintitle'> {$this->lang->words['sub_forum_title']} <a id="subforum_{$forum_data['id']}" class='toggle right' href='#' title="{parse expression="sprintf( $this->lang->words['toggle_cat'], $this->lang->words['sub_forum_title'] )"}" onclick="toggleSubforums(this);"></a> </h3>Сохраняем шаблон и собственно всё. 5 Link to comment Share on other sites More sharing options...
justme Posted January 13, 2014 Share Posted January 13, 2014 perfect thanks Link to comment Share on other sites More sharing options...
Strategius Posted August 21, 2016 Share Posted August 21, 2016 У меня почему-то не заработал мод... Сделал по инструкции, эффекта нет, ничего не поменялось. Должна была кнопка сворачивания появиться? Link to comment Share on other sites More sharing options...
Strategius Posted August 21, 2016 Share Posted August 21, 2016 А есть для 3.4 какой-нибудь другой хук, позволяющий сворачивать подфорумы? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now