diff options
author | pluralcafe-docker <git@plural.cafe> | 2018-10-30 05:54:55 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2018-10-30 05:54:55 +0000 |
commit | 431c09bfbe07715a2a88846864179a419d72ab59 (patch) | |
tree | 8b7772f64ea23cdf5e55dda9f92ff57a41adf3a4 /app/javascript/core | |
parent | 7c96ee7815c216d6ac3b748d7dd6959376d3914e (diff) | |
parent | 7ec3f6022d5c991bb584c481a29c416e9f1c5438 (diff) |
Merge branch 'glitch'
Diffstat (limited to 'app/javascript/core')
-rw-r--r-- | app/javascript/core/admin.js | 21 | ||||
-rw-r--r-- | app/javascript/core/settings.js | 16 |
2 files changed, 9 insertions, 28 deletions
diff --git a/app/javascript/core/admin.js b/app/javascript/core/admin.js index 0c26dc18d..3f6f187bc 100644 --- a/app/javascript/core/admin.js +++ b/app/javascript/core/admin.js @@ -2,18 +2,6 @@ import { delegate } from 'rails-ujs'; -function handleDeleteStatus(event) { - const [data] = event.detail; - const element = document.querySelector(`[data-id="${data.id}"]`); - if (element) { - element.parentNode.removeChild(element); - } -} - -[].forEach.call(document.querySelectorAll('.trash-button'), (content) => { - content.addEventListener('ajax:success', handleDeleteStatus); -}); - const batchCheckboxClassName = '.batch-checkbox input[type="checkbox"]'; delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { @@ -24,6 +12,7 @@ delegate(document, '#batch_checkbox_all', 'change', ({ target }) => { delegate(document, batchCheckboxClassName, 'change', () => { const checkAllElement = document.querySelector('#batch_checkbox_all'); + if (checkAllElement) { checkAllElement.checked = [].every.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); checkAllElement.indeterminate = !checkAllElement.checked && [].some.call(document.querySelectorAll(batchCheckboxClassName), (content) => content.checked); @@ -43,8 +32,14 @@ delegate(document, '.media-spoiler-hide-button', 'click', () => { }); delegate(document, '#domain_block_severity', 'change', ({ target }) => { - const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectMediaDiv = document.querySelector('.input.with_label.domain_block_reject_media'); + const rejectReportsDiv = document.querySelector('.input.with_label.domain_block_reject_reports'); + if (rejectMediaDiv) { rejectMediaDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; } + + if (rejectReportsDiv) { + rejectReportsDiv.style.display = (target.value === 'suspend') ? 'none' : 'block'; + } }); diff --git a/app/javascript/core/settings.js b/app/javascript/core/settings.js index af97c84f9..23a303747 100644 --- a/app/javascript/core/settings.js +++ b/app/javascript/core/settings.js @@ -1,30 +1,16 @@ // This file will be loaded on settings pages, regardless of theme. -const { length } = require('stringz'); const { delegate } = require('rails-ujs'); import emojify from '../mastodon/features/emoji/emoji'; delegate(document, '#account_display_name', 'input', ({ target }) => { - const nameCounter = document.querySelector('.name-counter'); - const name = document.querySelector('.card .display-name strong'); - - if (nameCounter) { - nameCounter.textContent = 30 - length(target.value); - } + const name = document.querySelector('.card .display-name strong'); if (name) { name.innerHTML = emojify(target.value); } }); -delegate(document, '#account_note', 'input', ({ target }) => { - const noteCounter = document.querySelector('.note-counter'); - - if (noteCounter) { - noteCounter.textContent = 500 - length(target.value); - } -}); - delegate(document, '#account_avatar', 'change', ({ target }) => { const avatar = document.querySelector('.card .avatar img'); const [file] = target.files || []; |