I've searched everything about something like "compress html javascript" in the Web, but found nothing to answer my question, but I cannot understand what's wrong. The problem: if you have something like <span>blah<span>blah</span>blah<span>blah</span></span>
in your html page, why don't you try to compress this? For example,
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<style>
.click {color: blue; cursor: pointer;}
.encoded {display:none;}
</style>
<script src="jquery.js"></script>
<script>
$(document).ready(function () {
$.fn.encode = function () {
//encoding code
};
$.fn.decode = function () {
//decoding code
};
$('.click').click(function () {
var decoded = $(this).next('.encoded').text().decode();
$(this).next('.encoded').removeClass('encoded').addClass('decoded').html(decoded);
});
});
</script>
</head>
<body>
<div class="click">click</div>
<div class="encoded">AbCxYz*_()+=…
<!-- decoded html: <span>blah<span>blah</span>blah<span>blah</span></span>-->
</div>
</body>
</html>
Is there any functions that may be used for those encode/decode parts? Of course, base64 is not a solution, because that html must be compressed at first, and then something like base64 must be applied to the result...