Skip to content

Commit f6c178c

Browse files
committed
First Commit
All of the basic files
0 parents  commit f6c178c

12 files changed

+98
-0
lines changed

CacheMenuBingCache.png

4.45 KB
Loading

CacheMenuCoralCDN.png

4.9 KB
Loading

CacheMenuGigablast.png

4.6 KB
Loading

CacheMenuGoogleCache.png

4.71 KB
Loading

CacheMenuWaybackMachine.png

4.58 KB
Loading

CacheMenuWebCite.png

4.18 KB
Loading

CacheMenuYahooCache.png

4.54 KB
Loading

background.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<html>
2+
<body>
3+
</body>
4+
</html>

cacheList.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
</head>
5+
6+
<body>
7+
<img src="CacheMenuWaybackMachine.png", alt="WayBack Machine" class="button" id="WayBack Machine" height ="34px" />
8+
<img src="CacheMenuGoogleCache.png", alt="Google Cache" class="button" id="Google Cache" height ="34px" />
9+
<img src="CacheMenuYahooCache.png", alt="Yahoo Cache" class="button" id="Yahoo Cache" height ="34px" />
10+
<img src="CacheMenuBingCache.png", alt="Bing Cache" class="button" id="Bing Cache" height ="34px" />
11+
<img src="CacheMenuGigablast.png", alt="Gigablast" class="button" id="Gigablast" height ="34px" />
12+
<img src="CacheMenuCoralCDN.png", alt="CoralCDN" class="button" id="CoralCDN" height ="34px" />
13+
<img src="CacheMenuWebCite.png", alt="Webcite" class="button" id="Webcite" height ="34px" />
14+
15+
<script type="text/javascript" src="redirect.js"> </script>
16+
</body>
17+
18+
</html>

icon.png

3.49 KB
Loading

manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "gCache",
3+
"version": "1.1.5",
4+
"description": "View the Google Cache of a page",
5+
6+
"browser_action": {
7+
"default_icon": "icon.png",
8+
"default_text": "Google Cache version of this page",
9+
"default_popup": "cacheList.html"
10+
},
11+
12+
"permissions": [
13+
"tabs"
14+
]
15+
}

redirect.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
document.addEventListener('DOMContentLoaded', function() {
3+
var x, img = document.getElementsByTagName("img");
4+
for(x=0;x < img.length; x++) {
5+
img[x].addEventListener('click',openPage, false);
6+
//console.log("img[x]: " + img[x]);
7+
}
8+
});
9+
10+
function openPage(event) {
11+
//alert("clicked" + event.target.id);
12+
console.log("id: " + event.target.id);
13+
14+
var e = event.target;
15+
switch(e.id) {
16+
case "WayBack Machine":
17+
chrome.tabs.getSelected(null, function(tab) {
18+
chrome.tabs.update(tab.id, { url: "http://wayback.archive.org/web/*/" + tab.url });
19+
});
20+
break;
21+
22+
case "Google Cache":
23+
chrome.tabs.getSelected(null, function(tab) {
24+
if(tab.url.substring(0, 5) == "http:")
25+
chrome.tabs.update(tab.id, { url: 'http://webcache.googleusercontent.com/search?q=cache:' + tab.url.substr(7) });
26+
else if(tab.url.substring(0,6) == "https:")
27+
chrome.tabs.update(tab.id, { url: 'http://webcache.googleusercontent.com/search?q=cache:' + tab.url.substr(8) });
28+
});
29+
break;
30+
31+
case "Yahoo Cache":
32+
// Need the yahoo cache url
33+
break;
34+
35+
case "Bing Cache":
36+
chrome.tabs.getSelected(null, function(tab) {
37+
chrome.tabs.update(tab.id, { url: "http://cc.bingj.com/cache.aspx?q=" + tab.url + "&d=4572216504747453&mkt=en-US&setlang=en-US&w=802790a9,218b61b8" });
38+
});
39+
break;
40+
41+
case "Gigablast":
42+
chrome.tabs.getSelected(null, function(tab) {
43+
chrome.tabs.update(tab.id, { url: "http://www.gigablast.com/get?q=" + tab.url + "&c=main&d=70166151696&cnsp=0" });
44+
});
45+
break;
46+
47+
case "CoralCDN":
48+
chrome.tabs.getSelected(null, function(tab) {
49+
chrome.tabs.update(tab.id, { url: tab.url + ".nyud.net" });
50+
});
51+
break;
52+
53+
default: // Webcite
54+
// Need to send a request, this won't do
55+
chrome.tabs.getSelected(null, function(tab) {
56+
chrome.tabs.update(tab.id, { url: "http://webcitation.org/query" });
57+
});
58+
break;
59+
}
60+
61+
}

0 commit comments

Comments
 (0)