Custom Html
/*************************************************
/*
/* Code based on Wikidot's HTML Block
/* Edited by Kenneth Tsang for Custom HTML Blocks
/*
/************************************************/
(function() {
    // running in private context, no namespace pollution :-)
 
    var delay = 250; // each 250 ms, content height will be checked
    var current_height = 0; // assume starting height is 0px
 
    // the following code has been edited by Kenneth Tsang for Custom HTML Blocks
    var url_array = location.toString().split('/');
    var iframe_hash = window.location.hash.match(/\/([a-zA-Z0-9\-_]+)$/)[1];
    var random = Math.random();
    var parentDomain = document.referrer.match(/^https?:\/\/([^\/\\]+)/)[1];
    var resize_div_id = 'div_' + iframe_hash + random;
    var resize_iframe_id = 'iframe_' + iframe_hash + random;
    var resize_url = url_array[0] + '//' + parentDomain + '/common--javascript/resize-iframe.html';
 
    var get_height = function() {
        if (document.body.scrollHeight) {
            return document.body.scrollHeight;
        }
        if (document.height) {
            return document.height;
        }
        return document.body.offsetHeight;
    };
 
    var resize = function() {
        var div = document.getElementById(resize_div_id);
 
        var old_iframe = document.getElementById(resize_iframe_id);
        if (old_iframe) {
            div.removeChild(old_iframe);
            delete old_iframe;
        }
 
        var iframe = document.createElement("iframe");
        iframe.id = resize_iframe_id;
        iframe.src = resize_url + "?" + Math.random() + "#" + current_height + "/" + iframe_hash;
        div.appendChild(iframe);
    };
 
    // every <delay> miliseconds:
    // if height changed from last time, do resize
    var tick = function() {
        var new_height = get_height();
        if (new_height != current_height) {
            current_height = new_height;
            resize(current_height);
        }
        setTimeout(tick, delay);
    };
 
    var init = function() {
        var div = document.createElement("div");
        div.id = resize_div_id;
        div.setAttribute('style', 'display: none');
        div.style.display = 'none'; // this way it works even in IE
        document.body.appendChild(div);
        tick();
    };
 
    var old_onload = window.onload;
    window.onload = function() {
        if (typeof(old_onload) == "function") {
            old_onload();
        }
        init();
    };
})();
<script type="text/javascript" src="1"></script>
<div contentEditable="true">
This HTML is meant to be iframed in an iframe in order to do cross-domain iframe resizing.
 
From parent.parent window, jQuery and document objects are grabbed.
Iframe with class "html-block-iframe" and src ending with src is matched
and resized to height height px using jQuery.
 
<src> and <height> are grabbed from URL of this iframe, format:
 
http://domain/common-javascript/resize-iframe.html#height/src
 
domain may be at wikidot.com or custom domain.
It must be the same as the parent.parent's domain.
</div>