mumuki-gobstones-board 1.20.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,192 @@
1
+ <link rel="import" href="gs-stone.html">
2
+ <link rel="import" href="cell-dresser.html">
3
+ <dom-module id="gs-cell">
4
+ <template>
5
+ <style>
6
+ .gbs_pointer {
7
+ cursor: pointer;
8
+ }
9
+
10
+ .gbs_unselectable {
11
+ -webkit-touch-callout: none;
12
+ -webkit-user-select: none;
13
+ -khtml-user-select: none;
14
+ -moz-user-select: none;
15
+ -ms-user-select: none;
16
+ user-select: none;
17
+ }
18
+
19
+ .gbs_gh {
20
+ /* position of the header in the board */
21
+ background: rgba(221, 221, 136, 0.7);
22
+ outline: 3px solid #cc0000;
23
+ outline-style: var(--outline-style);
24
+ }
25
+
26
+ div.gbs_gc {
27
+ background-image: var(--background-url);
28
+ background-repeat: no-repeat;
29
+ background-position: center;
30
+ background-size: cover;
31
+ }
32
+
33
+ table.gbs_gc {
34
+ /* cell table */
35
+ border-style: none;
36
+ border: solid black 0px;
37
+ }
38
+
39
+ .gbs_gc tr {
40
+ border-style: none;
41
+ border: 0px;
42
+ }
43
+
44
+ .gbs_gc td {
45
+ visibility: var(--stones-visibility);
46
+ border-style: none;
47
+ border: solid black 0px;
48
+ width: 15px;
49
+ height: 15px;
50
+ text-align: center;
51
+ color: #F3F3E9;
52
+ }
53
+
54
+ .gbs_gc td div {
55
+ line-height: 2;
56
+ }
57
+
58
+ /*# sourceMappingURL=style.css.map */
59
+
60
+ </style>
61
+
62
+ <cell-dresser id="dresser"></cell-dresser>
63
+
64
+ <template is="dom-if" if="true">
65
+ <!-- // ^ (otherwise, the cssClass() does not refresh itself) -->
66
+ <div class$="gbs_gc {{cssClass(header)}}">
67
+ <table>
68
+ <tbody>
69
+ <tr>
70
+ <td>
71
+ <gs-stone color="blue" amount="{{blue}}" options="{{options}}"></gs-stone>
72
+ </td>
73
+ <td>
74
+ <gs-stone color="black" amount="{{black}}" options="{{options}}"></gs-stone>
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <td>
79
+ <gs-stone color="red" amount="{{red}}" options="{{options}}"></gs-stone>
80
+ </td>
81
+ <td>
82
+ <gs-stone color="green" amount="{{green}}" options="{{options}}"></gs-stone>
83
+ </td>
84
+ </tr>
85
+ </tbody>
86
+ </table>
87
+ </div>
88
+ </template>
89
+
90
+ </template>
91
+ <script>
92
+ Polymer({
93
+ is: 'gs-cell',
94
+ properties: {
95
+ black: {
96
+ type: Number,
97
+ value: 0
98
+ },
99
+ blue: {
100
+ type: Number,
101
+ value: 0
102
+ },
103
+ green: {
104
+ type: Number,
105
+ value: 0
106
+ },
107
+ red: {
108
+ type: Number,
109
+ value: 0
110
+ },
111
+ cellIndex: Number,
112
+ rowIndex: Number,
113
+ attire: Object,
114
+ options: Object,
115
+ header: {
116
+ type: Object,
117
+ notify: true
118
+ }
119
+ },
120
+ listeners: {
121
+ click: "_leftClick"
122
+ },
123
+ ready: function() {
124
+ return this._validateData();
125
+ },
126
+ cssClass: function(header) {
127
+ var isHeader;
128
+ if ((header == null) || this.domHost.withoutHeader) {
129
+ return "";
130
+ }
131
+ isHeader = this.x() === header.x && this.y() === header.y;
132
+ if (isHeader) {
133
+ return "gbs_gh";
134
+ } else {
135
+ return "";
136
+ }
137
+ },
138
+ x: function() {
139
+ return this.cellIndex;
140
+ },
141
+ y: function() {
142
+ return this.domHost.getRowNumber(this.domHost.table, this.rowIndex);
143
+ },
144
+ updateCellStyles: function(table, header, attire) {
145
+ var cell, isHeader, rule, text, url, _ref, _ref1;
146
+ cell = (_ref = table[this.rowIndex]) != null ? _ref[this.cellIndex] : void 0;
147
+ if ((cell == null) || (header == null)) {
148
+ return;
149
+ }
150
+ isHeader = this.x() === header.x && this.y() === header.y;
151
+ rule = this.$.dresser.getRule(cell, isHeader, attire);
152
+ url = rule != null ? rule.image : void 0;
153
+ text = rule != null ? rule.text : void 0;
154
+ if ((text != null) && text !== "") {
155
+ url = "\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='50px'><text x='25' y='25' font-size='25' fill='black' text-anchor='middle' alignment-baseline='central'>" + text + "</text></svg>\"";
156
+ }
157
+ this.customStyle["--stones-visibility"] = url != null ? "hidden" : "visible";
158
+ this.customStyle["--outline-style"] = (url != null) && ((rule != null ? (_ref1 = rule.when) != null ? _ref1.head : void 0 : void 0) != null) ? "none" : "solid";
159
+ if (url != null) {
160
+ this.customStyle["--background-url"] = "url(" + url + ")";
161
+ } else {
162
+ delete this.customStyle["--background-url"];
163
+ }
164
+ return this.updateStyles();
165
+ },
166
+ _leftClick: function(event) {
167
+ if (!this.options.editable) {
168
+ return;
169
+ }
170
+ if (this.domHost.isCtrlPressed()) {
171
+ this.header = {
172
+ x: this.x(),
173
+ y: this.y()
174
+ };
175
+ return this.fire("board-changed");
176
+ }
177
+ },
178
+ _validateData: function() {
179
+ if ((this.cellIndex == null) || (this.rowIndex == null)) {
180
+ throw new Error("The coordinates are required");
181
+ }
182
+ if (this.header == null) {
183
+ throw new Error("The header is required");
184
+ }
185
+ if (this.options == null) {
186
+ throw new Error("The options are required");
187
+ }
188
+ }
189
+ });
190
+
191
+ </script>
192
+ </dom-module>
@@ -0,0 +1,206 @@
1
+ <dom-module id="gs-stone">
2
+ <template>
3
+ <style>
4
+ .gbs_pointer {
5
+ cursor: pointer;
6
+ }
7
+
8
+ .gbs_unselectable, .gbs_stone {
9
+ -webkit-touch-callout: none;
10
+ -webkit-user-select: none;
11
+ -khtml-user-select: none;
12
+ -moz-user-select: none;
13
+ -ms-user-select: none;
14
+ user-select: none;
15
+ }
16
+
17
+ .gbs_color-blue, ::content div.gbs_blue, .gbs_ghost-blue:hover {
18
+ background-image: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%232a7fff%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%230055d4%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%2304a%22/%3E%0A%3C/svg%3E%0A);
19
+ background-size: 20px 20px;
20
+ }
21
+
22
+ .gbs_color-black, ::content div.gbs_black, .gbs_ghost-black:hover {
23
+ background-image: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%23292929%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%23202020%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%23131313%22/%3E%0A%3C/svg%3E%0A);
24
+ background-size: 20px 20px;
25
+ }
26
+
27
+ .gbs_color-red, ::content div.gbs_red, .gbs_ghost-red:hover {
28
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%3Cmetadata%3E%0A%3Crdf%3ARDF%3E%0A%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%3Cdc%3Atitle/%3E%0A%3C/cc%3AWork%3E%0A%3C/rdf%3ARDF%3E%0A%3C/metadata%3E%0A%3Cg%20transform%3D%22translate%280%20-875.2%29%22%3E%0A%3Cellipse%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%22963.84%22%20cx%3D%2288.641%22%20fill%3D%22%23d40000%22/%3E%0A%3Cpath%20fill%3D%22%23b10000%22%20d%3D%22m171.5%20934.71c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22/%3E%0A%3Cellipse%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%22915.85%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%3Cellipse%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%22906.9%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%3Cpath%20fill%3D%22%23800%22%20d%3D%22m170.51%20969.47c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22/%3E%0A%3C/g%3E%0A%3C/svg%3E%0A);
29
+ background-size: 20px 20px;
30
+ }
31
+
32
+ .gbs_color-green, ::content div.gbs_green, .gbs_ghost-green:hover {
33
+ background-image: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%2337c837%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%232ca02c%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%23217821%22/%3E%0A%3C/svg%3E%0A);
34
+ background-size: 20px 20px;
35
+ }
36
+
37
+ ::content div.gbs_O {
38
+ background: white;
39
+ opacity: 0;
40
+ }
41
+
42
+ .gbs_hidden {
43
+ visibility: hidden;
44
+ }
45
+
46
+ .gbs_stone {
47
+ font-weight: bold;
48
+ font-size: 8pt;
49
+ width: 20px;
50
+ height: 20px;
51
+ }
52
+
53
+ .gbs_stone_amount {
54
+ vertical-align: sub;
55
+ }
56
+
57
+ .gbs_ghost-color, .gbs_ghost-blue:hover, .gbs_ghost-black:hover, .gbs_ghost-red:hover, .gbs_ghost-green:hover {
58
+ cursor: pointer;
59
+ opacity: 0.5 !important;
60
+ }
61
+
62
+ /* Tooltip container */
63
+ .gbs_tooltip {
64
+ position: relative;
65
+ }
66
+
67
+ /* Tooltip text */
68
+ .gbs_tooltip .gbs_tooltiptext {
69
+ visibility: hidden;
70
+ width: 50px;
71
+ background-color: #555;
72
+ color: #fff;
73
+ text-align: center;
74
+ padding: 5px 0;
75
+ border-radius: 6px;
76
+ /* Position the tooltip text */
77
+ position: absolute;
78
+ z-index: 1;
79
+ bottom: 125%;
80
+ left: 50%;
81
+ margin-left: -25px;
82
+ /* Fade in tooltip */
83
+ opacity: 0;
84
+ }
85
+
86
+ /* Tooltip arrow */
87
+ .gbs_tooltip .gbs_tooltiptext::after {
88
+ content: "";
89
+ position: absolute;
90
+ top: 100%;
91
+ left: 50%;
92
+ margin-left: -5px;
93
+ border-width: 5px;
94
+ border-style: solid;
95
+ border-color: #555 transparent transparent transparent;
96
+ }
97
+
98
+ /* Show the tooltip text when you mouse over the tooltip container */
99
+ .gbs_tooltip:hover .gbs_tooltiptext {
100
+ visibility: visible;
101
+ opacity: 1;
102
+ }
103
+
104
+ /*# sourceMappingURL=style.css.map */
105
+
106
+ </style>
107
+
108
+ <template is="dom-if" if="{{amount}}">
109
+ <div class$="gbs_stone gbs_tooltip gbs_{{color}} {{cssClass(color, amount)}}">
110
+ <span class="gbs_stone_amount">{{amountText(amount)}}</span>
111
+
112
+ <template is="dom-if" if="{{hasBigAmount(amount)}}">
113
+ <span class="gbs_tooltiptext">{{amount}}</span>
114
+ </template>
115
+ </div>
116
+ </template>
117
+
118
+ <template is="dom-if" if="{{!amount}}">
119
+ <div class$="gbs_stone gbs_O {{cssClass(color, amount)}}"></div>
120
+ </template>
121
+
122
+ </template>
123
+ <script>
124
+ Polymer({
125
+ is: 'gs-stone',
126
+ properties: {
127
+ color: String,
128
+ amount: {
129
+ type: Number,
130
+ value: 0,
131
+ notify: true,
132
+ observer: "_sanitizeAmount"
133
+ },
134
+ options: Object
135
+ },
136
+ listeners: {
137
+ click: "_leftClick",
138
+ contextmenu: "_rightClick"
139
+ },
140
+ ready: function() {
141
+ this._sanitizeAmount();
142
+ if (this.options == null) {
143
+ throw new Error("The options are required");
144
+ }
145
+ },
146
+ amountText: function(amount) {
147
+ if (this.hasBigAmount(amount)) {
148
+ return "*";
149
+ } else {
150
+ return amount;
151
+ }
152
+ },
153
+ cssClass: function(color, amount) {
154
+ if (this.options.editable) {
155
+ if (amount > 0) {
156
+ return "gbs_pointer";
157
+ } else {
158
+ return "gbs_ghost-" + color;
159
+ }
160
+ } else {
161
+ return "";
162
+ }
163
+ },
164
+ hasBigAmount: (function(_this) {
165
+ return function(amount) {
166
+ return amount > 99;
167
+ };
168
+ })(this),
169
+ _sanitizeAmount: function() {
170
+ if (!(typeof this.amount === "number" && this.amount >= 0)) {
171
+ return this.amount = 0;
172
+ }
173
+ },
174
+ _leftClick: function(event) {
175
+ var board, cell;
176
+ cell = this.domHost;
177
+ board = cell.domHost;
178
+ if (!this.options.editable || board.isCtrlPressed()) {
179
+ return;
180
+ }
181
+ this.amount += this._clickAmount();
182
+ board.setStonesNumber(cell, this.color, this.amount);
183
+ return event.stopPropagation();
184
+ },
185
+ _rightClick: function(event) {
186
+ var board, cell;
187
+ cell = this.domHost;
188
+ board = cell.domHost;
189
+ if (!this.options.editable) {
190
+ return;
191
+ }
192
+ this.amount -= this._clickAmount();
193
+ board.setStonesNumber(cell, this.color, this.amount);
194
+ return event.preventDefault();
195
+ },
196
+ _clickAmount: function() {
197
+ if (this.domHost.domHost.isShiftPressed()) {
198
+ return 10;
199
+ } else {
200
+ return 1;
201
+ }
202
+ }
203
+ });
204
+
205
+ </script>
206
+ </dom-module>
@@ -0,0 +1,53 @@
1
+ <dom-module id="key-tracker">
2
+ <template>
3
+ <style>
4
+
5
+
6
+ /*# sourceMappingURL=style.css.map */
7
+
8
+ </style>
9
+
10
+
11
+ </template>
12
+ <script>
13
+ Polymer({
14
+ is: 'key-tracker',
15
+ ready: function() {
16
+ this._pressedKeys = [];
17
+ this._listenTo("keydown", (function(_this) {
18
+ return function(ev) {
19
+ var key;
20
+ key = ev.key || ev.keyIdentifier;
21
+ if (!_this.isPressed(key)) {
22
+ return _this._pressedKeys.push(key);
23
+ }
24
+ };
25
+ })(this));
26
+ this._listenTo("keyup", (function(_this) {
27
+ return function(ev) {
28
+ var key;
29
+ key = ev.key || ev.keyIdentifier;
30
+ if (_this.isPressed(key)) {
31
+ return _this._pressedKeys.splice(_this._indexOf(key), 1);
32
+ }
33
+ };
34
+ })(this));
35
+ return window.addEventListener("blur", (function(_this) {
36
+ return function() {
37
+ return _this._pressedKeys = [];
38
+ };
39
+ })(this));
40
+ },
41
+ isPressed: function(key) {
42
+ return this._indexOf(key) !== -1;
43
+ },
44
+ _indexOf: function(key) {
45
+ return this._pressedKeys.indexOf(key);
46
+ },
47
+ _listenTo: function(eventName, handler) {
48
+ return window.addEventListener(eventName, handler);
49
+ }
50
+ });
51
+
52
+ </script>
53
+ </dom-module>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="50mm" width="50mm" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 177.16535 177.16535">
3
+ <metadata id="metadata4">
4
+ <rdf:RDF>
5
+ <cc:Work rdf:about="">
6
+ <dc:format>image/svg+xml</dc:format>
7
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
8
+ <dc:title/>
9
+ </cc:Work>
10
+ </rdf:RDF>
11
+ </metadata>
12
+ <ellipse id="ellipse8" rx="88.184" ry="88.715" cy="88.64" cx="88.641" fill="#2a7fff"/>
13
+ <path id="path10" d="m171.5 59.51c3.8341 9.671 5.9385 20.183 5.9385 31.178 0 47.861-39.767 86.675-88.804 86.675-49.035 0-88.802-38.814-88.802-86.675 0-11.546 2.321-22.563 6.5203-32.638 0.65931 1.4104 1.2522 2.2175 2.3526 3.2916 0.35416 1.0386 0.78421 1.6358 1.3755 2.1681-7.3662 20.277-6.1393 43.028 3.4436 62.435 54.759-46.096 78.905 15.358 153.35-15.895 5.0041-18.979 7.0041-31.152-1.2712-50.54h5.8942z" fill="#0055d4"/>
14
+ <ellipse id="ellipse12" rx="7.2374" ry="7.2809" cy="40.65" cx="55.881" fill="#fff"/>
15
+ <ellipse id="ellipse14" rx="4.0266" ry="4.0508" cy="31.7" cx="60.102" fill="#fff"/>
16
+ <path id="path16" d="m170.51 94.27c-0.7628 4.8812-1.991 9.9925-3.5039 15.73-22.254 9.3418-40.012 10.398-55.438 8.5215a61.964 57.5 0 0 0 -11.02 32.707 61.964 57.5 0 0 0 5.9121 24.359c38.986-7.6985 68.715-40.328 70.965-80.098a61.964 57.5 0 0 0 -6.916 -1.2207z" fill="#04a"/>
17
+ </svg>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="50mm" width="50mm" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 177.16535 177.16535">
3
+ <metadata id="metadata4">
4
+ <rdf:RDF>
5
+ <cc:Work rdf:about="">
6
+ <dc:format>image/svg+xml</dc:format>
7
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
8
+ <dc:title/>
9
+ </cc:Work>
10
+ </rdf:RDF>
11
+ </metadata>
12
+ <ellipse id="ellipse8" rx="88.184" ry="88.715" cy="88.64" cx="88.641" fill="#292929"/>
13
+ <path id="path10" d="m171.5 59.51c3.8341 9.671 5.9385 20.183 5.9385 31.178 0 47.861-39.767 86.675-88.804 86.675-49.035 0-88.802-38.814-88.802-86.675 0-11.546 2.321-22.563 6.5203-32.638 0.65931 1.4104 1.2522 2.2175 2.3526 3.2916 0.35416 1.0386 0.78421 1.6358 1.3755 2.1681-7.3662 20.277-6.1393 43.028 3.4436 62.435 54.759-46.096 78.905 15.358 153.35-15.895 5.0041-18.979 7.0041-31.152-1.2712-50.54h5.8942z" fill="#202020"/>
14
+ <ellipse id="ellipse12" rx="7.2374" ry="7.2809" cy="40.65" cx="55.881" fill="#fff"/>
15
+ <ellipse id="ellipse14" rx="4.0266" ry="4.0508" cy="31.7" cx="60.102" fill="#fff"/>
16
+ <path id="path16" d="m170.51 94.27c-0.7628 4.8812-1.991 9.9925-3.5039 15.73-22.254 9.3418-40.012 10.398-55.438 8.5215a61.964 57.5 0 0 0 -11.02 32.707 61.964 57.5 0 0 0 5.9121 24.359c38.986-7.6985 68.715-40.328 70.965-80.098a61.964 57.5 0 0 0 -6.916 -1.2207z" fill="#131313"/>
17
+ </svg>
@@ -0,0 +1,18 @@
1
+ <svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="50mm" width="50mm" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 177.16535 177.16535">
2
+ <metadata>
3
+ <rdf:RDF>
4
+ <cc:Work rdf:about="">
5
+ <dc:format>image/svg+xml</dc:format>
6
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
7
+ <dc:title/>
8
+ </cc:Work>
9
+ </rdf:RDF>
10
+ </metadata>
11
+ <g transform="translate(0 -875.2)">
12
+ <ellipse rx="88.184" ry="88.715" cy="963.84" cx="88.641" fill="#d40000"/>
13
+ <path fill="#b10000" d="m171.5 934.71c3.8341 9.671 5.9385 20.183 5.9385 31.178 0 47.861-39.767 86.675-88.804 86.675-49.035 0-88.802-38.814-88.802-86.675 0-11.546 2.321-22.563 6.5203-32.638 0.65931 1.4104 1.2522 2.2175 2.3526 3.2916 0.35416 1.0386 0.78421 1.6358 1.3755 2.1681-7.3662 20.277-6.1393 43.028 3.4436 62.435 54.759-46.096 78.905 15.358 153.35-15.895 5.0041-18.979 7.0041-31.152-1.2712-50.54h5.8942z"/>
14
+ <ellipse rx="7.2374" ry="7.2809" cy="915.85" cx="55.881" fill="#fff"/>
15
+ <ellipse rx="4.0266" ry="4.0508" cy="906.9" cx="60.102" fill="#fff"/>
16
+ <path fill="#800" d="m170.51 969.47c-0.7628 4.8812-1.991 9.9925-3.5039 15.73-22.254 9.3418-40.012 10.398-55.438 8.5215a61.964 57.5 0 0 0 -11.02 32.707 61.964 57.5 0 0 0 5.9121 24.359c38.986-7.6985 68.715-40.328 70.965-80.098a61.964 57.5 0 0 0 -6.916 -1.2207z"/>
17
+ </g>
18
+ </svg>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="50mm" width="50mm" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 177.16535 177.16535">
3
+ <metadata id="metadata4">
4
+ <rdf:RDF>
5
+ <cc:Work rdf:about="">
6
+ <dc:format>image/svg+xml</dc:format>
7
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
8
+ <dc:title/>
9
+ </cc:Work>
10
+ </rdf:RDF>
11
+ </metadata>
12
+ <ellipse id="ellipse8" rx="88.184" ry="88.715" cy="88.64" cx="88.641" fill="#37c837"/>
13
+ <path id="path10" d="m171.5 59.51c3.8341 9.671 5.9385 20.183 5.9385 31.178 0 47.861-39.767 86.675-88.804 86.675-49.035 0-88.802-38.814-88.802-86.675 0-11.546 2.321-22.563 6.5203-32.638 0.65931 1.4104 1.2522 2.2175 2.3526 3.2916 0.35416 1.0386 0.78421 1.6358 1.3755 2.1681-7.3662 20.277-6.1393 43.028 3.4436 62.435 54.759-46.096 78.905 15.358 153.35-15.895 5.0041-18.979 7.0041-31.152-1.2712-50.54h5.8942z" fill="#2ca02c"/>
14
+ <ellipse id="ellipse12" rx="7.2374" ry="7.2809" cy="40.65" cx="55.881" fill="#fff"/>
15
+ <ellipse id="ellipse14" rx="4.0266" ry="4.0508" cy="31.7" cx="60.102" fill="#fff"/>
16
+ <path id="path16" d="m170.51 94.27c-0.7628 4.8812-1.991 9.9925-3.5039 15.73-22.254 9.3418-40.012 10.398-55.438 8.5215a61.964 57.5 0 0 0 -11.02 32.707 61.964 57.5 0 0 0 5.9121 24.359c38.986-7.6985 68.715-40.328 70.965-80.098a61.964 57.5 0 0 0 -6.916 -1.2207z" fill="#217821"/>
17
+ </svg>
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"></head><body><div hidden="" by-vulcanize=""><dom-module id="gs-stone" assetpath="dist/components/"><template><style>.gbs_pointer{cursor:pointer;}.gbs_unselectable,.gbs_stone{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.gbs_color-blue,::content div.gbs_blue,.gbs_ghost-blue:hover{background-image:url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%232a7fff%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%230055d4%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%2304a%22/%3E%0A%3C/svg%3E%0A");background-size:20px 20px;}.gbs_color-black,::content div.gbs_black,.gbs_ghost-black:hover{background-image:url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%23292929%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%23202020%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%23131313%22/%3E%0A%3C/svg%3E%0A");background-size:20px 20px;}.gbs_color-red,::content div.gbs_red,.gbs_ghost-red:hover{background-image:url("data:image/svg+xml,%3Csvg%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%3Cmetadata%3E%0A%3Crdf%3ARDF%3E%0A%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%3Cdc%3Atitle/%3E%0A%3C/cc%3AWork%3E%0A%3C/rdf%3ARDF%3E%0A%3C/metadata%3E%0A%3Cg%20transform%3D%22translate%280%20-875.2%29%22%3E%0A%3Cellipse%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%22963.84%22%20cx%3D%2288.641%22%20fill%3D%22%23d40000%22/%3E%0A%3Cpath%20fill%3D%22%23b10000%22%20d%3D%22m171.5%20934.71c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22/%3E%0A%3Cellipse%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%22915.85%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%3Cellipse%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%22906.9%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%3Cpath%20fill%3D%22%23800%22%20d%3D%22m170.51%20969.47c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22/%3E%0A%3C/g%3E%0A%3C/svg%3E%0A");background-size:20px 20px;}.gbs_color-green,::content div.gbs_green,.gbs_ghost-green:hover{background-image:url("data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20standalone%3D%22no%22%3F%3E%0A%3Csvg%20id%3D%22svg2%22%20xmlns%3Ardf%3D%22http%3A//www.w3.org/1999/02/22-rdf-syntax-ns%23%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20height%3D%2250mm%22%20width%3D%2250mm%22%20version%3D%221.1%22%20xmlns%3Acc%3D%22http%3A//creativecommons.org/ns%23%22%20xmlns%3Adc%3D%22http%3A//purl.org/dc/elements/1.1/%22%20viewBox%3D%220%200%20177.16535%20177.16535%22%3E%0A%20%3Cmetadata%20id%3D%22metadata4%22%3E%0A%20%20%3Crdf%3ARDF%3E%0A%20%20%20%3Ccc%3AWork%20rdf%3Aabout%3D%22%22%3E%0A%20%20%20%20%3Cdc%3Aformat%3Eimage/svg+xml%3C/dc%3Aformat%3E%0A%20%20%20%20%3Cdc%3Atype%20rdf%3Aresource%3D%22http%3A//purl.org/dc/dcmitype/StillImage%22/%3E%0A%20%20%20%20%3Cdc%3Atitle/%3E%0A%20%20%20%3C/cc%3AWork%3E%0A%20%20%3C/rdf%3ARDF%3E%0A%20%3C/metadata%3E%0A%20%3Cellipse%20id%3D%22ellipse8%22%20rx%3D%2288.184%22%20ry%3D%2288.715%22%20cy%3D%2288.64%22%20cx%3D%2288.641%22%20fill%3D%22%2337c837%22/%3E%0A%20%3Cpath%20id%3D%22path10%22%20d%3D%22m171.5%2059.51c3.8341%209.671%205.9385%2020.183%205.9385%2031.178%200%2047.861-39.767%2086.675-88.804%2086.675-49.035%200-88.802-38.814-88.802-86.675%200-11.546%202.321-22.563%206.5203-32.638%200.65931%201.4104%201.2522%202.2175%202.3526%203.2916%200.35416%201.0386%200.78421%201.6358%201.3755%202.1681-7.3662%2020.277-6.1393%2043.028%203.4436%2062.435%2054.759-46.096%2078.905%2015.358%20153.35-15.895%205.0041-18.979%207.0041-31.152-1.2712-50.54h5.8942z%22%20fill%3D%22%232ca02c%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse12%22%20rx%3D%227.2374%22%20ry%3D%227.2809%22%20cy%3D%2240.65%22%20cx%3D%2255.881%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cellipse%20id%3D%22ellipse14%22%20rx%3D%224.0266%22%20ry%3D%224.0508%22%20cy%3D%2231.7%22%20cx%3D%2260.102%22%20fill%3D%22%23fff%22/%3E%0A%20%3Cpath%20id%3D%22path16%22%20d%3D%22m170.51%2094.27c-0.7628%204.8812-1.991%209.9925-3.5039%2015.73-22.254%209.3418-40.012%2010.398-55.438%208.5215a61.964%2057.5%200%200%200%20-11.02%2032.707%2061.964%2057.5%200%200%200%205.9121%2024.359c38.986-7.6985%2068.715-40.328%2070.965-80.098a61.964%2057.5%200%200%200%20-6.916%20-1.2207z%22%20fill%3D%22%23217821%22/%3E%0A%3C/svg%3E%0A");background-size:20px 20px;}::content div.gbs_O{background:white;opacity:0;}.gbs_hidden{visibility:hidden;}.gbs_stone{font-weight:bold;font-size:8pt;width:20px;height:20px;}.gbs_stone_amount{vertical-align:sub;}.gbs_ghost-color,.gbs_ghost-blue:hover,.gbs_ghost-black:hover,.gbs_ghost-red:hover,.gbs_ghost-green:hover{cursor:pointer;opacity:0.5 !important;}.gbs_tooltip{position:relative;}.gbs_tooltip .gbs_tooltiptext{visibility:hidden;width:50px;background-color:#555;color:#fff;text-align:center;padding:5px 0;border-radius:6px;position:absolute;z-index:1;bottom:125%;left:50%;margin-left:-25px;opacity:0;}.gbs_tooltip .gbs_tooltiptext::after{content:"";position:absolute;top:100%;left:50%;margin-left:-5px;border-width:5px;border-style:solid;border-color:#555 transparent transparent transparent;}.gbs_tooltip:hover .gbs_tooltiptext{visibility:visible;opacity:1;}</style><template is="dom-if" if="{{amount}}"><div class$="gbs_stone gbs_tooltip gbs_{{color}} {{cssClass(color, amount)}}"><span class="gbs_stone_amount">{{amountText(amount)}}</span><template is="dom-if" if="{{hasBigAmount(amount)}}"><span class="gbs_tooltiptext">{{amount}}</span></template></div></template><template is="dom-if" if="{{!amount}}"><div class$="gbs_stone gbs_O {{cssClass(color, amount)}}"></div></template></template><script>Polymer({is:"gs-stone",properties:{color:String,amount:{type:Number,value:0,notify:!0,observer:"_sanitizeAmount"},options:Object},listeners:{click:"_leftClick",contextmenu:"_rightClick"},ready:function(){if(this._sanitizeAmount(),null==this.options)throw new Error("The options are required")},amountText:function(e){return this.hasBigAmount(e)?"*":e},cssClass:function(e,t){return this.options.editable?t>0?"gbs_pointer":"gbs_ghost-"+e:""},hasBigAmount:function(e){return function(e){return e>99}}(),_sanitizeAmount:function(){if(!("number"==typeof this.amount&&this.amount>=0))return this.amount=0},_leftClick:function(e){var t,i;if(i=this.domHost,t=i.domHost,this.options.editable&&!t.isCtrlPressed())return this.amount+=this._clickAmount(),t.setStonesNumber(i,this.color,this.amount),e.stopPropagation()},_rightClick:function(e){var t,i;if(i=this.domHost,t=i.domHost,this.options.editable)return this.amount-=this._clickAmount(),t.setStonesNumber(i,this.color,this.amount),e.preventDefault()},_clickAmount:function(){return this.domHost.domHost.isShiftPressed()?10:1}});</script></dom-module><dom-module id="cell-dresser" assetpath="dist/components/"><template><style></style></template><script>Polymer({is:"cell-dresser",getRule:function(e,t,i){if(null!=i&&i.enabled)return null!=i?i.rules.filter(function(i){return function(n){return i._doesSatisfyRule(e,t,n)}}(this))[0]:void 0},_doesSatisfyRule:function(e,t,i){var n;return n=function(n){return function(r){return n._doesSatisfyQuantity(e[r],i.when[r])&&n._doesSatisfyHeader(t,i.when.head)}}(this),["red","blue","green","black"].reduce(function(e){return function(e,t){return e&&n(t)}}(),!0)},_doesSatisfyQuantity:function(e,t){switch(null==e&&(e=0),t){case"*":return!0;case"+":return e>0;default:return e===t}},_doesSatisfyHeader:function(e,t){return null==t||t===e}});</script></dom-module><dom-module id="gs-cell" assetpath="dist/components/"><template><style>.gbs_pointer{cursor:pointer;}.gbs_unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.gbs_gh{background:rgba(221,221,136,0.7);outline:3px solid #cc0000;outline-style:var(--outline-style);}div.gbs_gc{background-image:var(--background-url);background-repeat:no-repeat;background-position:center;background-size:cover;}table.gbs_gc{border-style:none;border:solid black 0px;}.gbs_gc tr{border-style:none;border:0px;}.gbs_gc td{visibility:var(--stones-visibility);border-style:none;border:solid black 0px;width:15px;height:15px;text-align:center;color:#F3F3E9;}.gbs_gc td div{line-height:2;}</style><cell-dresser id="dresser"></cell-dresser><template is="dom-if" if="true"><div class$="gbs_gc {{cssClass(header)}}"><table><tbody><tr><td><gs-stone color="blue" amount="{{blue}}" options="{{options}}"></gs-stone></td><td><gs-stone color="black" amount="{{black}}" options="{{options}}"></gs-stone></td></tr><tr><td><gs-stone color="red" amount="{{red}}" options="{{options}}"></gs-stone></td><td><gs-stone color="green" amount="{{green}}" options="{{options}}"></gs-stone></td></tr></tbody></table></div></template></template><script>Polymer({is:"gs-cell",properties:{black:{type:Number,value:0},blue:{type:Number,value:0},green:{type:Number,value:0},red:{type:Number,value:0},cellIndex:Number,rowIndex:Number,attire:Object,options:Object,header:{type:Object,notify:!0}},listeners:{click:"_leftClick"},ready:function(){return this._validateData()},cssClass:function(e){var t;return null==e||this.domHost.withoutHeader?"":(t=this.x()===e.x&&this.y()===e.y,t?"gbs_gh":"")},x:function(){return this.cellIndex},y:function(){return this.domHost.getRowNumber(this.domHost.table,this.rowIndex)},updateCellStyles:function(e,t,i){var n,r,o,s,a,l,h;if(null!=(n=null!=(l=e[this.rowIndex])?l[this.cellIndex]:void 0)&&null!=t)return r=this.x()===t.x&&this.y()===t.y,o=this.$.dresser.getRule(n,r,i),a=null!=o?o.image:void 0,s=null!=o?o.text:void 0,null!=s&&""!==s&&(a="\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='50px' width='50px'><text x='25' y='25' font-size='25' fill='black' text-anchor='middle' alignment-baseline='central'>"+s+'</text></svg>"'),this.customStyle["--stones-visibility"]=null!=a?"hidden":"visible",this.customStyle["--outline-style"]=null!=a&&null!=(null!=o&&null!=(h=o.when)?h.head:void 0)?"none":"solid",null!=a?this.customStyle["--background-url"]="url("+a+")":delete this.customStyle["--background-url"],this.updateStyles()},_leftClick:function(e){if(this.options.editable)return this.domHost.isCtrlPressed()?(this.header={x:this.x(),y:this.y()},this.fire("board-changed")):void 0},_validateData:function(){if(null==this.cellIndex||null==this.rowIndex)throw new Error("The coordinates are required");if(null==this.header)throw new Error("The header is required");if(null==this.options)throw new Error("The options are required")}});</script></dom-module><dom-module id="key-tracker" assetpath="dist/components/"><template><style></style></template><script>Polymer({is:"key-tracker",ready:function(){return this._pressedKeys=[],this._listenTo("keydown",function(e){return function(t){var i;if(i=t.key||t.keyIdentifier,!e.isPressed(i))return e._pressedKeys.push(i)}}(this)),this._listenTo("keyup",function(e){return function(t){var i;if(i=t.key||t.keyIdentifier,e.isPressed(i))return e._pressedKeys.splice(e._indexOf(i),1)}}(this)),window.addEventListener("blur",function(e){return function(){return e._pressedKeys=[]}}(this))},isPressed:function(e){return-1!==this._indexOf(e)},_indexOf:function(e){return this._pressedKeys.indexOf(e)},_listenTo:function(e,t){return window.addEventListener(e,t)}});</script></dom-module><dom-module id="gs-board" assetpath="dist/components/"><template><style>.gbs_pointer{cursor:pointer;}.gbs_unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.background,.gbs_board td.gbs_lht,.gbs_board td.gbs_lhb,.gbs_board td.gbs_lvl,.gbs_board td.gbs_lvr,.gbs_board td.gbs_top_left,.gbs_board td.gbs_top_right,.gbs_board td.gbs_bottom_left,.gbs_board td.gbs_bottom_right{background-repeat:no-repeat;background-position:center;background-size:cover;}table.gbs_board{border-style:none;border:solid black 0px;border-spacing:0;border-collapse:collapse;font-family:Arial,Helvetica,sans-serif;font-size:9pt;display:inline-block;vertical-align:top;line-height:normal;}.gbs_board td{margin:0;padding:var(--cell-padding);border:var(--cell-border);width:30px;height:30px;}.gbs_board td.gbs_lv{text-align:center;vertical-align:middle;border-style:none;border:solid black 0px;background:#ddd;width:15px;}.gbs_board td.gbs_lh{text-align:center;vertical-align:middle;border-style:none;border:solid black 0px;background:#ddd;height:15px;}.gbs_board td.gbs_lx{border-style:none;border:solid black 0px;background:#ddd;width:15px;height:15px;}.gbs_board td.gbs_lht{background-image:var(--top-background-url);}.gbs_board td.gbs_lhb{background-image:var(--bottom-background-url);}.gbs_board td.gbs_lvl{background-image:var(--left-background-url);}.gbs_board td.gbs_lvr{background-image:var(--right-background-url);}.gbs_board td.gbs_top_left{-webkit-border-top-left-radius:10px;-moz-border-top-left-radius:10px;border-top-left-radius:10px;background-image:var(--top-left-background-url);}.gbs_board td.gbs_top_right{-webkit-border-top-right-radius:10px;-moz-border-top-right-radius:10px;border-top-right-radius:10px;background-image:var(--top-right-background-url);}.gbs_board td.gbs_bottom_left{-webkit-border-bottom-left-radius:10px;-moz-border-bottom-left-radius:10px;border-bottom-left-radius:10px;background-image:var(--bottom-left-background-url);}.gbs_board td.gbs_bottom_right{-webkit-border-bottom-right-radius:10px;-moz-border-bottom-right-radius:10px;border-bottom-right-radius:10px;background-image:var(--bottom-right-background-url);}.gbs_boom,.gbs_boom::after{content:url("https://user-images.githubusercontent.com/1631752/37945593-54b482c0-3157-11e8-9f32-bd25d7bf901b.png");}</style><key-tracker id="keyTracker" aria-hidden="true"></key-tracker><template is="dom-if" if="{{!boom}}"><button aria-label$="{{gbb}}" style="opacity: 0; position: absolute;"></button><table class="gbs_board" aria-hidden="true"><tbody><tr><td class="gbs_lx gbs_top_left"></td><template is="dom-repeat" items="{{columnIndexes}}" as="columnIndex"><td class="gbs_lh gbs_lht">{{columnIndex}}</td></template><td class="gbs_lx gbs_top_right"></td></tr><template is="dom-repeat" items="{{table}}" as="row" index-as="rowIndex"><tr><td class="gbs_lv gbs_lvl">{{getRowNumber(table, rowIndex)}}</td><template is="dom-repeat" items="{{row}}" as="cell" index-as="cellIndex"><td><gs-cell black="{{cell.black}}" blue="{{cell.blue}}" green="{{cell.green}}" red="{{cell.red}}" cell-index="{{cellIndex}}" row-index="{{rowIndex}}" header="{{header}}" options="{{options}}" attire="{{attire}}"></gs-cell></td></template><td class="gbs_lv gbs_lvr">{{getRowNumber(table, rowIndex)}}</td></tr></template><tr><td class="gbs_lx gbs_bottom_left"></td><template is="dom-repeat" items="{{columnIndexes}}" as="columnIndex"><td class="gbs_lh gbs_lhb">{{columnIndex}}</td></template><td class="gbs_lx gbs_bottom_right"></td></tr></tbody></table></template><template is="dom-if" if="{{boom}}"><div class="gbs_boom"></div></template></template><script>var stringUtils={splitByLines:function(e){return e.split(/\r\n|\r|\n/)},scan:function(e,t){if(!t.global)throw new Error('The regExp must be global (with "g" flag)');var i=[],r=i;for(i=t.exec(e);i;)i.shift(),r.push(i),i=t.exec(e);return r}},gbbReader={};gbbReader.fromString=function(e){var t=this._try(e),i=stringUtils.splitByLines(t).map(function(e){return e.trim()}),r=i.filter(function(e){return!/GBB\/(\d\.)+\d$/.test(e)&&""!==e});return this._buildBoard(r)},gbbReader._buildBoard=function(e){var t=this._getDimensions(e),i=this._getHeader(e);try{for(var r={width:t[0],height:t[1],head:{x:i[0],y:i[1]},table:[]},n=r.height-1;n>=0;n--){r.table[n]=[];for(var o=0;o<r.width;o++)r.table[n][o]={}}return this._putCells(e,r),r}catch(e){var s=new Error("Error building the board");throw s.inner=e,s}},gbbReader._getDimensions=function(e){var t=this._try(e[0].match(/^size (\d+) (\d+)$/),"dimensions");return this._getPositionOf(t)},gbbReader._getHeader=function(e){var t=this._try(e[e.length-1].match(/^head (\d+) (\d+)$/),"header");return this._getPositionOf(t)},gbbReader._putCells=function(e,t){var i=/^cell (\d+) (\d+)/;e.filter(function(e){return i.test(e)}).forEach(function(e){var r=e.match(i),n=this._getPositionOf(r,e),o=n[0],s=n[1];this._putBalls(o,s,e,t)}.bind(this))},gbbReader._putBalls=function(e,t,i,r){var n=stringUtils.scan(i,/(Azul|Negro|Rojo|Verde) (\d+)/g),o=function(e){var t=n.filter(function(t){return t[0]===e});return parseInt((t[0]||{})[1]||0,0)};const s=r.table[r.height-1-t][e];s.blue=o("Azul"),s.black=o("Negro"),s.red=o("Rojo"),s.green=o("Verde")},gbbReader._getPositionOf=function(e,t){return e=e||{},[this._try(e[1],t),this._try(e[2],t)].map(function(e){return parseInt(e,0)})},gbbReader._try=function(e,t){if(!e)throw new Error("Error parsing "+(t||"GBB file"));return e},window.GobstonesBoard={attireProvider:null,defaultAttire:null,getAttire:function(e){if(null==this.attireProvider)throw new Error("You need to provide an attire provider with GobstonesBoard.setAttireProvider");return this.attireProvider.get(e)},setAttireProvider:function(e){if(!(null!=e?e.get:void 0))throw new Error("Attire providers must have a `get` method");return this.attireProvider=e,this.updateAllBoards()},setDefaultAttire:function(e){return this.defaultAttire=e,this.updateAllBoards()},updateAllBoards:function(){return document.querySelectorAll("gs-board").forEach(function(e){return function(e){return e.detectAttire()}}())}},Polymer({is:"gs-board",properties:{table:Array,size:{type:Object,value:{x:2,y:2},observer:"_updateSize"},header:{type:Object,value:{x:0,y:0}},options:Object,boom:{type:Boolean,value:!1},gbb:{type:String},attire:{type:Object,observer:"_notifyAttireChanged"},attireSrc:{type:String},noAttire:{type:Boolean,value:!1},withoutHeader:{type:Boolean,value:!1}},observers:["_updateStyles(table.*, header.*, attire.*)"],ready:function(){return this._setBorderOn(),this._readGbb(),this._initializeTable(),this._initializeOptions()},attached:function(){return setTimeout(this.detectAttire.bind(this))},_notifyAttireChanged:function(){return this.fire("board-attire-changed")},getRowNumber:function(e,t){return e.length-1-t},isCtrlPressed:function(){return this.$.keyTracker.isPressed("Control")},isShiftPressed:function(){return this.$.keyTracker.isPressed("Shift")},setStonesNumber:function(e,t,i){return this.table[e.rowIndex][e.cellIndex][t]=i,this.fire("board-changed")},fillTable:function(){var e,t,i,r,n,o,s,a,l;if(null!=this.table){for(i=function(e,t){return e.slice(0,t)},r=this.table.slice().reverse(),e=o=0,a=this.size.y;0<=a?o<a:o>a;e=0<=a?++o:--o)for(t=s=0,l=this.size.x;0<=l?s<l:s>l;t=0<=l?++s:--s)null==r[e]&&(r[e]=[]),r[e]=i(r[e],this.size.x),null==(n=r[e])[t]&&(n[t]={});return r=i(r,this.size.y),this.table=r.reverse(),this._forceHeaderSet()}},update:function(e,t){return this.table=e,this.header=t,this._setSizeFromTable(),this.fillTable()},detectAttire:function(){return this.attireSrc?this.attire=GobstonesBoard.getAttire(this.attireSrc):GobstonesBoard.defaultAttire&&!this.noAttire?this.attire=GobstonesBoard.defaultAttire:void 0},_initializeTable:function(){return null!=this.table?this._setSizeFromTable():(this.table=[],this.fillTable())},_setSizeFromTable:function(){var e;return this.size={x:(null!=(e=this.table[0])?e.length:void 0)||0,y:this.table.length||0}},_initializeOptions:function(){var e;return null==this.options&&(this.options={}),null!=(e=this.options).editable?e.editable:e.editable=!1},_updateSize:function(){var e;return this.columnIndexes=function(){e=[];for(var t=0,i=this.size.x;0<=i?t<i:t>i;0<=i?t++:t--)e.push(t);return e}.apply(this),this.fire("board-changed")},_forceHeaderSet:function(){var e,t;return e=Math.min(this.header.x,this.size.x-1),t=Math.min(this.header.y,this.size.y-1),this.header=null,this.header={x:e,y:t}},_readGbb:function(){var e,t,i,r;if(!(null==(e=Polymer.dom(this).textContent)||e.indexOf("GBB")<0))return this.gbb=e,r=gbbReader.fromString(this.gbb),this.table=r.table,this.header=r.head,i=r.width,t=r.height,this.size.x=i,this.size.y=t},_updateStyles:function(e,t,i){var r,n,o;if(o=null!=e?e.base:void 0,n=null!=t?t.base:void 0,r=null!=i?i.base:void 0,null!=o&&null!=n)return null!=r&&r.enabled?this._setBorderOff():this._setBorderOn(),this._updateBorderImages(r),this.updateStyles(),this.querySelectorAll("gs-cell").forEach(function(e){return e.updateCellStyles(o,n,r)})},_setBorderOn:function(){return this.customStyle["--cell-padding"]="2px",this.customStyle["--cell-border"]="solid #888 1px"},_setBorderOff:function(){return this.customStyle["--cell-padding"]="0 0",this.customStyle["--cell-border"]="none"},_updateBorderImages:function(e){var t;return t=function(t){return function(t){var i,r;if(i=null!=e&&null!=(r=e.borders)?r[t]:void 0,(null!=e?e.enabled:void 0)&&null!=i)return"url("+i+")"}}(),this.customStyle["--top-left-background-url"]=t("topLeft"),this.customStyle["--top-right-background-url"]=t("topRight"),this.customStyle["--bottom-left-background-url"]=t("bottomLeft"),this.customStyle["--bottom-right-background-url"]=t("bottomRight"),this.customStyle["--left-background-url"]=t("left"),this.customStyle["--top-background-url"]=t("top"),this.customStyle["--right-background-url"]=t("right"),this.customStyle["--bottom-background-url"]=t("bottom")}});</script></dom-module></div></body></html>