Skip to content

Commit ebfb216

Browse files
committed
0.2 - Add support for new cloud console.
1 parent 6a725a4 commit ebfb216

File tree

7 files changed

+66
-19
lines changed

7 files changed

+66
-19
lines changed

css/demo-cloud.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.p6n-appbar-container, .p6n-layout-nav, .p6n-scroll-container {
2+
background-color: #F9E0E0 !important;
3+
}

css/dev-cloud.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.p6n-appbar-container, .p6n-layout-nav, .p6n-scroll-container {
2+
background-color: #E6F8E0 !important;
3+
}

css/prod-cloud.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.p6n-appbar-container, .p6n-layout-nav, .p6n-scroll-container {
2+
background-color: #FFFFFF !important;
3+
}

css/prod.css

Whitespace-only changes.

css/test-cloud.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.p6n-appbar-container, .p6n-layout-nav, .p6n-scroll-container {
2+
background-color: #F5F6CE !important;
3+
}

js/synaesthete.js

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,64 @@ var setPageAction = function(tabId) {
44
chrome.pageAction.show(tabId);
55
};
66

7-
var setColors = function(tab) {
8-
if (tab.url.indexOf('-dev') > -1) {
9-
// This is a DEV environment.
10-
tab.insertCSS(null, {file: "css/dev.css"});
11-
}
12-
else if (tab.url.indexOf('-test') > -1) {
13-
// This is a TEST environment.
14-
tab.insertCSS(null, {file: "css/test.css"});
15-
}
16-
else if (tab.url.indexOf('-demo') > -1) {
17-
// This is a TEST environment.
18-
tab.insertCSS(null, {file: "css/demo.css"});
7+
var setColors = function(tab, environment) {
8+
9+
if (environment === 'appengine') {
10+
if (tab.url.indexOf('-dev') > -1) {
11+
// This is a DEV environment.
12+
chrome.tabs.insertCSS(null, {file: "css/dev.css"});
13+
}
14+
else if (tab.url.indexOf('-test') > -1) {
15+
// This is a TEST environment.
16+
chrome.tabs.insertCSS(null, {file: "css/test.css"});
17+
}
18+
else if (tab.url.indexOf('-demo') > -1) {
19+
// This is a TEST environment.
20+
chrome.tabs.insertCSS(null, {file: "css/demo.css"});
21+
}
22+
else if (tab.url.indexOf('-prod') > -1) {
23+
// This is a TEST environment.
24+
chrome.tabs.insertCSS(null, {file: "css/prod.css"});
25+
}
26+
} else if (environment === 'cloud') {
27+
if (tab.url.indexOf('-dev') > -1) {
28+
// This is a DEV environment.
29+
chrome.tabs.insertCSS(null, {file: "css/dev-cloud.css"});
30+
}
31+
else if (tab.url.indexOf('-test') > -1) {
32+
// This is a TEST environment.
33+
chrome.tabs.insertCSS(null, {file: "css/test-cloud.css"});
34+
}
35+
else if (tab.url.indexOf('-demo') > -1) {
36+
// This is a TEST environment.
37+
chrome.tabs.insertCSS(null, {file: "css/demo-cloud.css"});
38+
}
39+
else if (tab.url.indexOf('-prod') > -1) {
40+
// This is a TEST environment.
41+
chrome.tabs.insertCSS(null, {file: "css/prod-cloud.css"});
42+
}
43+
} else {
44+
console.log('Encountered an unrecognized environment. Please file a feature request at ' +
45+
'https://github.com/colleenjhardie/synaesthesia/issues');
1946
}
2047
};
2148

49+
2250
var checkUrl = function(tabId, changeInfo, tab) {
51+
var environment = 'wat';
2352
if (tab.url.indexOf('https://appengine.google.com/') > -1) {
24-
// This is an appengine admin page.
25-
// Display the page action icon.
26-
setPageAction(tabId);
27-
// Set the colors.
28-
setColors(tab);
53+
// This is an appengine admin page
54+
self.environment = 'appengine'
55+
} else if (tab.url.indexOf('https://console.developers.google.com/project/') > -1) {
56+
// This is a cloud console page.
57+
self.environment = 'cloud'
2958
}
59+
60+
// Display the page action icon.
61+
setPageAction(tabId);
62+
//Set the colors.
63+
setColors(tab, self.environment);
64+
3065
return false;
3166
};
3267

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "synaesthesia",
44
"description": "A chrome extension that changes the default colours of the GAE admin console based on app ID.",
5-
"version": "0.1",
5+
"version": "0.2",
66
"options_page": "./html/options.html",
77
"background" : {
88
"scripts": ["./js/synaesthete.js"],
@@ -15,6 +15,6 @@
1515
},
1616
"permissions": [
1717
"background",
18-
"tabs", "https://appengine.google.com/*"
18+
"tabs", "https://appengine.google.com/*", "https://console.developers.google.com/project/repcore-dev"
1919
]
2020
}

0 commit comments

Comments
 (0)