|
@@ -224,8 +224,36 @@ export function checkURL(URL) {
|
|
|
var Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
|
|
|
var objExp = new RegExp(Expression);
|
|
|
if (objExp.test(str) == true) {
|
|
|
- return true;
|
|
|
+ return true;
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+let $_data = []
|
|
|
+export function $(key, cache = true) {
|
|
|
+ if (!key) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!cache) {
|
|
|
+ return document.querySelector(key)
|
|
|
+ }
|
|
|
+
|
|
|
+ let _dom
|
|
|
+ for (let i in $_data) {
|
|
|
+ if ($_data[i].key == key) {
|
|
|
+ _dom = $_data[i].element
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (!_dom) {
|
|
|
+ _dom = document.querySelector(key)
|
|
|
+ if (_dom) {
|
|
|
+ $_data.push({ key, element: _dom })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return _dom
|
|
|
+}
|