You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

toolbar.js 7.9KB

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