mirrorsharp/Owin.Demo/index.html

77 строки
2.6 KiB
HTML
Исходник Обычный вид История

<!DOCTYPE html>
<html>
<head>
2017-05-14 11:55:22 +03:00
<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">
2017-05-14 11:55:22 +03:00
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans">
2016-09-13 13:32:05 +03:00
<style>
2017-05-14 11:55:22 +03:00
* { box-sizing: border-box; }
2016-09-13 13:32:05 +03:00
html, body { width: 100%; height: 100%; }
2017-05-14 11:55:22 +03:00
body {
padding: 0;
margin: 0;
font-size: 16px;
display: flex;
flex-direction: column;
padding: 10px;
}
nav { display: flex; font-family: 'Open Sans', sans-serif; }
2017-05-15 01:20:13 +03:00
nav ul {
2017-05-14 11:55:22 +03:00
list-style: none;
display: flex;
padding: 0;
margin: 0;
}
2017-05-15 01:20:13 +03:00
nav li {
2017-05-14 11:55:22 +03:00
margin-left: 10px;
}
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.CodeMirror {
2017-05-14 11:55:22 +03:00
flex-grow: 1;
margin-top: 10px;
border: 1px solid #ddd;
}
2016-09-13 13:32:05 +03:00
</style>
</head>
<body>
2017-05-14 11:55:22 +03:00
<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>
2016-09-13 13:32:05 +03:00
<script>
2017-05-14 11:55:22 +03:00
'use strict';
2017-05-15 01:20:13 +03:00
const language = ((window.location.search.match(/language=([^&]+)/) || [])[1] || 'CSharp').replace('Sharp', '#');
2017-05-14 11:55:22 +03:00
const textarea = document.getElementsByTagName('textarea')[0];
if (language === 'F#')
2017-05-15 01:20:13 +03:00
textarea.value = '[<EntryPoint>]\r\nlet main argv = \r\n 0';
2017-05-14 11:55:22 +03:00
mirrorsharp(textarea, {
serviceUrl: window.location.href.replace(/^http(s?:\/\/[^/]+).*$/i, 'ws$1/mirrorsharp'),
selfDebugEnabled: true,
2017-05-15 01:20:13 +03:00
language: language
});
</script>
</body>
</html>