mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
refactor(check-ip): use AJQuery $/$$ instead of document.querySelector*
This commit is contained in:
parent
55a8afdd02
commit
98938936fc
@ -1,13 +1,21 @@
|
|||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const form = document.querySelector(".search-form");
|
function $(sel, $parent) {
|
||||||
const input = form.querySelector('input[type="text"]');
|
return ($parent || document).querySelector(sel);
|
||||||
const btn = form.querySelector("button");
|
}
|
||||||
const myIpLink = document.getElementById("my-ip-link");
|
|
||||||
const loading = document.querySelector(".loading");
|
function $$(sel, $parent) {
|
||||||
const errorEl = document.querySelector(".error-msg");
|
return Array.from(($parent || document).querySelectorAll(sel));
|
||||||
const resultEl = document.querySelector(".result");
|
}
|
||||||
|
|
||||||
|
const form = $(".search-form");
|
||||||
|
const input = $("input[type=\"text\"]", form);
|
||||||
|
const btn = $("button", form);
|
||||||
|
const myIpLink = $("#my-ip-link");
|
||||||
|
const loading = $(".loading");
|
||||||
|
const errorEl = $(".error-msg");
|
||||||
|
const resultEl = $(".result");
|
||||||
let myIpVisible = false;
|
let myIpVisible = false;
|
||||||
|
|
||||||
function show(el) { el.classList.add("visible"); }
|
function show(el) { el.classList.add("visible"); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user