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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. // Works only for close2.html because close.html doesn't have this element.
  40. insertTextMsg('thanksMessage',
  41. `Thank you for using ${interfaceConfig.APP_NAME}`);
  42. // If there is a setting show a special message only for the guests
  43. if (interfaceConfig.CLOSE_PAGE_GUEST_HINT) {
  44. if (window.sessionStorage.getItem('guest') === 'true') {
  45. const element = document.getElementById('hintQuestion');
  46. element.classList.add('hide');
  47. insertTextMsg('hintMessage', interfaceConfig.CLOSE_PAGE_GUEST_HINT);
  48. return;
  49. }
  50. }
  51. insertTextMsg('hintMessage', getHint());
  52. }
  53. window.onload = onLoad;