📄 ehlpdhtm.js
字号:
}
}
return nIndex;
}
//the browser information itself
function _BSPSBrowserItself()
{
var agent = navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
this.ns2 = ((this.ns) && (this.major == 2));
this.ns3 = ((this.ns) && (this.major == 3));
this.ns4 = ((this.ns) && (this.major >= 4));
this.ns6 = ((this.ns) && (this.major >= 5));
this.ie = (agent.indexOf("msie") != -1);
this.ie3 = ((this.ie) && (this.major == 2));
this.ie4 = ((this.ie) && (this.major >= 4));
this.op3 = (agent.indexOf("opera") != -1);
if (this.ns4)
{
gBsDoc = "document";
gBsSty = "";
gBsHtm = ".document";
gBsStyVisShow = "show";
gBsStyVisHide = "hide";
}
else if (this.ie4)
{
gBsDoc = "document.all";
gBsSty = ".style";
gBsHtm = "";
gBsStyVisShow = "visible";
gBsStyVisHide = "hidden";
}
}
//Here is the browser type
function _BSPSGetBrowserInfo()
{
gBsBrowser = new _BSPSBrowserItself();
}
_BSPSGetBrowserInfo();
//Get client size info
function _BSPSGetClientSize()
{
if (gBsBrowser.ns4)
{
gBsClientWidth = innerWidth;
gBsClientHeight = innerHeight;
}
else if (gBsBrowser.ie4)
{
gBsClientWidth = document.body.clientWidth;
gBsClientHeight = document.body.clientHeight;
}
}
var gstrPopupID = 'BSSCPopup';
var gstrPopupShadowID = 'BSSCPopupShadow';
var gstrPopupTopicID = 'BSSCPopupTopic';
var gstrPopupIFrameID = 'BSSCPopupIFrame';
var gstrPopupIFrameName = 'BSSCPopupIFrameName';
var gstrPopupSecondWindowName = 'BSSCPopup';
var gPopupWindow = null;
var gnPopupClickX = 0;
var gnPopupClickY = 0;
var gnPopupScreenClickX = 0;
var gnPopupScreenClickY = 0;
var gbPopupTimeoutExpired = false;
function DHTMLPopupSupport()
{
if ((gbBsIE4) && (!gbBsMac)) {
return true;
}
return false;
}
function BSSCPopup_IsPopup()
{
if (DHTMLPopupSupport() && (this.name.indexOf(gstrPopupIFrameName) != -1)) {
return true;
} else if ((gbBsNS4 || gbBsIE4) && (this.name.indexOf(gstrPopupID) != -1)) {
return true;
} else {
return false;
}
}
// If there is a hyperlink in a popup window, display the hyperlink in
// the original window. (bsscright)
if (BSSCPopup_IsPopup() && !gbBsIE4) {
document.write("<base target=\"bsscright\">");
}
// Local functions.
function BsPopup_CreateDiv(nIndex)
{
if(!DHTMLPopupSupport())
return;
// DO NOT SET Width and height for the div, otherwize it will make IE4 popup do not work when view the topic alone.
var strPopupDiv = "<DIV ID='" + getPopupID(nIndex) + "' STYLE='position:absolute; top:-100; left:0; z-index:600; visibility:hidden;'>";
strPopupDiv += "<DIV ID='" + getPopupShadowID(nIndex) + "' STYLE=\"position:absolute;top:0; left:0; background-color:#C0C0C0;\"></DIV>";
strPopupDiv += "<DIV ID='" + getPopupTopicID(nIndex) + "' STYLE=\"position:absolute;top:0; left:0; background-color:#FFFFFF;border:1px #000000 outset;\">";
strPopupDiv += "<IFRAME title=\"Popup Window\" ID='" + getPopupIFrameID(nIndex) + "' name='" + getPopupIFrameName(nIndex) + "' src = '" + getPopupURL(nIndex) + "' frameborder=0 scrolling=auto></IFRAME>";
strPopupDiv += "</DIV></DIV>";
var objBody = document.all.tags("BODY")[0];
if( typeof(objBody) != "object" )
return;
objBody.insertAdjacentHTML("beforeEnd", strPopupDiv);
}
function BSSCPopup_Timeout(nIndex, nToken)
{
if (!IsValidToken(nToken)) return;
if ((getPopupIFrame(nIndex).document.readyState == "complete") &&
(getPopupIFrame(nIndex).document.body != null)) {
window.getPopupDivStyle(nIndex).visibility = gBsStyVisShow;
setClear(nIndex);
window.gbPopupTimeoutExpired = true;
BSSCPopup_ChangeTargettoParent(getPopupIFrame(nIndex).document);
getPopupIFrame(nIndex).document.body.onclick = BSSCPopupClicked;
if (!gbOrignalOnMouseDown && document.onmousedown)
gbOrignalOnMouseDown = document.onmousedown;
document.onmousedown = BSSCPopupParentClicked;
} else {
setTimeout("BSSCPopup_Timeout(" + nIndex + "," + nToken + ")", 100);
}
}
// VH 08/10/00
// do not change target to parent if the href is using javascript
function BSSCPopup_ChangeTargettoParent(tagsObject)
{
var collA = tagsObject.all.tags("A");
BSSCPopup_ChangeTargettoParent2(collA);
var collIMG = tagsObject.all.tags("IMG");
BSSCPopup_ChangeTargettoParent2(collIMG);
}
function BSSCPopup_ChangeTargettoParent2(colls)
{
var j = 0;
if (colls != null) {
for (j = 0; j < colls.length; j ++ )
{
var strtemp = colls[j].href;
strtemp = strtemp.toLowerCase();
if (strtemp.indexOf("javascript:") == -1)
if (colls[j].target == "")
colls[j].target = "_parent";
}
}
}
function BSPSPopupTopicWinHelp(strURL)
{
_BSSCPopup(strURL);
return;
}
function _BSSCPopup(strURL, width, height)
{
var cuswidth = 0;
var cusheight = 0;
if ("undefined" != typeof(width) && "undefined" != typeof(height)) {
cuswidth = width;
cusheight= height;
}
if (DHTMLPopupSupport()) {
// If we are already in a popup, replace the contents
// if (BSSCPopup_IsPopup()) {
// parent._BSSCPopup(strURL, cuswidth, cusheight);
// } else {
var nToken = takeToken(); // take token first.
var nIndex = _BSSCCreatePopupDiv(strURL);
window.gbPopupTimeoutExpired = false;
var ntWidth = gBsClientWidth;
var ntHeight = gBsClientHeight;
_BSPSGetClientSize();
if (ntWidth != gBsClientWidth || ntHeight != gBsClientHeight) {
setDirty();
}
if (IsDirty(nIndex)) {
if (gbBsMac) {
setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight +")", 400);
} else {
setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 100);
}
}
else {
MoveDivAndShow(nIndex ,nToken, cuswidth, cusheight);
}
// }
} else {
_BSSCPopup2(strURL, cuswidth, cusheight);
}
return;
}
if (gbBsIE55)
{
var ehlpdhtm_fOldBefureUnload = window.onbeforeunload;
window.onbeforeunload = window_BUnload;
}
function window_BUnload()
{
for (var i = 0; i < arrayPopupURL.length; i ++)
document.all(getPopupID(i)).outerHTML = "";
arrayPopupURL.length = 0;
if (ehlpdhtm_fOldBefureUnload)
ehlpdhtm_fOldBefureUnload();
}
function _BSSCPopup2(strURL, width, height)
{
if (window.name == gstrPopupSecondWindowName) {
window.location = strURL;
} else {
if (!gbBsMac || !gBsBrowser.ns4) {
BSSCHidePopupWindow();
}
var nX = 0;
var nY = 0;
var nHeight = 300;
var nWidth = 400;
if (width > 0 && height > 0) {
nHeight = height;
nWidth = width;
}
_BSPSGetClientSize();
nX = window.gnPopupScreenClickX;
nY = window.gnPopupScreenClickY;
if (nY + nHeight + 40 > screen.availHeight) {
nY = screen.availHeight - nHeight - 40;
}
if (nX + nWidth + 40 > screen.availWidth) {
nX = screen.availWidth - nWidth - 40;
}
// Launch a separate window
var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes";
if (gBsBrowser.ns) {
if (gBsBrowser.ns6) {
strParam += ",Height=" + nHeight + ",Width=" + nWidth;
strParam += ",screenX=" + nX + ",screenY=" + nY;
strParam += ",dependent=yes";
}
else {
strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth;
strParam += ",screenX=" + nX + ",screenY=" + nY;
strParam += ",dependent=yes";
}
}
else {
strParam += ",height=" + nHeight + ",width=" + nWidth;
strParam += ",left=" + nX + ",top=" + nY;
}
window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam);
if (gBsBrowser.ns4)
setEventHandle();
else if (gBsBrowser.ie4)
setTimeout("setPopupFocus();", 100);
}
return;
}
function setEventHandle()
{
window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE);
window.gPopupWindow.onclick = NonIEPopup_HandleClick;
window.gPopupWindow.onblur = NonIEPopup_HandleBlur;
}
function setPopupFocus()
{
window.gPopupWindow.focus();
}
function NonIEPopup_HandleBlur(e)
{
window.gPopupWindow.focus();
}
function NonIEPopup_HandleClick(e)
{
// Because navigator will give the event to the handler before the hyperlink, let's
// first route the event to see if we are clicking on a Popup menu in a popup.
document.routeEvent(e);
// If a popup menu is active then don't do anything with the click
if (window.gPopupWindow.gbInPopupMenu) {
window.gPopupWindow.captureEvents(Event.CLICK);
window.gPopupWindow.onclick = NonIEPopup_HandleClick;
return false;
}
// Close the popup window
if (e.target.href) {
if (e.target.target == "")
window.location.href = e.target.href;
else
window.open(e.target.href, e.target.target);
if (e.target.href.indexOf("javascript:void(0)") == -1 && e.target.href.indexOf("javascript:null") == -1 && e.target.href.indexOf("BsscPopup") == -1) {
this.close();
}
} else {
this.close();
}
return false;
}
function BSSCPopup_AfterLoad(nIndex, nToken, cuswidth, cusheight)
{
if (typeof(window.getPopupIFrame(nIndex).document) == "unknown") {
_BSSCPopup2(getPopupURL(nIndex), cuswidth, cusheight);
return;
}
if (!IsValidToken(nToken)) return;
if ((window.getPopupIFrame(nIndex).document.readyState == "complete") &&
(window.getPopupIFrame(nIndex).document.body != null)) {
if (window.getPopupIFrame(nIndex).document.location.href.indexOf("about:blank") != -1) { // add this check. IE will use about:blank" as the default vaule for Iframe.
window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex);
setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
}
else
{
setAbsPopupURL(nIndex, window.getPopupIFrame(nIndex).document.location.href); // change URL to abs url.
BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight);
}
} else {
setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
}
}
function BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight)
{
if (window.gbPopupTimeoutExpired) return;
if (!IsValidToken(nToken)) return;
getPopupDivStyle(nIndex).visibility = gBsStyVisHide;
// Determine the width and height for the window
//var size = new BSSCSize(0, 0);
//BSSCGetContentSize(window.getPopupIFrame(nIndex), size);
//var nWidth = size.x;
//var nHeight = size.y;
_BSPSGetClientSize();
var size = new BSSCSize(0, 0);
if (cuswidth <= 0 || cusheight <= 0)
BSSCGetContentSize(window.getPopupIFrame(nIndex), size);
else {
size.x = cuswidth;
size.y = cusheight;
}
// Determine the width and height for the window
var nWidth = size.x;
var nHeight = size.y;
// for small popup size, we should allow any size.
// The popup size should be ok if bigger than 0
if (nWidth < 0 || nHeight < 0) return; // there must be something terribly wrong.
// if (nWidth < 40 || nHeight < 40) return; // there must be something terribly wrong.
window.getPopupDivStyle(nIndex).pixelWidth = nWidth;
window.getPopupDivStyle(nIndex).pixelHeight = nHeight;
window.getPopupShadowStyle(nIndex).pixelWidth = nWidth;
window.getPopupShadowStyle(nIndex).pixelHeight = nHeight;
window.getPopupTopicStyle(nIndex).pixelWidth = nWidth;
window.getPopupTopicStyle(nIndex).pixelHeight = nHeight;
if (gbBsIE55)
{
window.getPopupShadowStyle(nIndex).pixelWidth = nWidth + 2;
window.getPopupShadowStyle(nIndex).pixelHeight = nHeight + 2;
window.getPopupTopicStyle(nIndex).pixelWidth = nWidth + 2;
window.getPopupTopicStyle(nIndex).pixelHeight = nHeight + 2;
}
window.getPopupIFrameStyle(nIndex).pixelWidth = nWidth;
window.getPopupIFrameStyle(nIndex).pixelHeight = nHeight;
if (gbBsIE55)
{
window.getPopupIFrameStyle(nIndex).top = 0;
window.getPopupIFrameStyle(nIndex).left = 0;
}
var strURL = getPopupURL(nIndex);
if (strURL.indexOf("#") != -1)
getPopupIFrame(nIndex).location.href = strURL; // reload again, this will fix the bookmark misunderstand in IE5.
MoveDivAndShow(nIndex, nToken, cuswidth, cusheight);
}
function MoveDivAndShow(nIndex, nToken, cuswidth, cusheight)
{
if (window.getPopupIFrame(nIndex).document.location.href != getAbsPopupURL(nIndex)) { // if redirect, reload again.
window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex);
setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200);
return;
}
// Determine the position of the window
var nClickX = window.gnPopupClickX;
var nClickY = window.gnPopupClickY;
var nTop = 0;
var nLeft = 0;
var nWidth = window.getPopupDivStyle(nIndex).pixelWidth;
var nHeight = window.getPopupDivStyle(nIndex).pixelHeight;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -