📄 mcprintx.htm
字号:
var nBelow = 0;
var iAbove = iMaxNumericZoom + 1;
var i;
for (i = 0; i <= iMaxNumericZoom; i++)
{
var nThisIndex = parseInt(selectZoom.options[i].value);
if (nThisIndex >= g_nZoomFactor)
{
iBelow = i;
nBelow = nThisIndex;
}
else
{
break;
}
}
if (nBelow > g_nZoomFactor)
{
iAbove = iBelow + 1;
}
else
{
iAbove = iBelow;
}
return fnBounder(iBelow, iAbove);
}
function HandleZoom(nZoomIndexDelta)
{
var iCurrZoom = selectZoom.selectedIndex;
var iMaxNumericZoom = selectZoom.options.length-1-3;
if (iCurrZoom > iMaxNumericZoom)
{
var fnRemapBounder = null;
if (nZoomIndexDelta == 1)
{
fnRemapBounder = Math.min;
}
else
{
fnRemapBounder = Math.max;
}
iCurrZoom = NumericFromSpecialZoom(fnRemapBounder);
}
selectZoom.selectedIndex = Math.min(Math.max(0, iCurrZoom + nZoomIndexDelta), iMaxNumericZoom);
ChangeZoom(parseInt(selectZoom.options[selectZoom.selectedIndex].value));
}
function HandleDynamicZoom()
{
var nZoomType = parseInt(selectZoom.options[selectZoom.selectedIndex].value);
if (nZoomType < 0)
{
var nZoomFactor = 100;
var xPageWidth = getPageWidth();
switch (nZoomType)
{
case -1:
nZoomFactor = Math.floor(((OverflowContainer.offsetWidth - 20) * 100) / xPageWidth);
break;
case -2:
var xZoom = Math.floor(((OverflowContainer.offsetWidth - 20) * 100) / xPageWidth);
var yZoom = Math.floor(((OverflowContainer.offsetHeight - 20) * 100) / getPageHeight());
nZoomFactor = Math.min(xZoom, yZoom);
break;
case -3:
nZoomFactor = Math.floor(((OverflowContainer.offsetWidth - 30) * 100) / (2 * xPageWidth));
break;
default:
nZoomFactor = 100;
break;
}
ChangeZoom(nZoomFactor);
}
}
function HandleZoomSelect()
{
var nZoomFactor = parseInt(selectZoom.options[selectZoom.selectedIndex].value);
if (nZoomFactor < 0)
{
HandleDynamicZoom();
}
else
{
ChangeZoom(nZoomFactor);
}
}
function HandleFramesetSelect()
{
ChangeFramesetLayout(parseInt(selectFrameset.options[selectFrameset.selectedIndex].value), false);
}
function HandleZoomInButton()
{
HandleZoom(-1);
MasterContainer.focus();
}
function HandleZoomOutButton()
{
HandleZoom(1);
MasterContainer.focus();
}
function HandleInputKeyPress()
{
var keyStroke = event.keyCode;
if (keyStroke == 13)
{
event.srcElement.onchange();
}
else if (keyStroke < 48 || keyStroke > 57)
{
event.returnValue = false;
}
}
function Close()
{
Printer.updatePageStatus(-1);
if (g_fDelayClose)
{
g_fDelayClose = false;
window.setTimeout("Close()", 120000);
return;
}
window.close();
}
function PrintAll()
{
var i;
var nFirstDoc;
if ( g_nFramesLeft > 0
&& Printer.framesetDocument
&& !Printer.frameAsShown )
{
window.setTimeout("PrintAll()", 100);
return;
}
EnsureDocuments();
if (Printer.copies <= 0)
{
Close();
}
else if ( Printer.selectedPages
&& Printer.pageFrom > Printer.pageTo )
{
var L_PAGERANGE_ErrorMessage = "The 'From' value cannot be greater than the 'To' value.";
alert(L_PAGERANGE_ErrorMessage);
;
if (!g_fPreview)
PrintNow(true);
}
else
{
g_cLeftToPrint = 1;
Printer.updatePageStatus(1);
PrintSentinel(((Printer.selection)
? "S"
: (Printer.frameActive && !!g_strActiveFrame)
? g_strActiveFrame
: "C"),
true);
}
}
function PrintSentinel( strDoc, fRecursionOK )
{
if ( !g_aDocTree[strDoc]
|| !g_aDocTree[strDoc].ReadyToPrint() )
{
window.setTimeout("PrintSentinel('" + strDoc + "'," + fRecursionOK + ");", 500);
return;
}
g_aDocTree[strDoc].Print(fRecursionOK);
}
function PrintDocumentComplete()
{
g_cLeftToPrint--;
if (g_cLeftToPrint <= 0)
{
Close();
}
}
function PrintNow( fWithPrompt)
{
if ( !g_aDocTree["C"]
|| !g_aDocTree["C"]._aaRect[1][0]
|| !g_aDocTree["C"]._aaRect[1][0].contentDocument.body)
{
window.setTimeout("PrintNow('" + fWithPrompt + "');", 100);
return;
}
var oDoc = g_aDocTree["C"]._aaRect[1][0].contentDocument;
var fConfirmed;
var fFramesetDocument = (oDoc.body.tagName.toUpperCase() == "FRAMESET");
var fActiveFrame = (oDoc.all.tags("HTML").item(0).__IE_ActiveFrame != null);
Printer.framesetDocument = fFramesetDocument;
Printer.frameActiveEnabled = fActiveFrame;
if (g_fPreview)
{
Printer.frameActive = (g_nFramesetLayout == 1);
Printer.frameAsShown = (g_nFramesetLayout == 0);
Printer.currentPageAvail = true;
}
else
{
Printer.frameActive = fActiveFrame;
Printer.frameAsShown = false;
Printer.currentPageAvail = false;
}
Printer.selectionEnabled = !!(dialogArguments.__IE_ContentSelectionUrl);
Printer.selection = false;
fConfirmed = (eval(fWithPrompt)) ? Printer.showPrintDialog() : Printer.ensurePrintDialogDefaults();
if ( fConfirmed )
{
if ( Printer.selection
&& dialogArguments.__IE_ContentSelectionUrl )
{
CreateDocument(dialogArguments.__IE_ContentSelectionUrl, "S", true);
}
Printer.usePrinterCopyCollate = ( Printer.deviceSupports("copies") >= Printer.copies
&& ( !Printer.collate
|| Printer.deviceSupports("collate") ));
PrintAll();
}
else
{
if ( !g_fPreview )
{
Close();
}
else
{
Printer.tableoflinks = false;
}
}
}
function HandlePrintClick()
{
PrintNow(true, true);
}
function CPrintDoc_ReadyToPrint()
{
if ( this._nStatus == 4
&& this._aaRect[1][0].contentDocument.readyState == "complete")
{
return true;
}
return false;
}
function CPrintDoc_Print( fRecursionOK )
{
if (!this.ReadyToPrint())
{
HandleError("Printing when not ready!", document.URL, "CPrintDoc::Print");
return;
}
var nCount = (Printer.usePrinterCopyCollate) ? 1 : Printer.copies;
var nFrom;
var nTo;
;
if (fRecursionOK)
{
var fFrameset = (this._aaRect[1][0].contentDocument.body.tagName.toUpperCase() == "FRAMESET");
if (Printer.frameActive)
{
var n = parseInt(this._aaRect[1][0].contentDocument.all.tags("HTML").item(0).__IE_ActiveFrame);
if (n >= 0)
{
var oTargetFrame = (fFrameset)
? this._aaRect[1][0].contentDocument.all.tags("FRAME").item(n)
: this._aaRect[1][0].contentDocument.all.tags("IFRAME").item(n);
if ( IsPersistedDoc()
&& ( !oTargetFrame.src /* captain: oTargetFrame.src check */
|| oTargetFrame.src == "res://SHDOCLC.DLL/printnof.htm"
|| oTargetFrame.src == "about:blank" ))
{
Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, true);
}
else
{
this.CreateSubDocument(oTargetFrame.src, true);
this.PrintAllSubDocuments(true);
}
PrintDocumentComplete();
return;
}
}
if (fFrameset)
{
if (!Printer.frameAsShown)
{
this.PrintAllSubDocuments(true);
if (IsPersistedDoc())
{
Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, false);
}
PrintDocumentComplete();
return;
}
else
{
Printer.printNonNativeFrames(this._aaRect[1][0].contentDocument, false);
}
}
else
{
if (Printer.allLinkedDocuments)
{
this.BuildAllLinkedDocuments();
this.PrintAllSubDocuments(false);
}
}
}
if (Printer.printNonNative(this._aaRect[1][0].contentDocument) )
{
g_fDelayClose = !g_fPreview;
PrintDocumentComplete();
return;
}
if (Printer.selectedPages)
{
nFrom = Printer.pageFrom;
nTo = Printer.pageTo;
if (nFrom < 1)
nFrom = 1;
if (nTo > this.Pages())
nTo = this.Pages();
}
else if ( Printer.currentPage
&& this._strDoc == DisplayDocument())
{
nFrom = (this.Pages() >= g_nDispPage) ? g_nDispPage : this.Pages();
nTo = nFrom;
}
else
{
nFrom = 1;
nTo = this.Pages();
}
if (nTo < nFrom)
{
PrintDocumentComplete();
return;
}
;
;
;
var docToPrint = this._aaRect[1][0].contentDocument; // captain: use document.title
if (Printer.startDoc(docToPrint.title? docToPrint.title: docToPrint.URL))
{
if (Printer.collate)
{
var fExtraPage = ( Printer.duplex
&& ((nFrom - nTo) % 2 == 0) );
for (j = 0; j < nCount; j++)
{
for (i = nFrom; i <= nTo; i++)
{
Printer.printPage(this.Page(i).children[0]);
}
if (fExtraPage)
Printer.printBlankPage();
}
}
else
{
var fDuplex = Printer.duplex;
for (i = nFrom; i <= nTo; i++)
{
for (j = 0; j < nCount; j++)
{
Printer.printPage(this.Page(i).children[0]);
if (fDuplex)
{
if (i < nTo)
Printer.printPage(this.Page(i+1));
else
Printer.printBlankPage();
}
}
if (fDuplex)
i++;
}
}
Printer.stopDoc();
}
PrintDocumentComplete();
}
function CPrintDoc_RectComplete(fOverflow, strElement)
{
var nStatus = parseInt(strElement.substr(5,1));
var nPage = parseInt(strElement.substr(strElement.lastIndexOf("p") + 1));
;
;
if (nStatus > this._nStatus)
return false;
if (nPage != this._acPage[nStatus] - 1 + this._anMerge[nStatus])
return false;
if (nStatus != this._nStatus)
{
if (!fOverflow)
return false;
this.StopFixupHF();
if (this._nStatus == 4)
g_nDocsToCalc++;
this._nStatus = nStatus;
}
if (fOverflow)
{
this.AddPage();
}
else
{
switch (this._nStatus)
{
case 0:
this._nStatus = 1;
this.AddFirstPage();
this._aaRect[this._nStatus][0].contentSrc = this._strDocURL;
break;
case 1:
this._nStatus = 2;
this.AddTableOfLinks();
break;
case 2:
this._nStatus = 3;
if (this._strDoc == DisplayDocument())
ChangeDispPage(g_nDispPage);
this.FixupHF();
break;
}
}
if (this._strDoc == DisplayDocument())
{
spanPageTotal.innerText = this.Pages();
updateNavButtons();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -