slidebox-js
Version:
A jQuery plugin for easy creation of responsive lightbox-style media galleries and carousels.
39 lines (27 loc) • 621 B
JavaScript
// jshint ignore: start
function htmlEscape(str) {
return str
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
function formatCode() {
var $codeblocks = $('.codeblock');
$codeblocks.each(function() {
var $codeblock = $(this),
html = $codeblock.html();
html = htmlEscape(html
.replace('<!--', '')
.replace('-->', '')
.replace('/*', '<!--')
.replace('*/', '-->'));
//html = htmlEscape(html);
//console.log(html);
$codeblock.replaceWith(html);
});
}
$(function () {
formatCode();
});