get the real file size
This commit is contained in:
parent
8a489597d5
commit
881d927442
1 changed files with 22 additions and 6 deletions
|
@ -7,7 +7,6 @@
|
|||
<link type="text/css" rel="stylesheet/less" href="download.less"/>
|
||||
<script src="less.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-41177412-1']);
|
||||
_gaq.push(['_setDomainName', 'minfwk.com']);
|
||||
|
@ -19,7 +18,6 @@
|
|||
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -145,19 +143,37 @@
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
oRequest = new XMLHttpRequest();
|
||||
var sURL = "http://8b51d1abd8.test-url.ws/gzipsize.php?encode="+mincss;
|
||||
|
||||
oRequest.open("GET",sURL,false);
|
||||
oRequest.send(null);
|
||||
*/
|
||||
//Old XHR stuff above
|
||||
|
||||
|
||||
var url = "http://8b51d1abd8.test-url.ws/gzipsize.php";
|
||||
var params = "?encode="+mincss;
|
||||
http.open("POST", url, true);
|
||||
|
||||
document.getElementById('details').innerHTML = "Your download of min is " + details.total + " bytes unminified, " + details.totalmin + " bytes minified (above), and " + details.totalmingzip + " bytes <a href='http://8b51d1abd8.test-url.ws/gzip.php?encode="+mincss+"'>minified and gzipped</a>."
|
||||
//Send the proper header information along with the request
|
||||
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
http.setRequestHeader("Content-length", params.length);
|
||||
http.setRequestHeader("Connection", "close");
|
||||
|
||||
//details.totalmingzip = parseInt(oRequest.responseText);
|
||||
http.onreadystatechange = function() {
|
||||
//Call a function when the state changes.
|
||||
if (http.readyState == 4 && http.status == 200) {
|
||||
alert(http.responseText);
|
||||
details.totalmingzip = parseInt(http.responseText)
|
||||
document.getElementById('details').innerHTML = document.getElementById('details').innerHTML.replace(' and', ',');
|
||||
document.getElementById('details').innerHTML += ", and " + details.totalmingzip + " bytes <a href='http://8b51d1abd8.test-url.ws/gzip.php?encode="+mincss+"'>minified and gzipped</a>."
|
||||
mixpanel.track('Calculate CSS', details);
|
||||
}
|
||||
}
|
||||
http.send(params);
|
||||
|
||||
mixpanel.track('Calculate CSS', details);
|
||||
document.getElementById('details').innerHTML = "Your download of min is " + details.total + " bytes unminified and " + details.totalmin + " bytes minified (above)";
|
||||
|
||||
console.log(details);
|
||||
return mincss;
|
||||
|
|
Loading…
Add table
Reference in a new issue