Skip to content

Commit

Permalink
try webhook on shared change
Browse files Browse the repository at this point in the history
  • Loading branch information
steam0r committed Mar 5, 2024
1 parent f99bf51 commit afd3be4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions shared/client/src/ele.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class Ele
*/
byId(id)
{
if (id && id[0] == "#") console.warn("ele.byId should not contain #");
if (id && id[0] === "#") console.warn("ele.byId should not contain #");
return document.getElementById(id);
}

/**
* shortcut for document.querySelector(id)
* @param {String} query
* @param {String} q
* @returns {Object} DOM element
*/
byQuery(q)
Expand All @@ -28,7 +28,7 @@ class Ele

/**
* shortcut for document.querySelectorAll(id)
* @param {String} query
* @param {String} q
* @returns {Array} DOM elements
*/
byQueryAll(q)
Expand All @@ -38,33 +38,33 @@ class Ele

/**
* returns the first element with class
* @param {String} classname
* @param {String} name
* @returns {Object} DOM element
*/
byClass(name)
{
if (name && name[0] == ".") console.warn("ele.byClass should not contain .");
if (name && name[0] === ".") console.warn("ele.byClass should not contain .");
const els = document.getElementsByClassName(name);
if (els.length > 0) return els[0];
return null;
}

/**
* returns the all elements with class
* @param {String} classname
* @param {String} name
* @returns {Array} DOM elements
*/
byClassAll(name)
{
if (name && name[0] == ".") console.warn("ele.byClassAll should not contain .");
if (name && name[0] === ".") console.warn("ele.byClassAll should not contain .");
const els = document.getElementsByClassName(name);
if (!els) return [];
return els;
}

forEachClass(name, cb)
{
if (name && name[0] == ".") console.warn("ele.forEachClass should not contain .");
if (name && name[0] === ".") console.warn("ele.forEachClass should not contain .");

const eles = document.getElementsByClassName(name);
for (let i = 0; i < eles.length; i++) cb(eles[i]);
Expand Down

0 comments on commit afd3be4

Please sign in to comment.