Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * Utility functions.
  3. */
  4. var Util = (function (my) {
  5. /**
  6. * Returns the text width for the given element.
  7. *
  8. * @param el the element
  9. */
  10. my.getTextWidth = function(el) {
  11. return (el.clientWidth + 1);
  12. };
  13. /**
  14. * Returns the text height for the given element.
  15. *
  16. * @param el the element
  17. */
  18. my.getTextHeight = function(el) {
  19. return (el.clientHeight + 1);
  20. };
  21. /**
  22. * Casts the given number to integer.
  23. *
  24. * @param number the number to cast
  25. */
  26. my.toInteger = function(number) {
  27. return Math.round(Number(number));
  28. };
  29. /**
  30. * Plays the sound given by id.
  31. *
  32. * @param id the identifier of the audio element.
  33. */
  34. my.playSoundNotification = function(id) {
  35. document.getElementById(id).play();
  36. };
  37. return my;
  38. }(Util || {}));