mirror of https://github.com/tongzx/nt5src
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
262 lines
7.9 KiB
<HTML>
|
|
|
|
<OBJECT ID="MMCCtrl" <
|
|
CLASSID="CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A">
|
|
>
|
|
</OBJECT>
|
|
|
|
<STYLE TYPE="text/css">
|
|
</STYLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
|
|
function CheckForDuplicate (taskArray, j)
|
|
{
|
|
var i;
|
|
var task = taskArray[j];
|
|
for (i=0; i<j; i++) {
|
|
var display = taskArray[i].DisplayObject;
|
|
if (display.DisplayObjectType == 1)
|
|
if (display.FontFamilyName == task.DisplayObject.FontFamilyName)
|
|
if (display.URLtoEOT == task.DisplayObject.URLtoEOT)
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function AddClickStuff (str, task)
|
|
{
|
|
var myStr = "";
|
|
var clsid = task.Clsid;
|
|
|
|
switch (task.ActionType) {
|
|
case 0: // task.MMC_TASK_ACTION_ID:
|
|
myStr += "onclick=\"MMCCtrl.TaskNotify ('" + clsid + "', " + task.CommandID +", '" + "0" + "')\"";
|
|
break;
|
|
|
|
case 1: //task.MMC_TASK_ACTION_LINK:
|
|
myStr += "onclick=\"window.location=" + task.ActionURL + "\"";
|
|
break;
|
|
|
|
case 2: //task.MMC_TASK_ACTION_SCRIPT:
|
|
myStr += "onclick=\"" + task.Script + "\"";
|
|
break;
|
|
|
|
default:
|
|
alert ("unrecognized task");
|
|
break;
|
|
}
|
|
return myStr;
|
|
}
|
|
|
|
function myLoad()
|
|
{
|
|
var taskArray = new Array();
|
|
|
|
// get title and ignore it for now
|
|
var title = MMCCtrl.GetTitle (hash);
|
|
|
|
var background = MMCCtrl.GetBackground (hash);
|
|
|
|
// TODO: get descriptive text
|
|
|
|
var str;
|
|
var display; // display object
|
|
var hash = location.hash;
|
|
if (hash != "")
|
|
hash = hash.substr(1);
|
|
var task = MMCCtrl.GetFirstTask (hash);
|
|
var numTasks = 0;
|
|
while (task != null) {
|
|
taskArray[numTasks++] = task;
|
|
task = MMCCtrl.GetNextTask();
|
|
}
|
|
|
|
window.name = "don't reload";
|
|
// alert (window.name);
|
|
|
|
document.open();
|
|
document.writeln ("<HTML>");
|
|
|
|
document.writeln ("<OBJECT ID=\"MMCCtrl\" <");
|
|
document.writeln (" CLASSID=\"CLSID:545AE700-50BF-11D1-9FE9-00600832DB4A\">");
|
|
document.writeln (">");
|
|
document.writeln ("</OBJECT>");
|
|
|
|
document.writeln ("<STYLE>");
|
|
|
|
// TODO: these may cause duplicates, too
|
|
if (background != null)
|
|
if (background.DisplayObjectType == 1) {
|
|
str = "@font-face {";
|
|
str += " font-family: " + background.FontFamilyName + ";";
|
|
str += " src: url(" + background.URLtoEOT +");";
|
|
str += "}";
|
|
document.writeln (str);
|
|
}
|
|
|
|
var i;
|
|
for (i=0; i<numTasks; i++) {
|
|
display = taskArray[i].DisplayObject;
|
|
if (display.DisplayObjectType == 1) { // MMC_TASK_DISPLAY_TYPE_SYMBOL
|
|
if (CheckForDuplicate (taskArray, i) == false) {
|
|
str = "";
|
|
|
|
str += "@font-face {";
|
|
str += " font-family: " + display.FontFamilyName + ";";
|
|
str += " src: url(" + display.URLtoEOT +");";
|
|
str += "}";
|
|
|
|
// alert (str);
|
|
document.writeln (str);
|
|
}
|
|
}
|
|
}
|
|
document.writeln ("</STYLE>");
|
|
|
|
document.writeln ("<SCRIPT>");
|
|
|
|
document.writeln ("if (window.name == \"do reload\") {");
|
|
// document.writeln (" alert (\"about to reload\");");
|
|
document.writeln (" window.name = \"don't reload\";");
|
|
// document.writeln (" location.reload (true);");
|
|
// document.writeln (" alert (\"default.htm#" + hash + "\");");
|
|
document.writeln (" location.replace (\"default.htm#" + hash + "\");");
|
|
document.writeln ("}");
|
|
|
|
// document.writeln (" alert (location + \"#\" + \"" + hash + "\");");
|
|
// document.writeln (" alert (this.outerHTML);");
|
|
|
|
|
|
document.writeln ("</" + "SCRIPT>");
|
|
|
|
// TODO: this doesn't work!
|
|
// TODO: load a generic loader page that just reloads this one?
|
|
|
|
document.writeln ("<BODY>");
|
|
document.writeln ("</BODY>");
|
|
document.writeln ("</HTML>");
|
|
|
|
document.close();
|
|
|
|
window.name = "do reload";
|
|
|
|
// background
|
|
if (background != null) {
|
|
// use z-index = -2
|
|
switch (background.DisplayObjectType) {
|
|
default:
|
|
alert ("skipping due to background.DisplayObjectType == " + background.DisplayObjectType);
|
|
break; // skip
|
|
case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
|
|
str = "";
|
|
str += "<SPAN STYLE=\"position:absolute; top:0; left:0; z-index:-1; font-family:";
|
|
str += background.FontFamilyName;
|
|
str += "; font-size:45pt; \">";
|
|
str += background.SymbolString;
|
|
str += "</SPAN>";
|
|
document.body.insertAdjacentHTML ("BeforeEnd", str);
|
|
break;
|
|
case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
|
|
case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
|
|
case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
|
|
document.body.insertAdjacentHTML ("BeforeEnd",
|
|
"<IMG SRC=\"" +
|
|
background.MouseOverBitmap +
|
|
"\" STYLE=\"position:absolute; top:0; left:0; z-index:-2\">");
|
|
break;
|
|
}
|
|
}
|
|
|
|
// for all tasks
|
|
for (i=0; i<numTasks; i++) {
|
|
task = taskArray[i];
|
|
|
|
var text = task.Text;
|
|
var help = task.Help;
|
|
var type = task.ActionType;
|
|
var clsid = task.Clsid;
|
|
|
|
str = "";
|
|
|
|
display = task.DisplayObject;
|
|
switch (display.DisplayObjectType) {
|
|
default:
|
|
alert ("bad DisplayObjectType! skipping...");
|
|
break;
|
|
case 1: // MMC_TASK_DISPLAY_TYPE_SYMBOL
|
|
|
|
str += "<P ALIGN=center ";
|
|
|
|
str += "STYLE= \"";
|
|
str += "font-family:" + display.FontFamilyName + ";";
|
|
str += "font-size:45pt";
|
|
str += "\" ";
|
|
|
|
str += AddClickStuff (str, task);
|
|
|
|
str += ">";
|
|
|
|
str += display.SymbolString;
|
|
|
|
str += "</P>";
|
|
|
|
// alert (str);
|
|
break;
|
|
case 2: // MMC_TASK_DISPLAY_TYPE_VANILLA_GIF, // (GIF) index 0 is transparent
|
|
case 3: // MMC_TASK_DISPLAY_TYPE_CHOCOLATE_GIF, // (GIF) index 1 is transparent
|
|
case 4: // MMC_TASK_DISPLAY_TYPE_BITMAP // non-transparent raster
|
|
|
|
// 3 possibilities for action: "ID:", "LINK:" and "SCRIPT:"
|
|
// default is "ID:", I guess
|
|
switch (type) {
|
|
case 0: //task.MMC_TASK_ACTION_ID:
|
|
str += "<P ALIGN=center>";
|
|
str += "<IMG SRC=" + display.MouseOffBitmap;
|
|
str += " style=\"filter: gray(enabled=true) invert(enabled=0)\"";
|
|
str += " onmouseover=\"filters.invert.enabled = true;\"";
|
|
str += " onmouseout =\"filters.invert.enabled = false;\"";
|
|
// str += " onclick=\"myClick('" + clsid + "', " + task.CommandID +", '" + "0" + "')\">";
|
|
str += " onclick=\"MMCCtrl.TaskNotify ('" + clsid + "', " + task.CommandID +", '" + "0" + "')\">";
|
|
|
|
str += text + "</P>";
|
|
break;
|
|
|
|
case 1: //task.MMC_TASK_ACTION_LINK:
|
|
str = "<P ALIGN=center>";
|
|
str += "<A HREF=" + task.ActionURL + ">";
|
|
str += "<IMG SRC=" + display.MouseOffBitmap + ">";
|
|
str += text + "</A>";
|
|
break;
|
|
|
|
case 2: //task.MMC_TASK_ACTION_SCRIPT:
|
|
str += "<P ALIGN=center>";
|
|
str += "<IMG SRC=" + display.MouseOffBitmap;
|
|
str += " LANGUAGE=" + task.ScriptLanguage;
|
|
str += " onclick=\"" + task.Script;
|
|
str += "\">";
|
|
str += text + "</P>";
|
|
break;
|
|
|
|
default:
|
|
alert ("unrecognized task");
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
if (str != "")
|
|
document.body.insertAdjacentHTML ("BeforeEnd", str);
|
|
}
|
|
alert ("document.body.innerHTML:\n" + document.body.innerHTML);
|
|
}
|
|
window.onload = myLoad;
|
|
</SCRIPT>
|
|
|
|
<HEAD>
|
|
<TITLE>Default TaskPad</TITLE>
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" TOPMARGIN=0 LEFTMARGIN=0>
|
|
|
|
</BODY>
|
|
|
|
</HTML>
|