<script language = "VBScript">
'Download selected link
sub AddLink(Url, Remark)
On Error Resume Next
set NTIECatcher = CreateObject("NTIEHelper.NTIEAddUrl")
if err = 0 then
call NTIECatcher.AddLink(external.menuArguments.document.Url, Url, Remark)
end if
end sub
sub OnContextMenu()
set srcEvent = external.menuArguments.event
set EventElement = external.menuArguments.document.elementFromPoint(srcEvent.clientX, srcEvent.clientY)
if srcEvent.type = "MenuExtAnchor" then
set srcAnchor = EventElement
do until TypeName(srcAnchor) = "HTMLAnchorElement"
set srcAnchor = srcAnchor.parentElement
Loop
call AddLink(srcAnchor.href, srcAnchor.innerText)
elseif srcEvent.type = "MenuExtImage" then
if TypeName(EventElement) = "HTMLAreaElement" then
call AddLink(EventElement.href, EventElement.Alt)
else
set srcAnchor = EventElement.parentElement
do until TypeName(srcAnchor) = "HTMLAnchorElement"
set srcAnchor = srcAnchor.parentElement
if TypeName(srcAnchor) = "Nothing" then
call AddLink(EventElement.href, EventElement.Alt)
exit sub
end if
Loop
call AddLink(srcAnchor.href, EventElement.Alt)
end if
elseif srcEvent.type = "MenuExtUnknown" then
set srcAnchor = EventElement
do until TypeName(srcAnchor) = "HTMLAnchorElement"
set srcAnchor = srcAnchor.parentElement
if TypeName(srcAnchor) = "Nothing" then
call AddLink(EventElement.href, EventElement.innerText)
exit sub
end if
Loop
call AddLink(srcAnchor.href, srcAnchor.innerText)
end if
end sub
call OnContextMenu()
</script>
[此贴子已经被作者于2005-6-29 9:23:44编辑过] |