diff --git a/package.json b/package.json index 17625e3..5ff135d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "LiteRyzJS", - "version": "0.1.0.357", + "version": "0.1.0.397", "devDependencies": { "css-loader": "^7.1.2", "sass": "^1.77.8", diff --git a/src/extensions/document.js b/src/extensions/document.js index adea58c..88349b9 100644 --- a/src/extensions/document.js +++ b/src/extensions/document.js @@ -6,4 +6,51 @@ Document.ready = async function(fn) { fn(); }); })(); -} \ No newline at end of file +} + +Document.getWidth = function(el) { + if (el == null) { + return 0; + } + + if (typeof(el) == "undefined") { + return 0; + } + + return (el.offsetWidth || el.innerWidth || el.clientWidth); +} + +Document.getHeight = function(el) { + if (el == null) { + return 0; + } + + if (typeof(el) == "undefined") { + return 0; + } + + return (el.offsetHeight || el.innerHeight || el.clientHeight); +} + +Document.appendHtml = function(el, html) { + const newEl = document.createElement(html); + + el.appendChild(newEl); +} + +Document.addClass = function(el, className) { + if (el.classList.contains(className)) { + return; + } + + el.classList.add(className); +} + +Document.removeClass = function(el, className) { + if (!el.classList.contains(className)) { + return; + } + + el.classList.remove(className); +} +