mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Making magic number more readable
This commit is contained in:
parent
318e0bf508
commit
7eb5f3b026
1 changed files with 3 additions and 3 deletions
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
let BookWyrm = new class {
|
let BookWyrm = new class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.MAX_FILE_SIZE = 10000000
|
this.MAX_FILE_SIZE_BYTES = 10 * 1000000
|
||||||
this.initOnDOMLoaded();
|
this.initOnDOMLoaded();
|
||||||
this.initReccuringTasks();
|
this.initReccuringTasks();
|
||||||
this.initEventListeners();
|
this.initEventListeners();
|
||||||
|
@ -298,14 +298,14 @@ let BookWyrm = new class {
|
||||||
}
|
}
|
||||||
|
|
||||||
disableIfTooLarge(eventOrElement) {
|
disableIfTooLarge(eventOrElement) {
|
||||||
const { addRemoveClass, MAX_FILE_SIZE } = this
|
const { addRemoveClass, MAX_FILE_SIZE_BYTES } = this
|
||||||
const element = eventOrElement.currentTarget || eventOrElement
|
const element = eventOrElement.currentTarget || eventOrElement
|
||||||
|
|
||||||
const submits = element.form.querySelectorAll('[type="submit"]')
|
const submits = element.form.querySelectorAll('[type="submit"]')
|
||||||
const warns = element.parentElement.querySelectorAll('.file-too-big')
|
const warns = element.parentElement.querySelectorAll('.file-too-big')
|
||||||
const isTooBig = element.files &&
|
const isTooBig = element.files &&
|
||||||
element.files[0] &&
|
element.files[0] &&
|
||||||
element.files[0].size > MAX_FILE_SIZE
|
element.files[0].size > MAX_FILE_SIZE_BYTES
|
||||||
|
|
||||||
if (isTooBig) {
|
if (isTooBig) {
|
||||||
submits.forEach(submitter => submitter.disabled = true)
|
submits.forEach(submitter => submitter.disabled = true)
|
||||||
|
|
Loading…
Reference in a new issue