String.prototype.escape = function () {
var tmls = {
'&': '&',
'<': '<',
'>': '>'
};
return this.replace(/[&<>]/g, function (tag) {
return tmls[tag] || tag;
});
};
(function ($) {
$('.add-html-code').each(function () {
var
_this = $(this),
s = _this.innerHTML.escape(),
r = '<pre class="language-html line-numbers">' + s + '</pre>';
alert(_this.innerHTML);
if (_this.data('target')) {
$('#' + _this.data('target')).html(r);
}
else {
_this.after('<br/><h5>Code:</h5><div>' + r + '</div><p> </p>');
}
});
})(jQuery);
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
};
$('.nav-tabs a').on('shown.bs.tab', function (e) {
if (history.pushState) {
history.pushState(null, null, e.target.hash);
} else {
window.location.hash = e.target.hash;
}
});