From 376b2777efc28ed6a11e409f1bbf34ff1a284db6 Mon Sep 17 00:00:00 2001 From: Khaled Developer <47381418+khaled-dev-loper@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:26:19 +0330 Subject: [PATCH] Update jbezz-up-to-date.js --- jbezz-up-to-date.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jbezz-up-to-date.js b/jbezz-up-to-date.js index ab05736..80efadb 100644 --- a/jbezz-up-to-date.js +++ b/jbezz-up-to-date.js @@ -1,7 +1,7 @@ /* - JBezz V1.3.2 + JBezz V1.3.3 Khaled Developer https://github.com/khaled-dev-loper/jbezz-library */ -"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});var $$=function(t,n=null){let i=[];"string"!=typeof t||$$.isHtml(t)?"[object Array]"===Object.prototype.toString.call(t)?i=t:"string"==typeof t&&$$.isHtml(t)?i[0]=$$.toHtml(t):i[0]=t:i=null!==n?document.querySelectorAll(t+":nth-child("+n+")"):document.querySelectorAll(t);let r={elem:i,watchAttr:function(t){return this.run(function(n){new MutationObserver(function(n){n.forEach(function(n){"attributes"==n.type&&t(n.attributeName)})}).observe(n,{attributes:!0})})},data:function(t,n){return this.attr(t+"-data",n)},resetStyle:function(){return this.run(function(t){let n=$$(t).attr("class");$$(t).attr("class","").attr("class",n),$$(t).attr("style"),$$(t).attr("style","").attr("style",n)})},fadeIn:function(t=100,n=function(){},i=function(){}){return this.run(function(r){$$(r).animation(function(t){0==t&&i(r,t),$$(r).css("opacity",t.toString()+"%"),t>=100&&n(r,t)},.06*t,t)})},fadeOut:function(t=100,n=function(){},i=function(){}){return this.run(function(r){$$(r).animation(function(t){0==t&&i(r,t),$$(r).css("opacity",(100-t).toString()+"%"),t>=100&&n(r,t)},.06*t,t)})},animation:function(t=function(){},n=100,i=2500){let r=0;function o(){(r+=i/n)0?(arguments[0](i[0].parentElement,i[0]),this):void 0},hasChild:function(t,n){function i(i=!1){let o=0;r.run(function(u){let c=r.childs();$$.each(c,function(r){$$.each(r,function(r){i?$$.each(t,function(t){n(t,r===t)}):n(cl,r===t),o++})})})}return void 0===t?e.hasChildNodes():("[object HTMLCollection]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t)?i(!0):i(),this)},removeChild:function(t){return this.run(function(n){if("[object HTMLCollection]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t))$$.each(t,function(t){try{n.removeChild(t)}catch(i){console.warn(i)}});else try{n.removeChild(t)}catch(i){console.warn(i)}})},addChild:function(t){return this.run(function(n){if("[object HTMLCollection]"===Object.prototype.toString.call(t)||"[object Array]"===Object.prototype.toString.call(t))$$.each(t,function(t){try{$$.isHtml(t)?$$(n).html($$(n).html()+t):n.appendChild(t)}catch(i){console.warn(i)}});else try{$$.isHtml(t)?$$(n).html($$(n).html()+t):n.appendChild(t)}catch(i){console.warn(i)}})},firstChild:function(){let t=[];return this.run(function(n){try{t.push(n.firstChild)}catch(i){}}),t},lastChild:function(){let t=[];return this.run(function(n){try{t.push(n.lastChild)}catch(i){}}),t},addFirstChild:function(t){return this.run(function(n){if("[object Array]"===Object.prototype.toString.call(t))$$.each(t,function(t){try{n.prepend(t)}catch(i){console.warn(i)}});else try{n.prepend(t)}catch(i){console.warn(i)}})},posX:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().x)}),t},posY:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().y)}),t},posTop:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().top)}),t},posRight:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().right)}),t},posLeft:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().left)}),t},posBottom:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().bottom)}),t},width:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().width)}),t},height:function(){let t=[];return this.run(function(n){t.push(n.getBoundingClientRect().height)}),t},size:function(){let t=[];return this.run(function(n){let i=[],r=n.getBoundingClientRect().width,o=n.getBoundingClientRect().height;i.push(r,o),t.push(i)}),t},attr:function(){if(0===arguments.length){let t=[],n=0;return this.run(function(i){t[n]=[];for(var r=0;r0||n)&&(t(),clearInterval(i)))},1)})},hover:function(t,n,i){return this.mouseEnter(t),this.mouseMove(n),this.mouseExit(i),this},mouseEnter:function(t){return this.on("mouseenter",t)},mouseMove:function(t){return this.on("mousemove",t)},mouseOver:function(t){return this.on("mouseover",t)},mouseExit:function(t){return this.on("mouseleave",t)},mouseDown:function(t){return this.on("mousedown",t)},mouseUp:function(t){return this.on("mouseup",t)},focus:function(t){return this.on("focus",t)},blur:function(t){return this.on("blur",t)},unload:function(t){return this.on("unload",t)},input:function(t){return this.on("input",t)},change:function(t){return this.on("change",t)},click:function(t){return void 0===t?this.run(function(t){t.click()}):this.on("click",t)},dblclick:function(t){return this.on("dblclick",t)},keyDown:function(t){return this.on("keydown",t)},keyUp:function(t){return this.on("keyup",t)},show:function(t="block"){return this.run(function(n){$$(n).css("display",t).css("opacity","100%")})},hide:function(){return this.run(function(t){$$(t).css("display","none").css("opacity","0")})},off:function(t,n){return this.run(function(i){i.removeEventListener(t,n)})},on:function(t,n){return this.run(function(i){i.addEventListener(t,function(t){n(t,i)})})},val:function(t){if(i[0].tagName="radio"==i[0].getAttribute("type")){let n=null;return i.forEach(function(t){t.checked&&(n=t.value)}),n}return void 0===t?i[0].value:(this.run(function(n){n.value=t}),this)},text:function(t){return void 0===t?i[0].innerText:(this.run(function(n){n.innerText=t}),this)},html:function(t){return void 0===t?i[0].innerHTML:(this.run(function(n){n.innerHTML=t}),this)},empty:function(){return this.run(function(t){t.innerHTML=null})},self:function(t,n){return this.run(function(i){$$(i).on(t.replace("hover","mousemove"),function(t){t.stopPropagation(),t.target==i&&n(t.target)})})},clickOnly:function(t){return this.self("click",t)},kill:function(t){return this.run(function(n){n.remove(),void 0!==t&&t()})},remove:function(t){return this.kill(t)},run:function(t){return null!==n?i.forEach(function(n,i){t(n,i)}):t(i[0],0),this},runEvent:function(t="",n,i=!1){return this.run(function(r){r.dispatchEvent(i?new CustomEvent(t,n):new Event(t,n))})}};return r};$$.$save=function(){return null},$$.makeHttpObject=function(){try{return new XMLHttpRequest}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(n){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}throw Error("Could not create HTTP request object.")},$$.get=function(t){let n=t.url,i=t.success?t.success:function(){},r=t.error?t.error:function(){},o=!!t.asyne&&t.asyne;var u=$$.makeHttpObject();u.onreadystatechange=function(){4==u.readyState&&(200==u.status?i(u.responseText):r(u.statusText))},u.open("GET",n,o),u.ontimeout=r,u.send(null)},$$.api=function(t){let n=t.type?t.type:"GET",i=t.data,r=t.url,o=!!t.withCredentials&&t.withCredentials,u=t.start?t.start:function(){},c=!!t.progress&&t.progress,s=!1,l=t.success?t.success:function(){},a=t.error?t.error:function(){},f=!!t.asyne&&t.asyne,h=null;try{h=new URLSearchParams(i).toString()}catch(d){h=Object.keys(i).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(i[t])}).join("&")}"GET"==n&&(r+="?"+h);let p=$$.makeHttpObject();p.onload=function(){l(this.responseText)},!1!==c&&(p.onprogress=function(){var t=0;evt.lengthComputable&&(t=evt.loaded/evt.total*100),c(t,evt)}),p.withCredentials=o,p.onreadystatechange=function(){1==p.readyState&&!1==s&&(u(),s=!0),4==p.readyState&&200!==p.status&&a(p.statusText)},p.open(n,r,f),p.setRequestHeader("Access-Control-Allow-Origin","*"),p.setRequestHeader("Content-type","application/x-www-form-urlencoded"),p.send(h)},$$.cssPath=function(t){if(t instanceof Element){for(var n=[];t.nodeType===Node.ELEMENT_NODE;){var i=t.nodeName.toLowerCase();if(t.id){i+="#"+t.id,n.unshift(i);break}for(var r=t,o=1;r=r.previousElementSibling;)r.nodeName.toLowerCase()==i&&o++;1!=o&&(i+=":nth-of-type("+o+")"),n.unshift(i),t=t.parentNode}return n.join(" > ")}},$$.toHtml=function(t){return new DOMParser().parseFromString(t,"text/html")},$$.isHtml=function(t){return Array.from($$.toHtml(t).body.childNodes).some(t=>1===t.nodeType)},$$.each=function(t,n){try{t.forEach(n)}catch(i){for(let r=0;r"+r+"",$$(i.head).addChild(r))}; +"remove"in Element.prototype||(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)});var $$=function(t,n=null){let i=[];"string"!=typeof t||$$.isHtml(t)?"[object Array]"===Object.prototype.toString.call(t)?i=t:"string"==typeof t&&$$.isHtml(t)?i[0]=$$.toHtml(t):i[0]=t:i=null!==n?document.querySelectorAll(t+":nth-child("+n+")"):document.querySelectorAll(t);let r={elem:$$.uniqeArray(i),setElem:function(t){return this.elem=$$.uniqeArray(t),this},find:function(t){return newElems=[],this.run(function(n){try{let i=n.querySelectorAll(t);newElems.push(i)}catch(r){console.warn(r)}}),this.setElem(newElems),this},closest:function(t){return newElems=[],this.run(function(n){try{let i=n.closest(t);newElems.push(i)}catch(r){console.warn(r)}}),this.setElem(newElems),this},watchAttr:function(t){return this.run(function(n){new MutationObserver(function(n){n.forEach(function(n){"attributes"==n.type&&t(n.attributeName)})}).observe(n,{attributes:!0})})},data:function(t,n){return this.attr(t+"-data",n)},resetStyle:function(){return this.run(function(t){let n=$$(t).attr("class");$$(t).attr("class","").attr("class",n),$$(t).attr("style"),$$(t).attr("style","").attr("style",n)})},fadeIn:function(t=100,n=function(){},i=function(){}){return this.run(function(r){$$(r).animation(function(t){0==t&&i(r,t),$$(r).css("opacity",t.toString()+"%"),t>=100&&n(r,t)},.06*t,t)})},fadeOut:function(t=100,n=function(){},i=function(){}){return this.run(function(r){$$(r).animation(function(t){0==t&&i(r,t),$$(r).css("opacity",(100-t).toString()+"%"),t>=100&&n(r,t)},.06*t,t)})},animation:function(t=function(){},n=100,i=2500){let r=0;function o(){(r+=i/n){/^on/.test(t)&&window.addEventListener(t.slice(2),t=>{console.log(t)})}),this},ready:function(t,n,i=100){return this.run(function(r){"[object HTMLDocument]"==Object.prototype.toString.call(r)&&void 0===n?($$(r).on("DOMContentLoaded",()=>{t()}),clearInterval(null)):"[object Window]"==Object.prototype.toString.call(r)&&void 0===n?($$(r).on("load",()=>{t()}),clearInterval(null)):void 0!==n&&function t(n,i,r=100){void 0!==i&&$$(i).elem.length?n():setTimeout((n,i,r)=>{t(n,i,r)},r,n,i,r)}(t,n,i)})},hover:function(t,n,i){return this.mouseEnter(t),this.mouseMove(n),this.mouseExit(i),this},mouseEnter:function(t){return this.on("mouseenter",t)},mouseMove:function(t){return this.on("mousemove",t)},mouseOver:function(t){return this.on("mouseover",t)},mouseExit:function(t){return this.on("mouseleave",t)},mouseDown:function(t){return this.on("mousedown",t)},mouseUp:function(t){return this.on("mouseup",t)},focus:function(t){return this.on("focus",t)},blur:function(t){return this.on("blur",t)},unload:function(t){return this.on("unload",t)},input:function(t){return this.on("input",t)},change:function(t){return this.on("change",t)},click:function(t){return void 0===t?this.run(function(t){t.click()}):this.on("click",t)},dblclick:function(t){return this.on("dblclick",t)},keyDown:function(t){return this.on("keydown",t)},keyUp:function(t){return this.on("keyup",t)},show:function(t="block"){return this.run(function(n){$$(n).css("display",t).css("opacity","100%")})},hide:function(){return this.run(function(t){$$(t).css("display","none").css("opacity","0")})},off:function(t,n){return this.run(function(i){i.removeEventListener(t,n)})},on:function(t,n){return this.run(function(i){i.addEventListener(t,function(t){n(t,i)})})},val:function(t){if(i[0].tagName="radio"==i[0].getAttribute("type")){let n=null;return this.run(function(t){t.checked&&(n=t.value)}),n}return void 0===t?i[0].value:(this.run(function(n){n.value=t}),this)},text:function(t){return void 0===t?i[0].innerText:(this.run(function(n){n.innerText=t}),this)},html:function(t){return void 0===t?i[0].innerHTML:(this.run(function(n){n.innerHTML=t}),this)},empty:function(){return this.run(function(t){t.innerHTML=null})},self:function(t,n){return this.run(function(i){$$(i).on(t.replace("hover","mousemove"),function(t){t.stopPropagation(),t.target==i&&n(t.target)})})},clickOnly:function(t){return this.self("click",t)},kill:function(t){return this.run(function(n){n.remove(),void 0!==t&&t()})},remove:function(t){return this.kill(t)},run:function(t){return this.elem.length&&this.elem.forEach(function(n,i){t(n,i)}),this},runEvent:function(t="",n,i=!1){return this.run(function(r){r.dispatchEvent(i?new CustomEvent(t,n):new Event(t,n))})}};return r};$$.$save=function(){return null},$$.makeHttpObject=function(){try{return new XMLHttpRequest}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(n){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}throw Error("Could not create HTTP request object.")},$$.get=function(t){let n=t.url,i=t.success?t.success:function(){},r=t.error?t.error:function(){},o=!!t.asyne&&t.asyne;var u=$$.makeHttpObject();u.onreadystatechange=function(){4==u.readyState&&(200==u.status?i(u.responseText):r(u.statusText))},u.open("GET",n,o),u.ontimeout=r,u.send(null)},$$.api=function(t){let n=t.type?t.type:"GET",i=t.data,r=t.url,o=!!t.withCredentials&&t.withCredentials,u=t.start?t.start:function(){},c=!!t.progress&&t.progress,s=!1,l=t.success?t.success:function(){},a=t.error?t.error:function(){},f=!!t.asyne&&t.asyne,h=null;try{h=new URLSearchParams(i).toString()}catch(d){h=Object.keys(i).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(i[t])}).join("&")}"GET"==n&&(r+="?"+h);let p=$$.makeHttpObject();p.onload=function(){l(this.responseText)},!1!==c&&(p.onprogress=function(){var t=0;evt.lengthComputable&&(t=evt.loaded/evt.total*100),c(t,evt)}),p.withCredentials=o,p.onreadystatechange=function(){1==p.readyState&&!1==s&&(u(),s=!0),4==p.readyState&&200!==p.status&&a(p.statusText)},p.open(n,r,f),p.setRequestHeader("Access-Control-Allow-Origin","*"),p.setRequestHeader("Content-type","application/x-www-form-urlencoded"),p.send(h)},$$.cssPath=function(t){if(!(t instanceof Element)){let n=$$(t),i=[];return n.run(function(t){i.push($$.cssPath(t))}),$$.uniqeArray(i)}for(var r=[];t.nodeType===Node.ELEMENT_NODE;){var o=t.nodeName.toLowerCase();if(t.id){o+="#"+t.id,r.unshift(o);break}for(var u=t,c=1;u=u.previousElementSibling;)u.nodeName.toLowerCase()==o&&c++;1!=c&&(o+=":nth-of-type("+c+")"),r.unshift(o),t=t.parentNode}return r.join(" > ")},$$.toHtml=function(t){return new DOMParser().parseFromString(t,"text/html")},$$.isHtml=function(t){return Array.from($$.toHtml(t).body.childNodes).some(t=>1===t.nodeType)},$$.each=function(t,n){try{t.forEach(n)}catch(i){for(let r=0;r"+r+"",$$(i.head).addChild(r))},$$.uniqeArray=function(t){var n={};return"function"==typeof t.filter?t.filter(function(t){return!n.hasOwnProperty(t)&&(n[t]=!0)}):t},$$.ready=function(t,n){return $$(document||window).ready(t,n)},$$.monitor=function(){return $$(window).monitor()},$$.load=function(){window.dispatchEvent(new Event("load")),document.dispatchEvent(new Event("DOMContentLoaded"))};