forked from justinfagnani/chessboard-element
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
138 lines (124 loc) · 9.16 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>chessboard-element » </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/chessboard-element/img/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
<link rel="stylesheet" href="/chessboard-element/css/prism-okaidia.css">
<link rel="stylesheet" href="/chessboard-element/css/site.css">
</head>
<body class="homepage">
<script type="module" src="/chessboard-element/bundled/chessboard-element.bundled.js"></script>
<div class="hero-wrapper">
<div class="body-width-115f6 hero-inner-556fe">
<img src="/chessboard-element/img/bK.png" alt="Black King">
<h1>chessboard-element</h1>
<h2>A <chess-board> element for your web pages</h2>
</div>
</div>
<nav id="start" class="homepage-nav-b9ecc">
<div class="body-width-115f6 navbar-a57cc hover-effect">
<a href="#start"><span class="piece">♟</span> Getting Started</a>
<a href="/chessboard-element/examples/"><span class="piece">♛</span> Examples</a>
<a href="/chessboard-element/docs/"><span class="piece">♜</span> Documentation</a>
<a href="/chessboard-element/install/"><span class="piece">♞</span> Install</a>
</div>
</nav>
<main>
<section class="homepage-section-88e4a body-width-115f6">
<div class="col-11bcf">
<h2>As easy as HTML</h2>
<p>
<chess-board> is just an element. Use it anywhere you use HTML!
</p>
<h4>HTML</h4>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>chess-board</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>chess-board</span><span class="token punctuation">></span></span></code></pre>
<p>
<chess-board> works in plain HTML documents, with your favorite
framework, content management systems, standard Markdown, and more!
</p>
</div>
<div class="col-11bcf">
<chess-board id="board1"></chess-board>
</div>
</section>
<section class="homepage-section-88e4a body-width-115f6">
<div class="col-11bcf">
<h2>Declarative configuration with attributes</h2>
<p>
Set the board position, enable draggable pieces, show spare pieces, and
more with attributes.
</p>
<h4>HTML</h4>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>chess-board</span><br> <span class="token attr-name">draggable-pieces</span><br> <span class="token attr-name">position</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>8/R7/8/8/k1K5/8/8/8<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><br><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>chess-board</span><span class="token punctuation">></span></span></code></pre>
</pre>
</div>
<div class="col-11bcf">
<chess-board
draggable-pieces
position="8/R7/8/8/k1K5/8/8/8">
</chess-board>
</div>
</section>
<section class="homepage-section-88e4a body-width-115f6">
<div class="col-11bcf">
<h2>Powerful HTML, JavaScript, and CSS APIs</h2>
<p>
Set the board position, move pieces, listen to events, style squares and
pieces, and more with native HTML, JavaScript, and CSS APIs.
</p>
<h4>HTML</h4>
<pre class="language-html"><code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>chess-board</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>board3<span class="token punctuation">"</span></span><br> <span class="token attr-name">draggable-pieces</span><br> <span class="token attr-name">spare-pieces</span><br> <span class="token attr-name">drop-off-board</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>trash<span class="token punctuation">"</span></span><span class="token punctuation">></span></span><br><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>chess-board</span><span class="token punctuation">></span></span><br><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>button</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>startBtn<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Start Position<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>button</span><span class="token punctuation">></span></span><br><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>button</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>clearBtn<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Clear Board<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>button</span><span class="token punctuation">></span></span></code></pre>
<h4>JavaScript</h4>
<pre class="language-js"><code class="language-js">startBtn<span class="token punctuation">.</span><span class="token function">addEventListener</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span><br> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> board3<span class="token punctuation">.</span><span class="token function">start</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br> <br>clearBtn<span class="token punctuation">.</span><span class="token function">addEventListener</span><span class="token punctuation">(</span><span class="token string">'click'</span><span class="token punctuation">,</span><br> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> board3<span class="token punctuation">.</span><span class="token function">clear</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</div>
<div class="col-11bcf">
<chess-board id="board3"
draggable-pieces
spare-pieces
drop-off-board="trash">
</chess-board>
<button id="startBtn">Start Position</button>
<button id="clearBtn">Clear Board</button>
</div>
</section>
<section class="homepage-section-88e4a body-width-115f6">
<div class="col-11bcf">
<h2>Works with your favorite framework</h2>
<p>
Because <chess-board> is a web component, it works in any framework.
</p>
<p>
Here's <chess-board> inside of a React app.
</p>
<p>
And at only 15k minified and gzipped it's probably smaller than your framework!
</p>
</div>
<div class="col-11bcf">
<iframe
style="width: 512px; height: 620px;"
src="https://stackblitz.com/edit/react-chess-board?embed=1&file=index.js&hideExplorer=1&hideNavigation=1&view=preview">
</iframe>
</div>
</section>
</main>
<footer>
<div class="body-width-115f6 flex-c31d5">
<div class="left-3edd4">
<p>chessboard-element is released under the <a href="https://github.com/justinfagnani/chessboard-element/blob/master/LICENSE.md">MIT License</a></p>
<p>The code can be found on <a href="https://github.com/justinfagnani/chessboard-element/">GitHub</a></p>
<p>chessboard-element is a fork of the awesome <a href="https://github.com/oakmac/chessboardjs/">chessboard.js</a> project by Chris Oakman</p>
<p>Made with <a href="https://lit-element.polymer-project.org/">LitElement</a> by <a href="https://twitter.com/justinfagnani">Justin Fagnani</a></p>
</div>
</div>
</footer>
<script>
// Example 2
startBtn.addEventListener('click', () => board3.start());
clearBtn.addEventListener('click', () => board3.clear());
</script>
</body>
</html>