53 lines
1.9 KiB
JavaScript
53 lines
1.9 KiB
JavaScript
|
|
$(document).ready(function() {
|
|
/// PREVIEWS
|
|
let html_count=0;
|
|
if ($(".code-content") && $(".is_awnsers_show_me_help").length !== 1) { $(".code-content").remove() }
|
|
|
|
|
|
$('pre code[class*="language-markup"]').each(function() {
|
|
var codeContent = $(this).text();
|
|
// alert("classpls "+classpls)
|
|
if ( $(this).hasClass("nohelp_result") ) {
|
|
console.log("nohelp_result")
|
|
}
|
|
else if ( !$(this).hasClass("nohelp") || $(".is_awnsers_show_me_help").length==1 ) {
|
|
// alert("gooo")
|
|
$(this).parent('pre:not(.nohelp_result, .nohelp)')
|
|
.after(`<input type="checkbox" class="checkbox_minimize_code" id="minimize_code" />
|
|
<label for="minimize_code"></label>
|
|
<input type="checkbox" class="checkbox_maximize_code" id="maximize_code" />
|
|
<label for="maximize_code"></label>
|
|
<div class="code-content"><span id="codeContent_label">Rendu :</span>` + codeContent + `</div>`);
|
|
}
|
|
});
|
|
|
|
$('pre code[class*="language"]').each(function() {
|
|
html_count++;
|
|
$(this).attr("data-num_html", html_count)
|
|
var classpls = $(this).attr("class");
|
|
$(this).parent().parent().attr("data-type",classpls).parent().attr("data-type",classpls)
|
|
});
|
|
|
|
/// Try fix Css error
|
|
$('.language-css').each(function() {
|
|
var codeContent = $(this).html().replace(">", ">").replace("\>", ">");
|
|
// console.log("\n"+codeContent)
|
|
$(this).html(codeContent)
|
|
});
|
|
|
|
|
|
|
|
$("style[css_count]").remove()
|
|
let css_count=0;
|
|
$('code.language-css').each(function() {
|
|
css_count++;
|
|
$(this).attr("data-num_css", css_count)
|
|
var codeContent = $(this).text();
|
|
let this_data_name = $(this).attr("id");
|
|
// alert(this_data_name)
|
|
let dataname = ($(this).attr("id")) ? ' data-id="'+ this_data_name +'"' : "";
|
|
$('<style css_count="'+css_count+'"'+dataname+'>'+codeContent+'</style>').appendTo('head');
|
|
});
|
|
|
|
});
|