ServParam2ClientModelEngine/CodeShowWeb/CodeShow.aspx

51 lines
3.1 KiB
Plaintext
Raw Normal View History

2018-10-18 23:06:30 +08:00
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CodeShow.aspx.cs" Inherits="CodeShowWeb.CodeShow" %>
<!DOCTYPE html>
<html>
<head>
<title>highlight</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" href="styles/default.css">
<script src="highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
代码配色方案:<div id="changeStyleSelect"></div>
<div ><pre>
<code class="java">
<%=GetCode() %>
</code>
</pre>
</div>
<script>
styleArr = ["<%=GetCodeStyle() %>",//第一个放自己喜欢的23333
"agate.css", "androidstudio.css", "arduino-light.css", "arta.css", "ascetic.css", "atelier-cave-dark.css", "atelier-cave-light.css", "atelier-dune-dark.css", "atelier-dune-light.css", "atelier-estuary-dark.css", "atelier-estuary-light.css", "atelier-forest-dark.css", "atelier-forest-light.css", "atelier-heath-dark.css", "atelier-heath-light.css", "atelier-lakeside-dark.css", "atelier-lakeside-light.css", "atelier-plateau-dark.css", "atelier-plateau-light.css", "atelier-savanna-dark.css", "atelier-savanna-light.css", "atelier-seaside-dark.css", "atelier-seaside-light.css", "atelier-sulphurpool-dark.css", "atelier-sulphurpool-light.css", "brown-paper.css", "codepen-embed.css", "color-brewer.css", "dark.css", "darkula.css", "default.css", "docco.css", "dracula.css", "far.css", "foundation.css", "github.css", "github-gist.css", "googlecode.css", "grayscale.css", "gruvbox-dark.css", "gruvbox-light.css", "hopscotch.css", "hybrid.css", "idea.css", "ir-black.css", "kimbie.dark.css", "kimbie.light.css", "magula.css", "mono-blue.css", "monokai.css", "monokai-sublime.css", "obsidian.css", "paraiso-dark.css", "paraiso-light.css", "pojoaque.css", "purebasic.css", "qtcreator_dark.css", "qtcreator_light.css", "railscasts.css", "rainbow.css", "school-book.css", "solarized-dark.css", "solarized-light.css", "sunburst.css", "tomorrow.css", "tomorrow-night.css", "tomorrow-night-blue.css", "tomorrow-night-bright.css", "tomorrow-night-eighties.css", "vs.css", "xcode.css", "xt256.css", "zenburn.css"];
selectHtml = [];
selectHtml.push('<select id="changeStyle">');
for (i in styleArr) {
OptionValue = styleArr[i];
selectHtml.push('<option value="' + OptionValue + '" >' + OptionValue + '</option>');
}
selectHtml.push('</select>');
selectHtmlString = selectHtml.join("");
document.getElementById('changeStyleSelect').innerHTML = selectHtmlString;
obj = document.getElementById('changeStyle');
obj.addEventListener("change", function (event) {
var value = this.options[this.options.selectedIndex].value;
l = document.createElement('link');
l.setAttribute('href', 'styles/' + value);
l.setAttribute('rel', 'stylesheet');
document.head.appendChild(l);
});
//首先载入自己喜欢的
l = document.createElement('link');
l.setAttribute('href', 'styles/' +"<%=GetCodeStyle() %>");
l.setAttribute('rel','stylesheet');
document.head.appendChild(l);
</script>
</body>
</html>