Browse Source

Merge pull request #1007 from BeatC/connection-indicator-restyle

Connection indicator restyle
master
yanas 9 years ago
parent
commit
3bf8b7fbe2

+ 1
- 0
css/_base.scss View File

@@ -186,6 +186,7 @@ form {
186 186
 }
187 187
 
188 188
 .link {
189
+    cursor: pointer;
189 190
     color: $linkFontColor;
190 191
     @include transition(color .1s ease-out);
191 192
 

+ 67
- 78
css/_jitsi_popover.scss View File

@@ -8,98 +8,87 @@
8 8
     min-width: 100px;
9 9
     padding: 1px;
10 10
     text-align: left;
11
-    color: #333333;
12
-    background-color: #ffffff;
11
+    color: $popoverFontColor;
12
+    background-color: $popoverBg;
13 13
     background-clip: padding-box;
14
-    border: 1px solid #cccccc;
15
-    border: 1px solid rgba(0, 0, 0, 0.2);
16
-    border-radius: 6px;
14
+    border: 1px solid $popoverBg;
15
+    border-radius: 3px;
17 16
     /*-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);*/
18 17
     /*box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);*/
19 18
     white-space: normal;
20 19
     margin-top: -10px;
21 20
     margin-bottom: 35px;
22
-}
23 21
 
24
-.jitsipopover.black
25
-{
26
-    background-color: rgba(0,0,0,0.8);
27
-    color: #ffffff;
28
-}
22
+    &__title {
23
+        text-align: left;
24
+        margin: 0;
25
+        padding: 0;
26
+    }
29 27
 
30
-.jitsipopover-content {
31
-    padding: 9px 14px;
32
-    font-size: 10pt;
33
-    white-space:pre-wrap;
34
-    text-align: center;
35
-}
28
+    &__content {
29
+        padding: em(5) em(10);
30
+        font-size: em(14);
31
+        white-space:pre-wrap;
32
+        text-align: center;
33
+    }
36 34
 
37
-.jitsipopover > .arrow,
38
-.jitsipopover > .arrow:after {
39
-    position: absolute;
40
-    display: block;
41
-    width: 0;
42
-    height: 0;
43
-    border-color: transparent;
44
-    border-style: solid;
45
-}
35
+    &__icon {
36
+        margin-right: 2px;
37
+    }
46 38
 
47
-.jitsipopover > .arrow {
48
-    border-width: 11px;
49
-    left: 50%;
50
-    margin-left: -11px;
51
-    border-bottom-width: 0;
52
-    border-top-color: #999999;
53
-    border-top-color: rgba(0, 0, 0, 0.25);
54
-    bottom: -11px;
55
-}
56
-.jitsipopover > .arrow:after {
57
-    border-width: 10px;
58
-    content: " ";
59
-    bottom: 1px;
60
-    margin-left: -10px;
61
-    border-bottom-width: 0;
62
-    border-top-color: #ffffff;
63
-}
39
+    &__green
40
+    {
41
+        @extend .jitsipopover__icon;
42
+        color: #4abd04;
43
+    }
64 44
 
65
-.jitsipopover.black > .arrow:after
66
-{
67
-    border-top-color: rgba(0, 0, 0, 0.8);
68
-}
45
+    &__orange
46
+    {
47
+        @extend .jitsipopover__icon;
48
+        color: #ffa800;
49
+    }
69 50
 
70
-.jitsiPopupmenuPadding {
71
-    height: 35px;
72
-    width: 100px;
73
-    position: absolute;
74
-    bottom: -35px;
75
-}
51
+    &__menu-padding {
52
+        height: 35px;
53
+        width: 100px;
54
+        position: absolute;
55
+        bottom: -35px;
56
+    }
76 57
 
77
-.jitsipopover_green
78
-{
79
-    color: #4abd04;
80
-}
58
+    &__showmore {
59
+        display: block;
60
+        text-align: center;
61
+        width: 90px;
62
+        margin: 10px auto;
63
+    }
81 64
 
82
-.jitsipopover_orange
83
-{
84
-    color: #ffa800;
85
-}
65
+    &__clear {
66
+        position: absolute;
67
+        display: block;
68
+        width: 0;
69
+        height: 0;
70
+        border-color: transparent;
71
+        border-style: solid;
72
+    }
86 73
 
87
-.jitsipopover_blue
88
-{
89
-    color: #21B9FC;
90
-}
74
+    > .arrow {
75
+        border-width: 5px 2.5px 0 2.5px;
76
+        left: 50%;
77
+        margin-left: -5px;
78
+        @extend .jitsipopover__clear;
79
+        border-bottom-width: 0;
80
+        border-top-color: $popoverBg;
81
+        bottom: -5px;
91 82
 
92
-.jitsipopover_showmore
93
-{
94
-    background-color: #21B9FC;
95
-    color: #ffffff;
96
-    cursor: pointer;
97
-    border-radius: 3px;
98
-    text-align: center;
99
-    width: 90px;
100
-    height: 16px;
101
-    padding-top: 4px;
102
-    padding-left: 10px;
103
-    padding-right: 10px;
104
-    margin: 15px auto 0px auto;
83
+
84
+        &:after {
85
+            border-width: 5px;
86
+            content: " ";
87
+            bottom: 1px;
88
+            margin-left: -5px;
89
+            @extend .jitsipopover__clear;
90
+            border-bottom-width: 0;
91
+            border-top-color: $popoverBg;
92
+        }
93
+    }
105 94
 }

+ 5
- 0
css/_variables.scss View File

@@ -1,3 +1,8 @@
1
+/**
2
+* Theme
3
+*/
4
+@import 'themes/main';
5
+
1 6
 /**
2 7
  * Style variables
3 8
  */

+ 0
- 18
css/_videolayout_default.scss View File

@@ -260,24 +260,6 @@
260 260
     height: 13px;
261 261
 }
262 262
 
263
-.connection_info
264
-{
265
-    float: left;
266
-    padding-bottom: 5px;
267
-}
268
-
269
-.connection_info > table
270
-{
271
-    white-space: nowrap;
272
-}
273
-
274
-.connection_info, .connection_info > table
275
-{
276
-    text-align: left;
277
-    font-size: 11px;
278
-    color: #ffffff;
279
-}
280
-
281 263
 #localVideoContainer>span.status:hover,
282 264
 #localVideoContainer .displayname:hover {
283 265
     cursor: text;

+ 26
- 0
css/connection-info.scss View File

@@ -0,0 +1,26 @@
1
+%connection-info {
2
+    text-align: left;
3
+    font-size: 12px;
4
+    font-weight: 400;
5
+    color: $popoverFontColor;
6
+
7
+    td {
8
+        padding: 2px 0;
9
+    }
10
+}
11
+
12
+.connection-info
13
+{
14
+    float: left;
15
+    padding-bottom: 5px;
16
+    @extend %connection-info;
17
+
18
+    > table {
19
+        white-space: nowrap;
20
+        @extend %connection-info;
21
+    }
22
+
23
+    td:nth-child(n-1) {
24
+        padding-left: 5px;
25
+    }
26
+}

+ 1
- 0
css/main.scss View File

@@ -61,5 +61,6 @@
61 61
 @import 'shortcuts/main';
62 62
 @import 'buttons/button-control';
63 63
 @import "modals/invite/invite";
64
+@import "connection-info";
64 65
 
65 66
 /* Modules END */

+ 5
- 1
css/themes/_light.scss View File

@@ -43,4 +43,8 @@ $labelFontWeight: 400;
43 43
 $hintFontSize: em(13, 14);
44 44
 $linkFontColor: #3572b0;
45 45
 $linkHoverFontColor: darken(#3572b0, 10%);
46
-$dropdownColor: #333;
46
+$dropdownColor: #333;
47
+
48
+// Popover colors
49
+$popoverBg: #000;
50
+$popoverFontColor: #ffffff;

+ 1
- 0
lang/main.json View File

@@ -151,6 +151,7 @@
151 151
     },
152 152
     "connectionindicator":
153 153
     {
154
+        "header": "Connection data",
154 155
         "bitrate": "Bitrate:",
155 156
         "packetloss": "Packet loss:",
156 157
         "resolution": "Resolution:",

+ 1
- 0
modules/UI/UI.js View File

@@ -764,6 +764,7 @@ UI.getRemoteVideoType = function (jid) {
764 764
 
765 765
 UI.connectionIndicatorShowMore = function(id) {
766 766
     VideoLayout.showMore(id);
767
+    return false;
767 768
 };
768 769
 
769 770
 // FIXME check if someone user this

+ 4
- 4
modules/UI/util/JitsiPopover.js View File

@@ -29,8 +29,8 @@ var JitsiPopover = (function () {
29 29
         this.element = element;
30 30
         this.template = ' <div class="jitsipopover ' + this.options.skin +
31 31
             '"><div class="arrow"></div>' +
32
-            '<div class="jitsipopover-content"></div>' +
33
-            '<div class="jitsiPopupmenuPadding"></div></div>';
32
+            '<div class="jitsipopover__content"></div>' +
33
+            '<div class="jitsipopover__menu-padding"></div></div>';
34 34
         var self = this;
35 35
         this.element.on("mouseenter", function () {
36 36
             self.elementIsHovered = true;
@@ -76,7 +76,7 @@ var JitsiPopover = (function () {
76 76
      */
77 77
     JitsiPopover.prototype.createPopover = function () {
78 78
         $("body").append(this.template);
79
-        $(".jitsipopover > .jitsipopover-content").html(this.options.content);
79
+        $(".jitsipopover > .jitsipopover__content").html(this.options.content);
80 80
         var self = this;
81 81
         $(".jitsipopover").on("mouseenter", function () {
82 82
             self.popoverIsHovered = true;
@@ -103,7 +103,7 @@ var JitsiPopover = (function () {
103 103
                 $(".jitsipopover").css(
104 104
                     {top: position.top, left: position.left, display: "table"});
105 105
                 $(".jitsipopover > .arrow").css({left: calcLeft});
106
-                $(".jitsipopover > .jitsiPopupmenuPadding").css(
106
+                $(".jitsipopover > .jitsipopover__menu-padding").css(
107 107
                     {left: calcLeft - 50});
108 108
             }
109 109
         });

+ 49
- 32
modules/UI/videolayout/ConnectionIndicator.js View File

@@ -80,10 +80,10 @@ ConnectionIndicator.prototype.generateText = function () {
80 80
         packetLoss = "N/A";
81 81
     } else {
82 82
 
83
-        packetLoss = "<span class='jitsipopover_green'>&darr;</span>" +
83
+        packetLoss = "<span class='jitsipopover__green'>&darr;</span>" +
84 84
             (this.packetLoss.download !== null ?
85 85
                 this.packetLoss.download : "N/A") +
86
-            "% <span class='jitsipopover_orange'>&uarr;</span>" +
86
+            "% <span class='jitsipopover__orange'>&uarr;</span>" +
87 87
             (this.packetLoss.upload !== null? this.packetLoss.upload : "N/A") +
88 88
             "%";
89 89
     }
@@ -95,31 +95,48 @@ ConnectionIndicator.prototype.generateText = function () {
95 95
         return `${width}x${height}`;
96 96
     }).join(', ') || 'N/A';
97 97
 
98
-    var result = "<table style='width:100%'>" +
99
-        "<tr>" +
100
-        "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.bitrate'>" +
101
-        translate("connectionindicator.bitrate") + "</span></td>" +
102
-        "<td><span class='jitsipopover_green'>&darr;</span>" +
103
-        downloadBitrate + " <span class='jitsipopover_orange'>&uarr;</span>" +
104
-        uploadBitrate + "</td>" +
105
-        "</tr><tr>" +
106
-        "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.packetloss'>" +
107
-        translate("connectionindicator.packetloss") + "</span></td>" +
108
-        "<td>" + packetLoss  + "</td>" +
109
-        "</tr><tr>" +
110
-        "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.resolution'>" +
111
-        translate("connectionindicator.resolution") + "</span></td>" +
112
-        "<td>" + resolutionStr + "</td></tr></table>";
98
+    let result = (
99
+        `<table class="connection-info__container" style='width:100%'>
100
+            <tr>
101
+                <td>
102
+                    <span data-i18n='connectionindicator.bitrate'>
103
+                        ${translate("connectionindicator.bitrate")}
104
+                    </span>
105
+                </td>
106
+                <td>
107
+                    <span class='jitsipopover__green'>&darr;</span>${downloadBitrate}
108
+                    <span class='jitsipopover__orange'>&uarr;</span>${uploadBitrate}
109
+                </td>
110
+            </tr>
111
+            <tr>
112
+                <td>
113
+                    <span data-i18n='connectionindicator.packetloss'>
114
+                        ${translate("connectionindicator.packetloss")}
115
+                    </span>
116
+                </td>
117
+                <td>${packetLoss}</td>
118
+            </tr>
119
+            <tr>
120
+                <td>
121
+                    <span data-i18n='connectionindicator.resolution'>
122
+                        ${translate("connectionindicator.resolution")}
123
+                    </span>
124
+                </td>
125
+                <td>
126
+                    ${resolutionStr}
127
+                </td>
128
+            </tr>
129
+        </table>`);
113 130
 
114 131
     if(this.videoContainer.videoSpanId == "localVideoContainer") {
115
-        result += "<div class=\"jitsipopover_showmore\" " +
132
+        result += "<a class=\"jitsipopover__showmore link\" " +
116 133
             "onclick = \"APP.UI.connectionIndicatorShowMore('" +
117 134
             // FIXME: we do not know local id when this text is generated
118 135
             //this.id + "')\"  data-i18n='connectionindicator." +
119 136
             "local')\"  data-i18n='connectionindicator." +
120 137
                 (this.showMoreValue ? "less" : "more") + "'>" +
121 138
             translate("connectionindicator." + (this.showMoreValue ? "less" : "more")) +
122
-            "</div><br />";
139
+            "</a>";
123 140
     }
124 141
 
125 142
     if (this.showMoreValue) {
@@ -138,7 +155,7 @@ ConnectionIndicator.prototype.generateText = function () {
138 155
 
139 156
         if (!this.transport || this.transport.length === 0) {
140 157
             transport = "<tr>" +
141
-                "<td><span class='jitsipopover_blue' " +
158
+                "<td><span " +
142 159
                 "data-i18n='connectionindicator.address'>" +
143 160
                 translate("connectionindicator.address") + "</span></td>" +
144 161
                 "<td> N/A</td></tr>";
@@ -171,7 +188,7 @@ ConnectionIndicator.prototype.generateText = function () {
171 188
             var local_address_key = "connectionindicator.localaddress";
172 189
             var remote_address_key = "connectionindicator.remoteaddress";
173 190
             var localTransport =
174
-                "<tr><td><span class='jitsipopover_blue' data-i18n='" +
191
+                "<tr><td><span data-i18n='" +
175 192
                 local_address_key +"' data-i18n-options='" +
176 193
                     JSON.stringify({count: data.localIP.length}) + "'>" +
177 194
                     translate(local_address_key, {count: data.localIP.length}) +
@@ -179,7 +196,7 @@ ConnectionIndicator.prototype.generateText = function () {
179 196
                 ConnectionIndicator.getStringFromArray(data.localIP) +
180 197
                 "</td></tr>";
181 198
             transport =
182
-                "<tr><td><span class='jitsipopover_blue' data-i18n='" +
199
+                "<tr><td><span data-i18n='" +
183 200
                 remote_address_key + "' data-i18n-options='" +
184 201
                     JSON.stringify({count: data.remoteIP.length}) + "'>" +
185 202
                     translate(remote_address_key,
@@ -193,14 +210,14 @@ ConnectionIndicator.prototype.generateText = function () {
193 210
 
194 211
             transport += "<tr>" +
195 212
                 "<td>" +
196
-                "<span class='jitsipopover_blue' data-i18n='" + key_remote +
213
+                "<span data-i18n='" + key_remote +
197 214
                 "' data-i18n-options='" +
198 215
                 JSON.stringify({count: this.transport.length}) + "'>" +
199 216
                 translate(key_remote, {count: this.transport.length}) +
200 217
                 "</span></td><td>";
201 218
             localTransport += "<tr>" +
202 219
                 "<td>" +
203
-                "<span class='jitsipopover_blue' data-i18n='" + key_local +
220
+                "<span data-i18n='" + key_local +
204 221
                 "' data-i18n-options='" +
205 222
                 JSON.stringify({count: this.transport.length}) + "'>" +
206 223
                 translate(key_local, {count: this.transport.length}) +
@@ -213,21 +230,21 @@ ConnectionIndicator.prototype.generateText = function () {
213 230
             transport += "</td></tr>";
214 231
             transport += localTransport + "</td></tr>";
215 232
             transport +="<tr>" +
216
-                "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.transport'>" +
233
+                "<td><span data-i18n='connectionindicator.transport'>" +
217 234
                 translate("connectionindicator.transport") + "</span></td>" +
218 235
                 "<td>" + this.transport[0].type + "</td></tr>";
219 236
 
220 237
         }
221 238
 
222
-        result += "<table  style='width:100%'>" +
239
+        result += "<table class='connection-info__container' style='width:100%'>" +
223 240
             "<tr>" +
224 241
             "<td>" +
225
-            "<span class='jitsipopover_blue' data-i18n='connectionindicator.bandwidth'>" +
242
+            "<span data-i18n='connectionindicator.bandwidth'>" +
226 243
             translate("connectionindicator.bandwidth") + "</span>" +
227 244
             "</td><td>" +
228
-            "<span class='jitsipopover_green'>&darr;</span>" +
245
+            "<span class='jitsipopover__green'>&darr;</span>" +
229 246
             downloadBandwidth +
230
-            " <span class='jitsipopover_orange'>&uarr;</span>" +
247
+            " <span class='jitsipopover__orange'>&uarr;</span>" +
231 248
             uploadBandwidth + "</td></tr>";
232 249
 
233 250
         result += transport + "</table>";
@@ -266,7 +283,7 @@ ConnectionIndicator.prototype.create = function () {
266 283
         this.connectionIndicatorContainer);
267 284
     this.popover = new JitsiPopover(
268 285
         $("#" + this.videoContainer.videoSpanId + " > .connectionindicator"),
269
-        {content: "<div class=\"connection_info\" data-i18n='connectionindicator.na'>" +
286
+        {content: "<div class=\"connection-info\" data-i18n='connectionindicator.na'>" +
270 287
             APP.translation.translateString("connectionindicator.na") + "</div>",
271 288
             skin: "black"});
272 289
 
@@ -379,9 +396,9 @@ ConnectionIndicator.prototype.updatePopoverData = function (force) {
379 396
     // popover is visible or we force to do so.
380 397
     if(this.popover.popoverShown || force) {
381 398
         this.popover.updateContent(
382
-            `<div class="connection_info">${this.generateText()}</div>`
399
+            `<div class="connection-info">${this.generateText()}</div>`
383 400
         );
384
-        APP.translation.translateElement($(".connection_info"));
401
+        APP.translation.translateElement($(".connection-info"));
385 402
     }
386 403
 };
387 404
 

Loading…
Cancel
Save