gobstones-board 1.18.0 → 1.18.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/htmls/components/gs-cell.html +1 -1
- data/app/assets/htmls/gs-board.html +1 -1
- data/app/assets/htmls/vendor/polymer-micro.html +9 -3
- data/app/assets/htmls/vendor/polymer-mini.html +17 -3
- data/app/assets/htmls/vendor/polymer.html +28 -3
- data/lib/gobstones/board/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82428252e6d08d7432232c750b83c160df9df2050d6d923a09cbc9cb905efa0b
|
4
|
+
data.tar.gz: 34d9fab2cca67bda8d83e800823b6d74da3b80df67b9d505387e404f32398612
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7d3b11bfac56aa92d9846c392dc39dfcb4ca348c9fb0d380c67fa51a409a140b154560969387d2640dcf47d99d6cb9830a90b1fb5c0cbe30e2f929687c2e863
|
7
|
+
data.tar.gz: 6110964fe37be7f7f90c1759a0e6b727987ec835ea12fda6fbfe0a93bc4c2202a0a39d7cd9199534d94a7bfe7d631f020b9eed89655670b41494bef2805498e1
|
@@ -151,7 +151,7 @@
|
|
151
151
|
rule = this.$.dresser.getRule(cell, isHeader, attire);
|
152
152
|
url = rule != null ? rule.image : void 0;
|
153
153
|
text = rule != null ? rule.text : void 0;
|
154
|
-
if ((
|
154
|
+
if ((text != null) && text !== "") {
|
155
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
156
|
}
|
157
157
|
this.customStyle["--stones-visibility"] = url != null ? "hidden" : "visible";
|
@@ -1 +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,n){if(null!=n&&n.enabled)return null!=n?n.rules.filter(function(n){return function(i){return n._doesSatisfyRule(e,t,i)}}(this))[0]:void 0},_doesSatisfyRule:function(e,t,n){var i;return i=function(i){return function(r){return i._doesSatisfyQuantity(e[r],n.when[r])&&i._doesSatisfyHeader(t,n.when.head)}}(this),["red","blue","green","black"].reduce(function(e){return function(e,t){return e&&i(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==a&&null!=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=[],n=i;for(i=t.exec(e);i;)i.shift(),n.push(i),i=t.exec(e);return n}},gbbReader={};gbbReader.fromString=function(e){var t=this._try(e),i=stringUtils.splitByLines(t).map(function(e){return e.trim()}),n=i.filter(function(e){return!/GBB\/(\d\.)+\d$/.test(e)&&""!==e});return this._buildBoard(n)},gbbReader._buildBoard=function(e){var t=this._getDimensions(e),i=this._getHeader(e);try{for(var n={width:t[0],height:t[1],head:{x:i[0],y:i[1]},table:[]},r=n.height-1;r>=0;r--){n.table[r]=[];for(var o=0;o<n.width;o++)n.table[r][o]={}}return this._putCells(e,n),n}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 n=e.match(i),r=this._getPositionOf(n,e),o=r[0],s=r[1];this._putBalls(o,s,e,t)}.bind(this))},gbbReader._putBalls=function(e,t,i,n){var r=stringUtils.scan(i,/(Azul|Negro|Rojo|Verde) (\d+)/g),o=function(e){var t=r.filter(function(t){return t[0]===e});return parseInt((t[0]||{})[1]||0,0)};const s=n.table[n.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()},_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,n,r,o,s,a,l;if(null!=this.table){for(i=function(e,t){return e.slice(0,t)},n=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==n[e]&&(n[e]=[]),n[e]=i(n[e],this.size.x),null==(r=n[e])[t]&&(r[t]={});return n=i(n,this.size.y),this.table=n.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,n;if(!(null==(e=Polymer.dom(this).textContent)||e.indexOf("GBB")<0))return this.gbb=e,n=gbbReader.fromString(this.gbb),this.table=n.table,this.header=n.head,i=n.width,t=n.height,this.size.x=i,this.size.y=t,this.detectAttire()},_updateStyles:function(e,t,i){var n,r,o;if(o=null!=e?e.base:void 0,r=null!=t?t.base:void 0,n=null!=i?i.base:void 0,null!=o&&null!=r)return null!=n&&n.enabled?this._setBorderOff():this._setBorderOn(),this._updateBorderImages(n),this.updateStyles(),this.querySelectorAll("gs-cell").forEach(function(e){return e.updateCellStyles(o,r,n)})},_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,n;if(i=null!=e&&null!=(n=e.borders)?n[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>
|
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()},_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,this.detectAttire()},_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>
|
@@ -408,6 +408,9 @@ Polymer.telemetry.instanceCount = 0;
|
|
408
408
|
}());(function () {
|
409
409
|
var modules = {};
|
410
410
|
var lcModules = {};
|
411
|
+
function setModule(id, module) {
|
412
|
+
modules[id] = lcModules[id.toLowerCase()] = module;
|
413
|
+
}
|
411
414
|
var findModule = function (id) {
|
412
415
|
return modules[id] || lcModules[id.toLowerCase()];
|
413
416
|
};
|
@@ -422,9 +425,12 @@ this.register();
|
|
422
425
|
register: function (id) {
|
423
426
|
id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
|
424
427
|
if (id) {
|
428
|
+
if (Polymer.Settings.strictTemplatePolicy && findModule(id) !== undefined) {
|
429
|
+
setModule(id, null);
|
430
|
+
throw new Error('strictTemplatePolicy: dom-module ' + id + ' re-registered');
|
431
|
+
}
|
425
432
|
this.id = id;
|
426
|
-
|
427
|
-
lcModules[id.toLowerCase()] = this;
|
433
|
+
setModule(id, this);
|
428
434
|
}
|
429
435
|
},
|
430
436
|
import: function (id, selector) {
|
@@ -791,7 +797,7 @@ default:
|
|
791
797
|
return value != null ? value : undefined;
|
792
798
|
}
|
793
799
|
}
|
794
|
-
});Polymer.version = "1.
|
800
|
+
});Polymer.version = "1.12.0";Polymer.Base._addFeature({
|
795
801
|
_registerFeatures: function () {
|
796
802
|
this._prepIs();
|
797
803
|
this._prepBehaviors();
|
@@ -75,7 +75,11 @@ _prepTemplate: function () {
|
|
75
75
|
var module;
|
76
76
|
if (this._template === undefined) {
|
77
77
|
module = Polymer.DomModule.import(this.is);
|
78
|
-
|
78
|
+
var template = module && module.querySelector('template');
|
79
|
+
if (Polymer.Settings.strictTemplatePolicy && !template) {
|
80
|
+
throw new Error('strictTemplatePolicy: expecting dom-module or null _template for ' + this.is);
|
81
|
+
}
|
82
|
+
this._template = template;
|
79
83
|
}
|
80
84
|
if (module) {
|
81
85
|
var assetPath = module.getAttribute('assetpath') || '';
|
@@ -1041,10 +1045,20 @@ this.removeChild(this.childNodes[0]);
|
|
1041
1045
|
},
|
1042
1046
|
setAttribute: function (name, value) {
|
1043
1047
|
this.node.setAttribute(name, value);
|
1044
|
-
this.
|
1048
|
+
this._maybeDistributeForAttributeChange(this.node, name);
|
1045
1049
|
},
|
1046
1050
|
removeAttribute: function (name) {
|
1047
1051
|
this.node.removeAttribute(name);
|
1052
|
+
this._maybeDistributeForAttributeChange(this.node, name);
|
1053
|
+
},
|
1054
|
+
_maybeDistributeForAttributeChange: function (element, name) {
|
1055
|
+
if (name === 'select' && element.localName === 'content') {
|
1056
|
+
var ownerRoot = this.getOwnerRoot();
|
1057
|
+
if (ownerRoot && this._nodeNeedsDistribution(ownerRoot.host)) {
|
1058
|
+
this._lazyDistribute(ownerRoot.host);
|
1059
|
+
return;
|
1060
|
+
}
|
1061
|
+
}
|
1048
1062
|
this._maybeDistributeParent();
|
1049
1063
|
},
|
1050
1064
|
_maybeDistributeParent: function () {
|
@@ -1599,7 +1613,7 @@ return h;
|
|
1599
1613
|
_unobserveContentElements: function (elements) {
|
1600
1614
|
for (var i = 0, n, h; i < elements.length && (n = elements[i]); i++) {
|
1601
1615
|
if (this._isContent(n)) {
|
1602
|
-
h = n.__observeNodesMap.get(this);
|
1616
|
+
h = n.__observeNodesMap && n.__observeNodesMap.get(this);
|
1603
1617
|
if (h) {
|
1604
1618
|
Polymer.dom(n).unobserveNodes(h);
|
1605
1619
|
n.__observeNodesMap.delete(this);
|
@@ -162,6 +162,11 @@ i++;
|
|
162
162
|
}
|
163
163
|
}
|
164
164
|
},
|
165
|
+
_select$Attr: function () {
|
166
|
+
var div = document.createElement('div');
|
167
|
+
div.innerHTML = '<div select$>';
|
168
|
+
return div.childNodes[0].attributes.getNamedItem('select$');
|
169
|
+
}(),
|
165
170
|
_replaceSlotWithContent: function (slot) {
|
166
171
|
var content = slot.ownerDocument.createElement('content');
|
167
172
|
while (slot.firstChild) {
|
@@ -169,13 +174,18 @@ content.appendChild(slot.firstChild);
|
|
169
174
|
}
|
170
175
|
var attrs = slot.attributes;
|
171
176
|
for (var i = 0; i < attrs.length; i++) {
|
172
|
-
|
173
|
-
content.setAttribute(attr.name, attr.value);
|
177
|
+
content.attributes.setNamedItem(attrs[i].cloneNode());
|
174
178
|
}
|
175
179
|
var name = slot.getAttribute('name');
|
176
180
|
if (name) {
|
177
181
|
content.setAttribute('select', '[slot=\'' + name + '\']');
|
178
182
|
}
|
183
|
+
var name$Value = slot.getAttribute('name$');
|
184
|
+
if (name$Value) {
|
185
|
+
var select$Attr = this._select$Attr.cloneNode();
|
186
|
+
select$Attr.value = '[slot=\'' + name$Value + '\']';
|
187
|
+
content.attributes.setNamedItem(select$Attr);
|
188
|
+
}
|
179
189
|
slot.parentNode.replaceChild(content, slot);
|
180
190
|
return content;
|
181
191
|
},
|
@@ -379,7 +389,7 @@ this._marshalAnnotatedListeners();
|
|
379
389
|
}
|
380
390
|
},
|
381
391
|
_configureAnnotationReferences: function () {
|
382
|
-
var notes = this._notes;
|
392
|
+
var notes = this._notes || [];
|
383
393
|
var nodes = this._nodes;
|
384
394
|
for (var i = 0; i < notes.length; i++) {
|
385
395
|
var note = notes[i];
|
@@ -695,7 +705,11 @@ deepTargetFind: function (x, y) {
|
|
695
705
|
var node = document.elementFromPoint(x, y);
|
696
706
|
var next = node;
|
697
707
|
while (next && next.shadowRoot) {
|
708
|
+
var oldNext = next;
|
698
709
|
next = next.shadowRoot.elementFromPoint(x, y);
|
710
|
+
if (oldNext === next) {
|
711
|
+
break;
|
712
|
+
}
|
699
713
|
if (next) {
|
700
714
|
node = next;
|
701
715
|
}
|
@@ -4346,6 +4360,9 @@ properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
|
|
4346
4360
|
_instanceProps: Polymer.nob,
|
4347
4361
|
_parentPropPrefix: '_parent_',
|
4348
4362
|
templatize: function (template) {
|
4363
|
+
if (Polymer.Settings.strictTemplatePolicy && !this._getRootDataHost()) {
|
4364
|
+
throw new Error('strictTemplatePolicy: template owner not trusted');
|
4365
|
+
}
|
4349
4366
|
this._templatized = template;
|
4350
4367
|
if (!template._content) {
|
4351
4368
|
template._content = template.content;
|
@@ -4945,6 +4962,9 @@ this._debounceTemplate(this._render);
|
|
4945
4962
|
this._flushTemplates();
|
4946
4963
|
},
|
4947
4964
|
_render: function () {
|
4965
|
+
if (!this.ctor) {
|
4966
|
+
return;
|
4967
|
+
}
|
4948
4968
|
if (this._needFullRefresh) {
|
4949
4969
|
this._applyFullRefresh();
|
4950
4970
|
this._needFullRefresh = false;
|
@@ -5426,10 +5446,12 @@ if (this._instance) {
|
|
5426
5446
|
var c$ = this._instance._children;
|
5427
5447
|
if (c$ && c$.length) {
|
5428
5448
|
var parent = Polymer.dom(Polymer.dom(c$[0]).parentNode);
|
5449
|
+
if (parent) {
|
5429
5450
|
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
5430
5451
|
parent.removeChild(n);
|
5431
5452
|
}
|
5432
5453
|
}
|
5454
|
+
}
|
5433
5455
|
this._instance = null;
|
5434
5456
|
}
|
5435
5457
|
},
|
@@ -5455,6 +5477,9 @@ properties: { notifyDomChange: { type: Boolean } },
|
|
5455
5477
|
extends: 'template',
|
5456
5478
|
_template: null,
|
5457
5479
|
created: function () {
|
5480
|
+
if (Polymer.Settings.strictTemplatePolicy) {
|
5481
|
+
throw new Error('strictTemplatePolicy: dom-bind not allowed');
|
5482
|
+
}
|
5458
5483
|
var self = this;
|
5459
5484
|
Polymer.RenderStatus.whenReady(function () {
|
5460
5485
|
if (document.readyState == 'loading') {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gobstones-board
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.0.
|
101
|
+
rubygems_version: 3.0.3
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Gobstones Board
|