mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 23:02:27 +01:00
fix #15 (browser.zoom.siteSpecific resets to false)
This commit is contained in:
@@ -48,9 +48,6 @@ function Buffer() //{{{
|
|||||||
|
|
||||||
var highlight = storage.newMap("highlight", false);
|
var highlight = storage.newMap("highlight", false);
|
||||||
|
|
||||||
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
|
|
||||||
120, 150, 200, 300, 500, 1000, 2000 ];
|
|
||||||
|
|
||||||
const util = modules.util;
|
const util = modules.util;
|
||||||
const arrayIter = util.Array.iterator;
|
const arrayIter = util.Array.iterator;
|
||||||
|
|
||||||
@@ -282,64 +279,34 @@ function Buffer() //{{{
|
|||||||
let error = styles.addSheet("font-size", "chrome://liberator/content/buffer.xhtml",
|
let error = styles.addSheet("font-size", "chrome://liberator/content/buffer.xhtml",
|
||||||
"body { font-size: " + fontSize + "; }", true);
|
"body { font-size: " + fontSize + "; }", true);
|
||||||
|
|
||||||
|
const ZOOM_MIN = Math.round(ZoomManager.MIN * 100);
|
||||||
|
const ZOOM_MAX = Math.round(ZoomManager.MAX * 100);
|
||||||
|
|
||||||
function setZoom(value, fullZoom)
|
function setZoom(value, fullZoom)
|
||||||
{
|
{
|
||||||
if (value < 1 || value > 2000)
|
if (value < ZOOM_MIN || value > ZOOM_MAX)
|
||||||
{
|
{
|
||||||
liberator.echoerr("Zoom value out of range (1-2000%)");
|
liberator.echoerr("Zoom value out of range (" + ZOOM_MIN + " - " + ZOOM_MAX + "%)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullZoom)
|
ZoomManager.useFullZoom = fullZoom;
|
||||||
getBrowser().markupDocumentViewer.fullZoom = value / 100.0;
|
ZoomManager.zoom = value / 100;
|
||||||
else
|
FullZoom._applySettingToPref();
|
||||||
getBrowser().markupDocumentViewer.textZoom = value / 100.0;
|
liberator.echo((fullZoom ? "Full" : "Text") + " zoom: " + value + "%");
|
||||||
|
|
||||||
liberator.echo((fullZoom ? "Full zoom: " : "Text zoom: ") + value + "%");
|
|
||||||
|
|
||||||
// TODO: shouldn't this just recalculate hint coords, rather than
|
|
||||||
// unsuccessfully attempt to reshow hints? i.e. isn't it just relying
|
|
||||||
// on the recalculation side effect? -- djk
|
|
||||||
// NOTE: we could really do with a zoom event...
|
|
||||||
// hints.reshowHints();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bumpZoomLevel(steps, fullZoom)
|
function bumpZoomLevel(steps, fullZoom)
|
||||||
{
|
{
|
||||||
if (fullZoom)
|
let values = ZoomManager.zoomValues;
|
||||||
var value = getBrowser().markupDocumentViewer.fullZoom * 100.0;
|
let i = values.indexOf(ZoomManager.snap(ZoomManager.zoom)) + steps;
|
||||||
else
|
|
||||||
var value = getBrowser().markupDocumentViewer.textZoom * 100.0;
|
|
||||||
|
|
||||||
var index = -1;
|
if (i >= 0 && i < values.length)
|
||||||
if (steps <= 0)
|
setZoom(Math.round(values[i] * 100), fullZoom);
|
||||||
{
|
// TODO: I'll leave the behaviour as is for now, but I think this
|
||||||
for (let i = zoomLevels.length - 1; i >= 0; i--)
|
// should probably just take you to the respective bounds -- djk
|
||||||
{
|
|
||||||
if ((zoomLevels[i] + 0.01) < value) // 0.01 for float comparison
|
|
||||||
{
|
|
||||||
index = i + 1 + steps;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
for (let i = 0; i < zoomLevels.length; i++)
|
|
||||||
{
|
|
||||||
if ((zoomLevels[i] - 0.01) > value) // 0.01 for float comparison
|
|
||||||
{
|
|
||||||
index = i - 1 + steps;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (index < 0 || index >= zoomLevels.length)
|
|
||||||
{
|
|
||||||
liberator.beep();
|
liberator.beep();
|
||||||
return;
|
|
||||||
}
|
|
||||||
setZoom(zoomLevels[index], fullZoom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkScrollYBounds(win, direction)
|
function checkScrollYBounds(win, direction)
|
||||||
@@ -396,9 +363,6 @@ function Buffer() //{{{
|
|||||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
// override this stupid pref, because otherwise zoom is lost after switching tabs
|
|
||||||
options.setPref("browser.zoom.siteSpecific", false);
|
|
||||||
|
|
||||||
options.add(["fullscreen", "fs"],
|
options.add(["fullscreen", "fs"],
|
||||||
"Show the current window fullscreen",
|
"Show the current window fullscreen",
|
||||||
"boolean", false,
|
"boolean", false,
|
||||||
@@ -953,7 +917,7 @@ function Buffer() //{{{
|
|||||||
{
|
{
|
||||||
args = args.string;
|
args = args.string;
|
||||||
|
|
||||||
var level;
|
let level;
|
||||||
|
|
||||||
if (!args)
|
if (!args)
|
||||||
{
|
{
|
||||||
@@ -971,10 +935,10 @@ function Buffer() //{{{
|
|||||||
level = buffer.textZoom + parseInt(args, 10);
|
level = buffer.textZoom + parseInt(args, 10);
|
||||||
|
|
||||||
// relative args shouldn't take us out of range
|
// relative args shouldn't take us out of range
|
||||||
if (level < 1)
|
if (level < ZOOM_MIN)
|
||||||
level = 1;
|
level = ZOOM_MIN;
|
||||||
if (level > 2000)
|
if (level > ZOOM_MAX)
|
||||||
level = 2000;
|
level = ZOOM_MAX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -215,7 +215,21 @@ browsing forums or documentation. Change 'previouspattern' to modify its
|
|||||||
behavior. It follows relations between files too.
|
behavior. It follows relations between files too.
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
section:Zooming[zooming]
|
section:Zooming[zooming,zoom]
|
||||||
|
|
||||||
|
The zooming commands are dependent on two properties - a zoom range and a
|
||||||
|
series of levels within that range.
|
||||||
|
|
||||||
|
The absolute value of the page zoom is limited to a value within the configured
|
||||||
|
zoom range (default: 30% - 300%). The zoom levels are used by
|
||||||
|
[m]zi[m]/[m]zo[m], and similar commands, to change the zoom value in steps. The
|
||||||
|
default zoom levels are 30%, 50%, 67%, 80%, 90%, 100%, 110%, 120%, 133%, 150%,
|
||||||
|
170%, 200%, 240%, 300%.
|
||||||
|
|
||||||
|
The available zoom range can be changed by setting the \'zoom.minPercent' and
|
||||||
|
\'zoom.maxPercent' Firefox preferences. The zoom levels can be changed using
|
||||||
|
the \'toolkit.ZoomManager.zoomLevels' preference. Note: The latter is specified
|
||||||
|
as a list of values between 0 and 1, not as a percentage.
|
||||||
|
|
||||||
|+| |zi| +
|
|+| |zi| +
|
||||||
||[count]zi||
|
||[count]zi||
|
||||||
@@ -248,8 +262,8 @@ ________________________________________________________________________________
|
|||||||
|zz| +
|
|zz| +
|
||||||
||[count]zz||
|
||[count]zz||
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
Set text zoom value of current web page. Zoom value can be between 1 and
|
Set text zoom value of current web page. Zoom value can be between 30 and 300%.
|
||||||
2000%. If it is omitted, text zoom is reset to 100%.
|
If it is omitted, text zoom is reset to 100%.
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
@@ -284,8 +298,8 @@ ________________________________________________________________________________
|
|||||||
|zZ| +
|
|zZ| +
|
||||||
||[count]zZ||
|
||[count]zZ||
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
Set full zoom value of current web page. Zoom value can be between 1 and
|
Set full zoom value of current web page. Zoom value can be between 30 and
|
||||||
2000%. If it is omitted, full zoom is reset to 100%.
|
300%. If it is omitted, full zoom is reset to 100%.
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
@@ -293,9 +307,9 @@ ________________________________________________________________________________
|
|||||||
||:zo[om][!] [value]|| +
|
||:zo[om][!] [value]|| +
|
||||||
||:zo[om][!] +{value} | -{value}|| +
|
||:zo[om][!] +{value} | -{value}|| +
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
Set zoom value of current web page. If [value] can be an absolute value
|
Set zoom value of current web page. [value] can be an absolute value between 30
|
||||||
between 1 and 2000% or a relative value if prefixed with "-" or "+". If
|
and 300% or a relative value if prefixed with "-" or "+". If [value] is
|
||||||
[value] is omitted, zoom is reset to 100%.
|
omitted, zoom is reset to 100%.
|
||||||
|
|
||||||
Normally this command operates on the text zoom, if used with [!] it operates
|
Normally this command operates on the text zoom, if used with [!] it operates
|
||||||
on full zoom.
|
on full zoom.
|
||||||
|
|||||||
Reference in New Issue
Block a user