Page 1 of 1
disabling Google instant previews and restoring cache links
Posted: Sat Jan 15, 2011 6:23 am
by al_9x
Instant previews is
another annoying search feature which Google will not let you turn off. Here is a surrogate that disables it:
Code: Select all
user_pref("noscript.surrogate.google_preview.sources", "@www.google.com/search");
user_pref("noscript.surrogate.google_preview.replacement", "addEventListener('DOMContentLoaded', function() { Array.forEach(document.getElementsByClassName('vsc'), function(e) { if (e.tagName === 'DIV' && e.hasAttribute('sig')) e.removeAttribute('sig'); }); }, false);");
It removes the sig attribute from each search result, which appears to be used only for previews so its removal disables the previews but doesn't seem to have side-effects.
Re: disabling Google instant previews with a surrogate
Posted: Sat Jan 15, 2011 9:15 am
by Giorgio Maone
Thanks for sharing.
Re: disabling Google instant previews with a surrogate
Posted: Thu Sep 22, 2011 8:22 am
by al_9x
Google's war on usability continues, they are rolling out a new layout that hides the cache links in the results list, showing them in the preview pane. And of course no prefs for this, as also for the preview itself. Here's a modified surrogate that: 1. disables preview, 2. kills the preview UI, 3. unhides the cache links.
For this to work,
you have to disable "Google Instant" in the search prefs, otherwise paging and subsequent searches are done with ajax and the load events don't fire. It's probably possible to make this work with ajax, but I don't want instant so haven't bothered.
Code: Select all
user_pref("noscript.surrogate.google_preview.sources", "@www.google.com/search?");
user_pref("noscript.surrogate.google_preview.replacement", "addEventListener('DOMContentLoaded', function() { Array.forEach(document.getElementsByClassName('vsc'), function(e) { if (e.tagName === 'DIV' && e.hasAttribute('sig')) e.removeAttribute('sig'); }); Array.slice(document.getElementsByClassName('vshid')).forEach(function(e) { if (e.tagName === 'SPAN' && !(e.previousElementSibling && e.previousElementSibling.tagName === 'SPAN' && e.previousElementSibling.classList.contains('gl')) && e.firstElementChild) { e.classList.remove('vshid'); e.classList.add('gl'); e.insertBefore(document.createTextNode(' - '), e.firstElementChild); } }); }, true); addEventListener('load', function() { Array.slice(document.getElementsByClassName('vspib')).forEach(function(e) { e.parentNode.removeChild(e); }); }, false);");
Re: disabling Google instant previews and restoring cache li
Posted: Mon Oct 31, 2011 10:52 am
by al_9x
Update:
1. limit the surrogate to web search urls
2. occasionally the preview pane UI is not built yet at onload, retrying once after a delay seems to work.
Code: Select all
user_pref("noscript.surrogate.google_preview.sources", "@^https?://www\.google\.com/search\?(?!(?:.*&)?tbm=[^&]+)");
user_pref("noscript.surrogate.google_preview.replacement", "addEventListener('DOMContentLoaded', function(e) {Array.forEach(document.getElementsByClassName('vsc'), function(e) {if (e.tagName === 'DIV' && e.hasAttribute('sig')) e.removeAttribute('sig');}); Array.slice(document.getElementsByClassName('vshid')).forEach(function(e) {if (e.tagName === 'SPAN' && !(e.previousElementSibling && e.previousElementSibling.tagName === 'SPAN' && e.previousElementSibling.classList.contains('gl')) && e.firstElementChild) {e.classList.remove('vshid'); e.classList.add('gl'); e.insertBefore(document.createTextNode(' - '), e.firstElementChild);}});}, true); addEventListener('load', function(e) {var count = typeof e === 'number' ? e : 1; var els = Array.slice(document.getElementsByClassName('vspib')); if (els.length) els.forEach(function(e) e.parentNode.removeChild(e)); else if (++count <= 2) setTimeout(arguments.callee, 100, count);}, false);");