您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

toolbar.js 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. var Toolbar = (function (my) {
  2. /**
  3. * Opens the lock room dialog.
  4. */
  5. my.openLockDialog = function () {
  6. // Only the focus is able to set a shared key.
  7. if (focus === null) {
  8. if (sharedKey)
  9. $.prompt("This conversation is currently protected by"
  10. + " a shared secret key.",
  11. {
  12. title: "Secret key",
  13. persistent: false
  14. }
  15. );
  16. else
  17. $.prompt("This conversation isn't currently protected by"
  18. + " a secret key. Only the owner of the conference"
  19. + " could set a shared key.",
  20. {
  21. title: "Secret key",
  22. persistent: false
  23. }
  24. );
  25. } else {
  26. if (sharedKey) {
  27. $.prompt("Are you sure you would like to remove your secret key?",
  28. {
  29. title: "Remove secret key",
  30. persistent: false,
  31. buttons: { "Remove": true, "Cancel": false},
  32. defaultButton: 1,
  33. submit: function (e, v, m, f) {
  34. if (v) {
  35. setSharedKey('');
  36. lockRoom(false);
  37. }
  38. }
  39. }
  40. );
  41. } else {
  42. $.prompt('<h2>Set a secret key to lock your room</h2>' +
  43. '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',
  44. {
  45. persistent: false,
  46. buttons: { "Save": true, "Cancel": false},
  47. defaultButton: 1,
  48. loaded: function (event) {
  49. document.getElementById('lockKey').focus();
  50. },
  51. submit: function (e, v, m, f) {
  52. if (v) {
  53. var lockKey = document.getElementById('lockKey');
  54. if (lockKey.value) {
  55. setSharedKey(Util.escapeHtml(lockKey.value));
  56. lockRoom(true);
  57. }
  58. }
  59. }
  60. }
  61. );
  62. }
  63. }
  64. };
  65. /**
  66. * Opens the invite link dialog.
  67. */
  68. my.openLinkDialog = function () {
  69. var inviteLink;
  70. if (roomUrl == null)
  71. inviteLink = "Your conference is currently being created...";
  72. else
  73. inviteLink = encodeURI(roomUrl);
  74. $.prompt('<input id="inviteLinkRef" type="text" value="' +
  75. inviteLink + '" onclick="this.select();" readonly>',
  76. {
  77. title: "Share this link with everyone you want to invite",
  78. persistent: false,
  79. buttons: { "Invite": true, "Cancel": false},
  80. defaultButton: 1,
  81. loaded: function (event) {
  82. if (roomUrl)
  83. document.getElementById('inviteLinkRef').select();
  84. else
  85. document.getElementById('jqi_state0_buttonInvite')
  86. .disabled = true;
  87. },
  88. submit: function (e, v, m, f) {
  89. if (v) {
  90. if (roomUrl) {
  91. inviteParticipants();
  92. }
  93. }
  94. }
  95. }
  96. );
  97. };
  98. /**
  99. * Invite participants to conference.
  100. */
  101. function inviteParticipants() {
  102. if (roomUrl == null)
  103. return;
  104. var sharedKeyText = "";
  105. if (sharedKey && sharedKey.length > 0)
  106. sharedKeyText
  107. = "This conference is password protected. Please use the "
  108. + "following pin when joining:%0D%0A%0D%0A"
  109. + sharedKey + "%0D%0A%0D%0A";
  110. var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
  111. var subject = "Invitation to a Jitsi Meet (" + conferenceName + ")";
  112. var body = "Hey there, I%27d like to invite you to a Jitsi Meet" +
  113. " conference I%27ve just set up.%0D%0A%0D%0A" +
  114. "Please click on the following link in order" +
  115. " to join the conference.%0D%0A%0D%0A" +
  116. roomUrl +
  117. "%0D%0A%0D%0A" +
  118. sharedKeyText +
  119. "Note that Jitsi Meet is currently only supported by Chromium," +
  120. " Google Chrome and Opera, so you need" +
  121. " to be using one of these browsers.%0D%0A%0D%0A" +
  122. "Talk to you in a sec!";
  123. if (window.localStorage.displayname)
  124. body += "%0D%0A%0D%0A" + window.localStorage.displayname;
  125. window.open("mailto:?subject=" + subject + "&body=" + body, '_blank');
  126. }
  127. /**
  128. * Opens the settings dialog.
  129. */
  130. my.openSettingsDialog = function () {
  131. $.prompt('<h2>Configure your conference</h2>' +
  132. '<input type="checkbox" id="initMuted"> Participants join muted<br/>' +
  133. '<input type="checkbox" id="requireNicknames"> Require nicknames<br/><br/>' +
  134. 'Set a secret key to lock your room: <input id="lockKey" type="text" placeholder="your shared key" autofocus>',
  135. {
  136. persistent: false,
  137. buttons: { "Save": true, "Cancel": false},
  138. defaultButton: 1,
  139. loaded: function (event) {
  140. document.getElementById('lockKey').focus();
  141. },
  142. submit: function (e, v, m, f) {
  143. if (v) {
  144. if ($('#initMuted').is(":checked")) {
  145. // it is checked
  146. }
  147. if ($('#requireNicknames').is(":checked")) {
  148. // it is checked
  149. }
  150. /*
  151. var lockKey = document.getElementById('lockKey');
  152. if (lockKey.value)
  153. {
  154. setSharedKey(lockKey.value);
  155. lockRoom(true);
  156. }
  157. */
  158. }
  159. }
  160. }
  161. );
  162. };
  163. /**
  164. * Toggles the application in and out of full screen mode
  165. * (a.k.a. presentation mode in Chrome).
  166. */
  167. my.toggleFullScreen = function() {
  168. var fsElement = document.documentElement;
  169. if (!document.mozFullScreen && !document.webkitIsFullScreen) {
  170. //Enter Full Screen
  171. if (fsElement.mozRequestFullScreen) {
  172. fsElement.mozRequestFullScreen();
  173. }
  174. else {
  175. fsElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
  176. }
  177. } else {
  178. //Exit Full Screen
  179. if (document.mozCancelFullScreen) {
  180. document.mozCancelFullScreen();
  181. } else {
  182. document.webkitCancelFullScreen();
  183. }
  184. }
  185. };
  186. /**
  187. * Updates the lock button state.
  188. */
  189. my.updateLockButton = function() {
  190. buttonClick("#lockIcon", "icon-security icon-security-locked");
  191. };
  192. // Shows or hides the 'recording' button.
  193. my.showRecordingButton = function (show) {
  194. if (!config.enableRecording) {
  195. return;
  196. }
  197. if (show) {
  198. $('#recording').css({display: "inline"});
  199. }
  200. else {
  201. $('#recording').css({display: "none"});
  202. }
  203. };
  204. // Toggle the state of the recording button
  205. my.toggleRecordingButtonState = function() {
  206. $('#recordButton').toggleClass('active');
  207. };
  208. // Shows or hides SIP calls button
  209. my.showSipCallButton = function (show)
  210. {
  211. if (config.hosts.call_control && show)
  212. {
  213. $('#sipCallButton').css({display: "inline"});
  214. }
  215. else
  216. {
  217. $('#sipCallButton').css({display: "none"});
  218. }
  219. };
  220. return my;
  221. }(Toolbar || {}));