mirrorsharp/Owin.Demo/index.html

77 строки
2.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MirrorSharp Demo</title>
<link rel="stylesheet" href="node_modules/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="node_modules/codemirror/addon/lint/lint.css">
<link rel="stylesheet" href="node_modules/codemirror/addon/hint/show-hint.css">
<link rel="stylesheet" href="node_modules/codemirror-addon-lint-fix/dist/lint-fix.css">
<link rel="stylesheet" href="node_modules/mirrorsharp/mirrorsharp.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans">
<style>
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
padding: 0;
margin: 0;
font-size: 16px;
display: flex;
flex-direction: column;
padding: 10px;
}
nav { display: flex; font-family: 'Open Sans', sans-serif; }
nav ul {
list-style: none;
display: flex;
padding: 0;
margin: 0;
}
nav li {
margin-left: 10px;
}
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.CodeMirror {
flex-grow: 1;
margin-top: 10px;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<nav>
Language:
<ul>
<li><a href="index.html?language=CSharp">C#</a></li>
<li><a href="index.html?language=FSharp">F#</a></li>
</ul>
</nav>
<textarea>using System;
class C {
void M() {
}
}</textarea>
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/clike/clike.js"></script>
<script src="node_modules/codemirror/mode/mllike/mllike.js"></script>
<script src="node_modules/codemirror/addon/lint/lint.js"></script>
<script src="node_modules/codemirror/addon/hint/show-hint.js"></script>
<script src="node_modules/codemirror-addon-lint-fix/dist/lint-fix.js"></script>
<script src="node_modules/mirrorsharp/mirrorsharp.js"></script>
<script>
'use strict';
const language = ((window.location.search.match(/language=([^&]+)/) || [])[1] || 'CSharp').replace('Sharp', '#');
const textarea = document.getElementsByTagName('textarea')[0];
if (language === 'F#')
textarea.value = '[<EntryPoint>]\r\nlet main argv = \r\n 0';
mirrorsharp(textarea, {
serviceUrl: window.location.href.replace(/^http(s?:\/\/[^/]+).*$/i, 'ws$1/mirrorsharp'),
selfDebugEnabled: true,
language: language
});
</script>
</body>
</html>