Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. var Toolbar = (function (my) {
  2. var INITIAL_TOOLBAR_TIMEOUT = 20000;
  3. var TOOLBAR_TIMEOUT = INITIAL_TOOLBAR_TIMEOUT;
  4. /**
  5. * Opens the lock room dialog.
  6. */
  7. my.openLockDialog = function () {
  8. // Only the focus is able to set a shared key.
  9. if (focus === null) {
  10. if (sharedKey)
  11. $.prompt("This conversation is currently protected by"
  12. + " a shared secret key.",
  13. {
  14. title: "Secret key",
  15. persistent: false
  16. }
  17. );
  18. else
  19. $.prompt("This conversation isn't currently protected by"
  20. + " a secret key. Only the owner of the conference"
  21. + " could set a shared key.",
  22. {
  23. title: "Secret key",
  24. persistent: false
  25. }
  26. );
  27. } else {
  28. if (sharedKey) {
  29. $.prompt("Are you sure you would like to remove your secret key?",
  30. {
  31. title: "Remove secret key",
  32. persistent: false,
  33. buttons: { "Remove": true, "Cancel": false},
  34. defaultButton: 1,
  35. submit: function (e, v, m, f) {
  36. if (v) {
  37. setSharedKey('');
  38. lockRoom(false);
  39. }
  40. }
  41. }
  42. );
  43. } else {
  44. $.prompt('<h2>Set a secret key to lock your room</h2>' +
  45. '<input id="lockKey" type="text" placeholder="your shared key" autofocus>',
  46. {
  47. persistent: false,
  48. buttons: { "Save": true, "Cancel": false},
  49. defaultButton: 1,
  50. loaded: function (event) {
  51. document.getElementById('lockKey').focus();
  52. },
  53. submit: function (e, v, m, f) {
  54. if (v) {
  55. var lockKey = document.getElementById('lockKey');
  56. if (lockKey.value) {
  57. setSharedKey(Util.escapeHtml(lockKey.value));
  58. lockRoom(true);
  59. }
  60. }
  61. }
  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. $.prompt('<input id="inviteLinkRef" type="text" value="' +
  77. inviteLink + '" onclick="this.select();" readonly>',
  78. {
  79. title: "Share this link with everyone you want to invite",
  80. persistent: false,
  81. buttons: { "Invite": true, "Cancel": false},
  82. defaultButton: 1,
  83. loaded: function (event) {
  84. if (roomUrl)
  85. document.getElementById('inviteLinkRef').select();
  86. else
  87. document.getElementById('jqi_state0_buttonInvite')
  88. .disabled = true;
  89. },
  90. submit: function (e, v, m, f) {
  91. if (v) {
  92. if (roomUrl) {
  93. inviteParticipants();
  94. }
  95. }
  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. 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. window.open("mailto:?subject=" + subject + "&body=" + body, '_blank');
  128. }
  129. /**
  130. * Opens the settings dialog.
  131. */
  132. my.openSettingsDialog = function () {
  133. $.prompt('<h2>Configure your conference</h2>' +
  134. '<input type="checkbox" id="initMuted"> Participants join muted<br/>' +
  135. '<input type="checkbox" id="requireNicknames"> Require nicknames<br/><br/>' +
  136. 'Set a secret key to lock your room: <input id="lockKey" type="text" placeholder="your shared key" autofocus>',
  137. {
  138. persistent: false,
  139. buttons: { "Save": true, "Cancel": false},
  140. defaultButton: 1,
  141. loaded: function (event) {
  142. document.getElementById('lockKey').focus();
  143. },
  144. submit: function (e, v, m, f) {
  145. if (v) {
  146. if ($('#initMuted').is(":checked")) {
  147. // it is checked
  148. }
  149. if ($('#requireNicknames').is(":checked")) {
  150. // it is checked
  151. }
  152. /*
  153. var lockKey = document.getElementById('lockKey');
  154. if (lockKey.value)
  155. {
  156. setSharedKey(lockKey.value);
  157. lockRoom(true);
  158. }
  159. */
  160. }
  161. }
  162. }
  163. );
  164. };
  165. /**
  166. * Toggles the application in and out of full screen mode
  167. * (a.k.a. presentation mode in Chrome).
  168. */
  169. my.toggleFullScreen = function() {
  170. var fsElement = document.documentElement;
  171. if (!document.mozFullScreen && !document.webkitIsFullScreen) {
  172. //Enter Full Screen
  173. if (fsElement.mozRequestFullScreen) {
  174. fsElement.mozRequestFullScreen();
  175. }
  176. else {
  177. fsElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
  178. }
  179. } else {
  180. //Exit Full Screen
  181. if (document.mozCancelFullScreen) {
  182. document.mozCancelFullScreen();
  183. } else {
  184. document.webkitCancelFullScreen();
  185. }
  186. }
  187. };
  188. /**
  189. * Shows the main toolbar.
  190. */
  191. my.showToolbar = function() {
  192. if (!$('#header').is(':visible')) {
  193. $('#header').show("slide", { direction: "up", duration: 300});
  194. $('#subject').animate({top: "+=40"}, 300);
  195. if (toolbarTimeout) {
  196. clearTimeout(toolbarTimeout);
  197. toolbarTimeout = null;
  198. }
  199. toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
  200. TOOLBAR_TIMEOUT = 4000;
  201. }
  202. if (focus != null)
  203. {
  204. // TODO: Enable settings functionality. Need to uncomment the settings button in index.html.
  205. // $('#settingsButton').css({visibility:"visible"});
  206. }
  207. // Show/hide desktop sharing button
  208. showDesktopSharingButton();
  209. };
  210. /**
  211. * Docks/undocks the toolbar.
  212. *
  213. * @param isDock indicates what operation to perform
  214. */
  215. my.dockToolbar = function(isDock) {
  216. if (isDock) {
  217. // First make sure the toolbar is shown.
  218. if (!$('#header').is(':visible')) {
  219. Toolbar.showToolbar();
  220. }
  221. // Then clear the time out, to dock the toolbar.
  222. if (toolbarTimeout) {
  223. clearTimeout(toolbarTimeout);
  224. toolbarTimeout = null;
  225. }
  226. }
  227. else {
  228. if (!$('#header').is(':visible')) {
  229. Toolbar.showToolbar();
  230. }
  231. else {
  232. toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
  233. }
  234. }
  235. };
  236. /**
  237. * Updates the lock button state.
  238. */
  239. my.updateLockButton = function() {
  240. buttonClick("#lockIcon", "icon-security icon-security-locked");
  241. };
  242. /**
  243. * Hides the toolbar.
  244. */
  245. var hideToolbar = function () {
  246. var isToolbarHover = false;
  247. $('#header').find('*').each(function () {
  248. var id = $(this).attr('id');
  249. if ($("#" + id + ":hover").length > 0) {
  250. isToolbarHover = true;
  251. }
  252. });
  253. clearTimeout(toolbarTimeout);
  254. toolbarTimeout = null;
  255. if (!isToolbarHover) {
  256. $('#header').hide("slide", { direction: "up", duration: 300});
  257. $('#subject').animate({top: "-=40"}, 300);
  258. }
  259. else {
  260. toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
  261. }
  262. };
  263. // Shows or hides the 'recording' button.
  264. my.showRecordingButton = function (show) {
  265. if (!config.enableRecording) {
  266. return;
  267. }
  268. if (show) {
  269. $('#recording').css({display: "inline"});
  270. }
  271. else {
  272. $('#recording').css({display: "none"});
  273. }
  274. };
  275. // Toggle the state of the recording button
  276. my.toggleRecordingButtonState = function() {
  277. $('#recordButton').toggleClass('active');
  278. };
  279. // Shows or hides SIP calls button
  280. my.showSipCallButton = function (show)
  281. {
  282. if (config.hosts.call_control && show)
  283. {
  284. $('#sipCallButton').css({display: "inline"});
  285. }
  286. else
  287. {
  288. $('#sipCallButton').css({display: "none"});
  289. }
  290. };
  291. return my;
  292. }(Toolbar || {}));