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

toolbar.js 7.7KB

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