瀏覽代碼

Updates invite link if the window has been already opened before it was available (Closes issue #70). Adds an invite button, which generates an invite email to be sent to other participants.

master
yanas 11 年之前
父節點
當前提交
d835887fa9
共有 2 個文件被更改,包括 64 次插入12 次删除
  1. 60
    12
      app.js
  2. 4
    0
      css/jquery-impromptu.css

+ 60
- 12
app.js 查看文件

@@ -677,7 +677,8 @@ $(document).bind('presence.muc', function (event, jid, info, pres) {
677 677
             showDisplayName('localVideoContainer', info.displayName + ' (me)');
678 678
         } else {
679 679
             ensurePeerContainerExists(jid);
680
-            showDisplayName('participant_' + Strophe.getResourceFromJid(jid), info.displayName);
680
+            showDisplayName('participant_' + Strophe.getResourceFromJid(jid),
681
+                            info.displayName);
681 682
         }
682 683
     }
683 684
 });
@@ -1287,22 +1288,61 @@ function openLockDialog() {
1287 1288
  * Opens the invite link dialog.
1288 1289
  */
1289 1290
 function openLinkDialog() {
1291
+    var inviteLink;
1290 1292
     if (roomUrl == null)
1291
-        openMessageDialog(  "Invite others",
1292
-                            "Your conference is currently being created."
1293
-                            + " Please try again in a few seconds.");
1293
+        inviteLink = "Your conference is currently being created...";
1294 1294
     else
1295
-        $.prompt('<input id="inviteLinkRef" type="text" value="' +
1296
-                encodeURI(roomUrl) + '" onclick="this.select();" readonly>',
1297
-                {
1298
-                    title: "Share this link with everyone you want to invite",
1299
-                    persistent: false,
1300
-                    buttons: { "Cancel": false},
1301
-                    loaded: function (event) {
1295
+        inviteLink = encodeURI(roomUrl);
1296
+
1297
+    $.prompt('<input id="inviteLinkRef" type="text" value="' +
1298
+            inviteLink + '" onclick="this.select();" readonly>',
1299
+            {
1300
+                title: "Share this link with everyone you want to invite",
1301
+                persistent: false,
1302
+                buttons: { "Invite": true, "Cancel": false},
1303
+                defaultButton: 1,
1304
+                loaded: function (event) {
1305
+                    if (roomUrl)
1302 1306
                         document.getElementById('inviteLinkRef').select();
1307
+                    else
1308
+                        document.getElementById('jqi_state0_buttonInvite')
1309
+                            .disabled = true;
1310
+                },
1311
+                submit: function (e, v, m, f) {
1312
+                    if (v) {
1313
+                        if (roomUrl) {
1314
+                            inviteParticipants();
1315
+                        }
1303 1316
                     }
1304 1317
                 }
1305
-            );
1318
+            }
1319
+        );
1320
+}
1321
+
1322
+/**
1323
+ * Invite participants to conference.
1324
+ */
1325
+function inviteParticipants() {
1326
+    if (roomUrl == null)
1327
+        return;
1328
+
1329
+    var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
1330
+    var subject = "Invitation to a Jitsi Meet (" + conferenceName + ")";
1331
+    var body = "Hey there, I%27d like to invite you to a Jitsi Meet"
1332
+                + " conference I%27ve just set up.%0D%0A%0D%0A"
1333
+                + "Please click on the following link in order"
1334
+                + " to join the conference.%0D%0A%0D%0A"
1335
+                + roomUrl + "%0D%0A%0D%0A"
1336
+                + "Note that Jitsi Meet is currently only supported by Chromim,"
1337
+                + " Google Chrome and Opera, so you need"
1338
+                + " to be using one of these browsers.%0D%0A%0D%0A"
1339
+                + "Talk to you in a sec!";
1340
+
1341
+    if (window.localStorage.displayname)
1342
+        body += "%0D%0A%0D%0A" + window.localStorage.displayname;
1343
+
1344
+    window.location.href
1345
+        = "mailto:?subject=" + subject + "&body=" + body;
1306 1346
 }
1307 1347
 
1308 1348
 /**
@@ -1448,6 +1488,14 @@ function dockToolbar(isDock) {
1448 1488
  */
1449 1489
 function updateRoomUrl(newRoomUrl) {
1450 1490
     roomUrl = newRoomUrl;
1491
+
1492
+    // If the invite dialog has been already opened we update the information.
1493
+    var inviteLink = document.getElementById('inviteLinkRef');
1494
+    if (inviteLink) {
1495
+        inviteLink.value = roomUrl;
1496
+        inviteLink.select();
1497
+        document.getElementById('jqi_state0_buttonInvite').disabled = false;
1498
+    }
1451 1499
 }
1452 1500
 
1453 1501
 /**

+ 4
- 0
css/jquery-impromptu.css 查看文件

@@ -66,6 +66,10 @@ div.jqi .jqibuttons button{
66 66
 div.jqi .jqibuttons button.jqidefaultbutton{
67 67
 	color: #489afe;
68 68
 }
69
+
70
+div.jqi .jqibuttons button:disabled {
71
+    color: #b6b6b6 !important;
72
+}
69 73
 div.jqi .jqibuttons button:hover,
70 74
 div.jqi .jqibuttons button:focus{
71 75
 	color: #287ade;

Loading…
取消
儲存