1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 14:18:00 +01:00

Merge branch 'master' into xulmus

Conflicts:
	License.txt
This commit is contained in:
Doug Kearns
2009-03-29 12:34:05 +11:00
41 changed files with 264 additions and 82 deletions

View File

@@ -11,7 +11,7 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@gmx.net>
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -125,6 +125,7 @@ function Buffer() //{{{
else
v = win.scrollMaxY / 100 * vertical;
marks.add("'", true);
win.scrollTo(h, v);
}
@@ -1303,6 +1304,17 @@ function Buffer() //{{{
scrollToPercentiles(-1, percentage);
},
scrollToRatio: function (x, y)
{
scrollToPercentiles(x * 100, y * 100);
},
scrollTo: function (x, y)
{
marks.add("'", true);
content.scrollTo(x, y);
},
/**
* Scrolls the current buffer laterally to its leftmost.
*/
@@ -1539,12 +1551,11 @@ function Marks() //{{{
function onPageLoad(event)
{
let win = event.originalTarget.defaultView;
for (let i = 0, length = pendingJumps.length; i < length; i++)
for (let [i, mark] in Iterator(pendingJumps))
{
let mark = pendingJumps[i];
if (win && win.location.href == mark.location)
{
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
buffer.scrollToRatio(mark.position.x, mark.position.y);
pendingJumps.splice(i, 1);
return;
}
@@ -1589,7 +1600,7 @@ function Marks() //{{{
}
}
function isLocalMark(mark) /^[a-z]$/.test(mark);
function isLocalMark(mark) /^['`a-z]$/.test(mark);
function isURLMark(mark) /^[A-Z0-9]$/.test(mark);
function localMarkIter()
@@ -1750,13 +1761,14 @@ function Marks() //{{{
* @param {string} mark
*/
// TODO: add support for frameset pages
add: function (mark)
add: function (mark, silent)
{
let win = window.content;
if (win.document.body.localName.toLowerCase() == "frameset")
{
liberator.echoerr("Marks support for frameset pages not implemented yet");
if (!silent)
liberator.echoerr("Marks support for frameset pages not implemented yet");
return;
}
@@ -1767,7 +1779,8 @@ function Marks() //{{{
if (isURLMark(mark))
{
urlMarks.set(mark, { location: win.location.href, position: position, tab: tabs.getTab() });
liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5);
if (!silent)
liberator.log("Adding URL mark: " + markToString(mark, urlMarks.get(mark)), 5);
}
else if (isLocalMark(mark))
{
@@ -1777,7 +1790,8 @@ function Marks() //{{{
localMarks.set(mark, []);
let vals = { location: win.location.href, position: position };
localMarks.get(mark).push(vals);
liberator.log("Adding local mark: " + markToString(mark, vals), 5);
if (!silent)
liberator.log("Adding local mark: " + markToString(mark, vals), 5);
}
},
@@ -1847,7 +1861,7 @@ function Marks() //{{{
return;
}
liberator.log("Jumping to URL mark: " + markToString(mark, slice), 5);
win.scrollTo(slice.position.x * win.scrollMaxX, slice.position.y * win.scrollMaxY);
buffer.scrollToRatio(slice.position.x, slice.position.y);
ok = true;
}
}
@@ -1862,7 +1876,7 @@ function Marks() //{{{
if (win.location.href == lmark.location)
{
liberator.log("Jumping to local mark: " + markToString(mark, lmark), 5);
win.scrollTo(lmark.position.x * win.scrollMaxX, lmark.position.y * win.scrollMaxY);
buffer.scrollToRatio(lmark.position.x, lmark.position.y);
ok = true;
break;
}