windows-nt/Source/XPSP1/NT/shell/ext/taskui/nusrmgr/html/body.htc
2020-09-26 16:20:57 +08:00

78 lines
1.9 KiB
Plaintext

<PUBLIC:COMPONENT lightweight>
<PUBLIC:ATTACH event="ondocumentready" onevent="onDocumentReady();" />
<PUBLIC:ATTACH event="onkeydown" onevent="HandleShortcuts();" />
<PUBLIC:ATTACH event="onselectstart" onevent="OnSelectStart();" />
<PUBLIC:ATTACH event="ondragstart" onevent="OnDragStart();" />
</PUBLIC:COMPONENT>
<SCRIPT language="JavaScript">
function onDocumentReady()
{
window.onerror = ErrorHandler;
try
{
window.document.createStyleSheet(window.external.cssPath);
}
catch (e)
{
// Fall back on duplicate rules in nusrmgr.css
alert('Error loading style sheet (' + (e.number & 0xffff) + ')');
}
}
function HandleShortcuts()
{
var code = event.keyCode;
if (event.altKey == true)
{
if (code == 36) // VK_HOME
{
window.external.goBack(-1);
event.returnValue = false;
}
else if (code == 37) // VK_LEFT
{
window.external.goBack();
event.returnValue = false;
}
else if (code == 39) // VK_RIGHT
{
window.external.goForward();
event.returnValue = false;
}
}
// Eat 'refresh' commands
if (code == 116) // VK_F5
{
event.returnValue = false;
}
}
// Since this is a web page the user can select elements on the
// page. Since this is an app, selecting element is undesireable.
// Therefore we catch the start of a selection event and cancel it.
function OnSelectStart()
{
// We still want to be able to select text in entry fields though.
event.returnValue = event.srcElement.isTextEdit;
}
// Don't want any drag-drop stuff going on
function OnDragStart()
{
event.returnValue = false;
}
// Show errors, but hide the scary filenames and line numbers
function ErrorHandler(szMsg)
{
alert(szMsg);
event.returnValue = true;
}
</SCRIPT>