mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 15:05:39 +01:00
Add initial website pages
This commit is contained in:
parent
f2b9092438
commit
99bc54b159
55 changed files with 13029 additions and 1 deletions
7
.vscode/settings.json
vendored
7
.vscode/settings.json
vendored
|
|
@ -1,4 +1,9 @@
|
|||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"files.trimTrailingWhitespace": true
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/bower_components": true,
|
||||
"**/release": true
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ The Monaco Editor is the code editor that powers [VS Code](https://github.com/Mi
|
|||
|
||||
## Issues
|
||||
|
||||
Please mention the version of the editor when creating issues and the browser you're having trouble in.
|
||||
|
||||
This repository contains only the scripts to glue things together, please create issues against the actual repositories where the source code lives:
|
||||
* monaco-editor-core: [Issues](https://github.com/Microsoft/vscode) -- [npm module](https://www.npmjs.com/package/monaco-editor-core) (Issues with the editor itself)
|
||||
* monaco-typescript: [Issues](https://github.com/Microsoft/monaco-typescript) -- [npm module](https://www.npmjs.com/package/monaco-typescript) (Issues with JavaScript or TypeScript language support)
|
||||
|
|
|
|||
274
website/all.css
Normal file
274
website/all.css
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
body {
|
||||
padding: 54px 0 40px 0;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
body.home {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
body,
|
||||
input,
|
||||
button,
|
||||
select,
|
||||
textarea,
|
||||
.navbar-search .search-query {
|
||||
font: 400 14px/1.4em "Segoe UI", "Open Sans", Calibri, Candara, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.navbar .nav {
|
||||
float: left;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0066cc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
letter-spacing: -0.01em;
|
||||
margin: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
/***** Bootstrap Cosmo Overrides *****/
|
||||
h1, h2 {
|
||||
font-family: "Segoe UI Light", "Segoe UI", "Open Sans", Calibri, Candara, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
}
|
||||
h1 {
|
||||
font-size: 72px;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.hero-unit h1 {
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
h1 small,
|
||||
h2 small,
|
||||
h3 small,
|
||||
h4 small,
|
||||
h5 small,
|
||||
h6 small {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.alert-heading,
|
||||
.alert h1,
|
||||
.alert h2,
|
||||
.alert h3,
|
||||
.alert h4,
|
||||
.alert h5,
|
||||
.alert h6 {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.alert-info {
|
||||
color: #3a87ad;
|
||||
background-color: #d9edf7;
|
||||
}
|
||||
|
||||
.navbar-inverse .navbar-inner {
|
||||
background-color: #68217A;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
.navbar-inverse.home .navbar-inner {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.navbar-inverse .btn-navbar {
|
||||
background: transparent;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.navbar-inverse .btn-navbar:hover,
|
||||
.navbar-inverse .btn-navbar:focus,
|
||||
.navbar-inverse .btn-navbar:active,
|
||||
.navbar-inverse .btn-navbar.active,
|
||||
.navbar-inverse .btn-navbar.disabled,
|
||||
.navbar-inverse .btn-navbar[disabled] {
|
||||
background: #442359;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #0072C6;
|
||||
}
|
||||
|
||||
.home .hero-unit {
|
||||
margin-top: -54px;
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.hero-unit {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hero-unit h1 {
|
||||
margin: 0 0 6px;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a:hover {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.nav-tabs > .active > a,
|
||||
.nav-tabs > .active > a:hover,
|
||||
.nav-tabs > .active > a:focus {
|
||||
color: #0072C6;
|
||||
}
|
||||
|
||||
/***** General *****/
|
||||
|
||||
body > section > .container {
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
.masthead {
|
||||
background-color: #0072C6;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.masthead .hero-unit {
|
||||
padding: 30px 0 0;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.navbar.home {
|
||||
position: relative;
|
||||
z-index: 500;
|
||||
}
|
||||
|
||||
.navbar .nav>li>a {
|
||||
text-shadow: none;
|
||||
padding-top: 18px;
|
||||
font-size: 14px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav-collapse .nav>li>a {
|
||||
color: white;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav>li>a.nav-item:focus, .navbar-inverse .nav>li>a.nav-item:hover {
|
||||
background-color: rgba(0,0,0,.12);
|
||||
}
|
||||
|
||||
.navbar-inverse .nav .active>a.nav-item, .navbar-inverse .nav .active>a.nav-item:hover, .navbar-inverse .nav .active>a.nav-item:focus {
|
||||
color:#fff;
|
||||
background-color: rgba(0,0,0,.24);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.navbar .logo {
|
||||
/*background: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOSI+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTIxIDBsLTExIDEyLTcuMzMzLTUuNjY2LTIuNjY3IDEuNjgydjEzLjk4NGwyLjY2NyAxLjY2NiA3LjMzMy01LjY2NiAxMSAxMSA3LTN2LTIyLjMzM2wtNy0zLjY2N3ptLTE4IDE5di05bDQgNS00IDR6bTExLTRsNy02djEybC03LTZ6Ii8+PC9zdmc+") left center no-repeat;*/
|
||||
/*padding: 16px 12px 0 34px;*/
|
||||
padding: 16px 12px 0 0px;
|
||||
height: 35px;
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.navbar .logo a {
|
||||
color: #fff;
|
||||
font-size: 24px;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.navbar-fixed-top {
|
||||
z-index: 500;
|
||||
}
|
||||
|
||||
.flgroup:after {
|
||||
content: "";
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Controls */
|
||||
|
||||
/* Media Queries */
|
||||
@media (min-width: 1200px) {
|
||||
h1, h2 {
|
||||
letter-spacing: -0.04em;
|
||||
}
|
||||
|
||||
.hero-unit h1 {
|
||||
font-size: 72px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 36px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 980px) {
|
||||
.navbar .nav {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.navbar-inverse .nav-collapse .nav>li>a {
|
||||
padding-left: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) and (max-width: 979px) {
|
||||
h1 {
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 979px) {
|
||||
body {
|
||||
padding: inherit;
|
||||
}
|
||||
|
||||
.navbar-fixed-top, .navbar-fixed-bottom, .navbar-static-top {
|
||||
margin-right: inherit;
|
||||
margin-left: inherit;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.navbar-fixed-top .navbar-inner {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.navbar .container {
|
||||
width: 724px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.navbar .container {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.navbar .logo a {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
154
website/index.html
Normal file
154
website/index.html
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title>Monaco Editor</title>
|
||||
|
||||
<link href="./lib/bootstrap-cosmo.css" rel="stylesheet">
|
||||
<link href="./lib/bootstrap-responsive.min.css" rel="stylesheet">
|
||||
<link href="./all.css" rel="stylesheet" type="text/css">
|
||||
<link href="./lib/bootstrap-select.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<link href="./index/index.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<div class="logo">
|
||||
<a href="#">Monaco Editor</a>
|
||||
</div>
|
||||
<!-- collapse button for smaller screens -->
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
|
||||
<!-- navbar title -->
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<li><a class="nav-item" href="index.html">Home</a></li>
|
||||
<li><a class="nav-item" href="playground.html">Playground</a></li>
|
||||
<li><a class="nav-item" href="monarch.html">Monarch</a></li>
|
||||
<li><a class="nav-item" href="https://www.npmjs.com/package/monaco-editor">Download</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<section class="try">
|
||||
<div class="container">
|
||||
<h3>About</h3>
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
<br/>
|
||||
<p>The Monaco Editor is the code editor that powers <a href="https://github.com/Microsoft/vscode">VS Code</a>, a good page describing the code editor's features is <a href="https://code.visualstudio.com/docs/editor/editingevolved">here</a>.</p>
|
||||
|
||||
<p>It is licensed under the MIT License and supports IE 9/10/11, Edge, Chrome, Firefox, Safari and Opera.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
<h3>Editor</h3>
|
||||
<div class="editor row">
|
||||
<div class="span3">
|
||||
<h4 title="Syntax colorization plus support for errors, warnings, IntelliSense, formatting and outlining">Rich IntelliSense, Validation</h4>
|
||||
<p>TypeScript, JavaScript, CSS, LESS</p>
|
||||
<br>
|
||||
<h4 title="Syntax colorization">Basic Syntax Colorization</h4>
|
||||
<p>HTML, XML, PHP, C#, C++, Razor, Markdown, Diff, Java, VB, CoffeeScript, Handlebars, Batch, Jade, F#, Lua, Powershell,
|
||||
Python, SASS, R, Objective-C</p>
|
||||
<br>
|
||||
<p>Colorizers are implemented using <a href="monarch.html"
|
||||
target="_blank">Monarch</a>.</p>
|
||||
</div>
|
||||
<div class="span9">
|
||||
<div class="row">
|
||||
<div class="span4">
|
||||
<label class="control-label">Language</label>
|
||||
<select class="language-picker"></select>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<label class="control-label">Theme</label>
|
||||
<select class="theme-picker">
|
||||
<option>Visual Studio</option>
|
||||
<option>Visual Studio Dark</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-frame">
|
||||
<div class="loading editor" style="display: none;">
|
||||
<div class="progress progress-striped active">
|
||||
<div class="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="editor"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<h3>Diff Editor</h3>
|
||||
<div class="editor row">
|
||||
<div class="span3">
|
||||
<h4 title="As you type diffing for all supported languages">Side by side live comparison</h4>
|
||||
<p>Supports all languages out of the box</p>
|
||||
</div>
|
||||
<div class="span9">
|
||||
<div class="row">
|
||||
<div class="span8">
|
||||
<div class="checkbox">
|
||||
<label class="control-label">
|
||||
<input id="inline-diff-checkbox" type="checkbox" value=""> Inline diff
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-frame">
|
||||
<div class="loading diff-editor" style="display: none;">
|
||||
<div class="progress progress-striped active">
|
||||
<div class="bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="diff-editor"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="container">
|
||||
<hr>
|
||||
<p class="text-center">
|
||||
<small>© 2016 Microsoft</small>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="./lib/jquery-1.9.1.min.js" type="text/javascript"></script>
|
||||
<script src="./lib/bootstrap.min.js"></script>
|
||||
<script src="./lib/bootstrap-select.min.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript" src="../release/min/vs/loader.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.MonacoEnvironment = {
|
||||
getWorkerUrl: function(workerId, label) {
|
||||
return 'worker-loader-proxy.js';
|
||||
}
|
||||
};
|
||||
require.config({
|
||||
paths: {
|
||||
vs: '../release/min/vs'
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script src="./index/index.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
308
website/index/index.css
Normal file
308
website/index/index.css
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
.try [class*="span"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.try .drops {
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.try .drops li {
|
||||
float: left;
|
||||
width: auto;
|
||||
height: auto;
|
||||
text-indent: 0;
|
||||
font-size: 26px;
|
||||
line-height: normal;
|
||||
margin: 0 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.try .drops li a:hover,
|
||||
.try .drops li a:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.try .drops li h4 {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.try .drops li.active h4,
|
||||
.try .drops li.active:hover h4 {
|
||||
color: #0072C6;
|
||||
}
|
||||
|
||||
.try .drops li:hover h4 {
|
||||
color: rgba(0, 114, 198, .5);
|
||||
}
|
||||
|
||||
.try .editor.row {
|
||||
padding: 18px 0
|
||||
}
|
||||
|
||||
.try .row h4 {
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.try .tile {
|
||||
position: relative;
|
||||
height: 72px;
|
||||
border: 1px solid #ddd;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
|
||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
|
||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
|
||||
|
||||
-webkit-box-sizing: border-box;
|
||||
-o-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-ms-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.try .tile:hover {
|
||||
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
|
||||
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
|
||||
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.try .tile h4 {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
bottom: 12px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.try .tile .glyph {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
bottom: -6px;
|
||||
background: url('../img/cloud.png') no-repeat;
|
||||
background-size: 80px 43px;
|
||||
height: 43px;
|
||||
width: 80px;
|
||||
|
||||
opacity: .5;
|
||||
transition: opacity .5s ease, bottom .5s ease;
|
||||
-webkit-transition: opacity .5s ease, bottom .5s ease;
|
||||
}
|
||||
|
||||
.try .tile:hover .glyph {
|
||||
opacity: 1;
|
||||
bottom: -2px;
|
||||
}
|
||||
|
||||
.try .editor.row h4 small {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.try .editor.row .control-label {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top: -4px;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.try .editor.row .monaco-editor .find-widget input[type="text"] {
|
||||
margin-bottom: 0;
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
-o-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
.try .editor.row .monaco-editor .find-widget .monaco-checkbox .label {
|
||||
min-height: 20px;
|
||||
min-width: 20px;
|
||||
}
|
||||
|
||||
.try .editor.row .monaco-editor .find-widget .close {
|
||||
float: none;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .btn {
|
||||
background: none;
|
||||
color: #555;
|
||||
border: 1px solid #ddd;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .open .btn {
|
||||
background-color: #0072C6;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .open .btn .caret {
|
||||
border-top-color: #FFF;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .btn:focus {
|
||||
outline: 0 auto #0072C6 !important;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .btn:active,
|
||||
.try .editor.row .bootstrap-select.btn-group.open .dropdown-toggle {
|
||||
-webkit-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .dropdown-menu > li > a {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.try .editor.row .bootstrap-select .dropdown-menu > li > a:hover {
|
||||
background: none;
|
||||
background-color: #CDE7F9;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame #editor,
|
||||
.try .editor .editor-frame #diff-editor {
|
||||
height: 400px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame .loading {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: rgba(255, 255, 255, .5);
|
||||
margin: 0 auto;
|
||||
display: none;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame .progress {
|
||||
width: 50%;
|
||||
margin: 15% auto 0;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame .progress .bar {
|
||||
width: 100%;
|
||||
background-color: #4bb1cf;
|
||||
}
|
||||
|
||||
.try .editor .editor-frame #editor .alert,
|
||||
.try .editor .editor-frame #diff-editor .alert {
|
||||
margin: 18% auto 0;
|
||||
width: 30%;
|
||||
text-align: center;
|
||||
color: #b94a48;
|
||||
background-color: #f2dede;
|
||||
border-color: #eed3d7;
|
||||
}
|
||||
|
||||
.try .editor #editor .monaco-editor .row,
|
||||
.try .editor #diff-editor .monaco-editor .row {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.try .editor .vs.monaco-editor .context-view.monaco-menu-container a {
|
||||
color: #646465;
|
||||
}
|
||||
|
||||
.try .editor .vs-dark.monaco-editor .context-view.monaco-menu-container a {
|
||||
color: #BBB;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.try .container {
|
||||
margin: 0 24px;
|
||||
}
|
||||
|
||||
.try .tile h4 {
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.try .editor > .span9 .row .span4 {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.try .editor > .span9 .row .bootstrap-select {
|
||||
display: block;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.try .editor > .span9 .row .bootstrap-select .btn {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.try .editor h4 {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 520px) {
|
||||
.try .editor > .span3 p,
|
||||
.try .editor > .span3 h4 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 320px) {
|
||||
.try .editor > .span9 {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ------- BEGIN bootstrap fixes for the editor ------- */
|
||||
|
||||
.monaco-editor .container:before, .monaco-editor .row:before {
|
||||
content: "";
|
||||
display: inherit;
|
||||
}
|
||||
|
||||
.monaco-editor .container:after, .monaco-editor .row:after {
|
||||
clear: inherit;
|
||||
}
|
||||
|
||||
.monaco-editor .container {
|
||||
width: auto;
|
||||
margin: inherit;
|
||||
padding: inherit;
|
||||
}
|
||||
|
||||
.monaco-editor .close {
|
||||
float: none;
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
text-shadow: inherit;
|
||||
opacity: inherit;
|
||||
filter: inherit;
|
||||
}
|
||||
|
||||
.monaco-editor .row {
|
||||
margin: inherit;
|
||||
}
|
||||
|
||||
.monaco-editor .invisible {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* ------- END bootstrap fixes for the editor ------- */
|
||||
147
website/index/index.js
Normal file
147
website/index/index.js
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
/// <reference path="../../release/monaco.d.ts" />
|
||||
|
||||
"use strict";
|
||||
|
||||
var editor = null, diffEditor = null;
|
||||
|
||||
$(document).ready(function() {
|
||||
require(['vs/editor/editor.main'], function () {
|
||||
var MODES = (function() {
|
||||
var modesIds = monaco.languages.getLanguages().map(function(lang) { return lang.id; });
|
||||
modesIds.sort();
|
||||
|
||||
return modesIds.map(function(modeId) {
|
||||
return {
|
||||
modeId: modeId,
|
||||
sampleURL: 'index/samples/sample.' + modeId + '.txt'
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
for (var i = 0; i < MODES.length; i++) {
|
||||
var o = document.createElement('option');
|
||||
o.textContent = MODES[i].modeId;
|
||||
$(".language-picker").append(o);
|
||||
}
|
||||
$(".language-picker").change(function() {
|
||||
loadSample(MODES[this.selectedIndex]);
|
||||
});
|
||||
$('.language-picker').selectpicker({
|
||||
size: 10
|
||||
});
|
||||
loadSample(MODES[0]);
|
||||
|
||||
$(".theme-picker").change(function() {
|
||||
changeTheme(this.selectedIndex);
|
||||
});
|
||||
$('.theme-picker').selectpicker({
|
||||
size: 2
|
||||
});
|
||||
|
||||
loadDiffSample();
|
||||
|
||||
$('#inline-diff-checkbox').change(function () {
|
||||
diffEditor.updateOptions({
|
||||
renderSideBySide: !$(this).is(':checked')
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
window.onresize = function () {
|
||||
if (editor) {
|
||||
editor.layout();
|
||||
}
|
||||
if (diffEditor) {
|
||||
diffEditor.layout();
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
function loadSample(mode) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: mode.sampleURL,
|
||||
dataType: 'text',
|
||||
beforeSend: function() {
|
||||
$('.loading.editor').show();
|
||||
},
|
||||
error: function () {
|
||||
$('.loading.editor').fadeOut({ duration: 200 });
|
||||
$('#editor').append('<p class="alert alert-error">Failed to load ' + mode.name + ' sample</p>');
|
||||
}
|
||||
}).done(function (data) {
|
||||
if (!editor) {
|
||||
editor = monaco.editor.create(document.getElementById('editor'), {
|
||||
model: null,
|
||||
});
|
||||
}
|
||||
|
||||
var oldModel = editor.getModel();
|
||||
var newModel = monaco.editor.createModel(data, mode.modeId);
|
||||
editor.setModel(newModel);
|
||||
if (oldModel) {
|
||||
oldModel.dispose();
|
||||
}
|
||||
$('.loading.editor').fadeOut({ duration: 300 });
|
||||
});
|
||||
}
|
||||
|
||||
function loadDiffSample() {
|
||||
|
||||
var onError = function() {
|
||||
$('.loading.diff-editor').fadeOut({ duration: 200 });
|
||||
$('#diff-editor').append('<p class="alert alert-error">Failed to load diff editor sample</p>');
|
||||
};
|
||||
|
||||
$('.loading.diff-editor').show();
|
||||
|
||||
var lhsData = null, rhsData = null, jsMode = null;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'index/samples/diff.lhs.txt',
|
||||
dataType: 'text',
|
||||
error: onError
|
||||
}).done(function (data) {
|
||||
lhsData = data;
|
||||
onProgress();
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: 'index/samples/diff.rhs.txt',
|
||||
dataType: 'text',
|
||||
error: onError
|
||||
}).done(function (data) {
|
||||
rhsData = data;
|
||||
onProgress();
|
||||
});
|
||||
|
||||
function onProgress() {
|
||||
if (lhsData && rhsData) {
|
||||
diffEditor = monaco.editor.createDiffEditor(document.getElementById('diff-editor'), {
|
||||
enableSplitViewResizing: false
|
||||
});
|
||||
|
||||
var lhsModel = monaco.editor.createModel(lhsData, 'text/javascript');
|
||||
var rhsModel = monaco.editor.createModel(rhsData, 'text/javascript');
|
||||
|
||||
diffEditor.setModel({
|
||||
original: lhsModel,
|
||||
modified: rhsModel
|
||||
});
|
||||
|
||||
$('.loading.diff-editor').fadeOut({ duration: 300 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeTheme(theme) {
|
||||
var newTheme = (theme === 1 ? 'vs-dark' : 'vs');
|
||||
if (editor) {
|
||||
editor.updateOptions({ 'theme' : newTheme });
|
||||
}
|
||||
if (diffEditor) {
|
||||
diffEditor.updateOptions({ 'theme': newTheme });
|
||||
}
|
||||
}
|
||||
216
website/index/samples/diff.lhs.txt
Normal file
216
website/index/samples/diff.lhs.txt
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
|
||||
/*
|
||||
© Microsoft. All rights reserved.
|
||||
|
||||
This library is supported for use in Windows Tailored Apps only.
|
||||
|
||||
Build: 6.2.8100.0
|
||||
Version: 0.5
|
||||
*/
|
||||
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
undefinedVariable = {};
|
||||
undefinedVariable.prop = 5;
|
||||
|
||||
function initializeProperties(target, members) {
|
||||
var keys = Object.keys(members);
|
||||
var properties;
|
||||
var i, len;
|
||||
for (i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
var enumerable = key.charCodeAt(0) !== /*_*/95;
|
||||
var member = members[key];
|
||||
if (member && typeof member === 'object') {
|
||||
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
|
||||
if (member.enumerable === undefined) {
|
||||
member.enumerable = enumerable;
|
||||
}
|
||||
properties = properties || {};
|
||||
properties[key] = member;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// These next lines will be deleted
|
||||
if (!enumerable) {
|
||||
properties = properties || {};
|
||||
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
|
||||
continue;
|
||||
}
|
||||
target[key] = member;
|
||||
}
|
||||
if (properties) {
|
||||
Object.defineProperties(target, properties);
|
||||
}
|
||||
}
|
||||
|
||||
(function (rootNamespace) {
|
||||
|
||||
// Create the rootNamespace in the global namespace
|
||||
if (!global[rootNamespace]) {
|
||||
global[rootNamespace] = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
// Cache the rootNamespace we just created in a local variable
|
||||
var _rootNamespace = global[rootNamespace];
|
||||
if (!_rootNamespace.Namespace) {
|
||||
_rootNamespace.Namespace = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
function defineWithParent(parentNamespace, name, members) {
|
||||
/// <summary locid="1">
|
||||
/// Defines a new namespace with the specified name, under the specified parent namespace.
|
||||
/// </summary>
|
||||
/// <param name="parentNamespace" type="Object" locid="2">
|
||||
/// The parent namespace which will contain the new namespace.
|
||||
/// </param>
|
||||
/// <param name="name" type="String" locid="3">
|
||||
/// Name of the new namespace.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
var currentNamespace = parentNamespace,
|
||||
namespaceFragments = name.split(".");
|
||||
|
||||
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
|
||||
var namespaceName = namespaceFragments[i];
|
||||
if (!currentNamespace[namespaceName]) {
|
||||
Object.defineProperty(currentNamespace, namespaceName,
|
||||
{ value: {}, writable: false, enumerable: true, configurable: true }
|
||||
);
|
||||
}
|
||||
currentNamespace = currentNamespace[namespaceName];
|
||||
}
|
||||
|
||||
if (members) {
|
||||
initializeProperties(currentNamespace, members);
|
||||
}
|
||||
|
||||
return currentNamespace;
|
||||
}
|
||||
|
||||
function define(name, members) {
|
||||
/// <summary locid="6">
|
||||
/// Defines a new namespace with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name" type="String" locid="7">
|
||||
/// Name of the namespace. This could be a dot-separated nested name.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
return defineWithParent(global, name, members);
|
||||
}
|
||||
|
||||
// Establish members of the "WinJS.Namespace" namespace
|
||||
Object.defineProperties(_rootNamespace.Namespace, {
|
||||
|
||||
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
|
||||
|
||||
define: { value: define, writable: true, enumerable: true }
|
||||
|
||||
});
|
||||
|
||||
})("WinJS");
|
||||
|
||||
(function (WinJS) {
|
||||
|
||||
function define(constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="8">
|
||||
/// Defines a class using the given constructor and with the specified instance members.
|
||||
/// </summary>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
function derive(baseClass, constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="13">
|
||||
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
|
||||
/// </summary>
|
||||
/// <param name="baseClass" type="Function" locid="14">
|
||||
/// The class to inherit from.
|
||||
/// </param>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
if (baseClass) {
|
||||
constructor = constructor || function () { };
|
||||
var basePrototype = baseClass.prototype;
|
||||
constructor.prototype = Object.create(basePrototype);
|
||||
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
|
||||
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
} else {
|
||||
return define(constructor, instanceMembers, staticMembers);
|
||||
}
|
||||
}
|
||||
|
||||
function mix(constructor) {
|
||||
/// <summary locid="15">
|
||||
/// Defines a class using the given constructor and the union of the set of instance members
|
||||
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
|
||||
/// </summary>
|
||||
/// <param name="constructor" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <returns locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
var i, len;
|
||||
for (i = 0, len = arguments.length; i < len; i++) {
|
||||
initializeProperties(constructor.prototype, arguments[i]);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
// Establish members of "WinJS.Class" namespace
|
||||
WinJS.Namespace.define("WinJS.Class", {
|
||||
define: define,
|
||||
derive: derive,
|
||||
mix: mix
|
||||
});
|
||||
|
||||
})(WinJS);
|
||||
|
||||
})(this);
|
||||
213
website/index/samples/diff.rhs.txt
Normal file
213
website/index/samples/diff.rhs.txt
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
|
||||
/*
|
||||
© Microsoft. All rights reserved.
|
||||
|
||||
This library is supported for use in Windows Tailored Apps only.
|
||||
|
||||
Build: 6.2.8100.0
|
||||
Version: 0.5
|
||||
*/
|
||||
|
||||
// Here are some inserted lines
|
||||
// with some extra comments
|
||||
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
var definedVariable = {};
|
||||
definedVariable.prop = 5;
|
||||
|
||||
function initializeProperties(target, members) {
|
||||
var keys = Object.keys(members);
|
||||
var properties;
|
||||
var i, len;
|
||||
for (i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
var enumerable = key.charCodeAt(0) !== /*_*/95;
|
||||
var member = members[key];
|
||||
if (member && typeof member === 'object') {
|
||||
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
|
||||
if (member.enumerable === undefined) {
|
||||
member.enumerable = enumerable;
|
||||
}
|
||||
properties = properties || {};
|
||||
properties[key] = member;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
target[key] = member;
|
||||
}
|
||||
if (properties) {
|
||||
Object.defineProperties(target, properties);
|
||||
}
|
||||
}
|
||||
|
||||
(function (rootNamespace) {
|
||||
|
||||
// Create the rootNamespace in the global namespace
|
||||
if (!global[rootNamespace]) {
|
||||
global[rootNamespace] = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
// Cache the rootNamespace we just created in a local variable
|
||||
var _rootNamespace = global[rootNamespace];
|
||||
if (!_rootNamespace.Namespace) {
|
||||
_rootNamespace.Namespace = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
function defineWithParent(parentNamespace, name, members) {
|
||||
/// <summary locid="1">
|
||||
/// Defines a new namespace with the specified name, under the specified parent namespace.
|
||||
/// </summary>
|
||||
/// <param name="parentNamespace" type="Object" locid="2">
|
||||
/// The parent namespace which will contain the new namespace.
|
||||
/// </param>
|
||||
/// <param name="name" type="String" locid="3">
|
||||
/// Name of the new namespace.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
var currentNamespace = parentNamespace,
|
||||
namespaceFragments = name.split(".");
|
||||
|
||||
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
|
||||
var namespaceName = namespaceFragments[i];
|
||||
if (!currentNamespace[namespaceName]) {
|
||||
Object.defineProperty(currentNamespace, namespaceName,
|
||||
{ value: {}, writable: false, enumerable: true, configurable: true }
|
||||
);
|
||||
}
|
||||
currentNamespace = currentNamespace[namespaceName];
|
||||
}
|
||||
|
||||
if (members) {
|
||||
initializeProperties(currentNamespace, members);
|
||||
}
|
||||
|
||||
return currentNamespace;
|
||||
}
|
||||
|
||||
function define(name, members) {
|
||||
/// <summary locid="6">
|
||||
/// Defines a new namespace with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name" type="String" locid="7">
|
||||
/// Name of the namespace. This could be a dot-separated nested name.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
return defineWithParent(global, name, members);
|
||||
}
|
||||
|
||||
// Establish members of the "WinJS.Namespace" namespace
|
||||
Object.defineProperties(_rootNamespace.Namespace, {
|
||||
|
||||
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
|
||||
|
||||
define: { value: define, writable: true, enumerable: true }
|
||||
|
||||
});
|
||||
|
||||
})("WinJS");
|
||||
|
||||
(function (WinJS) {
|
||||
|
||||
function define(constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="8">
|
||||
/// Defines a class using the given constructor and with the specified instance members.
|
||||
/// </summary>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
function derive(baseClass, constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="13">
|
||||
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
|
||||
/// </summary>
|
||||
/// <param name="baseClass" type="Function" locid="14">
|
||||
/// The class to inherit from.
|
||||
/// </param>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
if (baseClass) {
|
||||
constructor = constructor || function () { };
|
||||
var basePrototype = baseClass.prototype;
|
||||
constructor.prototype = Object.create(basePrototype);
|
||||
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
|
||||
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
} else {
|
||||
return define(constructor, instanceMembers, staticMembers);
|
||||
}
|
||||
}
|
||||
|
||||
function mix(constructor) {
|
||||
/// <summary locid="15">
|
||||
/// Defines a class using the given constructor and the union of the set of instance members
|
||||
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
|
||||
/// </summary>
|
||||
/// <param name="constructor" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <returns locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
var i, len;
|
||||
for (i = 0, len = arguments.length; i < len; i++) {
|
||||
initializeProperties(constructor.prototype, arguments[i]);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
// Establish members of "WinJS.Class" namespace
|
||||
WinJS.Namespace.define("WinJS.Class", {
|
||||
define: define,
|
||||
derive: derive,
|
||||
mix: mix
|
||||
});
|
||||
|
||||
})(WinJS);
|
||||
|
||||
})(this);
|
||||
13
website/index/samples/sample.bat.txt
Normal file
13
website/index/samples/sample.bat.txt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
rem *******Begin Comment**************
|
||||
rem This program starts the superapp batch program on the network,
|
||||
rem directs the output to a file, and displays the file
|
||||
rem in Notepad.
|
||||
rem *******End Comment**************
|
||||
@echo off
|
||||
if exist C:\output.txt goto EMPTYEXISTS
|
||||
setlocal
|
||||
path=g:\programs\superapp;%path%
|
||||
call superapp>C:\output.txt
|
||||
endlocal
|
||||
:EMPTYEXISTS
|
||||
start notepad c:\output.txt
|
||||
246
website/index/samples/sample.c.txt
Normal file
246
website/index/samples/sample.c.txt
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
#include "pch.h"
|
||||
#include "Direct3DBase.h"
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
// Constructor.
|
||||
Direct3DBase::Direct3DBase()
|
||||
{
|
||||
}
|
||||
|
||||
// Initialize the Direct3D resources required to run.
|
||||
void Direct3DBase::Initialize(CoreWindow^ window)
|
||||
{
|
||||
m_window = window;
|
||||
|
||||
CreateDeviceResources();
|
||||
CreateWindowSizeDependentResources();
|
||||
}
|
||||
|
||||
// These are the resources that depend on the device.
|
||||
void Direct3DBase::CreateDeviceResources()
|
||||
{
|
||||
// This flag adds support for surfaces with a different color channel ordering than the API default.
|
||||
// It is recommended usage, and is required for compatibility with Direct2D.
|
||||
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
// If the project is in a debug build, enable debugging via SDK Layers with this flag.
|
||||
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
||||
// This array defines the set of DirectX hardware feature levels this app will support.
|
||||
// Note the ordering should be preserved.
|
||||
// Don't forget to declare your application's minimum required feature level in its
|
||||
// description. All applications are assumed to support 9.1 unless otherwise stated.
|
||||
D3D_FEATURE_LEVEL featureLevels[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
D3D_FEATURE_LEVEL_9_2,
|
||||
D3D_FEATURE_LEVEL_9_1
|
||||
};
|
||||
|
||||
// Create the DX11 API device object, and get a corresponding context.
|
||||
ComPtr<ID3D11Device> device;
|
||||
ComPtr<ID3D11DeviceContext> context;
|
||||
DX::ThrowIfFailed(
|
||||
D3D11CreateDevice(
|
||||
nullptr, // specify null to use the default adapter
|
||||
D3D_DRIVER_TYPE_HARDWARE,
|
||||
nullptr, // leave as nullptr unless software device
|
||||
creationFlags, // optionally set debug and Direct2D compatibility flags
|
||||
featureLevels, // list of feature levels this app can support
|
||||
ARRAYSIZE(featureLevels), // number of entries in above list
|
||||
D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION
|
||||
&device, // returns the Direct3D device created
|
||||
&m_featureLevel, // returns feature level of device created
|
||||
&context // returns the device immediate context
|
||||
)
|
||||
);
|
||||
|
||||
// Get the DirectX11.1 device by QI off the DirectX11 one.
|
||||
DX::ThrowIfFailed(
|
||||
device.As(&m_d3dDevice)
|
||||
);
|
||||
|
||||
// And get the corresponding device context in the same way.
|
||||
DX::ThrowIfFailed(
|
||||
context.As(&m_d3dContext)
|
||||
);
|
||||
}
|
||||
|
||||
// Allocate all memory resources that change on a window SizeChanged event.
|
||||
void Direct3DBase::CreateWindowSizeDependentResources()
|
||||
{
|
||||
// Store the window bounds so the next time we get a SizeChanged event we can
|
||||
// avoid rebuilding everything if the size is identical.
|
||||
m_windowBounds = m_window->Bounds;
|
||||
|
||||
// If the swap chain already exists, resize it.
|
||||
if(m_swapChain != nullptr)
|
||||
{
|
||||
DX::ThrowIfFailed(
|
||||
m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)
|
||||
);
|
||||
}
|
||||
// Otherwise, create a new one.
|
||||
else
|
||||
{
|
||||
// Create a descriptor for the swap chain.
|
||||
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
|
||||
swapChainDesc.Width = 0; // use automatic sizing
|
||||
swapChainDesc.Height = 0;
|
||||
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format
|
||||
swapChainDesc.Stereo = false;
|
||||
swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling
|
||||
swapChainDesc.SampleDesc.Quality = 0;
|
||||
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect
|
||||
swapChainDesc.Scaling = DXGI_SCALING_NONE;
|
||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications
|
||||
swapChainDesc.Flags = 0;
|
||||
|
||||
// Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device
|
||||
|
||||
// First, retrieve the underlying DXGI Device from the D3D Device
|
||||
ComPtr<IDXGIDevice1> dxgiDevice;
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice.As(&dxgiDevice)
|
||||
);
|
||||
|
||||
// Identify the physical adapter (GPU or card) this device is running on.
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter;
|
||||
DX::ThrowIfFailed(
|
||||
dxgiDevice->GetAdapter(&dxgiAdapter)
|
||||
);
|
||||
|
||||
// And obtain the factory object that created it.
|
||||
ComPtr<IDXGIFactory2> dxgiFactory;
|
||||
DX::ThrowIfFailed(
|
||||
dxgiAdapter->GetParent(
|
||||
__uuidof(IDXGIFactory2),
|
||||
&dxgiFactory
|
||||
)
|
||||
);
|
||||
|
||||
Windows::UI::Core::CoreWindow^ p = m_window.Get();
|
||||
|
||||
// Create a swap chain for this window from the DXGI factory.
|
||||
DX::ThrowIfFailed(
|
||||
dxgiFactory->CreateSwapChainForCoreWindow(
|
||||
m_d3dDevice.Get(),
|
||||
reinterpret_cast<IUnknown*>(p),
|
||||
&swapChainDesc,
|
||||
nullptr, // allow on all displays
|
||||
&m_swapChain
|
||||
)
|
||||
);
|
||||
|
||||
// Ensure that DXGI does not queue more than one frame at a time. This both reduces
|
||||
// latency and ensures that the application will only render after each VSync, minimizing
|
||||
// power consumption.
|
||||
DX::ThrowIfFailed(
|
||||
dxgiDevice->SetMaximumFrameLatency(1)
|
||||
);
|
||||
}
|
||||
|
||||
// Obtain the backbuffer for this window which will be the final 3D rendertarget.
|
||||
ComPtr<ID3D11Texture2D> backBuffer;
|
||||
DX::ThrowIfFailed(
|
||||
m_swapChain->GetBuffer(
|
||||
0,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
&backBuffer
|
||||
)
|
||||
);
|
||||
|
||||
// Create a view interface on the rendertarget to use on bind.
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateRenderTargetView(
|
||||
backBuffer.Get(),
|
||||
nullptr,
|
||||
&m_renderTargetView
|
||||
)
|
||||
);
|
||||
|
||||
// Cache the rendertarget dimensions in our helper class for convenient use.
|
||||
D3D11_TEXTURE2D_DESC backBufferDesc;
|
||||
backBuffer->GetDesc(&backBufferDesc);
|
||||
m_renderTargetSize.Width = static_cast<float>(backBufferDesc.Width);
|
||||
m_renderTargetSize.Height = static_cast<float>(backBufferDesc.Height);
|
||||
|
||||
// Create a descriptor for the depth/stencil buffer.
|
||||
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
||||
DXGI_FORMAT_D24_UNORM_S8_UINT,
|
||||
backBufferDesc.Width,
|
||||
backBufferDesc.Height,
|
||||
1,
|
||||
1,
|
||||
D3D11_BIND_DEPTH_STENCIL);
|
||||
|
||||
// Allocate a 2-D surface as the depth/stencil buffer.
|
||||
ComPtr<ID3D11Texture2D> depthStencil;
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateTexture2D(
|
||||
&depthStencilDesc,
|
||||
nullptr,
|
||||
&depthStencil
|
||||
)
|
||||
);
|
||||
|
||||
// Create a DepthStencil view on this surface to use on bind.
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateDepthStencilView(
|
||||
depthStencil.Get(),
|
||||
&CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D),
|
||||
&m_depthStencilView
|
||||
)
|
||||
);
|
||||
|
||||
// Create a viewport descriptor of the full window size.
|
||||
CD3D11_VIEWPORT viewPort(
|
||||
0.0f,
|
||||
0.0f,
|
||||
static_cast<float>(backBufferDesc.Width),
|
||||
static_cast<float>(backBufferDesc.Height)
|
||||
);
|
||||
|
||||
// Set the current viewport using the descriptor.
|
||||
m_d3dContext->RSSetViewports(1, &viewPort);
|
||||
}
|
||||
|
||||
void Direct3DBase::UpdateForWindowSizeChange()
|
||||
{
|
||||
if (m_window->Bounds.Width != m_windowBounds.Width ||
|
||||
m_window->Bounds.Height != m_windowBounds.Height)
|
||||
{
|
||||
m_renderTargetView = nullptr;
|
||||
m_depthStencilView = nullptr;
|
||||
CreateWindowSizeDependentResources();
|
||||
}
|
||||
}
|
||||
|
||||
void Direct3DBase::Present()
|
||||
{
|
||||
// The first argument instructs DXGI to block until VSync, putting the application
|
||||
// to sleep until the next VSync. This ensures we don't waste any cycles rendering
|
||||
// frames that will never be displayed to the screen.
|
||||
HRESULT hr = m_swapChain->Present(1, 0);
|
||||
|
||||
// If the device was removed either by a disconnect or a driver upgrade, we
|
||||
// must completely reinitialize the renderer.
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
|
||||
{
|
||||
Initialize(m_window.Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
DX::ThrowIfFailed(hr);
|
||||
}
|
||||
}
|
||||
28
website/index/samples/sample.coffeescript.txt
Normal file
28
website/index/samples/sample.coffeescript.txt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
"""
|
||||
A CoffeeScript sample.
|
||||
"""
|
||||
|
||||
class Vehicle
|
||||
constructor: (@name) =>
|
||||
|
||||
drive: () =>
|
||||
alert "Conducting #{@name}"
|
||||
|
||||
class Car extends Vehicle
|
||||
drive: () =>
|
||||
alert "Driving #{@name}"
|
||||
|
||||
c = new Car "Brandie"
|
||||
|
||||
while notAtDestination()
|
||||
c.drive()
|
||||
|
||||
raceVehicles = (new Car for i in [1..100])
|
||||
|
||||
startRace = (vehicles) -> [vehicle.drive() for vehicle in vehicles]
|
||||
|
||||
fancyRegExp = ///
|
||||
(\d+) # numbers
|
||||
(\w*) # letters
|
||||
$ # the end
|
||||
///
|
||||
246
website/index/samples/sample.cpp.txt
Normal file
246
website/index/samples/sample.cpp.txt
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
#include "pch.h"
|
||||
#include "Direct3DBase.h"
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Windows::UI::Core;
|
||||
using namespace Windows::Foundation;
|
||||
|
||||
// Constructor.
|
||||
Direct3DBase::Direct3DBase()
|
||||
{
|
||||
}
|
||||
|
||||
// Initialize the Direct3D resources required to run.
|
||||
void Direct3DBase::Initialize(CoreWindow^ window)
|
||||
{
|
||||
m_window = window;
|
||||
|
||||
CreateDeviceResources();
|
||||
CreateWindowSizeDependentResources();
|
||||
}
|
||||
|
||||
// These are the resources that depend on the device.
|
||||
void Direct3DBase::CreateDeviceResources()
|
||||
{
|
||||
// This flag adds support for surfaces with a different color channel ordering than the API default.
|
||||
// It is recommended usage, and is required for compatibility with Direct2D.
|
||||
UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
|
||||
|
||||
#if defined(_DEBUG)
|
||||
// If the project is in a debug build, enable debugging via SDK Layers with this flag.
|
||||
creationFlags |= D3D11_CREATE_DEVICE_DEBUG;
|
||||
#endif
|
||||
|
||||
// This array defines the set of DirectX hardware feature levels this app will support.
|
||||
// Note the ordering should be preserved.
|
||||
// Don't forget to declare your application's minimum required feature level in its
|
||||
// description. All applications are assumed to support 9.1 unless otherwise stated.
|
||||
D3D_FEATURE_LEVEL featureLevels[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
D3D_FEATURE_LEVEL_9_2,
|
||||
D3D_FEATURE_LEVEL_9_1
|
||||
};
|
||||
|
||||
// Create the DX11 API device object, and get a corresponding context.
|
||||
ComPtr<ID3D11Device> device;
|
||||
ComPtr<ID3D11DeviceContext> context;
|
||||
DX::ThrowIfFailed(
|
||||
D3D11CreateDevice(
|
||||
nullptr, // specify null to use the default adapter
|
||||
D3D_DRIVER_TYPE_HARDWARE,
|
||||
nullptr, // leave as nullptr unless software device
|
||||
creationFlags, // optionally set debug and Direct2D compatibility flags
|
||||
featureLevels, // list of feature levels this app can support
|
||||
ARRAYSIZE(featureLevels), // number of entries in above list
|
||||
D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION
|
||||
&device, // returns the Direct3D device created
|
||||
&m_featureLevel, // returns feature level of device created
|
||||
&context // returns the device immediate context
|
||||
)
|
||||
);
|
||||
|
||||
// Get the DirectX11.1 device by QI off the DirectX11 one.
|
||||
DX::ThrowIfFailed(
|
||||
device.As(&m_d3dDevice)
|
||||
);
|
||||
|
||||
// And get the corresponding device context in the same way.
|
||||
DX::ThrowIfFailed(
|
||||
context.As(&m_d3dContext)
|
||||
);
|
||||
}
|
||||
|
||||
// Allocate all memory resources that change on a window SizeChanged event.
|
||||
void Direct3DBase::CreateWindowSizeDependentResources()
|
||||
{
|
||||
// Store the window bounds so the next time we get a SizeChanged event we can
|
||||
// avoid rebuilding everything if the size is identical.
|
||||
m_windowBounds = m_window->Bounds;
|
||||
|
||||
// If the swap chain already exists, resize it.
|
||||
if(m_swapChain != nullptr)
|
||||
{
|
||||
DX::ThrowIfFailed(
|
||||
m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)
|
||||
);
|
||||
}
|
||||
// Otherwise, create a new one.
|
||||
else
|
||||
{
|
||||
// Create a descriptor for the swap chain.
|
||||
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};
|
||||
swapChainDesc.Width = 0; // use automatic sizing
|
||||
swapChainDesc.Height = 0;
|
||||
swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format
|
||||
swapChainDesc.Stereo = false;
|
||||
swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling
|
||||
swapChainDesc.SampleDesc.Quality = 0;
|
||||
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||
swapChainDesc.BufferCount = 2; // use two buffers to enable flip effect
|
||||
swapChainDesc.Scaling = DXGI_SCALING_NONE;
|
||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; // we recommend using this swap effect for all applications
|
||||
swapChainDesc.Flags = 0;
|
||||
|
||||
// Once the desired swap chain description is configured, it must be created on the same adapter as our D3D Device
|
||||
|
||||
// First, retrieve the underlying DXGI Device from the D3D Device
|
||||
ComPtr<IDXGIDevice1> dxgiDevice;
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice.As(&dxgiDevice)
|
||||
);
|
||||
|
||||
// Identify the physical adapter (GPU or card) this device is running on.
|
||||
ComPtr<IDXGIAdapter> dxgiAdapter;
|
||||
DX::ThrowIfFailed(
|
||||
dxgiDevice->GetAdapter(&dxgiAdapter)
|
||||
);
|
||||
|
||||
// And obtain the factory object that created it.
|
||||
ComPtr<IDXGIFactory2> dxgiFactory;
|
||||
DX::ThrowIfFailed(
|
||||
dxgiAdapter->GetParent(
|
||||
__uuidof(IDXGIFactory2),
|
||||
&dxgiFactory
|
||||
)
|
||||
);
|
||||
|
||||
Windows::UI::Core::CoreWindow^ p = m_window.Get();
|
||||
|
||||
// Create a swap chain for this window from the DXGI factory.
|
||||
DX::ThrowIfFailed(
|
||||
dxgiFactory->CreateSwapChainForCoreWindow(
|
||||
m_d3dDevice.Get(),
|
||||
reinterpret_cast<IUnknown*>(p),
|
||||
&swapChainDesc,
|
||||
nullptr, // allow on all displays
|
||||
&m_swapChain
|
||||
)
|
||||
);
|
||||
|
||||
// Ensure that DXGI does not queue more than one frame at a time. This both reduces
|
||||
// latency and ensures that the application will only render after each VSync, minimizing
|
||||
// power consumption.
|
||||
DX::ThrowIfFailed(
|
||||
dxgiDevice->SetMaximumFrameLatency(1)
|
||||
);
|
||||
}
|
||||
|
||||
// Obtain the backbuffer for this window which will be the final 3D rendertarget.
|
||||
ComPtr<ID3D11Texture2D> backBuffer;
|
||||
DX::ThrowIfFailed(
|
||||
m_swapChain->GetBuffer(
|
||||
0,
|
||||
__uuidof(ID3D11Texture2D),
|
||||
&backBuffer
|
||||
)
|
||||
);
|
||||
|
||||
// Create a view interface on the rendertarget to use on bind.
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateRenderTargetView(
|
||||
backBuffer.Get(),
|
||||
nullptr,
|
||||
&m_renderTargetView
|
||||
)
|
||||
);
|
||||
|
||||
// Cache the rendertarget dimensions in our helper class for convenient use.
|
||||
D3D11_TEXTURE2D_DESC backBufferDesc;
|
||||
backBuffer->GetDesc(&backBufferDesc);
|
||||
m_renderTargetSize.Width = static_cast<float>(backBufferDesc.Width);
|
||||
m_renderTargetSize.Height = static_cast<float>(backBufferDesc.Height);
|
||||
|
||||
// Create a descriptor for the depth/stencil buffer.
|
||||
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
||||
DXGI_FORMAT_D24_UNORM_S8_UINT,
|
||||
backBufferDesc.Width,
|
||||
backBufferDesc.Height,
|
||||
1,
|
||||
1,
|
||||
D3D11_BIND_DEPTH_STENCIL);
|
||||
|
||||
// Allocate a 2-D surface as the depth/stencil buffer.
|
||||
ComPtr<ID3D11Texture2D> depthStencil;
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateTexture2D(
|
||||
&depthStencilDesc,
|
||||
nullptr,
|
||||
&depthStencil
|
||||
)
|
||||
);
|
||||
|
||||
// Create a DepthStencil view on this surface to use on bind.
|
||||
DX::ThrowIfFailed(
|
||||
m_d3dDevice->CreateDepthStencilView(
|
||||
depthStencil.Get(),
|
||||
&CD3D11_DEPTH_STENCIL_VIEW_DESC(D3D11_DSV_DIMENSION_TEXTURE2D),
|
||||
&m_depthStencilView
|
||||
)
|
||||
);
|
||||
|
||||
// Create a viewport descriptor of the full window size.
|
||||
CD3D11_VIEWPORT viewPort(
|
||||
0.0f,
|
||||
0.0f,
|
||||
static_cast<float>(backBufferDesc.Width),
|
||||
static_cast<float>(backBufferDesc.Height)
|
||||
);
|
||||
|
||||
// Set the current viewport using the descriptor.
|
||||
m_d3dContext->RSSetViewports(1, &viewPort);
|
||||
}
|
||||
|
||||
void Direct3DBase::UpdateForWindowSizeChange()
|
||||
{
|
||||
if (m_window->Bounds.Width != m_windowBounds.Width ||
|
||||
m_window->Bounds.Height != m_windowBounds.Height)
|
||||
{
|
||||
m_renderTargetView = nullptr;
|
||||
m_depthStencilView = nullptr;
|
||||
CreateWindowSizeDependentResources();
|
||||
}
|
||||
}
|
||||
|
||||
void Direct3DBase::Present()
|
||||
{
|
||||
// The first argument instructs DXGI to block until VSync, putting the application
|
||||
// to sleep until the next VSync. This ensures we don't waste any cycles rendering
|
||||
// frames that will never be displayed to the screen.
|
||||
HRESULT hr = m_swapChain->Present(1, 0);
|
||||
|
||||
// If the device was removed either by a disconnect or a driver upgrade, we
|
||||
// must completely reinitialize the renderer.
|
||||
if (hr == DXGI_ERROR_DEVICE_REMOVED || hr == DXGI_ERROR_DEVICE_RESET)
|
||||
{
|
||||
Initialize(m_window.Get());
|
||||
}
|
||||
else
|
||||
{
|
||||
DX::ThrowIfFailed(hr);
|
||||
}
|
||||
}
|
||||
23
website/index/samples/sample.csharp.txt
Normal file
23
website/index/samples/sample.csharp.txt
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace VS
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
ProcessStartInfo si = new ProcessStartInfo();
|
||||
float load= 3.2e02f;
|
||||
|
||||
si.FileName = @"tools\\node.exe";
|
||||
si.Arguments = "tools\\simpleserver.js";
|
||||
|
||||
Process.Start(si);
|
||||
}
|
||||
}
|
||||
}
|
||||
828
website/index/samples/sample.css.txt
Normal file
828
website/index/samples/sample.css.txt
Normal file
|
|
@ -0,0 +1,828 @@
|
|||
html {
|
||||
background-color: #e2e2e2;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
border-top: solid 10px #000;
|
||||
color: #333;
|
||||
font-size: .85em;
|
||||
font-family: "Segoe UI","HelveticaNeue-Light", sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
a:link, a:visited,
|
||||
a:active, a:hover {
|
||||
color: #333;
|
||||
outline: none;
|
||||
padding-left: 0;
|
||||
padding-right: 3px;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
|
||||
a:hover {
|
||||
background-color: #c7d1d6;
|
||||
}
|
||||
|
||||
|
||||
header, footer, hgroup
|
||||
nav, section {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.float-left {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.float-right {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
/* background-color: #a6dbed;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;*/
|
||||
}
|
||||
|
||||
.clear-fix:after {
|
||||
content: ".";
|
||||
clear: both;
|
||||
display: block;
|
||||
height: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
h1, h2, h3,
|
||||
h4, h5, h6 {
|
||||
color: #000;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.75em;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
h5, h6 {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
|
||||
.tile {
|
||||
/* 2px solid #7ac0da; */
|
||||
border: 0;
|
||||
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: 325px;
|
||||
|
||||
padding: 5px;
|
||||
margin-right: 5px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 20px;
|
||||
-webkit-perspective: 0;
|
||||
-webkit-transform-style: preserve-3d;
|
||||
-webkit-transition: -webkit-transform 0.2s;
|
||||
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.tile-item {
|
||||
/* 2px solid #7ac0da; */
|
||||
border-color: inherit;
|
||||
float: left;
|
||||
width: 50px;
|
||||
height: 70px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 20px;
|
||||
margin-top: 20px;
|
||||
background-image: url('../Images/documents.png');
|
||||
background-repeat: no-repeat;
|
||||
|
||||
}
|
||||
|
||||
.tile-wrapper {
|
||||
width: 100%;
|
||||
font-family: "Segoe UI" , Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 21px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
a.blue-box {
|
||||
font-size: 28px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 4px 1px;
|
||||
border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;
|
||||
padding-top: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
a.blue-box:hover {
|
||||
border: 4px solid #8ABAE4;
|
||||
padding-top: 12px;
|
||||
padding-left: 12px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
a.green-box {
|
||||
font-size: 28px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 4px 1px;
|
||||
border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;
|
||||
padding-top: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
a.green-box:hover {
|
||||
border: 4px solid #9CCF42;
|
||||
padding-top: 12px;
|
||||
padding-left: 12px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
a.green-box2 {
|
||||
font-size: 14px;
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
display: block; /* border-color: #C0C0C0; */
|
||||
padding-top: 6px;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
a.green-box2:hover {
|
||||
border: solid #8ABAE4;
|
||||
padding-top: 0px;
|
||||
padding-left: 0px;
|
||||
background-image: url('../Images/documents.png');
|
||||
background-color: #EFEFEF;
|
||||
}
|
||||
|
||||
a.yellow-box {
|
||||
font-size: 28px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 4px 1px;
|
||||
border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;
|
||||
padding-top: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
a.yellow-box:hover {
|
||||
border: 4px solid #DECF6B;
|
||||
padding-top: 12px;
|
||||
padding-left: 12px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
||||
a.red-box {
|
||||
font-size: 28px;
|
||||
height: 100px;
|
||||
display: block;
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 4px 1px;
|
||||
border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0;
|
||||
padding-top: 15px;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
a.red-box:hover {
|
||||
border: 4px solid #F79E84;
|
||||
padding-top: 12px;
|
||||
padding-left: 12px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
/* main layout
|
||||
----------------------------------------------------------*/
|
||||
.content-wrapper {
|
||||
margin: 0 auto;
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
#body {
|
||||
background-color: #efeeef;
|
||||
clear: both;
|
||||
padding-bottom: 35px;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
background: url("../images/accent.png") no-repeat;
|
||||
padding-left: 10px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.featured + .main-content {
|
||||
background: url("../images/heroaccent.png") no-repeat;
|
||||
}
|
||||
|
||||
footer {
|
||||
clear: both;
|
||||
background-color: #e2e2e2;
|
||||
font-size: .8em;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
|
||||
/* site title
|
||||
----------------------------------------------------------*/
|
||||
.site-title {
|
||||
color: #0066CC; /* font-family: Rockwell, Consolas, "Courier New", Courier, monospace; */
|
||||
font-size: 3.3em;
|
||||
margin-top: 40px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.site-title a, .site-title a:hover, .site-title a:active {
|
||||
background: none;
|
||||
color: #0066CC;
|
||||
outline: none;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
/* login
|
||||
----------------------------------------------------------*/
|
||||
#login {
|
||||
display: block;
|
||||
font-size: .85em;
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#login a {
|
||||
background-color: #d3dce0;
|
||||
margin-left: 10px;
|
||||
margin-right: 3px;
|
||||
padding: 2px 3px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#login a.username {
|
||||
background: none;
|
||||
margin-left: 0px;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#login li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
|
||||
/* menu
|
||||
----------------------------------------------------------*/
|
||||
ul#menu {
|
||||
font-size: 1.3em;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
text-decoration: none;
|
||||
|
||||
}
|
||||
|
||||
ul#menu li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
ul#menu li a {
|
||||
background: none;
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
ul#menu li a:hover {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* page elements
|
||||
----------------------------------------------------------*/
|
||||
/* featured */
|
||||
.featured {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.featured .content-wrapper {
|
||||
/*background-color: #7ac0da;
|
||||
background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
|
||||
background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
|
||||
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6));
|
||||
background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
|
||||
background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);
|
||||
color: #3e5667;
|
||||
*/
|
||||
padding: 0px 40px 30px 40px;
|
||||
}
|
||||
|
||||
.featured hgroup.title h1, .featured hgroup.title h2 {
|
||||
/* color: #fff;
|
||||
*/
|
||||
}
|
||||
|
||||
.featured p {
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* page titles */
|
||||
hgroup.title {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
hgroup.title h1, hgroup.title h2 {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
hgroup.title h2 {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* releases */
|
||||
.milestone {
|
||||
color: #fff;
|
||||
background-color: #8ABAE4;
|
||||
font-weight: normal;
|
||||
padding: 10px 10px 10px 10px;
|
||||
margin: 0 0 0 0;
|
||||
}
|
||||
.milestone .primary {
|
||||
font-size: 1.75em;
|
||||
}
|
||||
|
||||
.milestone .secondary {
|
||||
font-size: 1.2em;
|
||||
font-weight: normal;
|
||||
/* padding: 5px 5px 5px 10px;*/
|
||||
}
|
||||
|
||||
/* features */
|
||||
section.feature {
|
||||
width: 200px;
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* ordered list */
|
||||
ol.round {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
ol.round li {
|
||||
margin: 25px 0;
|
||||
padding-left: 45px;
|
||||
}
|
||||
|
||||
ol.round li.one {
|
||||
background: url("../images/orderedlistOne.png") no-repeat;
|
||||
}
|
||||
|
||||
ol.round li.two {
|
||||
background: url("../images/orderedlistTwo.png") no-repeat;
|
||||
}
|
||||
|
||||
ol.round li.three {
|
||||
background: url("../images/orderedlistThree.png") no-repeat;
|
||||
}
|
||||
|
||||
/* content */
|
||||
article {
|
||||
float: left;
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
aside {
|
||||
float: right;
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
aside ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
aside ul li {
|
||||
background: url("../images/bullet.png") no-repeat 0 50%;
|
||||
padding: 2px 0 2px 20px;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/* login page */
|
||||
#loginForm {
|
||||
border-right: solid 2px #c8c8c8;
|
||||
float: left;
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
#loginForm .validation-error {
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#socialLoginForm {
|
||||
margin-left: 40px;
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
/* contact */
|
||||
.contact h3 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.contact p {
|
||||
margin: 5px 0 0 10px;
|
||||
}
|
||||
|
||||
.contact iframe {
|
||||
border: solid 1px #333;
|
||||
margin: 5px 0 0 10px;
|
||||
}
|
||||
|
||||
/* forms */
|
||||
fieldset {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
display: none;
|
||||
}
|
||||
|
||||
fieldset ol {
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
fieldset ol li {
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
fieldset label {
|
||||
display: block;
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
fieldset label.checkbox {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
fieldset input[type="text"],
|
||||
fieldset input[type="password"] {
|
||||
border: 1px solid #e2e2e2;
|
||||
color: #333;
|
||||
font-size: 1.2em;
|
||||
margin: 5px 0 6px 0;
|
||||
padding: 5px;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
fieldset input[type="text"]:focus,
|
||||
fieldset input[type="password"]:focus {
|
||||
border: 1px solid #7ac0da;
|
||||
}
|
||||
|
||||
fieldset input[type="submit"] {
|
||||
background-color: #d3dce0;
|
||||
border: solid 1px #787878;
|
||||
cursor: pointer;
|
||||
font-size: 1.2em;
|
||||
font-weight: 600;
|
||||
padding: 7px;
|
||||
}
|
||||
|
||||
/* ajax login/registration dialog */
|
||||
.modal-popup {
|
||||
font-size: 0.7em;
|
||||
}
|
||||
|
||||
/* info and errors */
|
||||
.message-info {
|
||||
border: solid 1px;
|
||||
clear: both;
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.message-error {
|
||||
clear: both;
|
||||
color: #e80c4d;
|
||||
font-size: 1.1em;
|
||||
font-weight: bold;
|
||||
margin: 20px 0 10px 0;
|
||||
}
|
||||
|
||||
.message-success {
|
||||
color: #7ac0da;
|
||||
font-size: 1.3em;
|
||||
font-weight: bold;
|
||||
margin: 20px 0 10px 0;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: #7ac0da;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #e80c4d;
|
||||
}
|
||||
|
||||
/* styles for validation helpers */
|
||||
.field-validation-error {
|
||||
color: #e80c4d;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.field-validation-valid {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input[type="text"].input-validation-error,
|
||||
input[type="password"].input-validation-error {
|
||||
border: solid 1px #e80c4d;
|
||||
}
|
||||
|
||||
.validation-summary-errors {
|
||||
color: #e80c4d;
|
||||
font-weight: bold;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.validation-summary-valid {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* social */
|
||||
ul#social li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
ul#social li a {
|
||||
color: #999;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.facebook, a.twitter {
|
||||
display: block;
|
||||
float: left;
|
||||
height: 24px;
|
||||
padding-left: 17px;
|
||||
text-indent: -9999px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
a.facebook {
|
||||
background: url("../images/facebook.png") no-repeat;
|
||||
}
|
||||
|
||||
a.twitter {
|
||||
background: url("../images/twitter.png") no-repeat;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************
|
||||
* Mobile Styles *
|
||||
********************/
|
||||
@media only screen and (max-width: 850px) {
|
||||
|
||||
/* header
|
||||
----------------------------------------------------------*/
|
||||
header .float-left,
|
||||
header .float-right {
|
||||
float: none;
|
||||
}
|
||||
|
||||
/* logo */
|
||||
header .site-title {
|
||||
/*margin: 0; */
|
||||
/*margin: 10px;*/
|
||||
text-align: left;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
/* login */
|
||||
#login {
|
||||
font-size: .85em;
|
||||
margin-top: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#login ul {
|
||||
margin: 5px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#login li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
#login a {
|
||||
background: none;
|
||||
color: #999;
|
||||
font-weight: 600;
|
||||
margin: 2px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#login a:hover {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* menu */
|
||||
nav {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
ul#menu {
|
||||
margin: 0;
|
||||
padding:0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
ul#menu li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* main layout
|
||||
----------------------------------------------------------*/
|
||||
.main-content,
|
||||
.featured + .main-content {
|
||||
background-position: 10px 0;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.featured .content-wrapper {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* page content */
|
||||
article, aside {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ordered list */
|
||||
ol.round {
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
ol.round li {
|
||||
padding-left: 10px;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
ol.round li.one,
|
||||
ol.round li.two,
|
||||
ol.round li.three {
|
||||
background: none;
|
||||
}
|
||||
|
||||
/* features */
|
||||
section.feature {
|
||||
float: none;
|
||||
padding: 10px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
section.feature img {
|
||||
color: #999;
|
||||
content: attr(alt);
|
||||
font-size: 1.5em;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* forms */
|
||||
fieldset input[type="text"],
|
||||
fieldset input[type="password"] {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
/* login page */
|
||||
#loginForm {
|
||||
border-right: none;
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#loginForm .validation-error {
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#socialLoginForm {
|
||||
margin-left: 0;
|
||||
float: none;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* footer
|
||||
----------------------------------------------------------*/
|
||||
footer .float-left,
|
||||
footer .float-right {
|
||||
float: none;
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
height: auto;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
footer p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
ul#social {
|
||||
padding:0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a.facebook, a.twitter {
|
||||
background: none;
|
||||
display: inline;
|
||||
float: none;
|
||||
height: auto;
|
||||
padding-left: 0;
|
||||
text-indent: 0;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.subsite {
|
||||
color: #444;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-weight: normal;
|
||||
font-size: 24px;
|
||||
color: #444;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.tiles {
|
||||
padding-bottom: 20px;
|
||||
background-color: #e3e3e3;
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin: 0 auto;
|
||||
height: 500px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
|
||||
.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background {
|
||||
background: #F9F9F9;
|
||||
}
|
||||
32
website/index/samples/sample.dockerfile.txt
Normal file
32
website/index/samples/sample.dockerfile.txt
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
FROM mono:3.12
|
||||
|
||||
ENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2
|
||||
ENV KRE_USER_HOME /opt/kre
|
||||
|
||||
RUN apt-get -qq update && apt-get -qqy install unzip
|
||||
|
||||
ONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh
|
||||
ONBUILD RUN bash -c "source $KRE_USER_HOME/kvm/kvm.sh \
|
||||
&& kvm install latest -a default \
|
||||
&& kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default"
|
||||
|
||||
# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
|
||||
RUN apt-get -qqy install \
|
||||
autoconf \
|
||||
automake \
|
||||
build-essential \
|
||||
libtool
|
||||
RUN LIBUV_VERSION=1.0.0-rc2 \
|
||||
&& curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
|
||||
&& cd /usr/local/src/libuv-$LIBUV_VERSION \
|
||||
&& sh autogen.sh && ./configure && make && make install \
|
||||
&& rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
|
||||
&& ldconfig
|
||||
|
||||
ENV PATH $PATH:$KRE_USER_HOME/packages/default/bin
|
||||
|
||||
# Extra things to test
|
||||
RUN echo "string at end"
|
||||
RUN echo must work 'some str' and some more
|
||||
RUN echo hi this is # not a comment
|
||||
RUN echo 'String with ${VAR} and another $one here'
|
||||
8
website/index/samples/sample.fsharp.txt
Normal file
8
website/index/samples/sample.fsharp.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(* Sample F# application *)
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
printfn "%A" argv
|
||||
System.Console.WriteLine("Hello from F#")
|
||||
0 // return an integer exit code
|
||||
|
||||
//--------------------------------------------------------
|
||||
111
website/index/samples/sample.go.txt
Normal file
111
website/index/samples/sample.go.txt
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
// We often need our programs to perform operations on
|
||||
// collections of data, like selecting all items that
|
||||
// satisfy a given predicate or mapping all items to a new
|
||||
// collection with a custom function.
|
||||
|
||||
// In some languages it's idiomatic to use [generic](http://en.wikipedia.org/wiki/Generic_programming)
|
||||
// data structures and algorithms. Go does not support
|
||||
// generics; in Go it's common to provide collection
|
||||
// functions if and when they are specifically needed for
|
||||
// your program and data types.
|
||||
|
||||
// Here are some example collection functions for slices
|
||||
// of `strings`. You can use these examples to build your
|
||||
// own functions. Note that in some cases it may be
|
||||
// clearest to just inline the collection-manipulating
|
||||
// code directly, instead of creating and calling a
|
||||
// helper function.
|
||||
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
import "fmt"
|
||||
|
||||
// Returns the first index of the target string `t`, or
|
||||
// -1 if no match is found.
|
||||
func Index(vs []string, t string) int {
|
||||
for i, v := range vs {
|
||||
if v == t {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Returns `true` if the target string t is in the
|
||||
// slice.
|
||||
func Include(vs []string, t string) bool {
|
||||
return Index(vs, t) >= 0
|
||||
}
|
||||
|
||||
// Returns `true` if one of the strings in the slice
|
||||
// satisfies the predicate `f`.
|
||||
func Any(vs []string, f func(string) bool) bool {
|
||||
for _, v := range vs {
|
||||
if f(v) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Returns `true` if all of the strings in the slice
|
||||
// satisfy the predicate `f`.
|
||||
func All(vs []string, f func(string) bool) bool {
|
||||
for _, v := range vs {
|
||||
if !f(v) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Returns a new slice containing all strings in the
|
||||
// slice that satisfy the predicate `f`.
|
||||
func Filter(vs []string, f func(string) bool) []string {
|
||||
vsf := make([]string, 0)
|
||||
for _, v := range vs {
|
||||
if f(v) {
|
||||
vsf = append(vsf, v)
|
||||
}
|
||||
}
|
||||
return vsf
|
||||
}
|
||||
|
||||
// Returns a new slice containing the results of applying
|
||||
// the function `f` to each string in the original slice.
|
||||
func Map(vs []string, f func(string) string) []string {
|
||||
vsm := make([]string, len(vs))
|
||||
for i, v := range vs {
|
||||
vsm[i] = f(v)
|
||||
}
|
||||
return vsm
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
// Here we try out our various collection functions.
|
||||
var strs = []string{"peach", "apple", "pear", "plum"}
|
||||
|
||||
fmt.Println(Index(strs, "pear"))
|
||||
|
||||
fmt.Println(Include(strs, "grape"))
|
||||
|
||||
fmt.Println(Any(strs, func(v string) bool {
|
||||
return strings.HasPrefix(v, "p")
|
||||
}))
|
||||
|
||||
fmt.Println(All(strs, func(v string) bool {
|
||||
return strings.HasPrefix(v, "p")
|
||||
}))
|
||||
|
||||
fmt.Println(Filter(strs, func(v string) bool {
|
||||
return strings.Contains(v, "e")
|
||||
}))
|
||||
|
||||
// The above examples all used anonymous functions,
|
||||
// but you can also use named functions of the correct
|
||||
// type.
|
||||
fmt.Println(Map(strs, strings.ToUpper))
|
||||
|
||||
}
|
||||
31
website/index/samples/sample.handlebars.txt
Normal file
31
website/index/samples/sample.handlebars.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
<div class="entry">
|
||||
<h1>{{title}}</h1>
|
||||
{{#if author}}
|
||||
<h2>{{author.firstName}} {{author.lastName}}</h2>
|
||||
{{else}}
|
||||
<h2>Unknown Author</h2>
|
||||
{{/if}}
|
||||
{{contentBody}}
|
||||
</div>
|
||||
|
||||
{{#unless license}}
|
||||
<h3 class="warning">WARNING: This entry does not have a license!</h3>
|
||||
{{/unless}}
|
||||
|
||||
<div class="footnotes">
|
||||
<ul>
|
||||
{{#each footnotes}}
|
||||
<li>{{this}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<h1>Comments</h1>
|
||||
|
||||
<div id="comments">
|
||||
{{#each comments}}
|
||||
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
|
||||
<div>{{body}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
22
website/index/samples/sample.html.txt
Normal file
22
website/index/samples/sample.html.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Comments are overrated
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>HTML Sample</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<style type="text/css">
|
||||
h1 {
|
||||
color: #CCA3A3;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.alert("I am a sample...");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Heading No.1</h1>
|
||||
<input disabled type="button" value="Click me" />
|
||||
</body>
|
||||
</html>
|
||||
15
website/index/samples/sample.ini.txt
Normal file
15
website/index/samples/sample.ini.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Example of a .gitconfig file
|
||||
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = false
|
||||
bare = false
|
||||
logallrefupdates = true
|
||||
symlinks = false
|
||||
ignorecase = true
|
||||
hideDotFiles = dotGitOnly
|
||||
|
||||
# Defines the master branch
|
||||
[branch "master"]
|
||||
remote = origin
|
||||
merge = refs/heads/master
|
||||
18
website/index/samples/sample.jade.txt
Normal file
18
website/index/samples/sample.jade.txt
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
doctype 5
|
||||
html(lang="en")
|
||||
head
|
||||
title= pageTitle
|
||||
script(type='text/javascript')
|
||||
if (foo) {
|
||||
bar()
|
||||
}
|
||||
body
|
||||
// Disclaimer: You will need to turn insertSpaces to true in order for the
|
||||
syntax highlighting to kick in properly (especially for comments)
|
||||
Enjoy :)
|
||||
h1 Jade - node template engine
|
||||
#container
|
||||
if youAreUsingJade
|
||||
p You are amazing
|
||||
else
|
||||
p Get on it!
|
||||
14
website/index/samples/sample.java.txt
Normal file
14
website/index/samples/sample.java.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import java.util.ArrayList;
|
||||
import org.junit.Test;
|
||||
|
||||
public class Example {
|
||||
@Test
|
||||
public void method() {
|
||||
org.junit.Assert.assertTrue( "isEmpty", new ArrayList<Integer>().isEmpty());
|
||||
}
|
||||
|
||||
@Test(timeout=100) public void infinity() {
|
||||
while(true);
|
||||
}
|
||||
}
|
||||
|
||||
214
website/index/samples/sample.javascript.txt
Normal file
214
website/index/samples/sample.javascript.txt
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
© Microsoft. All rights reserved.
|
||||
|
||||
This library is supported for use in Windows Tailored Apps only.
|
||||
|
||||
Build: 6.2.8100.0
|
||||
Version: 0.5
|
||||
*/
|
||||
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
undefinedVariable = {};
|
||||
undefinedVariable.prop = 5;
|
||||
|
||||
function initializeProperties(target, members) {
|
||||
var keys = Object.keys(members);
|
||||
var properties;
|
||||
var i, len;
|
||||
for (i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i];
|
||||
var enumerable = key.charCodeAt(0) !== /*_*/95;
|
||||
var member = members[key];
|
||||
if (member && typeof member === 'object') {
|
||||
if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {
|
||||
if (member.enumerable === undefined) {
|
||||
member.enumerable = enumerable;
|
||||
}
|
||||
properties = properties || {};
|
||||
properties[key] = member;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!enumerable) {
|
||||
properties = properties || {};
|
||||
properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }
|
||||
continue;
|
||||
}
|
||||
target[key] = member;
|
||||
}
|
||||
if (properties) {
|
||||
Object.defineProperties(target, properties);
|
||||
}
|
||||
}
|
||||
|
||||
(function (rootNamespace) {
|
||||
|
||||
// Create the rootNamespace in the global namespace
|
||||
if (!global[rootNamespace]) {
|
||||
global[rootNamespace] = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
// Cache the rootNamespace we just created in a local variable
|
||||
var _rootNamespace = global[rootNamespace];
|
||||
if (!_rootNamespace.Namespace) {
|
||||
_rootNamespace.Namespace = Object.create(Object.prototype);
|
||||
}
|
||||
|
||||
function defineWithParent(parentNamespace, name, members) {
|
||||
/// <summary locid="1">
|
||||
/// Defines a new namespace with the specified name, under the specified parent namespace.
|
||||
/// </summary>
|
||||
/// <param name="parentNamespace" type="Object" locid="2">
|
||||
/// The parent namespace which will contain the new namespace.
|
||||
/// </param>
|
||||
/// <param name="name" type="String" locid="3">
|
||||
/// Name of the new namespace.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
var currentNamespace = parentNamespace,
|
||||
namespaceFragments = name.split(".");
|
||||
|
||||
for (var i = 0, len = namespaceFragments.length; i < len; i++) {
|
||||
var namespaceName = namespaceFragments[i];
|
||||
if (!currentNamespace[namespaceName]) {
|
||||
Object.defineProperty(currentNamespace, namespaceName,
|
||||
{ value: {}, writable: false, enumerable: true, configurable: true }
|
||||
);
|
||||
}
|
||||
currentNamespace = currentNamespace[namespaceName];
|
||||
}
|
||||
|
||||
if (members) {
|
||||
initializeProperties(currentNamespace, members);
|
||||
}
|
||||
|
||||
return currentNamespace;
|
||||
}
|
||||
|
||||
function define(name, members) {
|
||||
/// <summary locid="6">
|
||||
/// Defines a new namespace with the specified name.
|
||||
/// </summary>
|
||||
/// <param name="name" type="String" locid="7">
|
||||
/// Name of the namespace. This could be a dot-separated nested name.
|
||||
/// </param>
|
||||
/// <param name="members" type="Object" locid="4">
|
||||
/// Members in the new namespace.
|
||||
/// </param>
|
||||
/// <returns locid="5">
|
||||
/// The newly defined namespace.
|
||||
/// </returns>
|
||||
return defineWithParent(global, name, members);
|
||||
}
|
||||
|
||||
// Establish members of the "WinJS.Namespace" namespace
|
||||
Object.defineProperties(_rootNamespace.Namespace, {
|
||||
|
||||
defineWithParent: { value: defineWithParent, writable: true, enumerable: true },
|
||||
|
||||
define: { value: define, writable: true, enumerable: true }
|
||||
|
||||
});
|
||||
|
||||
})("WinJS");
|
||||
|
||||
(function (WinJS) {
|
||||
|
||||
function define(constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="8">
|
||||
/// Defines a class using the given constructor and with the specified instance members.
|
||||
/// </summary>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
function derive(baseClass, constructor, instanceMembers, staticMembers) {
|
||||
/// <summary locid="13">
|
||||
/// Uses prototypal inheritance to create a sub-class based on the supplied baseClass parameter.
|
||||
/// </summary>
|
||||
/// <param name="baseClass" type="Function" locid="14">
|
||||
/// The class to inherit from.
|
||||
/// </param>
|
||||
/// <param name="constructor" type="Function" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <param name="instanceMembers" type="Object" locid="10">
|
||||
/// The set of instance fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <param name="staticMembers" type="Object" locid="11">
|
||||
/// The set of static fields, properties and methods to be made available on the class.
|
||||
/// </param>
|
||||
/// <returns type="Function" locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
if (baseClass) {
|
||||
constructor = constructor || function () { };
|
||||
var basePrototype = baseClass.prototype;
|
||||
constructor.prototype = Object.create(basePrototype);
|
||||
Object.defineProperty(constructor.prototype, "_super", { value: basePrototype });
|
||||
Object.defineProperty(constructor.prototype, "constructor", { value: constructor });
|
||||
if (instanceMembers) {
|
||||
initializeProperties(constructor.prototype, instanceMembers);
|
||||
}
|
||||
if (staticMembers) {
|
||||
initializeProperties(constructor, staticMembers);
|
||||
}
|
||||
return constructor;
|
||||
} else {
|
||||
return define(constructor, instanceMembers, staticMembers);
|
||||
}
|
||||
}
|
||||
|
||||
function mix(constructor) {
|
||||
/// <summary locid="15">
|
||||
/// Defines a class using the given constructor and the union of the set of instance members
|
||||
/// specified by all the mixin objects. The mixin parameter list can be of variable length.
|
||||
/// </summary>
|
||||
/// <param name="constructor" locid="9">
|
||||
/// A constructor function that will be used to instantiate this class.
|
||||
/// </param>
|
||||
/// <returns locid="12">
|
||||
/// The newly defined class.
|
||||
/// </returns>
|
||||
constructor = constructor || function () { };
|
||||
var i, len;
|
||||
for (i = 0, len = arguments.length; i < len; i++) {
|
||||
initializeProperties(constructor.prototype, arguments[i]);
|
||||
}
|
||||
return constructor;
|
||||
}
|
||||
|
||||
// Establish members of "WinJS.Class" namespace
|
||||
WinJS.Namespace.define("WinJS.Class", {
|
||||
define: define,
|
||||
derive: derive,
|
||||
mix: mix
|
||||
});
|
||||
|
||||
})(WinJS);
|
||||
|
||||
})(this);
|
||||
68
website/index/samples/sample.json.txt
Normal file
68
website/index/samples/sample.json.txt
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"type": "team",
|
||||
"test": {
|
||||
"testPage": "tools/testing/run-tests.htm",
|
||||
"enabled": true
|
||||
},
|
||||
"search": {
|
||||
"excludeFolders": [
|
||||
".git",
|
||||
"node_modules",
|
||||
"tools/bin",
|
||||
"tools/counts",
|
||||
"tools/policheck",
|
||||
"tools/tfs_build_extensions",
|
||||
"tools/testing/jscoverage",
|
||||
"tools/testing/qunit",
|
||||
"tools/testing/chutzpah",
|
||||
"server.net"
|
||||
]
|
||||
},
|
||||
"languages": {
|
||||
"vs.languages.typescript": {
|
||||
"validationSettings": [{
|
||||
"scope":"/",
|
||||
"noImplicitAny":true,
|
||||
"noLib":false,
|
||||
"extraLibs":[],
|
||||
"semanticValidation":true,
|
||||
"syntaxValidation":true,
|
||||
"codeGenTarget":"ES5",
|
||||
"moduleGenTarget":"",
|
||||
"lint": {
|
||||
"emptyBlocksWithoutComment": "warning",
|
||||
"curlyBracketsMustNotBeOmitted": "warning",
|
||||
"comparisonOperatorsNotStrict": "warning",
|
||||
"missingSemicolon": "warning",
|
||||
"unknownTypeOfResults": "warning",
|
||||
"semicolonsInsteadOfBlocks": "warning",
|
||||
"functionsInsideLoops": "warning",
|
||||
"functionsWithoutReturnType": "warning",
|
||||
"tripleSlashReferenceAlike": "warning",
|
||||
"unusedImports": "warning",
|
||||
"unusedVariables": "warning",
|
||||
"unusedFunctions": "warning",
|
||||
"unusedMembers": "warning"
|
||||
}
|
||||
},
|
||||
{
|
||||
"scope":"/client",
|
||||
"baseUrl":"/client",
|
||||
"moduleGenTarget":"amd"
|
||||
},
|
||||
{
|
||||
"scope":"/server",
|
||||
"moduleGenTarget":"commonjs"
|
||||
},
|
||||
{
|
||||
"scope":"/build",
|
||||
"moduleGenTarget":"commonjs"
|
||||
},
|
||||
{
|
||||
"scope":"/node_modules/nake",
|
||||
"moduleGenTarget":"commonjs"
|
||||
}],
|
||||
"allowMultipleWorkers": true
|
||||
}
|
||||
}
|
||||
}
|
||||
46
website/index/samples/sample.less.txt
Normal file
46
website/index/samples/sample.less.txt
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@base: #f938ab;
|
||||
|
||||
.box-shadow(@style, @c) when (iscolor(@c)) {
|
||||
border-radius: @style @c;
|
||||
}
|
||||
|
||||
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
|
||||
.box-shadow(@style, rgba(0, 0, 0, @alpha));
|
||||
}
|
||||
|
||||
.box {
|
||||
color: saturate(@base, 5%);
|
||||
border-color: lighten(@base, 30%);
|
||||
|
||||
div {
|
||||
.box-shadow((0 0 5px), 30%);
|
||||
}
|
||||
}
|
||||
|
||||
#header {
|
||||
h1 {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
p { font-size: 12px;
|
||||
a { text-decoration: none;
|
||||
&:hover { border-width: 1px }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@the-border: 1px;
|
||||
@base-color: #111;
|
||||
@red: #842210;
|
||||
|
||||
#header {
|
||||
color: (@base-color * 3);
|
||||
border-left: @the-border;
|
||||
border-right: (@the-border * 2);
|
||||
}
|
||||
|
||||
#footer {
|
||||
color: (@base-color + #003300);
|
||||
border-color: desaturate(@red, 10%);
|
||||
}
|
||||
12
website/index/samples/sample.lua.txt
Normal file
12
website/index/samples/sample.lua.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- defines a factorial function
|
||||
function fact (n)
|
||||
if n == 0 then
|
||||
return 1
|
||||
else
|
||||
return n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
print("enter a number:")
|
||||
a = io.read("*number") -- read a number
|
||||
print(fact(a))
|
||||
97
website/index/samples/sample.markdown.txt
Normal file
97
website/index/samples/sample.markdown.txt
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
# Header 1 #
|
||||
## Header 2 ##
|
||||
### Header 3 ### (Hashes on right are optional)
|
||||
## Markdown plus h2 with a custom ID ## {#id-goes-here}
|
||||
[Link back to H2](#id-goes-here)
|
||||
|
||||
<!-- html madness -->
|
||||
<div class="custom-class" markdown="1">
|
||||
<div>
|
||||
nested div
|
||||
</div>
|
||||
<script type='text/x-koka'>
|
||||
function( x: int ) { return x*x; }
|
||||
</script>
|
||||
This is a div _with_ underscores
|
||||
and a & <b class="bold">bold</b> element.
|
||||
<style>
|
||||
body { font: "Consolas" }
|
||||
</style>
|
||||
</div>
|
||||
|
||||
* Bullet lists are easy too
|
||||
- Another one
|
||||
+ Another one
|
||||
|
||||
This is a paragraph, which is text surrounded by
|
||||
whitespace. Paragraphs can be on one
|
||||
line (or many), and can drone on for hours.
|
||||
|
||||
Now some inline markup like _italics_, **bold**,
|
||||
and `code()`. Note that underscores
|
||||
in_words_are ignored.
|
||||
|
||||
````application/json
|
||||
{ value: ["or with a mime type"] }
|
||||
````
|
||||
|
||||
> Blockquotes are like quoted text in email replies
|
||||
>> And, they can be nested
|
||||
|
||||
1. A numbered list
|
||||
2. Which is numbered
|
||||
3. With periods and a space
|
||||
|
||||
And now some code:
|
||||
|
||||
// Code is just text indented a bit
|
||||
which(is_easy) to_remember();
|
||||
|
||||
And a block
|
||||
|
||||
~~~
|
||||
// Markdown extra adds un-indented code blocks too
|
||||
|
||||
if (this_is_more_code == true && !indented) {
|
||||
// tild wrapped code blocks, also not indented
|
||||
}
|
||||
~~~
|
||||
|
||||
Text with
|
||||
two trailing spaces
|
||||
(on the right)
|
||||
can be used
|
||||
for things like poems
|
||||
|
||||
### Horizontal rules
|
||||
|
||||
* * * *
|
||||
****
|
||||
--------------------------
|
||||
|
||||

|
||||
|
||||
## Markdown plus tables ##
|
||||
|
||||
| Header | Header | Right |
|
||||
| ------ | ------ | -----: |
|
||||
| Cell | Cell | $10 |
|
||||
| Cell | Cell | $20 |
|
||||
|
||||
* Outer pipes on tables are optional
|
||||
* Colon used for alignment (right versus left)
|
||||
|
||||
## Markdown plus definition lists ##
|
||||
|
||||
Bottled water
|
||||
: $ 1.25
|
||||
: $ 1.55 (Large)
|
||||
|
||||
Milk
|
||||
Pop
|
||||
: $ 1.75
|
||||
|
||||
* Multiple definitions and terms are possible
|
||||
* Definitions can include multiple paragraphs too
|
||||
|
||||
*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)
|
||||
52
website/index/samples/sample.objective-c.txt
Normal file
52
website/index/samples/sample.objective-c.txt
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UseQuotes.h"
|
||||
#import <Use/GTLT.h>
|
||||
|
||||
/*
|
||||
Multi
|
||||
Line
|
||||
Comments
|
||||
*/
|
||||
@implementation Test
|
||||
|
||||
- (void) applicationWillFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
}
|
||||
|
||||
- (IBAction)onSelectInput:(id)sender
|
||||
{
|
||||
NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];
|
||||
|
||||
NSOpenPanel* panel = [NSOpenPanel openPanel];
|
||||
[panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@"ipa", @"xcarchive", @"app", nil]];
|
||||
|
||||
[panel beginWithCompletionHandler:^(NSInteger result)
|
||||
{
|
||||
if (result == NSFileHandlingPanelOKButton)
|
||||
[self.inputTextField setStringValue:[panel.URL path]];
|
||||
}];
|
||||
return YES;
|
||||
|
||||
int hex = 0xFEF1F0F;
|
||||
float ing = 3.14;
|
||||
ing = 3.14e0;
|
||||
ing = 31.4e-2;
|
||||
}
|
||||
|
||||
-(id) initWithParams:(id<anObject>) aHandler withDeviceStateManager:(id<anotherObject>) deviceStateManager
|
||||
{
|
||||
// add a tap gesture recognizer
|
||||
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
|
||||
NSMutableArray *gestureRecognizers = [NSMutableArray array];
|
||||
[gestureRecognizers addObject:tapGesture];
|
||||
[gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];
|
||||
scnView.gestureRecognizers = gestureRecognizers;
|
||||
|
||||
return tapGesture;
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
82
website/index/samples/sample.php.txt
Normal file
82
website/index/samples/sample.php.txt
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
// The next line contains a syntax error:
|
||||
if () {
|
||||
return "The parser recovers from this type of syntax error";
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title>Example page</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
// Some PHP embedded inside JS
|
||||
// Generated <?=date('l, F jS, Y')?>
|
||||
|
||||
var server_token = <?=rand(5, 10000)?>
|
||||
if (typeof server_token === 'number') {
|
||||
alert('token: ' + server_token);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div>
|
||||
Hello
|
||||
<? if (isset($user)) { ?>
|
||||
<b><?=$user?></b>
|
||||
<? } else { ?>
|
||||
<i>guest</i>
|
||||
<? } ?>
|
||||
!
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
/* Example PHP file
|
||||
multiline comment
|
||||
*/
|
||||
|
||||
$cards = array("ah", "ac", "ad", "as",
|
||||
"2h", "2c", "2d", "2s",
|
||||
"3h", "3c", "3d", "3s",
|
||||
"4h", "4c", "4d", "4s",
|
||||
"5h", "5c", "5d", "5s",
|
||||
"6h", "6c", "6d", "6s",
|
||||
"7h", "7c", "7d", "7s",
|
||||
"8h", "8c", "8d", "8s",
|
||||
"9h", "9c", "9d", "9s",
|
||||
"th", "tc", "td", "ts",
|
||||
"jh", "jc", "jd", "js",
|
||||
"qh", "qc", "qd", "qs",
|
||||
"kh", "kc", "kd", "ks");
|
||||
|
||||
srand(time());
|
||||
|
||||
for($i = 0; $i < 52; $i++) {
|
||||
$count = count($cards);
|
||||
$random = (rand()%$count);
|
||||
|
||||
if($cards[$random] == "") {
|
||||
$i--;
|
||||
} else {
|
||||
$deck[] = $cards[$random];
|
||||
$cards[$random] = "";
|
||||
}
|
||||
}
|
||||
|
||||
srand(time());
|
||||
$starting_point = (rand()%51);
|
||||
print("Starting point for cut cards is: $starting_point<p>");
|
||||
|
||||
// display shuffled cards (EXAMPLE ONLY)
|
||||
for ($index = 0; $index < 52; $index++) {
|
||||
if ($starting_point == 52) { $starting_point = 0; }
|
||||
print("Uncut Point: <strong>$deck[$index]</strong> ");
|
||||
print("Starting Point: <strong>$deck[$starting_point]</strong><br>");
|
||||
$starting_point++;
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
9
website/index/samples/sample.plaintext.txt
Normal file
9
website/index/samples/sample.plaintext.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus aliquet sapien, sed rhoncus leo ullamcorper ornare. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus feugiat eleifend nisl, aliquet rhoncus quam scelerisque vel. Morbi eu pellentesque ex. Nam suscipit maximus leo blandit cursus. Aenean sollicitudin nisi luctus, ornare nibh viverra, laoreet ex. Donec eget nibh sit amet dolor ornare elementum. Morbi sollicitudin enim vitae risus pretium vestibulum. Ut pretium hendrerit libero, non vulputate ante volutpat et. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam malesuada turpis vitae est porttitor, id tincidunt neque dignissim. Integer rhoncus vestibulum justo in iaculis. Praesent nec augue ut dui scelerisque gravida vel id velit. Donec vehicula feugiat mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
|
||||
|
||||
Praesent diam lorem, luctus quis ullamcorper non, consequat quis orci. Ut vel massa vel nunc sagittis porttitor a vitae ante. Quisque euismod lobortis imperdiet. Vestibulum tincidunt vehicula posuere. Nulla facilisi. Donec sodales imperdiet risus id ullamcorper. Nulla luctus orci tortor, vitae tincidunt urna aliquet nec. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam consequat dapibus massa. Sed ac pharetra magna, in imperdiet neque. Nullam nunc nisi, consequat vel nunc et, sagittis aliquam arcu. Aliquam non orci magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id sem ut sem pulvinar rhoncus. Aenean venenatis nunc eget mi ornare, vitae maximus lacus varius. Quisque quis vestibulum justo.
|
||||
|
||||
Donec euismod luctus volutpat. Donec sed lacinia enim. Vivamus aliquam elit cursus, convallis diam at, volutpat turpis. Sed lacinia nisl in auctor dapibus. Nunc turpis mi, mattis ut rhoncus id, lacinia sed lectus. Donec sodales tellus quis libero gravida pretium et quis magna. Etiam ultricies mollis purus, eget consequat velit. Duis vitae nibh vitae arcu tincidunt congue. Maecenas ut velit in ipsum condimentum dictum quis eget urna. Sed mattis nulla arcu, vitae mattis ligula dictum at.
|
||||
|
||||
Praesent at dignissim dolor. Donec quis placerat sem. Cras vitae placerat sapien, eu sagittis ex. Mauris nec luctus risus. Cras imperdiet semper neque suscipit auctor. Mauris nisl massa, commodo sit amet dignissim id, malesuada sed ante. Praesent varius sapien eget eros vehicula porttitor.
|
||||
|
||||
Mauris auctor nunc in quam tempor, eget consectetur nisi rhoncus. Donec et nulla imperdiet, gravida dui at, accumsan velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin sollicitudin condimentum auctor. Sed lacinia eleifend nisi, id scelerisque leo laoreet sit amet. Morbi congue augue a malesuada pulvinar. Curabitur nec ante finibus, commodo orci vel, aliquam libero. Morbi molestie purus non nunc placerat fermentum. Pellentesque commodo ligula sed pretium aliquam. Praesent ut nibh ex. Vivamus vestibulum velit in leo suscipit, vitae pellentesque urna vulputate. Suspendisse pretium placerat ligula eu ullamcorper. Nam eleifend mi tellus, ut tristique ante ultricies vitae. Quisque venenatis dapibus tellus sit amet mattis. Donec erat arcu, elementum vel nisl at, sagittis vulputate nisi.
|
||||
30
website/index/samples/sample.powershell.txt
Normal file
30
website/index/samples/sample.powershell.txt
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
$SelectedObjectNames=@();
|
||||
$XenCenterNodeSelected = 0;
|
||||
#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list
|
||||
foreach($parameterSet in $ObjInfoArray)
|
||||
{
|
||||
if ($parameterSet["class"] -eq "blank")
|
||||
{
|
||||
#When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank
|
||||
if ($XenCenterNodeSelected)
|
||||
{
|
||||
continue
|
||||
}
|
||||
$XenCenterNodeSelected = 1;
|
||||
$SelectedObjectNames += "XenCenter"
|
||||
}
|
||||
elseif ($parameterSet["sessionRef"] -eq "null")
|
||||
{
|
||||
#When a disconnected server is selected there is no session information, we get null for everything except class
|
||||
}
|
||||
$SelectedObjectNames += "a disconnected server"
|
||||
else
|
||||
{
|
||||
Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]
|
||||
#Use $class to determine which server objects to get
|
||||
#-properties allows us to filter the results to just include the selected object
|
||||
$exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
|
||||
$obj = Invoke-Expression $exp
|
||||
$SelectedObjectNames += $obj.name_label;
|
||||
}
|
||||
}
|
||||
12
website/index/samples/sample.python.txt
Normal file
12
website/index/samples/sample.python.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from banana import *
|
||||
|
||||
class Monkey:
|
||||
# Bananas the monkey can eat.
|
||||
capacity = 10
|
||||
def eat(self, N):
|
||||
'''Make the monkey eat N bananas!'''
|
||||
capacity = capacity - N*banana.size
|
||||
|
||||
def feeding_frenzy(self):
|
||||
eat(9.25)
|
||||
return "Yum yum"
|
||||
41
website/index/samples/sample.r.txt
Normal file
41
website/index/samples/sample.r.txt
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# © Microsoft. All rights reserved.
|
||||
|
||||
#' Add together two numbers.
|
||||
#'
|
||||
#' @param x A number.
|
||||
#' @param y A number.
|
||||
#' @return The sum of \code{x} and \code{y}.
|
||||
#' @examples
|
||||
#' add(1, 1)
|
||||
#' add(10, 1)
|
||||
add <- function(x, y) {
|
||||
x + y
|
||||
}
|
||||
|
||||
add(1, 2)
|
||||
add(1.0, 2.0)
|
||||
add(-1, -2)
|
||||
add(-1.0, -2.0)
|
||||
add(1.0e10, 2.0e10)
|
||||
|
||||
|
||||
#' Concatenate together two strings.
|
||||
#'
|
||||
#' @param x A string.
|
||||
#' @param y A string.
|
||||
#' @return The concatenated string built of \code{x} and \code{y}.
|
||||
#' @examples
|
||||
#' strcat("one", "two")
|
||||
strcat <- function(x, y) {
|
||||
paste(x, y)
|
||||
}
|
||||
|
||||
paste("one", "two")
|
||||
paste('one', 'two')
|
||||
paste(NULL, NULL)
|
||||
paste(NA, NA)
|
||||
|
||||
paste("multi-
|
||||
line",
|
||||
'multi-
|
||||
line')
|
||||
46
website/index/samples/sample.razor.txt
Normal file
46
website/index/samples/sample.razor.txt
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
@{
|
||||
var total = 0;
|
||||
var totalMessage = "";
|
||||
@* a multiline
|
||||
razor comment embedded in csharp *@
|
||||
if (IsPost) {
|
||||
|
||||
// Retrieve the numbers that the user entered.
|
||||
var num1 = Request["text1"];
|
||||
var num2 = Request["text2"];
|
||||
|
||||
// Convert the entered strings into integers numbers and add.
|
||||
total = num1.AsInt() + num2.AsInt();
|
||||
<italic><bold>totalMessage = "Total = " + total;</bold></italic>
|
||||
}
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Add Numbers</title>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
<body>
|
||||
<p>Enter two whole numbers and then click <strong>Add</strong>.</p>
|
||||
<form action="" method="post">
|
||||
<p><label for="text1">First Number:</label>
|
||||
<input type="text" name="text1" />
|
||||
</p>
|
||||
<p><label for="text2">Second Number:</label>
|
||||
<input type="text" name="text2" />
|
||||
</p>
|
||||
<p><input type="submit" value="Add" /></p>
|
||||
</form>
|
||||
|
||||
@* now we call the totalMessage method
|
||||
(a multi line razor comment outside code) *@
|
||||
|
||||
<p>@totalMessage</p>
|
||||
|
||||
<p>@(totalMessage+"!")</p>
|
||||
|
||||
An email address (with escaped at character): name@@domain.com
|
||||
|
||||
</body>
|
||||
</html>
|
||||
21
website/index/samples/sample.ruby.txt
Normal file
21
website/index/samples/sample.ruby.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#-------------------------------------------------------------------------
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
module Azure
|
||||
module Blob
|
||||
class Blob
|
||||
|
||||
def initialize
|
||||
@properties = {}
|
||||
@metadata = {}
|
||||
yield self if block_given?
|
||||
end
|
||||
|
||||
attr_accessor :name
|
||||
attr_accessor :snapshot
|
||||
attr_accessor :properties
|
||||
attr_accessor :metadata
|
||||
end
|
||||
end
|
||||
end
|
||||
37
website/index/samples/sample.sass.txt
Normal file
37
website/index/samples/sample.sass.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
$baseFontSizeInPixels: 14;
|
||||
|
||||
@function px2em ($font_size, $base_font_size: $baseFontSizeInPixels) {
|
||||
@return ($font_size / $base_font_size) + em;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: px2em(36, $baseFontSizeInPixels);
|
||||
}
|
||||
h2 {
|
||||
font-size: px2em(28, $baseFontSizeInPixels);
|
||||
}
|
||||
.class {
|
||||
font-size: px2em(14, $baseFontSizeInPixels);
|
||||
}
|
||||
|
||||
nav {
|
||||
ul {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
li { display: inline-block; }
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 6px 12px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@each $animal in puma, sea-slug, egret, salamander {
|
||||
.#{$animal}-icon {
|
||||
background-image: url('/images/#{$animal}.png');
|
||||
}
|
||||
}
|
||||
}
|
||||
52
website/index/samples/sample.sql.txt
Normal file
52
website/index/samples/sample.sql.txt
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
CREATE TABLE dbo.EmployeePhoto
|
||||
(
|
||||
EmployeeId INT NOT NULL PRIMARY KEY,
|
||||
Photo VARBINARY(MAX) FILESTREAM NULL,
|
||||
MyRowGuidColumn UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL
|
||||
UNIQUE DEFAULT NEWID()
|
||||
);
|
||||
|
||||
GO
|
||||
|
||||
/*
|
||||
text_of_comment
|
||||
/* nested comment */
|
||||
*/
|
||||
|
||||
-- line comment
|
||||
|
||||
CREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID
|
||||
ON Production.WorkOrder(ProductID)
|
||||
WITH (FILLFACTOR = 80,
|
||||
PAD_INDEX = ON,
|
||||
DROP_EXISTING = ON);
|
||||
GO
|
||||
|
||||
WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300
|
||||
BEGIN
|
||||
UPDATE Production.Product
|
||||
SET ListPrice = ListPrice * 2
|
||||
SELECT MAX(ListPrice) FROM Production.Product
|
||||
IF (SELECT MAX(ListPrice) FROM Production.Product) > $500
|
||||
BREAK
|
||||
ELSE
|
||||
CONTINUE
|
||||
END
|
||||
PRINT 'Too much for the market to bear';
|
||||
|
||||
MERGE INTO Sales.SalesReason AS [Target]
|
||||
USING (VALUES ('Recommendation','Other'), ('Review', 'Marketing'), ('Internet', 'Promotion'))
|
||||
AS [Source] ([NewName], NewReasonType)
|
||||
ON [Target].[Name] = [Source].[NewName]
|
||||
WHEN MATCHED
|
||||
THEN UPDATE SET ReasonType = [Source].NewReasonType
|
||||
WHEN NOT MATCHED BY TARGET
|
||||
THEN INSERT ([Name], ReasonType) VALUES ([NewName], NewReasonType)
|
||||
OUTPUT $action INTO @SummaryOfChanges;
|
||||
|
||||
SELECT ProductID, OrderQty, SUM(LineTotal) AS Total
|
||||
FROM Sales.SalesOrderDetail
|
||||
WHERE UnitPrice < $5.00
|
||||
GROUP BY ProductID, OrderQty
|
||||
ORDER BY ProductID, OrderQty
|
||||
OPTION (HASH GROUP, FAST 10);
|
||||
50
website/index/samples/sample.swift.txt
Normal file
50
website/index/samples/sample.swift.txt
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import Foundation
|
||||
|
||||
protocol APIControllerProtocol {
|
||||
func didReceiveAPIResults(results: NSArray)
|
||||
}
|
||||
|
||||
class APIController {
|
||||
var delegate: APIControllerProtocol
|
||||
|
||||
init(delegate: APIControllerProtocol) {
|
||||
self.delegate = delegate
|
||||
}
|
||||
|
||||
func get(path: String) {
|
||||
let url = NSURL(string: path)
|
||||
let session = NSURLSession.sharedSession()
|
||||
let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in
|
||||
println("Task completed")
|
||||
if(error != nil) {
|
||||
// If there is an error in the web request, print it to the console
|
||||
println(error.localizedDescription)
|
||||
}
|
||||
var err: NSError?
|
||||
if let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as? NSDictionary {
|
||||
if(err != nil) {
|
||||
// If there is an error parsing JSON, print it to the console
|
||||
println("JSON Error \(err!.localizedDescription)")
|
||||
}
|
||||
if let results: NSArray = jsonResult["results"] as? NSArray {
|
||||
self.delegate.didReceiveAPIResults(results)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// The task is just an object with all these properties set
|
||||
// In order to actually make the web request, we need to "resume"
|
||||
task.resume()
|
||||
}
|
||||
|
||||
func searchItunesFor(searchTerm: String) {
|
||||
// The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs
|
||||
let itunesSearchTerm = searchTerm.stringByReplacingOccurrencesOfString(" ", withString: "+", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil)
|
||||
|
||||
// Now escape anything else that isn't URL-friendly
|
||||
if let escapedSearchTerm = itunesSearchTerm.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {
|
||||
let urlPath = "https://itunes.apple.com/search?term=\(escapedSearchTerm)&media=music&entity=album"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
124
website/index/samples/sample.typescript.txt
Normal file
124
website/index/samples/sample.typescript.txt
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/* Game of Life
|
||||
* Implemented in TypeScript
|
||||
* To learn more about TypeScript, please visit http://www.typescriptlang.org/
|
||||
*/
|
||||
|
||||
module Conway {
|
||||
|
||||
export class Cell {
|
||||
public row: number;
|
||||
public col: number;
|
||||
public live: boolean;
|
||||
|
||||
constructor(row: number, col: number, live: boolean) {
|
||||
this.row = row;
|
||||
this.col = col;
|
||||
this.live = live
|
||||
}
|
||||
}
|
||||
|
||||
export class GameOfLife {
|
||||
private gridSize: number;
|
||||
private canvasSize: number;
|
||||
private lineColor: string;
|
||||
private liveColor: string;
|
||||
private deadColor: string;
|
||||
private initialLifeProbability: number;
|
||||
private animationRate: number;
|
||||
private cellSize: number;
|
||||
private context: CanvasRenderingContext2D;
|
||||
private world;
|
||||
|
||||
|
||||
constructor() {
|
||||
this.gridSize = 50;
|
||||
this.canvasSize = 600;
|
||||
this.lineColor = '#cdcdcd';
|
||||
this.liveColor = '#666';
|
||||
this.deadColor = '#eee';
|
||||
this.initialLifeProbability = 0.5;
|
||||
this.animationRate = 60;
|
||||
this.cellSize = 0;
|
||||
this.world = this.createWorld();
|
||||
this.circleOfLife();
|
||||
}
|
||||
|
||||
public createWorld() {
|
||||
return this.travelWorld( (cell : Cell) => {
|
||||
cell.live = Math.random() < this.initialLifeProbability;
|
||||
return cell;
|
||||
});
|
||||
}
|
||||
|
||||
public circleOfLife() : void {
|
||||
this.world = this.travelWorld( (cell: Cell) => {
|
||||
cell = this.world[cell.row][cell.col];
|
||||
this.draw(cell);
|
||||
return this.resolveNextGeneration(cell);
|
||||
});
|
||||
setTimeout( () => {this.circleOfLife()}, this.animationRate);
|
||||
}
|
||||
|
||||
public resolveNextGeneration(cell : Cell) {
|
||||
var count = this.countNeighbors(cell);
|
||||
var newCell = new Cell(cell.row, cell.col, cell.live);
|
||||
if(count < 2 || count > 3) newCell.live = false;
|
||||
else if(count == 3) newCell.live = true;
|
||||
return newCell;
|
||||
}
|
||||
|
||||
public countNeighbors(cell : Cell) {
|
||||
var neighbors = 0;
|
||||
for(var row = -1; row <=1; row++) {
|
||||
for(var col = -1; col <= 1; col++) {
|
||||
if(row == 0 && col == 0) continue;
|
||||
if(this.isAlive(cell.row + row, cell.col + col)) {
|
||||
neighbors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return neighbors;
|
||||
}
|
||||
|
||||
public isAlive(row : number, col : number) {
|
||||
if(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false;
|
||||
return this.world[row][col].live;
|
||||
}
|
||||
|
||||
public travelWorld(callback) {
|
||||
var result = [];
|
||||
for(var row = 0; row < this.gridSize; row++) {
|
||||
var rowData = [];
|
||||
for(var col = 0; col < this.gridSize; col++) {
|
||||
rowData.push(callback(new Cell(row, col, false)));
|
||||
}
|
||||
result.push(rowData);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public draw(cell : Cell) {
|
||||
if(this.context == null) this.context = this.createDrawingContext();
|
||||
if(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize;
|
||||
|
||||
this.context.strokeStyle = this.lineColor;
|
||||
this.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
|
||||
this.context.fillStyle = cell.live ? this.liveColor : this.deadColor;
|
||||
this.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);
|
||||
}
|
||||
|
||||
public createDrawingContext() {
|
||||
var canvas = <HTMLCanvasElement> document.getElementById('conway-canvas');
|
||||
if(canvas == null) {
|
||||
canvas = document.createElement('canvas');
|
||||
canvas.id = 'conway-canvas';
|
||||
canvas.width = this.canvasSize;
|
||||
canvas.height = this.canvasSize;
|
||||
document.body.appendChild(canvas);
|
||||
}
|
||||
return canvas.getContext('2d');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var game = new Conway.GameOfLife();
|
||||
59
website/index/samples/sample.vb.txt
Normal file
59
website/index/samples/sample.vb.txt
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
Imports System
|
||||
Imports System.Collections.Generic
|
||||
|
||||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
Dim a As New M8Ball
|
||||
|
||||
Do While True
|
||||
|
||||
Dim q As String = ""
|
||||
Console.Write("ask me about the future... ")
|
||||
q = Console.ReadLine()
|
||||
|
||||
If q.Trim <> "" Then
|
||||
Console.WriteLine("the answer is... {0}", a.getAnswer(q))
|
||||
Else
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
|
||||
Class M8Ball
|
||||
|
||||
Public Answers As System.Collections.Generic.Dictionary(Of Integer, String)
|
||||
|
||||
Public Sub New()
|
||||
Answers = New System.Collections.Generic.Dictionary(Of Integer, String)
|
||||
Answers.Add(0, "It is certain")
|
||||
Answers.Add(1, "It is decidedly so")
|
||||
Answers.Add(2, "Without a doubt")
|
||||
Answers.Add(3, "Yes, definitely")
|
||||
Answers.Add(4, "You may rely on ")
|
||||
Answers.Add(5, "As I see it, yes")
|
||||
Answers.Add(6, "Most likely")
|
||||
Answers.Add(7, "Outlook good")
|
||||
Answers.Add(8, "Signs point to yes")
|
||||
Answers.Add(9, "Yes")
|
||||
Answers.Add(10, "Reply hazy, try again")
|
||||
Answers.Add(11, "Ask again later")
|
||||
Answers.Add(12, "Better not tell you now")
|
||||
Answers.Add(13, "Cannot predict now")
|
||||
Answers.Add(14, "Concentrate and ask again")
|
||||
Answers.Add(15, "Don't count on it")
|
||||
Answers.Add(16, "My reply is no")
|
||||
Answers.Add(17, "My sources say no")
|
||||
Answers.Add(18, "Outlook not so")
|
||||
Answers.Add(19, "Very doubtful")
|
||||
End Sub
|
||||
|
||||
Public Function getAnswer(theQuestion As String) As String
|
||||
Dim r As New Random
|
||||
Return Answers(r.Next(0, 19))
|
||||
End Function
|
||||
|
||||
End Class
|
||||
14
website/index/samples/sample.xml.txt
Normal file
14
website/index/samples/sample.xml.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="value for the deployed Web.config file"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
<system.web>
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
</system.web>
|
||||
</configuration>
|
||||
6808
website/lib/bootstrap-cosmo.css
vendored
Normal file
6808
website/lib/bootstrap-cosmo.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
website/lib/bootstrap-responsive.min.css
vendored
Normal file
9
website/lib/bootstrap-responsive.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
website/lib/bootstrap-select.min.css
vendored
Normal file
1
website/lib/bootstrap-select.min.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.bootstrap-select.btn-group,.bootstrap-select.btn-group[class*="span"]{float:none;display:inline-block;margin-bottom:10px;margin-left:0}.bootstrap-select{width:220px}.bootstrap-select .btn{width:220px}.bootstrap-select .btn:focus{outline:thin dotted #333!important;outline:5px auto -webkit-focus-ring-color!important;outline-offset:-2px}.bootstrap-select.btn-group .btn .filter-option{overflow:hidden;position:absolute;left:12px;right:25px;text-align:left}.bootstrap-select.btn-group .btn .caret{position:absolute;right:12px}.bootstrap-select.btn-group>.disabled,.bootstrap-select.btn-group .dropdown-menu li.disabled>a{cursor:not-allowed}.bootstrap-select.btn-group[class*="span"] .btn{width:100%}.bootstrap-select.btn-group .dropdown-menu{min-width:100%;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.bootstrap-select.btn-group .dropdown-menu dt{display:block;padding:3px 20px;cursor:default}.bootstrap-select.btn-group .div-contain{overflow:hidden}.bootstrap-select.btn-group .dropdown-menu li>a.opt{padding-left:35px}.bootstrap-select.btn-group .dropdown-menu li>a{min-height:20px}.bootstrap-select.btn-group .dropdown-menu li small{padding-left:.5em}.bootstrap-select.btn-group .dropdown-menu li:not(.disabled)>a:hover small{color:#64b1d8;color:rgba(255,255,255,0.4)}.bootstrap-select.btn-group .dropdown-menu li>dt small{font-weight:normal}
|
||||
1
website/lib/bootstrap-select.min.js
vendored
Normal file
1
website/lib/bootstrap-select.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
website/lib/bootstrap.min.js
vendored
Normal file
6
website/lib/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
website/lib/jquery-1.9.1.min.js
vendored
Normal file
5
website/lib/jquery-1.9.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
84
website/playground.html
Normal file
84
website/playground.html
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title>Monaco Editor Playground</title>
|
||||
|
||||
<link href="./lib/bootstrap-cosmo.css" rel="stylesheet">
|
||||
<link href="./lib/bootstrap-responsive.min.css" rel="stylesheet">
|
||||
<link href="./all.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<link rel="stylesheet" href="./playground/spinner.css" />
|
||||
<link rel="stylesheet" href="./playground/playground.css" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
<div class="logo">
|
||||
<a href="#">Monaco Editor</a>
|
||||
</div>
|
||||
<!-- collapse button for smaller screens -->
|
||||
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
|
||||
<!-- navbar title -->
|
||||
<div class="nav-collapse collapse">
|
||||
<ul class="nav">
|
||||
<li><a class="nav-item" href="index.html">Home</a></li>
|
||||
<li><a class="nav-item" href="playground.html">Playground</a></li>
|
||||
<li><a class="nav-item" href="monarch.html">Monarch</a></li>
|
||||
<li><a class="nav-item" href="https://www.npmjs.com/package/monaco-editor">Download</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<div id="loading">
|
||||
<div class="spinner">
|
||||
<div class="rect1"></div>
|
||||
<div class="rect2"></div>
|
||||
<div class="rect3"></div>
|
||||
<div class="rect4"></div>
|
||||
<div class="rect5"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section id="playground">
|
||||
</section>
|
||||
|
||||
<footer class="container">
|
||||
<hr>
|
||||
<p class="text-center">
|
||||
<small>© 2016 Microsoft</small>
|
||||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="./lib/jquery-1.9.1.min.js" type="text/javascript"></script>
|
||||
<script src="./lib/bootstrap.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="../release/min/vs/loader.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.MonacoEnvironment = {
|
||||
getWorkerUrl: function(workerId, label) {
|
||||
return 'worker-loader-proxy.js';
|
||||
}
|
||||
};
|
||||
require.config({
|
||||
paths: {
|
||||
vs: "../release/min/vs"
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript" src="./playground/samples/all.js"></script>
|
||||
<script type="text/javascript" src="./playground/playground.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
86
website/playground/playground-runner.html
Normal file
86
website/playground/playground-runner.html
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<!DOCTYPE html>
|
||||
<html style="height:100%">
|
||||
<head>
|
||||
|
||||
<link rel="stylesheet" href="./spinner.css" />
|
||||
|
||||
<style type="text/css">
|
||||
body { margin: 0; padding: 0; border: 0; }
|
||||
.monaco-editor { overflow: hidden; }
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="../../release/min/vs/loader.js"></script>
|
||||
<script type="text/javascript">
|
||||
var geval = eval;
|
||||
|
||||
var receivedCall = null;
|
||||
window.load = function (js, html, css) {
|
||||
receivedCall = {
|
||||
js: js,
|
||||
html: html,
|
||||
css: css
|
||||
};
|
||||
};
|
||||
|
||||
window.MonacoEnvironment = {
|
||||
getWorkerUrl: function(workerId, label) {
|
||||
return '../worker-loader-proxy.js';
|
||||
}
|
||||
};
|
||||
|
||||
require.config({
|
||||
paths: {
|
||||
vs: "../../release/min/vs"
|
||||
}
|
||||
});
|
||||
|
||||
require(['require', 'vs/editor/editor.main'], function (require) {
|
||||
"use strict";
|
||||
|
||||
var loading = document.getElementById('loading');
|
||||
loading.parentNode.removeChild(loading);
|
||||
document.body.style.height = '100%';
|
||||
|
||||
// Switch `automaticLayout` property to true by default
|
||||
//TODO: var config = require('vs/editor/common/config/config');
|
||||
//config.getActiveEditor().automaticLayout = true;
|
||||
|
||||
window.load = function (js, html, css) {
|
||||
if (css) {
|
||||
var style = document.createElement("style");
|
||||
style.type = "text/css";
|
||||
style.innerHTML = css;
|
||||
document.body.appendChild(style);
|
||||
}
|
||||
if (html) {
|
||||
document.body.innerHTML += html;
|
||||
}
|
||||
if (js) {
|
||||
try {
|
||||
geval(js);
|
||||
} catch (err) {
|
||||
var pre = document.createElement("pre");
|
||||
pre.appendChild(document.createTextNode(err));
|
||||
document.body.insertBefore(pre, document.body.firstChild);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (receivedCall) {
|
||||
window.load(receivedCall.js, receivedCall.html, receivedCall.css);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="loading">
|
||||
<div class="spinner">
|
||||
<div class="rect1"></div>
|
||||
<div class="rect2"></div>
|
||||
<div class="rect3"></div>
|
||||
<div class="rect4"></div>
|
||||
<div class="rect5"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
59
website/playground/playground.css
Normal file
59
website/playground/playground.css
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: "Segoe UI",Arial,"HelveticaNeue-Light", sans-serif;
|
||||
font-size: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
select {
|
||||
width: initial;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-family: "Segoe UI Light","HelveticaNeue-UltraLight", sans-serif;
|
||||
font-weight: 100;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
.tabArea {
|
||||
height: 20px;
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
.tab {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
box-sizing: border-box;
|
||||
color: #999;
|
||||
padding: 0 8px;
|
||||
border: 1px solid #999;
|
||||
border-bottom: 0;
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
}
|
||||
.tab.active {
|
||||
color: black;
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
.action {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
box-sizing: border-box;
|
||||
color: black;
|
||||
padding: 0 5px;
|
||||
border: 1px solid #999;
|
||||
border-bottom: 0;
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.action.run {
|
||||
background: url('run.png') no-repeat left center;
|
||||
}
|
||||
.editor-container {
|
||||
border: 1px solid #999;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
|
||||
314
website/playground/playground.js
Normal file
314
website/playground/playground.js
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
window.onload = function() {
|
||||
require(['require', 'vs/editor/editor.main'], function(require) {
|
||||
|
||||
// require(['vs/languages/typescript/common/typescript'], function() {
|
||||
// var mode = require('vs/languages/typescript/common/typescript');
|
||||
// var winjs = require('vs/base/common/winjs.base');
|
||||
// winjs.xhr({ url: 'playground/samples/editor.d.ts.txt' }).then(function(response) {
|
||||
// mode.javaScriptDefaults.addExtraLib(response.responseText, 'editor.d.ts');
|
||||
// mode.javaScriptDefaults.addExtraLib([
|
||||
// 'declare var require: {',
|
||||
// ' toUrl(path: string): string;',
|
||||
// ' (moduleName: string): any;',
|
||||
// ' (dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;',
|
||||
// ' config(data: any): any;',
|
||||
// ' onError: Function;',
|
||||
// '};',
|
||||
// ].join('\n'), 'require.d.ts');
|
||||
|
||||
var loading = document.getElementById('loading');
|
||||
loading.parentNode.removeChild(loading);
|
||||
load();
|
||||
// });
|
||||
// });
|
||||
});
|
||||
};
|
||||
|
||||
var editor = null;
|
||||
var data = {
|
||||
js: {
|
||||
model: null,
|
||||
state: null
|
||||
},
|
||||
css: {
|
||||
model: null,
|
||||
state: null
|
||||
},
|
||||
html: {
|
||||
model: null,
|
||||
state: null
|
||||
}
|
||||
};
|
||||
|
||||
function load() {
|
||||
|
||||
function layout() {
|
||||
var GLOBAL_PADDING = 20;
|
||||
|
||||
var WIDTH = window.innerWidth - 2 * GLOBAL_PADDING;
|
||||
var HEIGHT = window.innerHeight;
|
||||
|
||||
var TITLE_HEIGHT = 110;
|
||||
var FOOTER_HEIGHT = 80;
|
||||
var TABS_HEIGHT = 20;
|
||||
var INNER_PADDING = 20;
|
||||
var SWITCHER_HEIGHT = 30;
|
||||
|
||||
var HALF_WIDTH = Math.floor((WIDTH - INNER_PADDING) / 2);
|
||||
var REMAINING_HEIGHT = HEIGHT - TITLE_HEIGHT - FOOTER_HEIGHT - SWITCHER_HEIGHT;
|
||||
|
||||
playgroundContainer.style.width = WIDTH + 'px';
|
||||
playgroundContainer.style.height = (HEIGHT - FOOTER_HEIGHT) + 'px';
|
||||
|
||||
sampleSwitcher.style.position = 'absolute';
|
||||
sampleSwitcher.style.top = TITLE_HEIGHT + 'px';
|
||||
sampleSwitcher.style.left = GLOBAL_PADDING + 'px';
|
||||
|
||||
typingContainer.style.position = 'absolute';
|
||||
typingContainer.style.top = GLOBAL_PADDING + TITLE_HEIGHT + SWITCHER_HEIGHT + 'px';
|
||||
typingContainer.style.left = GLOBAL_PADDING + 'px';
|
||||
typingContainer.style.width = HALF_WIDTH + 'px';
|
||||
typingContainer.style.height = REMAINING_HEIGHT + 'px';
|
||||
|
||||
tabArea.style.position = 'absolute';
|
||||
tabArea.style.boxSizing = 'border-box';
|
||||
tabArea.style.top = 0;
|
||||
tabArea.style.left = 0;
|
||||
tabArea.style.width = HALF_WIDTH + 'px';
|
||||
tabArea.style.height = TABS_HEIGHT + 'px';
|
||||
|
||||
editorContainer.style.position = 'absolute';
|
||||
editorContainer.style.boxSizing = 'border-box';
|
||||
editorContainer.style.top = TABS_HEIGHT + 'px';
|
||||
editorContainer.style.left = 0;
|
||||
editorContainer.style.width = HALF_WIDTH + 'px';
|
||||
editorContainer.style.height = (REMAINING_HEIGHT - TABS_HEIGHT) + 'px';
|
||||
|
||||
if (editor) {
|
||||
editor.layout({
|
||||
width: HALF_WIDTH - 2,
|
||||
height: (REMAINING_HEIGHT - TABS_HEIGHT) - 1
|
||||
});
|
||||
}
|
||||
|
||||
runContainer.style.position = 'absolute';
|
||||
runContainer.style.top = GLOBAL_PADDING + TITLE_HEIGHT + SWITCHER_HEIGHT + TABS_HEIGHT + 'px';
|
||||
runContainer.style.left = GLOBAL_PADDING + INNER_PADDING + HALF_WIDTH + 'px';
|
||||
runContainer.style.width = HALF_WIDTH + 'px';
|
||||
runContainer.style.height = (REMAINING_HEIGHT - TABS_HEIGHT) + 'px';
|
||||
|
||||
runIframeHeight = (REMAINING_HEIGHT - TABS_HEIGHT);
|
||||
if (runIframe) {
|
||||
runIframe.style.height = runIframeHeight + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
function changeTab(selectedTabNode, desiredModelId) {
|
||||
for (var i = 0; i < tabArea.childNodes.length; i++) {
|
||||
var child = tabArea.childNodes[i];
|
||||
if (/tab/.test(child.className)) {
|
||||
child.className = 'tab';
|
||||
}
|
||||
}
|
||||
selectedTabNode.className = 'tab active';
|
||||
|
||||
var currentState = editor.saveViewState();
|
||||
|
||||
var currentModel = editor.getModel();
|
||||
if (currentModel === data.js.model) {
|
||||
data.js.state = currentState;
|
||||
} else if (currentModel === data.css.model) {
|
||||
data.css.state = currentState;
|
||||
} else if (currentModel === data.html.model) {
|
||||
data.html.state = currentState;
|
||||
}
|
||||
|
||||
editor.setModel(data[desiredModelId].model);
|
||||
editor.restoreViewState(data[desiredModelId].state);
|
||||
editor.focus();
|
||||
}
|
||||
|
||||
|
||||
// create the typing side
|
||||
var typingContainer = document.createElement('div');
|
||||
typingContainer.className = 'typingContainer';
|
||||
|
||||
var tabArea = (function() {
|
||||
var tabArea = document.createElement('div');
|
||||
tabArea.className = 'tabArea';
|
||||
|
||||
var jsTab = document.createElement('span');
|
||||
jsTab.className = 'tab active';
|
||||
jsTab.appendChild(document.createTextNode('JavaScript'));
|
||||
jsTab.onclick = function() { changeTab(jsTab, 'js'); };
|
||||
tabArea.appendChild(jsTab);
|
||||
|
||||
var cssTab = document.createElement('span');
|
||||
cssTab.className = 'tab';
|
||||
cssTab.appendChild(document.createTextNode('CSS'));
|
||||
cssTab.onclick = function() { changeTab(cssTab, 'css'); };
|
||||
tabArea.appendChild(cssTab);
|
||||
|
||||
var htmlTab = document.createElement('span');
|
||||
htmlTab.className = 'tab';
|
||||
htmlTab.appendChild(document.createTextNode('HTML'));
|
||||
htmlTab.onclick = function() { changeTab(htmlTab, 'html'); };
|
||||
tabArea.appendChild(htmlTab);
|
||||
|
||||
var runBtn = document.createElement('span');
|
||||
runBtn.className = 'action run';
|
||||
runBtn.appendChild(document.createTextNode('Run'));
|
||||
runBtn.onclick = function() { run(); };
|
||||
tabArea.appendChild(runBtn);
|
||||
|
||||
return tabArea;
|
||||
})();
|
||||
|
||||
var editorContainer = document.createElement('div');
|
||||
editorContainer.className = 'editor-container';
|
||||
|
||||
typingContainer.appendChild(tabArea);
|
||||
typingContainer.appendChild(editorContainer);
|
||||
|
||||
var runContainer = document.createElement('div');
|
||||
runContainer.className = 'run-container';
|
||||
|
||||
var sampleSwitcher = document.createElement('select');
|
||||
var sampleChapter;
|
||||
ALL_SAMPLES.forEach(function (sample) {
|
||||
if (!sampleChapter || sampleChapter.label !== sample.chapter) {
|
||||
sampleChapter = document.createElement('optgroup');
|
||||
sampleChapter.label = sample.chapter;
|
||||
sampleSwitcher.appendChild(sampleChapter);
|
||||
}
|
||||
var sampleOption = document.createElement('option');
|
||||
sampleOption.value = sample.sampleId;
|
||||
sampleOption.appendChild(document.createTextNode(sample.name));
|
||||
sampleChapter.appendChild(sampleOption);
|
||||
});
|
||||
sampleSwitcher.className = 'sample-switcher';
|
||||
|
||||
function findSample(sampleId) {
|
||||
for (var i = 0; i < SAMPLES.length; i++) {
|
||||
var sample = SAMPLES[i];
|
||||
if (sample.id === sampleId) {
|
||||
return sample;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function loadSample(sampleId, callback) {
|
||||
var sample = findSample(sampleId);
|
||||
if (sample) {
|
||||
return callback(null, sample);
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.src = 'playground/samples/' + sampleId + '.js';
|
||||
script.onload = function() {
|
||||
var sample = findSample(sampleId);
|
||||
return callback(sample ? null : new Error('sample not found'), sample);
|
||||
};
|
||||
script.onerror = function(err) {
|
||||
return callback(err, null);
|
||||
};
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
sampleSwitcher.onchange = function() {
|
||||
var sampleId = sampleSwitcher.options[sampleSwitcher.selectedIndex].value;
|
||||
window.location.hash = sampleId;
|
||||
};
|
||||
|
||||
var playgroundContainer = document.getElementById('playground');
|
||||
|
||||
layout();
|
||||
window.onresize = layout;
|
||||
|
||||
playgroundContainer.appendChild(sampleSwitcher);
|
||||
playgroundContainer.appendChild(typingContainer);
|
||||
playgroundContainer.appendChild(runContainer);
|
||||
|
||||
data.js.model = monaco.editor.createModel('console.log("hi")', 'javascript');
|
||||
data.css.model = monaco.editor.createModel('css', 'css');
|
||||
data.html.model = monaco.editor.createModel('html', 'html');
|
||||
|
||||
editor = monaco.editor.create(editorContainer, {
|
||||
model: data.js.model
|
||||
});
|
||||
|
||||
var currentToken = 0;
|
||||
function parseHash(firstTime) {
|
||||
var sampleId = window.location.hash.replace(/^#/, '');
|
||||
if (!sampleId) {
|
||||
sampleId = ALL_SAMPLES[0].sampleId;
|
||||
}
|
||||
|
||||
if (firstTime) {
|
||||
for (var i = 0; i < sampleSwitcher.options.length; i++) {
|
||||
var opt = sampleSwitcher.options[i];
|
||||
if (opt.value === sampleId) {
|
||||
sampleSwitcher.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var myToken = (++currentToken);
|
||||
loadSample(sampleId, function(err, sample) {
|
||||
if (err) {
|
||||
alert('Sample not found! ' + err.message);
|
||||
return;
|
||||
}
|
||||
if (myToken !== currentToken) {
|
||||
return;
|
||||
}
|
||||
data.js.model.setValue(sample.js);
|
||||
data.html.model.setValue(sample.html);
|
||||
data.css.model.setValue(sample.css);
|
||||
editor.setScrollTop(0);
|
||||
run();
|
||||
});
|
||||
}
|
||||
window.onhashchange = parseHash;
|
||||
parseHash(true);
|
||||
|
||||
function run() {
|
||||
doRun(runContainer);
|
||||
}
|
||||
}
|
||||
|
||||
var runIframe = null, runIframeHeight = 0;
|
||||
function doRun(runContainer) {
|
||||
if (runIframe) {
|
||||
// Unload old iframe
|
||||
runContainer.removeChild(runIframe);
|
||||
}
|
||||
|
||||
// Load new iframe
|
||||
runIframe = document.createElement('iframe');
|
||||
runIframe.id = 'runner';
|
||||
runIframe.src = 'playground/playground-runner.html';
|
||||
runIframe.className = 'run-iframe';
|
||||
runIframe.style.boxSizing = 'border-box';
|
||||
runIframe.style.height = runIframeHeight + 'px';
|
||||
runIframe.style.width = '100%';
|
||||
runIframe.style.border = '1px solid lightgrey';
|
||||
runIframe.frameborder = '0';
|
||||
runContainer.appendChild(runIframe);
|
||||
|
||||
var getLang = function(lang) {
|
||||
return data[lang].model.getValue();
|
||||
};
|
||||
|
||||
runIframe.addEventListener('load', function(e) {
|
||||
runIframe.contentWindow.load(getLang('js'), getLang('html'), getLang('css'));
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
1577
website/playground/playground.mdoc
Normal file
1577
website/playground/playground.mdoc
Normal file
File diff suppressed because it is too large
Load diff
BIN
website/playground/run.png
Normal file
BIN
website/playground/run.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 B |
54
website/playground/spinner.css
Normal file
54
website/playground/spinner.css
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/* ---- BEGIN loading spinner ---- */
|
||||
#loading .spinner {
|
||||
margin: 100px auto;
|
||||
width: 50px;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#loading .spinner > div {
|
||||
background-color: #333;
|
||||
height: 100%;
|
||||
width: 6px;
|
||||
display: inline-block;
|
||||
|
||||
-webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out;
|
||||
animation: sk-stretchdelay 1.2s infinite ease-in-out;
|
||||
}
|
||||
|
||||
#loading .spinner .rect2 {
|
||||
-webkit-animation-delay: -1.1s;
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
|
||||
#loading .spinner .rect3 {
|
||||
-webkit-animation-delay: -1.0s;
|
||||
animation-delay: -1.0s;
|
||||
}
|
||||
|
||||
#loading .spinner .rect4 {
|
||||
-webkit-animation-delay: -0.9s;
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
|
||||
#loading .spinner .rect5 {
|
||||
-webkit-animation-delay: -0.8s;
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes sk-stretchdelay {
|
||||
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
|
||||
20% { -webkit-transform: scaleY(1.0) }
|
||||
}
|
||||
|
||||
@keyframes sk-stretchdelay {
|
||||
0%, 40%, 100% {
|
||||
transform: scaleY(0.4);
|
||||
-webkit-transform: scaleY(0.4);
|
||||
} 20% {
|
||||
transform: scaleY(1.0);
|
||||
-webkit-transform: scaleY(1.0);
|
||||
}
|
||||
}
|
||||
/* ---- END loading spinner ---- */
|
||||
4
website/worker-loader-proxy.js
Normal file
4
website/worker-loader-proxy.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
self.MonacoEnvironment = {
|
||||
baseUrl: '../release/min/'
|
||||
};
|
||||
importScripts('../release/min/vs/base/worker/workerMain.js');
|
||||
Loading…
Add table
Add a link
Reference in a new issue