EAF Browser: use new cssSelector algorithm to fix jump marker bugs

master
Mingde (Matthew) Zeng 6 years ago
parent 7ebc26b46c
commit 81eab81075
  1. 5
      README.md
  2. 24
      core/js/get_markers.js

@ -55,11 +55,10 @@ EAF is an extensible framework, one can develop any Qt5 application and integrat
sudo pip3 install dbus-python python-xlib pyqt5 pyqtwebengine pymupdf grip qrcode feedparser pyinotify markdown
```
If you use Arch Linux, we recommend you install dependencies with below command:
If you use **Arch Linux**, it is recommended to install dependencies using `pacman` and `yay` instead.
```Bash
sudo pacman -S python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-xlib python-qrcode python-feedparser
python-dbus python-pyinotify python-markdown
sudo pacman -S python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-xlib python-qrcode python-feedparser python-dbus python-pyinotify python-markdown
yay -S python-pymupdf python-grip
```

@ -1,25 +1,11 @@
(function() {
function cssSelector(el) {
let path = [];
while (el.nodeType === Node.ELEMENT_NODE) {
let selector = el.nodeName.toLowerCase();
if (el.id) {
selector += '#' + el.id;
path.unshift(selector);
break;
} else {
let sib = el, nth = 1;
while (sib = sib.previousElementSibling) {
if (sib.nodeName.toLowerCase() == selector)
nth++;
}
if (nth != 1)
selector += ":nth-of-type("+nth+")";
}
path.unshift(selector);
el = el.parentNode;
let path = [], parent;
while (parent = el.parentNode) {
path.unshift(`${el.tagName}:nth-child(${[].indexOf.call(parent.children, el)+1})`);
el = parent;
}
return path.join(" > ");
return `${path.join(' > ')}`.toLowerCase();
}
function getCoords(link){

Loading…
Cancel
Save