Leaked source code of windows server 2003
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.

155 lines
3.1 KiB

  1. // Set up the events
  2. //======================================================
  3. document.oncontextmenu=killcontext;
  4. document.onkeydown=keyhandler;
  5. document.onmousedown=killrightmouse;
  6. window.onload=init;
  7. // Kill the Href
  8. //======================================================
  9. function doNothing(){
  10. event.returnValue = false;
  11. }
  12. // Init the page
  13. //======================================================
  14. var bLoaded = false;
  15. function init(){
  16. bLoaded = true;
  17. }
  18. // Menu Action
  19. //======================================================
  20. var oCurrent;
  21. var iCurrent;
  22. var highColor = "red";
  23. var normColor = "000099";
  24. var iFocus = 1;
  25. function selectIt(iItem){
  26. if (!bLoaded)
  27. return;
  28. var oItem = document.all["menu_" + iItem];
  29. var oItemWrap = oItem.parentElement;
  30. if (oCurrent == null) setCurrent();
  31. iCurrent = oCurrent.id.substr(oCurrent.id.indexOf("_") + 1);
  32. oCurrent.parentElement.style.backgroundImage = "none";
  33. oCurrent.style.color = normColor;
  34. oCurrent.style.cursor = "hand";
  35. oCurrent.style.textDecoration = "";
  36. document.all["content_" + iCurrent].style.display = "none";
  37. oItemWrap.style.backgroundImage = "url(toccolor.gif)";
  38. oItem.style.cursor = "default";
  39. oItem.style.color = highColor;
  40. oItem.style.textDecoration = "none";
  41. hzLine.style.top = oItemWrap.offsetTop - 73;
  42. hzLine.style.visibility = "visible";
  43. try{
  44. document.all["content_" + iItem].style.display = "inline";
  45. }catch(e){
  46. selectIt(iItem);
  47. }
  48. oCurrent = oItem;
  49. iFocus = iItem;
  50. if (event != null) event.returnValue = false;
  51. }
  52. function setCurrent(){
  53. try{
  54. oCurrent = document.all.menu_1;
  55. }catch(e){
  56. setCurrent();
  57. }
  58. }
  59. function doNothing(){
  60. event.returnValue = false;
  61. }
  62. // Key handler
  63. //====================================================
  64. // general purpose key handler
  65. function keyhandler()
  66. {
  67. var iMenuCount = 5;
  68. var iKey = window.event.keyCode;
  69. //up, down and tab keys for toc
  70. switch(iKey){
  71. case 0x26:{
  72. iFocus = iFocus - 1;
  73. if (iFocus < 1) iFocus = iMenuCount;
  74. document.all["menu_" + iFocus].focus();
  75. break;
  76. }
  77. case 0x28:{
  78. iFocus = iFocus + 1;
  79. if (iFocus > iMenuCount) iFocus = 1;
  80. document.all["menu_" + iFocus].focus();
  81. break;
  82. }
  83. }
  84. // Function key f5
  85. if (iKey == 0x74) {
  86. window.event.cancelBubble = true;
  87. window.event.returnValue = false;
  88. return false;
  89. }
  90. //control hotkeys
  91. if(window.event.ctrlKey) {
  92. switch(iKey) {
  93. case 0x35: // 5
  94. case 0x65: // keypad 5
  95. case 0x41: // A
  96. case 0x46: // F
  97. case 0x4e: // N
  98. case 0x4f: // O
  99. case 0x50: // P
  100. {
  101. window.event.cancelBubble = true;
  102. window.event.returnValue = false;
  103. return false;
  104. }
  105. }
  106. }
  107. //test for escape key and bail if appropriate
  108. if(window.event.keyCode == 0x1b) {
  109. self.close();
  110. }
  111. }
  112. // kill the context menu
  113. function killcontext()
  114. {
  115. window.event.returnValue = false;
  116. }
  117. //kill the right mouse
  118. function killrightmouse(){
  119. window.event.returnValue = false;
  120. window.event.cancelBubble = true;
  121. return false;
  122. }