From 69ec4824f6c64a1c6024f853a672dbc76c3e0b9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 3 Jun 2020 17:47:06 +0200 Subject: [PATCH] Support icon based toggle buttons in WoltLabSuite/Core/Bbcode/Collapsible --- .../js/WoltLabSuite/Core/Bbcode/Collapsible.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Collapsible.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Collapsible.js index 64027a42b8..7f6416ce7f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Collapsible.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Bbcode/Collapsible.js @@ -34,7 +34,14 @@ define([], function() { var toggle = function (event) { if (container.classList.toggle('collapsed')) { toggleButtons.forEach(function (toggleButton) { - toggleButton.textContent = elData(toggleButton, 'title-expand'); + if (toggleButton.classList.contains('icon')) { + toggleButton.classList.remove('fa-compress'); + toggleButton.classList.add('fa-expand'); + toggleButton.title = elData(toggleButton, 'title-expand'); + } + else { + toggleButton.textContent = elData(toggleButton, 'title-expand'); + } }); if (event instanceof Event) { @@ -49,7 +56,14 @@ define([], function() { } else { toggleButtons.forEach(function (toggleButton) { - toggleButton.textContent = elData(toggleButton, 'title-collapse'); + if (toggleButton.classList.contains('icon')) { + toggleButton.classList.add('fa-compress'); + toggleButton.classList.remove('fa-expand'); + toggleButton.title = elData(toggleButton, 'title-collapse'); + } + else { + toggleButton.textContent = elData(toggleButton, 'title-collapse'); + } }); } }; -- 2.20.1