var preNum = 0; var preStyle = 'pre[class*="brush:"],pre[class*="prism"],pre>code'; var copyimg = bloghost + "zb_users/plugin/zxd_ctrlcenter/plugin/code/svg/copy.svg"; var goimg = bloghost + "zb_users/plugin/zxd_ctrlcenter/plugin/code/svg/yunxing.svg"; var bjimg = bloghost + "zb_users/plugin/zxd_ctrlcenter/plugin/code/svg/bianji.svg"; var bjgoimg = bloghost + "zb_users/plugin/zxd_ctrlcenter/plugin/code/svg/bianjigo.svg"; $(preStyle).each(function() { yid = "pre_" + preNum; precode = $(this).html(); xyattr = $(this).attr("class"); if ($("pre>code").length) { $cdom = $(this).parent() } else { $cdom = $(this) } $cdom.attr("id", yid); $cdom.after('"); preNum++ }); $(document).ready(function() { var a = 0; $("pre").each(function() { var d = "pre_" + a; var c = $(this).prev(); var b = ''; if (c.hasClass("prism-show-language")) { c.find("div").prepend(b) } else { $(this).before( '
' + b + "
") } a++ }) }); $('textarea[id*="tpre"]').blur(function() { $(this).text($(this).val()) }); function runCode(a) { var b = window.open("", "", ""); b.document.open("text/html", "replace"); b.opener = null; b.document.write($("#" + a).next("textarea").html().replace(/</g, "<").replace(/>/g, ">").replace(/ /g, " ") .replace(/"/g, '"').replace(/&/g, "&")); b.document.close() } document.writeln('