Skip to content

Commit 5a05de2

Browse files
authored
Merge pull request #2 from Dbz/right-click-menus
Right click menus Former-commit-id: baa864a
2 parents f3e30cc + f93ac3e commit 5a05de2

File tree

140 files changed

+12228
-60355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+12228
-60355
lines changed

.DS_Store

2 KB
Binary file not shown.

Chrome Store/ChromeStore.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
This is a chrome browser extension that allows the user to view a cached version of the current webpage. Set your primary cache as Google Cache, Wayback Machine, or Coral CDN. If what you're looking for isn't found, it'll cycle through the other caches until it finds what you're looking for. There are three ways to use WebCache:
2+
3+
1. Click the extension button to view the cached version of the web page
4+
5+
2. Access the cached webpage through the right click menu (enable this setting in the options page)
6+
7+
3. Auto-detect when a webpage is down, and fetch the cached version (enable this setting in the options page)
8+
9+
Source code is available here: https://github.com/Dbz/WebCache
10+
11+
PLEASE REPORT ISSUES/FEATURE REQUESTS HERE: https://github.com/Dbz/WebCache/issues
12+
13+
14+
Change Log:
15+
16+
V 4.0.0
17+
--------
18+
19+
- Added right click menu option to view the cached version of a web page
20+
- Re-wrote the HTML/CSS of the options page
21+
- Refactoring of the code base
22+
23+
24+
V 3.5.6
25+
---------
26+
27+
- Fixed a bug where first time installers couldn't use the extension before visiting the options page
28+
29+
30+
Google Cache, Wayback Machine, Coral CDN, cache

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,35 @@
1-
WebCache
2-
========
1+
#WebCache
32

4-
This is a chrome browser extension that allows the user to view a cached version of the current webpage
3+
This is a chrome browser extension that allows the user to view a cached version of the current web page.
4+
This is useful if the website:
55

6-
Install this extension here: https://chrome.google.com/webstore/detail/webcache/cmmlgikpahieigpcclckfmhnchdlfnjd
6+
1. DDOS attacked (Too much Reddit traffic)
7+
1. Taken down for maintenance
8+
1. No longer exists
9+
1. Has older versions with different content
710

8-
Images by Jason Rainbows
11+
Install this extension [here](https://chrome.google.com/webstore/detail/webcache/cmmlgikpahieigpcclckfmhnchdlfnjd)
912

13+
#Feedback
1014

11-
v3.5.6
15+
Please report any broken functionality or feature requests [here](https://github.com/Dbz/WebCache/issues).
16+
17+
If you would like to rate the chrome extension, please do so [here](https://chrome.google.com/webstore/detail/webcache/cmmlgikpahieigpcclckfmhnchdlfnjd/reviews).
18+
19+
20+
#Contributing
21+
22+
I explicitly welcome contributions from people who have never contributed to open-source before: we were all beginners once!
23+
I can help build on a partially working pull request with the aim of getting it merged.
24+
I am also actively seeking to diversify our contributors and especially welcome contributions from women from all backgrounds and people of color. <sup>[1](#References)</sup>
25+
26+
If you're interested in contributing, fork this repo and create a pull request.
27+
Please follow the [JavaScript Style Guide](https://github.com/airbnb/javascript).
28+
29+
##Version
30+
31+
v4.0.0
32+
33+
##References
34+
35+
1. I used and modified [Homebrew's](https://github.com/Homebrew/brew#contributing) welcoming contributing section.

bootstrap.min.css

Lines changed: 0 additions & 5 deletions
This file was deleted.

context-menu.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
var CONTEXT_HASH = {
2+
"google-cache": "http://webcache.googleusercontent.com/search?q=cache:",
3+
"wayback-machine": "http://web.archive.org/web/*/",
4+
"coral-cdn": ".nyud.net"
5+
};
6+
7+
function formUrl(context, url) {
8+
var contextUrl = CONTEXT_HASH[context];
9+
var isHTTPS = url.substring(0, 6) === "https:";
10+
11+
// Google and Wayback Machine
12+
if(context !== "coral-cdn") {
13+
return contextUrl + (isHTTPS ? url.substr(8) : url.substr(7));
14+
} else { // Coral CDN
15+
if(url.slice(-1) === "/") {
16+
return url.substring(0, url.length - 1) + contextUrl;
17+
} else {
18+
return url + contextUrl;
19+
}
20+
}
21+
}
22+
23+
function redirectToCachedUrl(info, tab) {
24+
chrome.tabs.update(tab.id, { url: formUrl(info.menuItemId, info.pageUrl) });
25+
}
26+
27+
// Create context menu caches
28+
function createContextMenu(cache) {
29+
var saveObj = {};
30+
var create_properties = {
31+
id: cache,
32+
title: "Open page with " + cache.split("-").join(" "),
33+
contexts: ["page"]
34+
};
35+
saveObj[cache] = true;
36+
37+
chrome.contextMenus.create(create_properties);
38+
chrome.storage.sync.set(saveObj);
39+
}
40+
41+
// Load Context Menus on Startup
42+
chrome.storage.sync.get(Object.keys(CONTEXT_HASH), function(results) {
43+
Object.keys(results).forEach(function(cache) {
44+
if(!!results[cache]) {
45+
createContextMenu(cache);
46+
}
47+
});
48+
});
49+
50+
chrome.contextMenus.onClicked.addListener(redirectToCachedUrl);
51+

images/.DS_Store

0 Bytes
Binary file not shown.

images/CacheMenuBingCache2.png

-4.4 KB
Binary file not shown.

images/CacheMenuCoralCDN2.png

-4.86 KB
Binary file not shown.

images/CacheMenuGigablast2.png

-4.54 KB
Binary file not shown.

images/CacheMenuGoogleCache2.png

-4.66 KB
Binary file not shown.

0 commit comments

Comments
 (0)