Only remove elements when doing a google dictionary search

This commit is contained in:
Kovid Goyal 2019-08-20 16:20:50 +05:30
parent 1f9ac958e2
commit 755cf383a3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 6 deletions

View File

@ -13,10 +13,15 @@
cc.style.marginLeft = '0';
cc = document.getElementById('cnt');
if (cc) cc.style.paddingTop = '0';
['sfcnt', 'top_nav', 'before-appbar', 'appbar', 'searchform', 'easter-egg'].forEach(function(id) {
var elem = document.getElementById(id);
if (elem) elem.style.display = 'none';
});
var params = new URLSearchParams(document.location.search.substring(1));
var q = params.get('q');
if (q && q.startsWith('define:')) {
var remove = ['sfcnt', 'top_nav', 'before-appbar', 'appbar', 'searchform', 'easter-egg'];
remove.forEach(function(id) {
var elem = document.getElementById(id);
if (elem) elem.style.display = 'none';
});
}
}
if (window.location.hostname === 'www.google.com') fix_google_markup();

View File

@ -23,13 +23,13 @@ from calibre.gui2.webengine import create_script, insert_scripts, secure_webengi
vprefs.defaults['lookup_locations'] = [
{
'name': 'Google dictionary',
'url': 'https://google.com/search?q=define:{word}',
'url': 'https://www.google.com/search?q=define:{word}',
'langs': [],
},
{
'name': 'Google search',
'url': 'https://google.com/search?q={word}',
'url': 'https://www.google.com/search?q={word}',
'langs': [],
},