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 8.7KB

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