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.

93 lines
2.5 KiB

  1. <PUBLIC:COMPONENT lightweight>
  2. <PUBLIC:ATTACH event="ondocumentready" onevent="onDocumentReady();" />
  3. <PUBLIC:ATTACH event="onkeydown" onevent="HandleShortcuts();" />
  4. <PUBLIC:ATTACH event="ondragstart" onevent="OnDragStart();" />
  5. <PUBLIC:ATTACH event="ondragenter" onevent="OnDragStart();" />
  6. </PUBLIC:COMPONENT>
  7. <SCRIPT language="JavaScript">
  8. function ErrorHandler(szMsg)
  9. {
  10. alert(szMsg);
  11. event.returnValue = true;
  12. }
  13. function onDocumentReady()
  14. {
  15. window.onerror = ErrorHandler;
  16. var css = top.window.g_strThemeCSS;
  17. if (!css)
  18. {
  19. css = "none";
  20. try
  21. {
  22. var oThemeManager = new ActiveXObject("Theme.Manager");
  23. var szTheme = oThemeManager.GetSelectedSchemeProperty("Path");
  24. if (szTheme)
  25. {
  26. var szColor = oThemeManager.GetSelectedSchemeProperty("Color");
  27. //alert("ThemeManager returned " + szTheme); // for debugging only
  28. if (szColor)
  29. css = "res://" + szTheme + "\\Shell\\" + szColor + "\\ShellStyle.dll/cpwebvw.css";
  30. }
  31. }
  32. catch (e)
  33. {
  34. //alert("ThemeManager error " + e.number); // for debugging only
  35. }
  36. top.window.g_strThemeCSS = css;
  37. }
  38. if (css != "none")
  39. window.document.createStyleSheet(css);
  40. }
  41. function HandleShortcuts()
  42. {
  43. var code = event.keyCode;
  44. if (event.altKey == true)
  45. {
  46. switch (code)
  47. {
  48. case 36: // VK_HOME
  49. top.window.g_Navigator.back(-1);
  50. event.returnValue = false;
  51. break;
  52. case 37: // VK_LEFT
  53. top.window.g_Navigator.back();
  54. event.returnValue = false;
  55. break;
  56. case 39: // VK_RIGHT
  57. top.window.g_Navigator.forward();
  58. event.returnValue = false;
  59. break;
  60. }
  61. }
  62. // ctrl-P brings up the print dialog by default
  63. if (event.ctrlKey == true && code == 80) // 'P'
  64. event.returnValue = false;
  65. // 'refresh'
  66. if (code == 116) // VK_F5
  67. {
  68. // Force a new enumeration and go back to the first page.
  69. g_oSelectedUser = null;
  70. g_oUserList = null;
  71. g_oUserList = new ActiveXObject("Shell.Users");
  72. top.window.g_Navigator.back(-1);
  73. event.returnValue = false;
  74. }
  75. }
  76. // Don't want any drag-drop stuff going on
  77. function OnDragStart()
  78. {
  79. event.returnValue = false;
  80. }
  81. </SCRIPT>