Browse Source

fix setPlayerName

Maxim Sokhatsky 11 years ago
parent
commit
7225963c40

+ 1 - 1
apps/web/priv/static/app/js/bootloader.js

@@ -19,7 +19,7 @@ function setPlayerName(e, playerName) {
     document.getElementById(e+"-Name").setAttribute("y",27);
     document.getElementById(e+"-Name").setAttribute("x",dx);
     document.getElementById(e+"-Name").textContent = playerName;
-    document.getElementById(e+"-Pad").setAttribute('width', document.getElementById(e).getBBox().width + 15); }
+    document.getElementById(e+"-Pad").setAttribute('width', document.getElementById(e+"-Name").getBBox().width + 25); }
 
 function template_engine(html, data) {
     var re = /{([^}]+)?}/g, code = 'var r=[];', cursor = 0;

+ 1 - 0
apps/web/priv/static/app/js/okey/app.js

@@ -198,6 +198,7 @@ function PostLoad()
             name: [ playerInfo[2], playerInfo[3] ].join(" "),
             noSkin: !0
         }),
+
         delete playersMap[e.detail.player], playersRightHandsMap[playerInfo[0]] = playersRightHandsMap[e.detail.player], 
         delete playersRightHandsMap[e.detail.player], playersLeftHandsMap[playerInfo[0]] = playersLeftHandsMap[e.detail.player], 
         delete playersLeftHandsMap[e.detail.player];

+ 13 - 13
apps/web/priv/static/app/js/player.js

@@ -3,26 +3,26 @@ function PlayerScope(scope) {
     function Player(options)
     {
         options = options || {},
-        this.name = options.name,
-        this.position = options.position, 
-        this.noSkin = options.noSkin,
-        this.skin = options.skin || scope.SKIN_NAMES[$.rand(0, scope.SKIN_NAMES.length - 1)], 
-        this.$el = $("#Player-" + this.position),
-//        this.$page = $("#Kakaranet-12-maxim"),
+        this.name = options.name;
+        this.position = options.position;
+        this.noSkin = options.noSkin;
+        this.skin = options.skin || scope.SKIN_NAMES[$.rand(0, scope.SKIN_NAMES.length - 1)];
+        this.$el = $("#Player-" + this.position);
         this.elements = {
             $timer: "#Timer",
             $name: "#Name",
             $nameWrapper: "#Name rect",
-            $nameText: "#Name text" },
-        this.proxies = [ "loadSkin" ],
-        this.__super__.constructor.call(this),
-        this.$el.show(), 
-        this.$timer.hide(),
-        this.$name.show(),
+            $nameText: "#Name text" };
+        this.proxies = [ "loadSkin" ];
+        this.__super__.constructor.call(this);
+        this.$el.show();
+        this.$timer.hide();
+        this.$name.show();
 
         setPlayerName("Player-" + this.position, this.name);
 
-        this.initTimer(),
+        this.initTimer();
+
         "Me" == this.position || this.noSkin || $.load("svg/" + [ "Person", this.position, this.skin ].join("-") + ".svg", this.loadSkin);
     }