@novemberizing/bootstrap
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,1 +0,1 @@ | ||
(t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})({});const t=(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},e=(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t};class r{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#r='<i class="fa-solid fa-star"></i>';static#n='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;r.#t=t.parseFromString(r.#t,"text/html").querySelector("p"),r.#e=t.parseFromString(r.#e,"text/html").querySelector("button"),r.#r=t.parseFromString(r.#r,"text/html").querySelector("i"),r.#n=t.parseFromString(r.#n,"text/html").querySelector("i")}#s=null;#o=null;#a=null;#i=null;#l=null;#u=null;#p=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const n of e)new r(n,"function"==typeof t?t(n):t)}static#c(){return r.#t.cloneNode(!0)}static#d(n,s){const o=r.#e.cloneNode(!0);return o.setAttribute("data-value",n+1),o.setAttribute("aria-pressed",s),s?o.appendChild(r.#r.cloneNode(!0)):o.appendChild(r.#n.cloneNode(!0)),o.addEventListener("click",(r=>{const n=t(r.target,"button"),s=t(n,"p"),o=e(s,"input"),a=parseInt(n.getAttribute("data-value")),i=n.getAttribute("aria-pressed"),l=n.nextElementSibling;"true"===i?l&&"true"===l.getAttribute("aria-pressed")?o.setAttribute("value",a):o.setAttribute("value",a-1):o.setAttribute("value",a);const u=parseInt(o.getAttribute("value")),p=s.querySelectorAll("button");for(const t of p){const e=t.querySelector("i");u<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#a=t,this.#i=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#s=this.#a.parentNode,this.#o=this.#a.nextSibling,this.#l=parseInt(this.#a.max),this.#u=parseInt(this.#a.min),this.#p=parseInt(this.#a.defaultValue);const n=r.#c();for(let t=this.#u;t<this.#l;t++){const e=r.#d(t,t<this.#p);n.appendChild(e)}this.#a.style.display="none",this.#s.insertBefore(n,this.#o)}}"undefined"==typeof novemberizing?console.error("need to ..."):void 0===novemberizing.bootstrap?novemberizing.bootstrap={Star:r}:novemberizing.bootstrap.Star=r; | ||
(t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})})({});const t=(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},e=(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t};class r{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#r='<i class="fa-solid fa-star"></i>';static#n='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;r.#t=t.parseFromString(r.#t,"text/html").querySelector("p"),r.#e=t.parseFromString(r.#e,"text/html").querySelector("button"),r.#r=t.parseFromString(r.#r,"text/html").querySelector("i"),r.#n=t.parseFromString(r.#n,"text/html").querySelector("i")}#s=null;#o=null;#i=null;#a=null;#l=null;#u=null;#c=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const n of e)new r(n,"function"==typeof t?t(n):t)}static#p(){return r.#t.cloneNode(!0)}static#d(n,s){const o=r.#e.cloneNode(!0);return o.setAttribute("data-value",n+1),o.setAttribute("aria-pressed",s),s?o.appendChild(r.#r.cloneNode(!0)):o.appendChild(r.#n.cloneNode(!0)),o.addEventListener("click",(r=>{const n=t(r.target,"button"),s=t(n,"p"),o=e(s,"input"),i=parseInt(n.getAttribute("data-value")),a=n.getAttribute("aria-pressed"),l=n.nextElementSibling;"true"===a?l&&"true"===l.getAttribute("aria-pressed")?o.setAttribute("value",i):o.setAttribute("value",i-1):o.setAttribute("value",i);const u=parseInt(o.getAttribute("value")),c=s.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");u<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#i=t,this.#a=e,"string"==typeof this.#i&&(this.#i=document.getElementById(this.#i)),this.#s=this.#i.parentNode,this.#o=this.#i.nextSibling,this.#l=parseInt(this.#i.max),this.#u=parseInt(this.#i.min),this.#c=parseInt(this.#i.defaultValue);const n=r.#p();for(let t=this.#u;t<this.#l;t++){const e=r.#d(t,t<this.#c);n.appendChild(e)}this.#i.style.display="none",this.#s.insertBefore(n,this.#o)}}void 0===window.novemberizing?console.error("need to ..."):void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:r}:window.novemberizing.bootstrap.Star=r; |
{ | ||
"name": "@novemberizing/bootstrap", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "novemberizing's bootstrap plugin", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
import Star from "./Star.js"; | ||
if(typeof novemberizing === 'undefined') { | ||
if(typeof window.novemberizing === 'undefined') { | ||
console.error('need to ...'); | ||
} else { | ||
if(typeof novemberizing.bootstrap === 'undefined') { | ||
novemberizing.bootstrap = { Star }; | ||
if(typeof window.novemberizing.bootstrap === 'undefined') { | ||
window.novemberizing.bootstrap = { Star }; | ||
} else { | ||
novemberizing.bootstrap.Star = Star; | ||
window.novemberizing.bootstrap.Star = Star; | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25791