Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pahud
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahud/f91c7321170237a822db to your computer and use it in GitHub Desktop.
Save pahud/f91c7321170237a822db to your computer and use it in GitHub Desktop.
OmegaProfile_auto_switch.pac
var FindProxyForURL = function(init, profiles) {
return function(url, host) {
"use strict";
var result = init, scheme = url.substr(0, url.indexOf(":"));
do {
result = profiles[result];
if (typeof result === "function") result = result(url, host, scheme);
} while (typeof result !== "string" || result.charCodeAt(0) === 43);
return result;
};
}("+auto switch", {
"+auto switch": function(url, host, scheme) {
"use strict";
if (/(?:^|\.)github\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)akamaihd\.net$/.test(host)) return "+proxy";
if (/(?:^|\.)facebook\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)ytimg\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)googlesyndication\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)google\.co\.jp$/.test(host)) return "+proxy";
if (/(?:^|\.)storage\.googleapis\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)ggpht\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)google\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)tmall\.com$/.test(host)) return "DIRECT";
if (/(?:^|\.)ajax\.googleapis\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)hackpad\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)gravatar\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)facebook\.net$/.test(host)) return "+proxy";
if (/(?:^|\.)yahoo\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)staticflickr\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)flickr\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)youtube\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)doubleclick\.net$/.test(host)) return "+proxy";
if (/(?:^|\.)googlevideo\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)2mdn\.net$/.test(host)) return "+proxy";
if (/(?:^|\.)taobaocdn\.com$/.test(host)) return "DIRECT";
if (/(?:^|\.)mmstat\.com$/.test(host)) return "DIRECT";
if (/(?:^|\.)googleusercontent\.com$/.test(host)) return "+proxy";
if (/(?:^|\.)fbcdn\.net$/.test(host)) return "+proxy";
if (/(?:^|\.)fbcdn\.com$/.test(host)) return "+proxy";
return "DIRECT";
},
"+proxy": function(url, host, scheme) {
"use strict";
if (host === "[::1]" || host === "localhost" || host === "127.0.0.1") return "DIRECT";
return "SOCKS5 127.0.0.1:1080";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment