FOSDEM-2025-keynote/lib/js/extra/headjs/site/assets/libs/builder/builder.min.js

2 lines
1.9 KiB
JavaScript
Raw Permalink Normal View History

function xhr(n,t){t=t||!0;var i;try{i=new window.ActiveXObject("Microsoft.XMLHTTP")}catch(r){i=new window.XMLHttpRequest}i.open("GET",n,t),i.onreadystatechange=function(){i.readyState==4&&alert(i.responseText)},i.send(null)}function GetFeatures(){$.getJSON("/src/features/inventory.json",function(n){$(n).each(function(n,t){var i="";i+="<li><label title='"+t.description+"'>",i+="<input type='checkbox' id='"+t.id+"' name='"+t.id+"' data-package='"+t.package+"' /> "+t.title,t.url&&(i+=" <small style='float:right'>(<a href='"+t.url+"' target='_blank'><em>more info<\/em><\/a>)<\/small>"),i+="<\/label><\/li>",$("#"+t.category).append(i)})})}function generate(){var t=[],n;document.getElementById("out").value="",$("[data-package]:checked").each(function(){$.ajax({type:"GET",url:"/src/"+$(this).data("package"),dataType:"text",async:!1}).done(function(n){t.push(n)})}),n=(new Packer).pack("var tests = ["+t+"];",$("#pack").is(":checked"),$("#minify").is(":checked")),document.getElementById("out").value=n,$("#size").html((n.length/1024).toFixed(2)+"K")}function getDownload(){var n=document.getElementById("out").value,t="head.custom.js";head.browser.ie?SaveIE(n,t):(head.browser.chrome||head.browser.ff)&&Download.save(n,t)}function SaveIE(n,t){var i,r;document.execCommand&&(i=window.open("about:blank","_blank"),i.document.write(n),i.document.close(),r=i.document.execCommand("SaveAs",!0,t),i.close())}var Download={click:function(n){var t=document.createEvent("MouseEvents");return t.initMouseEvent("click",!0,!1,self,0,0,0,0,0,!1,!1,!1,!1,0,null),n.dispatchEvent(t)},encode:function(n){return"data:application/octet-stream;base64,"+btoa(n)},link:function(n,t){var i=document.createElement("a");return i.download=t||self.location.pathname.slice(self.location.pathname.lastIndexOf("/")+1),i.href=n||self.location.href,i}};Download.save=function(n,t){this.click(this.link(this.encode(n),t))};
//# sourceMappingURL=builder.min.js.map