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.

close.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* global interfaceConfig */
  2. // list of tips
  3. const hints = [
  4. 'You can pin participants by clicking on their thumbnails.',
  5. 'You can tell others you have something to say by using the "Raise Hand" '
  6. + 'feature',
  7. 'You can learn about key shortcuts by pressing Shift+?',
  8. 'You can learn more about the state of everyone\'s connection by hovering '
  9. + 'on the bars in their thumbnail',
  10. 'You can hide all thumbnails by using the button in the bottom right corner'
  11. ];
  12. /**
  13. * Get a random hint meessage from hint array.
  14. *
  15. * @return {string} the hint message.
  16. */
  17. function getHint() {
  18. const l = hints.length - 1;
  19. const n = Math.round(Math.random() * l);
  20. return hints[n];
  21. }
  22. /**
  23. * Inserts text message
  24. * into DOM element
  25. *
  26. * @param id {string} element identificator
  27. * @param msg {string} text message
  28. */
  29. function insertTextMsg(id, msg) {
  30. const el = document.getElementById(id);
  31. if (el) {
  32. el.innerHTML = msg;
  33. }
  34. }
  35. /**
  36. * Sets the hint and thanks messages. Will be executed on load event.
  37. */
  38. function onLoad() {
  39. // Intentionally use string concatenation as this file does not go through
  40. // babel but IE11 is still supported.
  41. // eslint-disable-next-line prefer-template
  42. const thankYouMessage = 'Thank you for using ' + interfaceConfig.APP_NAME;
  43. // Works only for close2.html because close.html doesn't have this element.
  44. insertTextMsg('thanksMessage', thankYouMessage);
  45. // If there is a setting show a special message only for the guests
  46. if (interfaceConfig.CLOSE_PAGE_GUEST_HINT) {
  47. if (window.sessionStorage.getItem('guest') === 'true') {
  48. const element = document.getElementById('hintQuestion');
  49. element.classList.add('hide');
  50. insertTextMsg('hintMessage', interfaceConfig.CLOSE_PAGE_GUEST_HINT);
  51. return;
  52. }
  53. }
  54. insertTextMsg('hintMessage', getHint());
  55. }
  56. window.onload = onLoad;