function codepad_co_snippet(snippet_id) {
var snippet_url = "https://codepad.co/snippet/" + snippet_id,
img_src = "https://codepad.co/img/snippets/" + snippet_id + ".png";
return '<div class="codepad_co_snippet"><a target="_blank" href="' + snippet_url
+ '" ><img src="' + img_src + '" alt="' + snippet_id
+ '" width="550px" height="490px" title="Codepad.co Snippet '
+ snippet_id + ' - Embed by Jesse Graupmann" /></a></div>';
}
// EXAMPLE
function create(htmlStr) {
var frag = document.createDocumentFragment(),
temp = document.createElement('div');
temp.innerHTML = htmlStr;
while (temp.firstChild) {
frag.appendChild(temp.firstChild);
}
return frag;
}
var embed = codepad_co_snippet('RUvwkElC');
document.body.insertBefore( create( embed ), document.body.childNodes[0]);
PHP version: https://codepad.co/snippet/RUvwkElC
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.