Google Cache Browser

Continue browsing the page in Google cache

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Google Cache Browser
// @namespace   qixinglu.com
// @description Continue browsing the page in Google cache
// @grant       none
// @include     http://webcache.googleusercontent.com/search?*
// @include     https://webcache.googleusercontent.com/search?*
// @version 0.0.1.20140517140355
// ==/UserScript==

var convertCacheLinks = function(url) {
    var selector = 'body > div[style="position:relative"] a';
    var links = document.querySelectorAll(selector);
    var i, link;
    for (i = 0; i < links.length; i += 1) {
        link = links[i];
        link.href = location.href.replace(url, encodeURIComponent(link.href));
    }
};

var addOriginalLink = function(url) {
    var html = 'Go back to <a href="${href}">original page</a>.';
    var paragraph = document.createElement('p');
    paragraph.innerHTML = html.replace('${href}',decodeURIComponent(url));
    document.body.appendChild(paragraph);
};

var url = location.href.match(/q=cache:([^&+]+)/)[1];
if (document.title === 'Error 404 (Not Found)!!1') {
    addOriginalLink(url);
} else {
    convertCacheLinks(url);
}