Source code of Windows XP (NT5)
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.

77 lines
1.9 KiB

  1. <PUBLIC:COMPONENT lightweight>
  2. <PUBLIC:ATTACH event="ondocumentready" onevent="onDocumentReady();" />
  3. <PUBLIC:ATTACH event="onkeydown" onevent="HandleShortcuts();" />
  4. <PUBLIC:ATTACH event="onselectstart" onevent="OnSelectStart();" />
  5. <PUBLIC:ATTACH event="ondragstart" onevent="OnDragStart();" />
  6. </PUBLIC:COMPONENT>
  7. <SCRIPT language="JavaScript">
  8. function onDocumentReady()
  9. {
  10. window.onerror = ErrorHandler;
  11. try
  12. {
  13. window.document.createStyleSheet(window.external.cssPath);
  14. }
  15. catch (e)
  16. {
  17. // Fall back on duplicate rules in nusrmgr.css
  18. alert('Error loading style sheet (' + (e.number & 0xffff) + ')');
  19. }
  20. }
  21. function HandleShortcuts()
  22. {
  23. var code = event.keyCode;
  24. if (event.altKey == true)
  25. {
  26. if (code == 36) // VK_HOME
  27. {
  28. window.external.goBack(-1);
  29. event.returnValue = false;
  30. }
  31. else if (code == 37) // VK_LEFT
  32. {
  33. window.external.goBack();
  34. event.returnValue = false;
  35. }
  36. else if (code == 39) // VK_RIGHT
  37. {
  38. window.external.goForward();
  39. event.returnValue = false;
  40. }
  41. }
  42. // Eat 'refresh' commands
  43. if (code == 116) // VK_F5
  44. {
  45. event.returnValue = false;
  46. }
  47. }
  48. // Since this is a web page the user can select elements on the
  49. // page. Since this is an app, selecting element is undesireable.
  50. // Therefore we catch the start of a selection event and cancel it.
  51. function OnSelectStart()
  52. {
  53. // We still want to be able to select text in entry fields though.
  54. event.returnValue = event.srcElement.isTextEdit;
  55. }
  56. // Don't want any drag-drop stuff going on
  57. function OnDragStart()
  58. {
  59. event.returnValue = false;
  60. }
  61. // Show errors, but hide the scary filenames and line numbers
  62. function ErrorHandler(szMsg)
  63. {
  64. alert(szMsg);
  65. event.returnValue = true;
  66. }
  67. </SCRIPT>