mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-16 05:45:42 +01:00
Load lookup JS at document creation
This commit is contained in:
parent
42541ba212
commit
d0c5d21661
2 changed files with 5 additions and 3 deletions
|
|
@ -29,5 +29,7 @@
|
|||
if (promo) promo.parentNode.removeChild(promo);
|
||||
}
|
||||
|
||||
if (window.location.hostname === 'www.google.com') fix_google_markup();
|
||||
if (window.location.hostname === 'www.google.com') {
|
||||
window.addEventListener('DOMContentLoaded', fix_google_markup);
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
QTimer, QUrl, QVBoxLayout, QWidget, pyqtSignal
|
||||
)
|
||||
from PyQt5.QtWebEngineWidgets import (
|
||||
QWebEnginePage, QWebEngineProfile, QWebEngineView
|
||||
QWebEnginePage, QWebEngineProfile, QWebEngineScript, QWebEngineView
|
||||
)
|
||||
|
||||
from calibre import prints, random_user_agent
|
||||
|
|
@ -193,7 +193,7 @@ def create_profile():
|
|||
ans.setHttpUserAgent(random_user_agent(allow_ie=False))
|
||||
ans.setCachePath(os.path.join(cache_dir(), 'ev2vl'))
|
||||
js = P('lookup.js', data=True, allow_user_override=False)
|
||||
insert_scripts(ans, create_script('lookup.js', js))
|
||||
insert_scripts(ans, create_script('lookup.js', js, injection_point=QWebEngineScript.DocumentCreation))
|
||||
s = ans.settings()
|
||||
s.setDefaultTextEncoding('utf-8')
|
||||
create_profile.ans = ans
|
||||
|
|
|
|||
Loading…
Reference in a new issue