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 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 ```Bash
sudo pacman -S python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-xlib python-qrcode python-feedparser sudo pacman -S python-pyqt5 python-pyqt5-sip python-pyqtwebengine python-xlib python-qrcode python-feedparser python-dbus python-pyinotify python-markdown
python-dbus python-pyinotify python-markdown
yay -S python-pymupdf python-grip yay -S python-pymupdf python-grip
``` ```

@ -1,25 +1,11 @@
(function() { (function() {
function cssSelector(el) { function cssSelector(el) {
let path = []; let path = [], parent;
while (el.nodeType === Node.ELEMENT_NODE) { while (parent = el.parentNode) {
let selector = el.nodeName.toLowerCase(); path.unshift(`${el.tagName}:nth-child(${[].indexOf.call(parent.children, el)+1})`);
if (el.id) { el = parent;
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;
} }
return path.join(" > "); return `${path.join(' > ')}`.toLowerCase();
} }
function getCoords(link){ function getCoords(link){

Loading…
Cancel
Save