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.

262 lines
7.9 KiB

  1. <HTML>
  2. <OBJECT ID="MMCCtrl" <
  3. CLASSID="CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A">
  4. >
  5. </OBJECT>
  6. <STYLE TYPE="text/css">
  7. </STYLE>
  8. <SCRIPT LANGUAGE="JavaScript">
  9. function CheckForDuplicate (taskArray, j)
  10. {
  11. var i;
  12. var task = taskArray[j];
  13. for (i=0; i<j; i++) {
  14. var display = taskArray[i].DisplayObject;
  15. if (display.DisplayObjectType == 1)
  16. if (display.FontFamilyName == task.DisplayObject.FontFamilyName)
  17. if (display.URLtoEOT == task.DisplayObject.URLtoEOT)
  18. return true;
  19. }
  20. return false;
  21. }
  22. function AddClickStuff (str, task)
  23. {
  24. var myStr = "";
  25. var clsid = task.Clsid;
  26. switch (task.ActionType) {
  27. case 0: // task.MMC_TASK_ACTION_ID:
  28. myStr += "onclick=\"MMCCtrl.TaskNotify ('" + clsid + "', " + task.CommandID +", '" + "0" + "')\"";
  29. break;
  30. case 1: //task.MMC_TASK_ACTION_LINK:
  31. myStr += "onclick=\"window.location=" + task.ActionURL + "\"";
  32. break;
  33. case 2: //task.MMC_TASK_ACTION_SCRIPT:
  34. myStr += "onclick=\"" + task.Script + "\"";
  35. break;
  36. default:
  37. alert ("unrecognized task");
  38. break;
  39. }
  40. return myStr;
  41. }
  42. function myLoad()
  43. {
  44. var taskArray = new Array();
  45. // get title and ignore it for now
  46. var title = MMCCtrl.GetTitle (hash);
  47. var background = MMCCtrl.GetBackground (hash);
  48. // TODO: get descriptive text
  49. var str;
  50. var display; // display object
  51. var hash = location.hash;
  52. if (hash != "")
  53. hash = hash.substr(1);
  54. var task = MMCCtrl.GetFirstTask (hash);
  55. var numTasks = 0;
  56. while (task != null) {
  57. taskArray[numTasks++] = task;
  58. task = MMCCtrl.GetNextTask();
  59. }
  60. window.name = "don't reload";
  61. // alert (window.name);
  62. document.open();
  63. document.writeln ("<HTML>");
  64. document.writeln ("<OBJECT ID=\"MMCCtrl\" <");
  65. document.writeln (" CLASSID=\"CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A\">");
  66. document.writeln (">");
  67. document.writeln ("</OBJECT>");
  68. document.writeln ("<STYLE>");
  69. // TODO: these may cause duplicates, too
  70. if (background != null)
  71. if (background.DisplayObjectType == 1) {
  72. str = "@font-face {";
  73. str += " font-family: " + background.FontFamilyName + ";";
  74. str += " src: url(" + background.URLtoEOT +");";
  75. str += "}";
  76. document.writeln (str);
  77. }
  78. var i;
  79. for (i=0; i<numTasks; i++) {
  80. display = taskArray[i].DisplayObject;
  81. if (display.DisplayObjectType == 1) { // MMC_TASK_DISPLAY_TYPE_SYMBOL
  82. if (CheckForDuplicate (taskArray, i) == false) {
  83. str = "";
  84. str += "@font-face {";
  85. str += " font-family: " + display.FontFamilyName + ";";
  86. str += " src: url(" + display.URLtoEOT +");";
  87. str += "}";
  88. // alert (str);
  89. document.writeln (str);
  90. }
  91. }
  92. }
  93. document.writeln ("</STYLE>");
  94. document.writeln ("<SCRIPT>");
  95. document.writeln ("if (window.name == \"do reload\") {");
  96. // document.writeln (" alert (\"about to reload\");");
  97. document.writeln (" window.name = \"don't reload\";");
  98. // document.writeln (" location.reload (true);");
  99. // document.writeln (" alert (\"default.htm#" + hash + "\");");
  100. document.writeln (" location.replace (\"default.htm#" + hash + "\");");
  101. document.writeln ("}");
  102. // document.writeln (" alert (location + \"#\" + \"" + hash + "\");");
  103. // document.writeln (" alert (this.outerHTML);");
  104. document.writeln ("</" + "SCRIPT>");
  105. // TODO: this doesn't work!
  106. // TODO: load a generic loader page that just reloads this one?
  107. document.writeln ("<BODY>");
  108. document.writeln ("</BODY>");
  109. document.writeln ("</HTML>");
  110. document.close();
  111. window.name = "do reload";
  112. // background
  113. if (background != null) {
  114. // use z-index = -2
  115. switch (background.DisplayObjectType) {
  116. default:
  117. alert ("skipping due to background.DisplayObjectType == " + background.DisplayObjectType);
  118. break; // skip
  119. case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
  120. str = "";
  121. str += "<SPAN STYLE=\"position:absolute; top:0; left:0; z-index:-1; font-family:";
  122. str += background.FontFamilyName;
  123. str += "; font-size:45pt; \">";
  124. str += background.SymbolString;
  125. str += "</SPAN>";
  126. document.body.insertAdjacentHTML ("BeforeEnd", str);
  127. break;
  128. case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
  129. case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
  130. case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
  131. document.body.insertAdjacentHTML ("BeforeEnd",
  132. "<IMG SRC=\"" +
  133. background.MouseOverBitmap +
  134. "\" STYLE=\"position:absolute; top:0; left:0; z-index:-2\">");
  135. break;
  136. }
  137. }
  138. // for all tasks
  139. for (i=0; i<numTasks; i++) {
  140. task = taskArray[i];
  141. var text = task.Text;
  142. var help = task.Help;
  143. var type = task.ActionType;
  144. var clsid = task.Clsid;
  145. str = "";
  146. display = task.DisplayObject;
  147. switch (display.DisplayObjectType) {
  148. default:
  149. alert ("bad DisplayObjectType! skipping...");
  150. break;
  151. case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
  152. str += "<P ALIGN=center ";
  153. str += "STYLE= \"";
  154. str += "font-family:" + display.FontFamilyName + ";";
  155. str += "font-size:45pt";
  156. str += "\" ";
  157. str += AddClickStuff (str, task);
  158. str += ">";
  159. str += display.SymbolString;
  160. str += "</P>";
  161. // alert (str);
  162. break;
  163. case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
  164. case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
  165. case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
  166. // 3 possibilities for action: "ID:", "LINK:" and "SCRIPT:"
  167. // default is "ID:", I guess
  168. switch (type) {
  169. case 0: //task.MMC_TASK_ACTION_ID:
  170. str += "<P ALIGN=center>";
  171. str += "<IMG SRC=" + display.MouseOffBitmap;
  172. str += " style=\"filter: gray(enabled=true) invert(enabled=0)\"";
  173. str += " onmouseover=\"filters.invert.enabled = true;\"";
  174. str += " onmouseout =\"filters.invert.enabled = false;\"";
  175. // str += " onclick=\"myClick('" + clsid + "', " + task.CommandID +", '" + "0" + "')\">";
  176. str += " onclick=\"MMCCtrl.TaskNotify ('" + clsid + "', " + task.CommandID +", '" + "0" + "')\">";
  177. str += text + "</P>";
  178. break;
  179. case 1: //task.MMC_TASK_ACTION_LINK:
  180. str = "<P ALIGN=center>";
  181. str += "<A HREF=" + task.ActionURL + ">";
  182. str += "<IMG SRC=" + display.MouseOffBitmap + ">";
  183. str += text + "</A>";
  184. break;
  185. case 2: //task.MMC_TASK_ACTION_SCRIPT:
  186. str += "<P ALIGN=center>";
  187. str += "<IMG SRC=" + display.MouseOffBitmap;
  188. str += " LANGUAGE=" + task.ScriptLanguage;
  189. str += " onclick=\"" + task.Script;
  190. str += "\">";
  191. str += text + "</P>";
  192. break;
  193. default:
  194. alert ("unrecognized task");
  195. break;
  196. }
  197. break;
  198. }
  199. if (str != "")
  200. document.body.insertAdjacentHTML ("BeforeEnd", str);
  201. }
  202. alert ("document.body.innerHTML:\n" + document.body.innerHTML);
  203. }
  204. window.onload = myLoad;
  205. </SCRIPT>
  206. <HEAD>
  207. <TITLE>Default TaskPad</TITLE>
  208. </HEAD>
  209. <BODY BGCOLOR="white" TOPMARGIN=0 LEFTMARGIN=0>
  210. </BODY>
  211. </HTML>