浏览代码

Removed duplicated code for adding video thumbnail's hover handler.

master
paweldomas 9 年前
父节点
当前提交
4c2f0d3600
共有 3 个文件被更改,包括 22 次插入28 次删除
  1. 1
    13
      modules/UI/videolayout/LocalVideo.js
  2. 1
    15
      modules/UI/videolayout/RemoteVideo.js
  3. 20
    0
      modules/UI/videolayout/SmallVideo.js

+ 1
- 13
modules/UI/videolayout/LocalVideo.js 查看文件

@@ -9,6 +9,7 @@ var RTCBrowserType = require("../../RTC/RTCBrowserType");
9 9
 function LocalVideo(VideoLayout) {
10 10
     this.videoSpanId = "localVideoContainer";
11 11
     this.container = $("#localVideoContainer").get(0);
12
+    this.bindHoverHandler();
12 13
     this.VideoLayout = VideoLayout;
13 14
     this.flipX = true;
14 15
     this.isLocal = true;
@@ -173,19 +174,6 @@ LocalVideo.prototype.changeVideo = function (stream, isMuted) {
173 174
     localVideoContainerSelector.off('click');
174 175
     localVideoContainerSelector.on('click', localVideoClick);
175 176
 
176
-    // Add hover handler
177
-    localVideoContainerSelector.hover(
178
-        function() {
179
-            self.showDisplayName(true);
180
-        },
181
-        function() {
182
-            if (!LargeVideo.isLargeVideoVisible() ||
183
-                !LargeVideo.isCurrentlyOnLarge(self.getResourceJid())) {
184
-                self.showDisplayName(false);
185
-            }
186
-        }
187
-    );
188
-
189 177
     if(isMuted) {
190 178
         APP.UI.setVideoMute(true);
191 179
         return;

+ 1
- 15
modules/UI/videolayout/RemoteVideo.js 查看文件

@@ -20,6 +20,7 @@ function RemoteVideo(peerJid, VideoLayout) {
20 20
     nickfield.className = "nick";
21 21
     nickfield.appendChild(document.createTextNode(this.resourceJid));
22 22
     this.container.appendChild(nickfield);
23
+    this.bindHoverHandler();
23 24
     this.flipX = false;
24 25
     this.isLocal = false;
25 26
 }
@@ -252,21 +253,6 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
252 253
     if (RTCBrowserType.isTemasysPluginUsed())
253 254
         sel = $('#' + newElementId);
254 255
     sel[0].onclick = onClickHandler;
255
-
256
-    //FIXME
257
-    // Add hover handler
258
-    $(this.container).hover(
259
-        function() {
260
-            self.showDisplayName(true);
261
-        },
262
-        function() {
263
-            // If the video has been "pinned" by the user we want to
264
-            // keep the display name on place.
265
-            if (!LargeVideo.isLargeVideoVisible() ||
266
-                !LargeVideo.isCurrentlyOnLarge(self.getResourceJid()))
267
-                self.showDisplayName(false);
268
-        }
269
-    );
270 256
 },
271 257
 
272 258
 /**

+ 20
- 0
modules/UI/videolayout/SmallVideo.js 查看文件

@@ -120,6 +120,26 @@ SmallVideo.createStreamElement = function (sid, stream) {
120 120
     return element;
121 121
 };
122 122
 
123
+/**
124
+ * Configures hoverIn/hoverOut handlers.
125
+ */
126
+SmallVideo.prototype.bindHoverHandler = function () {
127
+    // Add hover handler
128
+    var self = this;
129
+    $(this.container).hover(
130
+        function () {
131
+            self.showDisplayName(true);
132
+        },
133
+        function () {
134
+            // If the video has been "pinned" by the user we want to
135
+            // keep the display name on place.
136
+            if (!LargeVideo.isLargeVideoVisible() ||
137
+                !LargeVideo.isCurrentlyOnLarge(self.getResourceJid()))
138
+                self.showDisplayName(false);
139
+        }
140
+    );
141
+};
142
+
123 143
 /**
124 144
  * Updates the data for the indicator
125 145
  * @param id the id of the indicator

正在加载...
取消
保存