



6. 這樣大致上,就算是完成註冊機碼的部份。我們透過製作 .reg 檔案方便讓使用者來進行安裝,以下是本範例 RegMake0rz.reg 檔案:
复制代码 代码如下:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMenuExt&Make 0rz]
@="file://C:\Program Files\Make0rz.js"
"Contexts"=dword:00000023
7. 以下是 Make0rz.js 的內容:
复制代码 代码如下:
<script language="JavaScript" >
var obj = external.menuArguments.event.srcElement;
var str = obj.tagName;
if (str.toUpperCase() == "A" || str.toUpperCase() == "IMG") {
if (str.toUpperCase() == "A") {
if (external.menuArguments.event.shiftKey) {
str = obj.firstChild.nodeValue;
}
else {
str = external.menuArguments.event.srcElement.href;
}
}
else {
str = external.menuArguments.event.srcElement.href;
}
}
else {
if (str.toUpperCase() != "BODY") {
str = obj.innerText;
if (trim(str) == "") {
str = external.menuArguments.location.href;
}
}
else {
str = external.menuArguments.location.href;
}
}
//// Preview
//var url = "http://0rz.tw/createget?redirect=1&url=" + encodeURIComponent(str);
//var width = 600;
//var height = 600;
// NO Preview
var url = "http://0rz.tw/createget?redirect=0&url=" + encodeURIComponent(str);
var width = 160;
var height = 90;
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
var cmd = "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left;
cmd += ", directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no";
newwin = window.open(url, "windowname5", cmd);
if (window.focus) {
newwin.focus()
}
function trim(strValue) {
var regL = /^[?@s]+/;
var regR = /[?@s]+$/;
strValue = strValue.replace(regL, "");
strValue = strValue.replace(regR, "");
return strValue;
}
</script>




