mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 07:07:58 +01:00
Add ''
This commit is contained in:
@@ -115,6 +115,7 @@ function Buffer() //{{{
|
|||||||
else
|
else
|
||||||
v = win.scrollMaxY / 100 * vertical;
|
v = win.scrollMaxY / 100 * vertical;
|
||||||
|
|
||||||
|
marks.add("'", true);
|
||||||
win.scrollTo(h, v);
|
win.scrollTo(h, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1156,6 +1157,17 @@ function Buffer() //{{{
|
|||||||
scrollToPercentiles(-1, percentage);
|
scrollToPercentiles(-1, percentage);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
scrollToRatio: function (x, y)
|
||||||
|
{
|
||||||
|
scrollToPercentiles(x * 100, y * 100);
|
||||||
|
},
|
||||||
|
|
||||||
|
scrollTo: function (x, y)
|
||||||
|
{
|
||||||
|
marks.add("'", true);
|
||||||
|
content.scrollTo(x, y);
|
||||||
|
},
|
||||||
|
|
||||||
scrollStart: function ()
|
scrollStart: function ()
|
||||||
{
|
{
|
||||||
scrollToPercentiles(0, -1);
|
scrollToPercentiles(0, -1);
|
||||||
@@ -1340,12 +1352,11 @@ function Marks() //{{{
|
|||||||
function onPageLoad(event)
|
function onPageLoad(event)
|
||||||
{
|
{
|
||||||
let win = event.originalTarget.defaultView;
|
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)
|
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);
|
pendingJumps.splice(i, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1390,7 +1401,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 isURLMark(mark) /^[A-Z0-9]$/.test(mark);
|
||||||
|
|
||||||
function localMarkIter()
|
function localMarkIter()
|
||||||
@@ -1537,13 +1548,14 @@ function Marks() //{{{
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
// TODO: add support for frameset pages
|
// TODO: add support for frameset pages
|
||||||
add: function (mark)
|
add: function (mark, silent)
|
||||||
{
|
{
|
||||||
let win = window.content;
|
let win = window.content;
|
||||||
|
|
||||||
if (win.document.body.localName.toLowerCase() == "frameset")
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1554,7 +1566,8 @@ function Marks() //{{{
|
|||||||
if (isURLMark(mark))
|
if (isURLMark(mark))
|
||||||
{
|
{
|
||||||
urlMarks.set(mark, { location: win.location.href, position: position, tab: tabs.getTab() });
|
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))
|
else if (isLocalMark(mark))
|
||||||
{
|
{
|
||||||
@@ -1564,7 +1577,8 @@ function Marks() //{{{
|
|||||||
localMarks.set(mark, []);
|
localMarks.set(mark, []);
|
||||||
let vals = { location: win.location.href, position: position };
|
let vals = { location: win.location.href, position: position };
|
||||||
localMarks.get(mark).push(vals);
|
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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1621,7 +1635,7 @@ function Marks() //{{{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
liberator.log("Jumping to URL mark: " + markToString(mark, slice), 5);
|
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;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1636,7 +1650,7 @@ function Marks() //{{{
|
|||||||
if (win.location.href == lmark.location)
|
if (win.location.href == lmark.location)
|
||||||
{
|
{
|
||||||
liberator.log("Jumping to local mark: " + markToString(mark, lmark), 5);
|
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;
|
ok = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -952,7 +952,7 @@ const liberator = (function () //{{{
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
let elem = buffer.evaluateXPath('//*[@class="tag" and text()="' + tag + '"]').snapshotItem(0);
|
let elem = buffer.evaluateXPath('//*[@class="tag" and text()="' + tag + '"]').snapshotItem(0);
|
||||||
if (elem)
|
if (elem)
|
||||||
window.content.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context
|
buffer.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context
|
||||||
else
|
else
|
||||||
liberator.dump('no element: ' + '@class="tag" and text()="' + tag + '"\n' );
|
liberator.dump('no element: ' + '@class="tag" and text()="' + tag + '"\n' );
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|||||||
Reference in New Issue
Block a user