-
Notifications
You must be signed in to change notification settings - Fork 1
/
fort.min.js
1 lines (1 loc) · 5.61 KB
/
fort.min.js
1
var Fort={clean:function(){for(var e=document.querySelectorAll(".form"),t=e.length;t--;){var o=e[t].querySelectorAll("input, textarea, select");Array.prototype.forEach.call(o,function(e){0!=e.value.length&&(e.classList?e.classList.add("ignore"):e.className+=" ignore")});var n=e[t].querySelectorAll("input[type=hidden]");Array.prototype.forEach.call(n,function(e){e.classList?e.classList.add("ignore"):e.className+=" ignore"})}},solid:function(e){function t(t){for(var o=[],r=n.length;r--;)n[r].value.length||o.push(n[r]);for(var l=o.length,s=n.length,a=document.querySelectorAll(".top-one"),i=a.length;i--;)a[i].style.width=100-l/s*100+"%";document.getElementById("top1").style.background=e}Fort.clean(),document.body.innerHTML='<div class="top-one" id="top1"><div class="colors"></div></div>'+document.body.innerHTML;for(var o=document.querySelectorAll(".form"),n=[],r=o.length;r--;)for(var l=o[r].querySelectorAll("input, textarea, select"),s=l.length;s--;){classes=l[s].className.replace(/\s+/g," ").split(" "),ignore=!1;for(var a=classes.length;a--;)if("ignore"==classes[a]){ignore=!0;break}"button"==l[s].type||"submit"==l[s].type||ignore||(n.push(l[s]),l[s].addEventListener("input",t,!1))}},gradient:function(e,t){function o(o){for(var n=[],l=r.length;l--;)r[l].value.length||n.push(r[l]);for(var s=n.length,a=r.length,i=document.querySelectorAll(".top-one"),c=i.length;c--;)i[c].style.width=100-s/a*100+"%";orientation="to right";var u="linear-gradient("+orientation+", "+e+", "+t+")";document.getElementById("top1").style.background=u}Fort.clean(),document.body.innerHTML='<div class="top-one" id="top1"><div class="colors"></div></div>'+document.body.innerHTML;for(var n=document.querySelectorAll(".form"),r=[],l=n.length;l--;)for(var s=n[l].querySelectorAll("input, textarea, select"),a=s.length;a--;){classes=s[a].className.replace(/\s+/g," ").split(" "),ignore=!1;for(var i=classes.length;i--;)if("ignore"==classes[i]){ignore=!0;break}"button"==s[a].type||"submit"==s[a].type||ignore||(r.push(s[a]),s[a].addEventListener("input",o,!1))}},sections:function(){function e(e){for(var t=[],o=s.length;o--;)s[o].value.length||t.push(s[o]);for(var n=t.length,r=s.length,l=document.querySelectorAll(".top-one"),a=l.length;a--;)l[a].style.width=100-n/r*100+"%"}function t(e){var t=[],o=0;for(n=0;n<2*e.length;n++){n%2&&o++;var r=Math.floor(1e3*o/e.length)/10;t.push([e[n-o],r+"%"])}return t}function o(e){var t,o=e.length;for(t=0;o>t;t++)e[t]=e[t].join(" ");return"linear-gradient( to right, "+e.join(", ")+")"}Fort.clean();for(var n=0;n<arguments.length;++n)var r=Array.prototype.slice.call(arguments);document.body.innerHTML='<div class="top-one" id="top1"><div class="colors"></div></div>'+document.body.innerHTML;for(var l=document.querySelectorAll(".form"),s=[],n=l.length;n--;)for(var a=l[n].querySelectorAll("input, textarea, select"),i=a.length;i--;){classes=a[i].className.replace(/\s+/g," ").split(" "),ignore=!1;for(var c=classes.length;c--;)if("ignore"==classes[c]){ignore=!0;break}"button"==a[i].type||"submit"==a[i].type||ignore||(s.push(a[i]),a[i].addEventListener("input",e,!1))}document.getElementsByClassName("top-one").innerHTML='<div class="colors"></div>',document.querySelector(".colors").style.background=o(t(r.sort()));var u=window.innerWidth+"px";document.querySelector(".colors").style.width=u},flash:function(){function e(e){for(var t=[],o=l.length;o--;)l[o].value.length||t.push(l[o]);for(var r=t.length,s=l.length,a=document.querySelectorAll(".top-one"),i=a.length;i--;)a[i].style.width=100-r/s*100+"%",a[i].style.background=n[s-r-1]}Fort.clean();for(var t=0;t<arguments.length;++t){arguments.length,arguments[t]}var o=Array.prototype.slice.call(arguments),n=o.sort();document.body.innerHTML='<div class="top-one" id="top1"><div class="colors"></div></div>'+document.body.innerHTML;for(var r=document.querySelectorAll(".form"),l=[],t=r.length;t--;)for(var s=r[t].querySelectorAll("input, textarea, select"),a=s.length;a--;){classes=s[a].className.replace(/\s+/g," ").split(" "),ignore=!1;for(var i=classes.length;i--;)if("ignore"==classes[i]){ignore=!0;break}"button"==s[a].type||"submit"==s[a].type||ignore||(l.push(s[a]),s[a].addEventListener("input",e,!1))}},merge:function(e){function t(t){for(var o=[],r=n.length;r--;)n[r].value.length||o.push(n[r]);for(var l=o.length,s=n.length,a=document.querySelectorAll("#top1"),i=a.length;i--;){precalct=100-l/s*100;var c=precalct/2;a[i].style.width=c+"%"}for(var l=o.length,s=n.length,a=document.querySelectorAll("#top2"),i=a.length;i--;){precalct=100-l/s*100;var c=precalct/2;a[i].style.width=c+"%"}document.getElementById("top1").style.background=e,document.getElementById("top2").style.background=e}Fort.clean(),document.body.innerHTML='<div class="top-one" id="top1"><div class="colors"></div></div>'+document.body.innerHTML,document.body.innerHTML='<div class="top-two" id="top2"><div class="colors"></div></div>'+document.body.innerHTML;for(var o=document.querySelectorAll(".form"),n=[],r=o.length;r--;)for(var l=o[r].querySelectorAll("input, textarea, select"),s=l.length;s--;){classes=l[s].className.replace(/\s+/g," ").split(" "),ignore=!1;for(var a=classes.length;a--;)if("ignore"==classes[a]){ignore=!0;break}"button"==l[s].type||"submit"==l[s].type||ignore||(n.push(l[s]),l[s].addEventListener("input",t,!1))}},config:function(e){var t=document.querySelector("#top1"),o=document.querySelector("#top2")||{style:{}};e.height&&(t.style.height=e.height,o.style.height=e.height),e.alignment&&("top"===e.alignment?(t.style.top=0,t.style.bottom="auto",o.style.top=0,o.style.bottom="auto"):(t.style.top="auto",t.style.bottom=0,o.style.top="auto",o.style.bottom=0)),e.duration&&(t.style.transitionDuration=e.duration,o.style.transitionDuration=e.duration)}};