mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-11 01:55:40 +00:00
frontend linting
This commit is contained in:
@@ -14,25 +14,25 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import getNumLevels from '../../levels/getNumLevels';
|
||||
import CONST from '../../const';
|
||||
import log from '../../../../../../logger';
|
||||
import getNumLevels from "../../levels/getNumLevels";
|
||||
import CONST from "../../const";
|
||||
import log from "../../../../../../logger";
|
||||
|
||||
import updateLabels from './updateLabel';
|
||||
import updateInputs from './updateInputs';
|
||||
import updateRemoveButton from './updateRemoveButton';
|
||||
import updateLevelGroup from './updateLevelGroup';
|
||||
import updateLabels from "./updateLabel";
|
||||
import updateInputs from "./updateInputs";
|
||||
import updateRemoveButton from "./updateRemoveButton";
|
||||
import updateLevelGroup from "./updateLevelGroup";
|
||||
|
||||
/**
|
||||
* update level number on fieldset legends and their ids too
|
||||
* @param {number} id - level number that was ordered to remove.
|
||||
* All updates are made relative to id
|
||||
* */
|
||||
const updateLevelNumbersOnDOM = (id: number) => {
|
||||
const updateLevelNumbersOnDOM = (id: number): void => {
|
||||
const numLevels = getNumLevels();
|
||||
if (id == numLevels) {
|
||||
throw new Error(
|
||||
"Can't remove the very fist element, it has to be first added to DOM",
|
||||
"Can't remove the very fist element, it has to be first added to DOM"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ const updateLevelNumbersOnDOM = (id: number) => {
|
||||
const newLevel = i - 1;
|
||||
|
||||
const levelGroup = document.querySelector(
|
||||
`#${CONST.LEVEL_FIELDSET_ID_WITHOUT_LEVEL}${i}`,
|
||||
`#${CONST.LEVEL_FIELDSET_ID_WITHOUT_LEVEL}${i}`
|
||||
);
|
||||
|
||||
if (levelGroup === null) {
|
||||
@@ -53,9 +53,9 @@ const updateLevelNumbersOnDOM = (id: number) => {
|
||||
}
|
||||
|
||||
// rename legend
|
||||
const legend = levelGroup.getElementsByTagName('legend')[0];
|
||||
const legend = levelGroup.getElementsByTagName("legend")[0];
|
||||
const legendText = document.createTextNode(`Level ${newLevel}`);
|
||||
const newLegend = document.createElement('legend');
|
||||
const newLegend = document.createElement("legend");
|
||||
newLegend.className = legend.className;
|
||||
newLegend.appendChild(legendText);
|
||||
legend.replaceWith(newLegend);
|
||||
|
||||
Reference in New Issue
Block a user