@wsl233/dsh-gomoku 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ui/lan.html ADDED
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="color-scheme" content="light">
7
+ <title>五子棋 · 局域网加入</title>
8
+ <link rel="stylesheet" href="/ui/gomoku.css?v=0.2.0-25">
9
+ <style>
10
+ html, body { margin: 0; min-height: 100%; background: #ffffff; }
11
+ body { min-height: 100vh; }
12
+ #app { min-height: 100vh; }
13
+ .gk-lan-note {
14
+ margin: 12px auto 28px;
15
+ max-width: 640px;
16
+ padding: 0 16px;
17
+ color: #8a6a4a;
18
+ font: 500 12px/1.7 "Segoe UI", "Microsoft YaHei", sans-serif;
19
+ text-align: center;
20
+ }
21
+ </style>
22
+ </head>
23
+ <body>
24
+ <div id="app"></div>
25
+ <div class="gk-lan-note">你已通过局域网加入对局。关掉本页即离开房间。</div>
26
+
27
+ <script src="/ui/engine/board.js"></script>
28
+ <script src="/ui/engine/evaluate.js"></script>
29
+ <script src="/ui/engine/ai.js"></script>
30
+ <script src="/ui/gomoku-ui.js?v=0.2.0-25"></script>
31
+ <script>
32
+ (function () {
33
+ var params = new URLSearchParams(window.location.search);
34
+ var room = params.get('room') || '';
35
+ var host = params.get('host') === '1';
36
+ window.DshGomokuUI.mount(document.getElementById('app'), {
37
+ demo: false,
38
+ preview: false,
39
+ lan: !host,
40
+ host: host,
41
+ room: room,
42
+ assetBase: '/assets/'
43
+ });
44
+ })();
45
+ </script>
46
+ </body>
47
+ </html>
@@ -0,0 +1,101 @@
1
+ QR Code Generator
2
+ ===
3
+
4
+ ## Getting Started
5
+
6
+ 1. Include qrcode.js in your html.
7
+ 2. Prepare a place holder.
8
+ 3. Generate QR and render it.
9
+
10
+ ```html
11
+ <script type="text/javascript" src="qrcode.js"></script>
12
+ ```
13
+ ```html
14
+ <div id="placeHolder"></div>
15
+ ```
16
+ ```javascript
17
+ var typeNumber = 4;
18
+ var errorCorrectionLevel = 'L';
19
+ var qr = qrcode(typeNumber, errorCorrectionLevel);
20
+ qr.addData('Hi!');
21
+ qr.make();
22
+ document.getElementById('placeHolder').innerHTML = qr.createImgTag();
23
+ ```
24
+ ## API Documentation
25
+
26
+ ### QRCodeFactory
27
+
28
+ #### qrcode(typeNumber, errorCorrectionLevel) => <code>QRCode</code>
29
+ Create a QRCode Object.
30
+
31
+ | Param | Type | Description |
32
+ | ---------------------| ------------------- | ---------------------------------------------- |
33
+ | typeNumber | <code>number</code> | Type number (1 ~ 40), or 0 for auto detection. |
34
+ | errorCorrectionLevel | <code>string</code> | Error correction level ('L', 'M', 'Q', 'H') |
35
+
36
+ #### qrcode.stringToBytes(s) : <code>number[]</code>
37
+ Encodes a string into an array of number(byte) using any charset.
38
+ This function is used by internal.
39
+ Overwrite this function to encode using a multibyte charset.
40
+
41
+ | Param | Type | Description |
42
+ | ------ | ------------------- | ---------------- |
43
+ | s | <code>string</code> | string to encode |
44
+
45
+ ### QRCode
46
+
47
+ #### addData(data, mode) => <code>void</code>
48
+ Add a data to encode.
49
+
50
+ | Param | Type | Description |
51
+ | ------ | ------------------- | ---------------------------------------------------------- |
52
+ | data | <code>string</code> | string to encode |
53
+ | mode | <code>string</code> | Mode ('Numeric', 'Alphanumeric', 'Byte'(default), 'Kanji') |
54
+
55
+ #### make() => <code>void</code>
56
+ Make a QR Code.
57
+
58
+ #### getModuleCount() => <code>number</code>
59
+ The number of modules(cells) for each orientation.
60
+ _[Note] call make() before this function._
61
+
62
+ #### isDark(row, col) => <code>boolean</code>
63
+ The module at row and col is dark or not.
64
+ _[Note] call make() before this function._
65
+
66
+ | Param | Type | Description |
67
+ | ----- | ------------------- | ------------------- |
68
+ | row | <code>number</code> | 0 ~ moduleCount - 1 |
69
+ | col | <code>number</code> | 0 ~ moduleCount - 1 |
70
+
71
+ #### createDataURL(cellSize, margin) => <code>string</code>
72
+ #### createImgTag(cellSize, margin, alt) => <code>string</code>
73
+ #### createSvgTag(cellSize, margin) => <code>string</code>
74
+ #### createTableTag(cellSize, margin) => <code>string</code>
75
+ #### createASCII(cellSize, margin) => <code>string</code>
76
+ Helper functions for HTML.
77
+ _[Note] call make() before these functions._
78
+
79
+ | Param | Type | Description |
80
+ | -------- | ------------------- | --------------------- |
81
+ | cellSize | <code>number</code> | default: 2 |
82
+ | margin | <code>number</code> | default: cellSize * 4 |
83
+ | alt | <code>string</code> | (optional) |
84
+
85
+ #### createSvgTag(opts) => <code>string</code>
86
+
87
+ | Param | Type | Description |
88
+ | ------------- | -------------------- | --------------------- |
89
+ | opts | <code>object</code> | default: {} |
90
+ | opts.cellSize | <code>number</code> | default: 2 |
91
+ | opts.margin | <code>number</code> | default: cellSize * 4 |
92
+ | opts.scalable | <code>boolean</code> | default: false |
93
+
94
+ #### renderTo2dContext(context, cellSize) => <code>void</code>
95
+
96
+ --
97
+
98
+ This implementation is based on JIS X 0510:1999.
99
+
100
+ The word 'QR Code' is registered trademark of DENSO WAVE INCORPORATED
101
+ <br/>http://www.denso-wave.com/qrcode/faqpatent-e.html