зеркало из https://github.com/mozilla/pjs.git
Bug 99501: JS error in viewZoomOverlay.js at startup. r=sfraser, sr=hewitt
This commit is contained in:
Родитель
cd9bf30f7f
Коммит
b66ae518a2
|
@ -1165,8 +1165,8 @@ function hiddenWindowStartup()
|
|||
// Disable menus which are not appropriate
|
||||
var disabledItems = ['cmd_close', 'Browser:SendPage', 'Browser:EditPage', 'Browser:PrintSetup', /*'Browser:PrintPreview',*/
|
||||
'Browser:Print', 'canGoBack', 'canGoForward', 'Browser:Home', 'Browser:AddBookmark', 'cmd_undo',
|
||||
'cmd_redo', 'cmd_cut', 'cmd_copy','cmd_paste', 'cmd_delete', 'cmd_selectAll'];
|
||||
for (id in disabledItems) {
|
||||
'cmd_redo', 'cmd_cut', 'cmd_copy','cmd_paste', 'cmd_delete', 'cmd_selectAll', 'menu_textZoom'];
|
||||
for (var id in disabledItems) {
|
||||
var broadcaster = document.getElementById(disabledItems[id]);
|
||||
if (broadcaster)
|
||||
broadcaster.setAttribute("disabled", "true");
|
||||
|
|
|
@ -73,12 +73,17 @@ ZoomManager.prototype = {
|
|||
steps : 0,
|
||||
|
||||
get textZoom() {
|
||||
var currentZoom = Math.round(getMarkupDocumentViewer().textZoom * 100);
|
||||
if (this.indexOf(currentZoom) == -1) {
|
||||
if (currentZoom != this.factorOther) {
|
||||
this.factorOther = currentZoom;
|
||||
this.factorAnchor = this.factorOther;
|
||||
var currentZoom;
|
||||
try {
|
||||
currentZoom = Math.round(getMarkupDocumentViewer().textZoom * 100);
|
||||
if (this.indexOf(currentZoom) == -1) {
|
||||
if (currentZoom != this.factorOther) {
|
||||
this.factorOther = currentZoom;
|
||||
this.factorAnchor = this.factorOther;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
currentZoom = 100;
|
||||
}
|
||||
return currentZoom;
|
||||
},
|
||||
|
@ -214,41 +219,36 @@ ZoomManager.prototype = {
|
|||
}
|
||||
|
||||
/***** init and helper functions for viewZoomOverlay.xul *****/
|
||||
|
||||
window.addEventListener("load", registerZoomManager, false);
|
||||
|
||||
function registerZoomManager()
|
||||
{
|
||||
var textZoomMenu = document.getElementById("menu_textZoom");
|
||||
if (textZoomMenu) {
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
var zoom = ZoomManager.prototype.getInstance();
|
||||
|
||||
textZoomMenu.removeAttribute("hidden");
|
||||
var parentMenu = textZoomMenu.parentNode;
|
||||
parentMenu.addEventListener("popupshowing", updateViewMenu, false);
|
||||
|
||||
var parentMenu = textZoomMenu.parentNode;
|
||||
parentMenu.addEventListener("popupshowing", updateViewMenu, false);
|
||||
var insertBefore = document.getElementById("menu_textZoomInsertBefore");
|
||||
var popup = insertBefore.parentNode;
|
||||
var accessKeys = zoom.bundle.getString("accessKeys").split(",");
|
||||
var zoomFactors = zoom.getZoomFactors();
|
||||
for (var i = 0; i < zoomFactors.length; ++i) {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("type", "radio");
|
||||
menuItem.setAttribute("name", "textZoom");
|
||||
|
||||
var insertBefore = document.getElementById("menu_textZoomInsertBefore");
|
||||
var popup = insertBefore.parentNode;
|
||||
var accessKeys = zoom.bundle.getString("accessKeys").split(",");
|
||||
var zoomFactors = zoom.getZoomFactors();
|
||||
for (var i = 0; i < zoomFactors.length; ++i) {
|
||||
var menuItem = document.createElement("menuitem");
|
||||
menuItem.setAttribute("type", "radio");
|
||||
menuItem.setAttribute("name", "textZoom");
|
||||
var label;
|
||||
if (zoomFactors[i] == 100)
|
||||
label = zoom.bundle.getString("labelOriginal");
|
||||
else
|
||||
label = zoom.bundle.getString("label");
|
||||
|
||||
var label;
|
||||
if (zoomFactors[i] == 100)
|
||||
label = zoom.bundle.getString("labelOriginal");
|
||||
else
|
||||
label = zoom.bundle.getString("label");
|
||||
|
||||
menuItem.setAttribute("label", label.replace(/%zoom%/, zoomFactors[i]));
|
||||
menuItem.setAttribute("accesskey", accessKeys[i]);
|
||||
menuItem.setAttribute("oncommand", "ZoomManager.prototype.getInstance().textZoom = this.value;");
|
||||
menuItem.setAttribute("value", zoomFactors[i]);
|
||||
popup.insertBefore(menuItem, insertBefore);
|
||||
}
|
||||
menuItem.setAttribute("label", label.replace(/%zoom%/, zoomFactors[i]));
|
||||
menuItem.setAttribute("accesskey", accessKeys[i]);
|
||||
menuItem.setAttribute("oncommand", "ZoomManager.prototype.getInstance().textZoom = this.value;");
|
||||
menuItem.setAttribute("value", zoomFactors[i]);
|
||||
popup.insertBefore(menuItem, insertBefore);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
<command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/>
|
||||
</commandset>
|
||||
|
||||
<menu id="menu_textZoom" accesskey="&textZoomMenu.accesskey;" hidden="true">
|
||||
<menu id="menu_textZoom" accesskey="&textZoomMenu.accesskey;">
|
||||
<menupopup id="menu_textZoomPopup" onpopupshowing="updateTextZoomMenu();">
|
||||
<menuitem key="key_textZoomReduce" label="&textZoomReduceCmd.label;" accesskey="&textZoomReduceCmd.accesskey;" command="cmd_textZoomReduce"/>
|
||||
<menuitem key="key_textZoomEnlarge" label="&textZoomEnlargeCmd.label;" accesskey="&textZoomEnlargeCmd.accesskey;" command="cmd_textZoomEnlarge"/>
|
||||
|
|
|
@ -55,6 +55,8 @@ Contributor(s): ______________________________________. -->
|
|||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://navigator/content/navigator.js"/>
|
||||
|
||||
<stringbundleset id="stringbundleset"/>
|
||||
|
||||
<!-- keys are appended from the overlay -->
|
||||
<keyset id="tasksKeys"/>
|
||||
<keyset id="navKeys">
|
||||
|
|
Загрузка…
Ссылка в новой задаче