?? xwindow.js
字號:
$cls.onclick = function()
{
core.free();
};
core.head.appendChild(core.icon);
core.head.appendChild(core.title);
core.head.appendChild(core.min);
core.head.appendChild(core.max);
core.head.appendChild(core.cls);
core.window.appendChild(core.head);
core.window.appendChild(core.body);
document.body.appendChild(core.window);
core.resizeTo(core.width, core.height);
core.vector = core.createVector();
};
xWindow.prototype.free = function()
{
jspp.count["win"]--;
var core = this;
if (jspp.ieVersion < 7)
{
for (var i = 0; i < core.select.length; i++)
{
core.select[i].srcElement.style.display = core.select[i].display;
}
}
core.window.parentNode.removeChild(core.window);
if (core.lock)
{
core.lock.parentNode.removeChild(core.lock);
}
eval("jspp.window." + core.name + " = null;");
};
xWindow.prototype.write = function(s)
{
var core = this;
core.body.innerHTML += s;
};
xWindow.prototype.draw = function(v, x, y)
{
var core = this;
if (typeof(v) == "object")
{
var obj = v;
}
else
{
var obj = document.createElement("DIV");
obj.innerHTML = v;
obj.style.fontSize = "12px";
obj.style.fontFamily = "Arial";
}
obj.style.visibility = "inherit";
obj.style.position = "absolute";
obj.style.left = x + "px";
obj.style.top = y + "px";
core.body.appendChild(obj);
};
xWindow.prototype.clear = function()
{
var core = this;
while (core.body.childNodes.length)
{
core.body.removeChild(core.body.childNodes[0]);
}
};
xWindow.prototype.above = function()
{
var core = this;
var i = parseInt(core.window.style.zIndex);
if (i != jspp.index - 1)
{
core.window.style.zIndex = jspp.index++;
}
};
xWindow.prototype.moveTo = function(x, y)
{
var core = this;
core.left = x;
core.top = y;
core.window.style.left = core.left + "px";
core.window.style.top = core.top + "px";
};
xWindow.prototype.resizeTo = function(w, h)
{
var core = this;
var i = 4;
core.width = w;
core.height = h;
core.window.style.width = core.width + "px";
core.window.style.height = core.height + "px";
if (core.clsButton)
{
i += 20;
core.cls.style.left = core.width - i + "px";
}
if (core.maxButton)
{
i += 20;
core.max.style.left = core.width - i + "px";
}
if (core.minButton)
{
i += 20;
core.min.style.left = core.width - i + "px";
}
core.body.style.height = core.height - 26 + "px";
};
xWindow.prototype.setCaption = function(s)
{
var core = this;
core.title.innerHTML = s;
};
xWindow.prototype.createVector = function()
{
var obj = document.getElementById("vector");
if (obj == null)
{
obj = document.createElement("DIV");
obj.id = "vector";
obj.style.position = "absolute";
obj.style.left = "0px";
obj.style.top = (document.body.clientHeight + document.body.scrollTop - 24) + "px";
obj.style.width = document.body.clientWidth + "px";
obj.style.height = "24px";
obj.style.background = "#004080";
obj.style.zIndex = 9999;
obj.style.display = "none";
document.body.appendChild(obj);
var func = function()
{
if (obj.style.display != "none")
{
obj.style.top = (document.body.clientHeight + document.body.scrollTop - 24) + "px";
}
};
if (window.attachEvent)
{
window.attachEvent("onscroll", func);
}
else if (window.addEventListener)
{
window.addEventListener("scroll", func, false);
}
}
return obj;
};
xWindow.prototype.resetVector = function()
{
var core = this;
var arr = core.vector.getElementsByTagName("LABEL");
var k = 2;
for (var i = 0; i < arr.length; i++)
{
arr[i].style.left = k + "px";
k += arr[i].offsetWidth + 2;
}
};
xWindow.prototype.setTray = function()
{
jspp.count['tray']++;
var core = this;
core.window.style.display = "none";
var tray = core.tray = document.createElement("LABEL");
tray.style.visibility = "inherit";
tray.style.position = "absolute";
tray.style.left = core.getTrayWidth();
tray.style.top = "2px";
tray.style.fontSize = "12px";
tray.style.fontFamily = "楷體";
tray.style.cursor = "default";
tray.style.padding = "4px 4px 0px 4px";
tray.style.background = "#004080";
tray.style.color = "#FFFFFF";
tray.style.border = "1px outset #FFFFFF";
tray.innerHTML = core.title.innerText;
core.vector.appendChild(tray);
core.vector.style.top = (document.body.clientHeight + document.body.scrollTop - 24) + "px";
core.vector.style.display = "";
tray.onmouseover = function()
{
tray.style.border = "1px inset #FFFFFF";
tray.style.backgroundColor = "#F7F6F0";
tray.style.color = "#000000";
};
tray.onmouseout = function()
{
tray.style.border = "1px outset #FFFFFF";
tray.style.backgroundColor = "#004080";
tray.style.color = "#FFFFFF";
};
tray.onclick = function()
{
core.delTray();
};
};
xWindow.prototype.getTrayWidth = function()
{
var core = this;
var arr = core.vector.getElementsByTagName("LABEL");
var k = 2;
for (var i = 0; i < arr.length; i++)
{
k += arr[i].offsetWidth + 2;
}
return k;
};
xWindow.prototype.delTray = function()
{
var core = this;
if (core.tray)
{
core.window.style.display = "";
core.tray.parentNode.removeChild(core.tray);
core.tray = null;
jspp.count['tray']--;
if (jspp.count['tray'] == 0)
{
core.vector.style.display = "none";
}
else
{
core.resetVector();
}
}
};
xWindow.prototype.center = function()
{
var core = this;
var x = 0, y = 0;
if (document.body.clientWidth > core.window.offsetWidth)
{
x = (document.body.clientWidth - core.window.offsetWidth) / 2 + document.body.scrollLeft;
}
if (document.body.clientHeight > core.window.offsetHeight)
{
y = (document.body.clientHeight - core.window.offsetHeight) / 2 + document.body.scrollTop;
}
core.moveTo(x, y);
};
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -