Skip to content

Instantly share code, notes, and snippets.

@fortserious
Created June 14, 2023 17:53
Show Gist options
  • Save fortserious/ca2e905bd08843a976be360ab820e96f to your computer and use it in GitHub Desktop.
Save fortserious/ca2e905bd08843a976be360ab820e96f to your computer and use it in GitHub Desktop.
google cached link
// ==UserScript==
// @name       google cache fixer
// @namespace  www.rossdoran.com
// @version    0.1
// @description adds a "Cached link" URL next to each google search result
// @match      https://www.google.com/search?q=*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @copyright ross doran 2023
// ==/UserScript==
OnLoad(".yuRUbf a:not('.cachelink')", function callback(jNode) {
   var newNode = document.createElement('a');
   newNode.setAttribute('href', 'http://webcache.googleusercontent.com/search?q=cache:' + jNode.attr('href'));
   newNode.setAttribute('class','cachelink');
   newNode.setAttribute('style','padding-left: 6px');
   newNode.innerHTML = "Cached link";   
   jNode.parent().append(newNode);
});
function OnLoad(selector, callback)
{
waitForKeyElements(selector, callback);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment