From f77088b9646de170efd6ace8ba3d7d97bb702a9c Mon Sep 17 00:00:00 2001 From: Fabien Basmaison Date: Wed, 7 Apr 2021 17:31:00 +0200 Subject: [PATCH] [assets] Remove redundant class already provided by bulma: Replace all classes `hidden` with `is-hidden` in templates, CSS and JS. --- bookwyrm/static/css/bookwyrm.css | 28 +++++++++---------- bookwyrm/static/js/bookwyrm.js | 16 +++++------ bookwyrm/static/js/localstorage.js | 2 +- bookwyrm/templates/book/book.html | 4 +-- .../templates/components/inline_form.html | 2 +- bookwyrm/templates/components/modal.html | 2 +- bookwyrm/templates/feed/feed.html | 2 +- bookwyrm/templates/goal.html | 2 +- bookwyrm/templates/layout.html | 2 +- bookwyrm/templates/search_results.html | 2 +- bookwyrm/templates/snippets/boost_button.html | 4 +-- .../snippets/content_warning_field.html | 2 +- .../snippets/create_status_form.html | 2 +- bookwyrm/templates/snippets/fav_button.html | 4 +-- .../snippets/filters_panel/filters_panel.html | 2 +- .../templates/snippets/follow_button.html | 4 +-- bookwyrm/templates/snippets/rate_action.html | 2 +- bookwyrm/templates/snippets/readthrough.html | 4 +-- .../shelve_button/shelve_button_options.html | 2 +- .../snippets/status/status_body.html | 2 +- .../snippets/status/status_content.html | 2 +- bookwyrm/templates/snippets/trimmed_text.html | 2 +- bookwyrm/templates/user/lists.html | 2 +- 23 files changed, 48 insertions(+), 48 deletions(-) diff --git a/bookwyrm/static/css/bookwyrm.css b/bookwyrm/static/css/bookwyrm.css index 980b4c4a..59961cac 100644 --- a/bookwyrm/static/css/bookwyrm.css +++ b/bookwyrm/static/css/bookwyrm.css @@ -25,16 +25,6 @@ html { min-width: 75% !important; } -/* --- "disabled" for non-buttons --- */ -.is-disabled { - background-color: #dbdbdb; - border-color: #dbdbdb; - box-shadow: none; - color: #7a7a7a; - opacity: 0.5; - cursor: not-allowed; -} - /* --- SHELVING --- */ /** @todo Replace icons with SVG symbols. @@ -57,10 +47,6 @@ html { display: none; } -.hidden { - display: none !important; -} - .hidden.transition-y, .hidden.transition-x { display: block !important; @@ -252,3 +238,17 @@ html { animation-duration: 1.5s; } } + +/* States + ******************************************************************************/ + +/* "disabled" for non-buttons */ + +.is-disabled { + background-color: #dbdbdb; + border-color: #dbdbdb; + box-shadow: none; + color: #7a7a7a; + opacity: 0.5; + cursor: not-allowed; +} diff --git a/bookwyrm/static/js/bookwyrm.js b/bookwyrm/static/js/bookwyrm.js index dacb8091..0393b4cc 100644 --- a/bookwyrm/static/js/bookwyrm.js +++ b/bookwyrm/static/js/bookwyrm.js @@ -99,7 +99,7 @@ let BookWyrm = new class { const count = data.count; if (count != currentCount) { - this.addRemoveClass(counter.closest('[data-poll-wrapper]'), 'hidden', count < 1); + this.addRemoveClass(counter.closest('[data-poll-wrapper]'), 'is-hidden', count < 1); counter.innerText = count; } } @@ -112,9 +112,9 @@ let BookWyrm = new class { */ revealForm(event) { let trigger = event.currentTarget; - let hidden = trigger.closest('.hidden-form').querySelectorAll('.hidden')[0]; + let hidden = trigger.closest('.hidden-form').querySelectorAll('.is-hidden')[0]; - this.addRemoveClass(hidden, 'hidden', !hidden); + this.addRemoveClass(hidden, 'is-hidden', !hidden); } /** @@ -139,7 +139,7 @@ let BookWyrm = new class { if (targetId && ! trigger.classList.contains('pulldown-menu')) { let target = document.getElementById(targetId); - this.addRemoveClass(target, 'hidden', !pressed); + this.addRemoveClass(target, 'is-hidden', !pressed); this.addRemoveClass(target, 'is-active', pressed); } @@ -196,7 +196,7 @@ let BookWyrm = new class { * @return {undefined} */ toggleContainer(container, pressed) { - this.addRemoveClass(container, 'hidden', pressed); + this.addRemoveClass(container, 'is-hidden', pressed); } /** @@ -260,8 +260,8 @@ let BookWyrm = new class { .then(function() { allTriggers.forEach(node => bookwyrm.addRemoveClass( node, - 'hidden', - node.className.indexOf('hidden') == -1 + 'is-hidden', + node.className.indexOf('is-hidden') == -1 )); }) .catch(error => { @@ -272,7 +272,7 @@ let BookWyrm = new class { allTriggers.forEach(node => bookwyrm.addRemoveClass( node, 'has-error', - node.className.indexOf('hidden') == -1 + node.className.indexOf('is-hidden') == -1 )); }); } diff --git a/bookwyrm/static/js/localstorage.js b/bookwyrm/static/js/localstorage.js index e724cb01..05955779 100644 --- a/bookwyrm/static/js/localstorage.js +++ b/bookwyrm/static/js/localstorage.js @@ -38,6 +38,6 @@ let LocalStorageTools = new class { let key = node.dataset.hide; let value = window.localStorage.getItem(key); - BookWyrm.addRemoveClass(node, 'hidden', value); + BookWyrm.addRemoveClass(node, 'is-hidden', value); } } diff --git a/bookwyrm/templates/book/book.html b/bookwyrm/templates/book/book.html index a7887c61..9f9e53e7 100644 --- a/bookwyrm/templates/book/book.html +++ b/bookwyrm/templates/book/book.html @@ -100,7 +100,7 @@ {% trans 'Add Description' as button_text %} {% include 'snippets/toggle/open_button.html' with text=button_text controls_text="add-description" controls_uid=book.id focus="id_description" hide_active=True id="hide-description" %} -