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.

74 lines
1.7 KiB

15 years ago
15 years ago
  1. var movimPollHandlers = new Array();
  2. var onloaders = new Array();
  3. /**
  4. * Adds a function to the onload event.
  5. */
  6. function movim_add_onload(func)
  7. {
  8. onloaders.push(func);
  9. }
  10. /**
  11. * Function that is run once the page is loaded.
  12. */
  13. function movim_onload()
  14. {
  15. for(var i = 0; i < onloaders.length; i++) {
  16. if(typeof(onloaders[i]) === "function")
  17. onloaders[i]();
  18. }
  19. }
  20. function log(text)
  21. {
  22. if(typeof text !== 'undefined') {
  23. text = text.toString();
  24. text = text.replace(/</g, '&lt;').replace(/>/g, '&gt;');
  25. /*document.getElementById('log_content').innerHTML
  26. = "$ " + text + "<br /> "
  27. + document.getElementById('log_content').innerHTML;*/
  28. }
  29. }
  30. function myFocus(element) {
  31. if (element.value == element.defaultValue) {
  32. element.value = '';
  33. }
  34. }
  35. function myBlur(element) {
  36. if (element.value == '') {
  37. element.value = element.defaultValue;
  38. }
  39. }
  40. function movim_parse_form(formname) {
  41. var form = document.forms[formname];
  42. if(!form)
  43. return false;
  44. var data = H();
  45. for(var i = 0; i < form.elements.length; i++) {
  46. data.set(form.elements[i].name,
  47. encodeURIComponent(form.elements[i].value));
  48. }
  49. return data;
  50. }
  51. function movim_reload(uri) {
  52. window.location.replace(uri);
  53. }
  54. /**
  55. * Set a global var for widgets to see if document is focused
  56. */
  57. var document_focus = true;
  58. var document_title = document.title;
  59. var messages_cpt = 1;
  60. document.onblur = function() { document_focus = false; }
  61. document.onfocus = function() { document_focus = true; document.title = document_title; messages_cpt = 1; }
  62. function movim_title_inc(){
  63. document.title='[' + messages_cpt + '] ' + document_title ;
  64. messages_cpt++;
  65. }