Skip to content

Commit 56eee91

Browse files
committed
Merge branch 'material'
2 parents 2a9d453 + 3be3b47 commit 56eee91

File tree

193 files changed

+2497
-2890
lines changed

Some content is hidden

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

193 files changed

+2497
-2890
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bower_components/

README.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
Card Board
22
=========
33

4-
A better New Tab Page with sleek google design and useful features
4+
The default New Tab is not Google enough ? Try Cardboard, Now with more Material Design (plus nifty features)
55

6-
[Google page](https://plus.google.com/115967816314012668475/about)
7-
[Chrome Web Store](https://chrome.google.com/webstore/detail/card-board-new-tab-page/hilmkmopmiomkmehbhajigccnglobaap)
6+
[Google + page](https://plus.google.com/115967816314012668475/about)
87

9-
![Card Board in action](https://lh5.googleusercontent.com/iAKjcXap0xU3zy3z91IqbS6Qr0RfikKpimiRSefXcpR8w4pP3ZTtvS9UFrznXcLGpWdW2Kzzyg=s640-h400-e365-rw)
8+
v2.0.0 screenshot
9+
![Cardboard Material](https://i.imgur.com/ONHiF9q.png)
1010

11+
##Installation
1112

12-
###Permissions
13-
- https://suggestqueries.google.com/* : to get autocomplete suggestions
14-
- downloads : to display your recent downloads (can't be optional due to API/manifest limitation)
15-
(more info here: http://developer.chrome.com/extensions/manifest.html)
16-
- downloads.open is required with the new download card. It allows you to open files you have downloaded when clicking on it.
13+
*Warning: This is for development purpose and not the right way to get the extension for daily use. If you want the stable version head over the [Chrome Web Store](https://chrome.google.com/webstore/detail/card-board-new-tab-page/hilmkmopmiomkmehbhajigccnglobaap) and install it from here.*
1714

18-
###Optional Permissions:
19-
- bookmarks: to display your bookmarks
20-
- management: to display your apps
21-
- topSites: to display your most visited websites
15+
1. `bower install`
16+
2. open [chrome://extensions/](chrome://extensions/)
17+
3. on top-right corner tick **Developer Mode**
18+
4. Click Load unpack extension and choose the root cardboard folder
19+
20+
## Notes on permissions
21+
22+
- https://hawttrends.appspot.com/api/terms/: to get trends
23+
- **downloads**: to display your recent downloads (can't be optional due to API/manifest limitation)
24+
(see: http://developer.chrome.com/extensions/manifest.html)
25+
- **downloads.open**: to open files you have downloaded from the download card (can't be optional)
26+
27+
- [Optional] **bookmarks**: to display your bookmarks
28+
- [Optional] **management**: to display your apps
29+
- [Optional] **topSites**: to display your most visited websites

app/cardboard.js

+230
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
angular.module('cardboard', [
2+
'ngRoute',
3+
'angular-packery',
4+
'cardboard.controllers',
5+
'cardboard.factories',
6+
'cardboard.directives',
7+
'cardboard.filters'
8+
])
9+
10+
.config(['$routeProvider','$compileProvider', function($routeProvider, $compileProvider) {
11+
$routeProvider
12+
.when('/feed', {
13+
controller: 'FeedCtrl',
14+
templateUrl: 'app/templates/Feed.html'
15+
})
16+
.when('/settings', {
17+
controller: 'SettingsCtrl',
18+
templateUrl: 'app/templates/Settings.html'
19+
})
20+
// .when('/onboarding', {
21+
// controller: 'OnboardingCtrl',
22+
// templateUrl: 'app/templates/Onboarding.html'
23+
// })
24+
.otherwise({ redirectTo: '/feed'});
25+
26+
// sanitize urls from chrome-extension
27+
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|chrome-extension):/);
28+
}])
29+
30+
31+
.value('DefaultSettings',{
32+
version: { "update": 4, "settings": 4},
33+
34+
// imgur album: https://imgur.com/a/NAaUE
35+
backgrounds : [
36+
{
37+
id: 0,
38+
name: "Austin",
39+
type: "Google Now",
40+
url: {
41+
dawn: "https://i.imgur.com/7ndeJog.png",
42+
day: "https://i.imgur.com/FsJ8mCW.png",
43+
dusk: "https://i.imgur.com/Mmwv5GQ.png",
44+
night: "https://i.imgur.com/brJBKA3.png"
45+
}
46+
},
47+
{
48+
id: 1,
49+
name: "Beach",
50+
type: "Google Now",
51+
url: {
52+
dawn: "https://i.imgur.com/Q5Tn8u9.png",
53+
day: "https://i.imgur.com/dTFXUxt.png",
54+
dusk: "https://i.imgur.com/vdO9Ote.png",
55+
night: "https://i.imgur.com/YaoPX9P.png"
56+
}
57+
},
58+
{
59+
id: 2,
60+
name: "Berlin",
61+
type: "Google Now",
62+
url: {
63+
dawn: "https://i.imgur.com/jG1OdPc.png",
64+
day: "https://i.imgur.com/lnILrRU.png",
65+
dusk: "https://i.imgur.com/ZCJVfSn.png",
66+
night: "https://i.imgur.com/5mN7Iau.png"
67+
}
68+
},
69+
{
70+
id: 3,
71+
name: "Chicago",
72+
type: "Google Now",
73+
url: {
74+
dawn: "https://i.imgur.com/f4HUPlZ.png",
75+
day: "https://i.imgur.com/t5wzT8j.png",
76+
dusk: "https://i.imgur.com/XrJi3O1.png",
77+
night: "https://i.imgur.com/xDWHJ45.png"
78+
}
79+
},
80+
{
81+
id: 4,
82+
name: "Default",
83+
type: "Google Now",
84+
url: {
85+
dawn: "https://i.imgur.com/kJFNQLr.png",
86+
day: "https://i.imgur.com/foVYQ6T.png",
87+
dusk: "https://i.imgur.com/dW217U5.png",
88+
night: "https://i.imgur.com/87UObPk.png"
89+
}
90+
},
91+
{
92+
id: 5,
93+
name: "Great Plains",
94+
type: "Google Now",
95+
url: {
96+
dawn: "https://i.imgur.com/dWzcGbr.png",
97+
day: "https://i.imgur.com/huGlyp2.png",
98+
dusk: "https://i.imgur.com/XNUMKAT.png",
99+
night: "https://i.imgur.com/d7KaqQ1.png"
100+
}
101+
},
102+
{
103+
id: 6,
104+
name: "London",
105+
type: "Google Now",
106+
url: {
107+
dawn: "https://i.imgur.com/ZD0XBoz.jpg",
108+
day: "https://i.imgur.com/C2Sg6JG.jpg",
109+
dusk: "https://i.imgur.com/Qb8PHnA.jpg",
110+
night: "https://i.imgur.com/k0idCJG.jpg"
111+
}
112+
},
113+
{
114+
id: 7,
115+
name: "New York",
116+
type: "Google Now",
117+
url: {
118+
dawn: "https://i.imgur.com/JVK8ID7.png",
119+
day: "https://i.imgur.com/yB93g10.png",
120+
dusk: "https://i.imgur.com/z4elpiG.png",
121+
night: "https://i.imgur.com/lh0LV5L.png"
122+
}
123+
},
124+
{
125+
id: 8,
126+
name: "Paris",
127+
type: "Google Now",
128+
url: {
129+
dawn: "https://i.imgur.com/c3wAjp2.png",
130+
day: "https://i.imgur.com/c3wAjp2.png",
131+
dusk: "https://i.imgur.com/vmfdH9T.png",
132+
night: "https://i.imgur.com/vmfdH9T.png"
133+
}
134+
},
135+
{
136+
id: 9,
137+
name: "San Francisco",
138+
type: "Google Now",
139+
url: {
140+
dawn: "https://i.imgur.com/fqewVsW.png",
141+
day: "https://i.imgur.com/lUZp177.png",
142+
dusk: "https://i.imgur.com/XP6Omxa.png",
143+
night: "https://i.imgur.com/NATsgio.png"
144+
}
145+
},
146+
{
147+
id: 10,
148+
name: "Seatte",
149+
type: "Google Now",
150+
url: {
151+
dawn: "https://i.imgur.com/7nsrzRK.jpg",
152+
day: "https://i.imgur.com/0E2xXb0.jpg",
153+
dusk: "https://i.imgur.com/wYytDhF.jpg",
154+
night: "https://i.imgur.com/ddI0eBh.jpg"
155+
}
156+
},
157+
{
158+
id: 11,
159+
name: "Tahoe",
160+
type: "Google Now",
161+
url: {
162+
dawn: "https://i.imgur.com/ZSXPIkL.jpg",
163+
day: "https://i.imgur.com/xeVYGPU.jpg",
164+
dusk: "https://i.imgur.com/Buxx2Cs.jpg",
165+
night: "https://i.imgur.com/g761v2t.jpg"
166+
}
167+
}
168+
],
169+
backgroundId : 4,
170+
trends : {
171+
url: "https://hawttrends.appspot.com/api/terms/",
172+
enabled: true
173+
},
174+
cards : [
175+
{
176+
name: "apps",
177+
enabled: false,
178+
template: "app/templates/cards/AppCard.html",
179+
permissions: ["management"]
180+
},
181+
{
182+
name: "bookmarks",
183+
enabled: false,
184+
template: "app/templates/cards/BookmarkCard.html",
185+
permissions: ["bookmarks"]
186+
},
187+
{
188+
name: "quick_settings",
189+
enabled: false,
190+
template: "app/templates/cards/QuickSettingsCard.html",
191+
permissions: ["browsingData"]
192+
},
193+
{
194+
name: "downloads",
195+
enabled: false,
196+
template: "app/templates/cards/DownloadCard.html",
197+
permissions: ["downloads"]
198+
},
199+
{
200+
name: "top_sites",
201+
enabled: false,
202+
template: "app/templates/cards/TopSitesCard.html",
203+
permissions: ["topSites"]
204+
},
205+
{
206+
name: "history",
207+
enabled: false,
208+
template: "app/templates/cards/HistoryCard.html",
209+
permissions: ["history"]
210+
},
211+
{
212+
name: "sessions",
213+
enabled: false,
214+
template: "app/templates/cards/SessionsCard.html",
215+
permissions: ["sessions", "tabs"]
216+
},
217+
{
218+
name: "system",
219+
enabled: false,
220+
template: "app/templates/cards/SystemCard.html",
221+
permissions: ["system.cpu", "system.memory", "system.storage"]
222+
}
223+
224+
// {name: "changelog", system: true, enabled: false, template: "app/templates/cards/ChangelogCard.html" }
225+
// {name: "appearance", system: true, enabled: true, template: "app/templates/cards/AppearanceCard.html" },
226+
// {name: "cards", system: true, enabled: true, template: "app/templates/cards/CardsCard.html" },
227+
// {name: "about", system: true, enabled: true, template: "app/templates/cards/AboutCard.html" }
228+
],
229+
faviconURL: "https://www.google.com/s2/favicons?domain_url="
230+
});

app/controllers/AppCtrl.js

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
angular.module('cardboard.controllers')
2+
3+
.controller('AppCtrl', ['$scope','ChromeFactory', function($scope, Chrome){
4+
$scope.apps = [];
5+
$scope.extensions = [];
6+
$scope.themes = [];
7+
8+
Chrome.management.getAllAsync()
9+
.then(function(all){
10+
angular.forEach(all, function(value, key){
11+
if(value.type == "extension")
12+
$scope.extensions.push(value);
13+
else if (value.type == "theme")
14+
$scope.themes.push(value);
15+
else if(value.enabled){
16+
if($scope.$parent.card.settings && $scope.$parent.card.settings[value.id])
17+
value.frequency = $scope.$parent.card.settings[value.id].frequency;
18+
else
19+
value.frequency = 0;
20+
21+
$scope.apps.push(value);
22+
}
23+
});
24+
$scope.$apply();
25+
$('.card.apps .tooltipped').tooltip({delay: 1000});
26+
});
27+
28+
$scope.launch = function(){
29+
if(this.app.launchType == "OPEN_AS_WINDOW")
30+
Chrome.management.launchApp(this.app.id);
31+
}
32+
33+
$scope.getIcon = function(){
34+
var icon_url;
35+
if(this.app.icons)
36+
icon_url = this.app.icons[this.app.icons.length-1].url;
37+
else
38+
icon_url = "chrome://extension-icon/khopmbdjffemhegeeobelklnbglcdgfh/256/1";
39+
if(!this.app.enabled)
40+
icon_url+="?grayscale=true";
41+
return icon_url;
42+
};
43+
44+
$scope.updateFrequency = function(){
45+
if(!$scope.$parent.card.settings)
46+
$scope.$parent.card.settings = {};
47+
48+
// If frequency not defined we put 1 else we increment it
49+
if(!$scope.$parent.card.settings[this.app.id])
50+
$scope.$parent.card.settings[this.app.id] = {'frequency': 1};
51+
else if($scope.$parent.card.settings[this.app.id].frequency)
52+
$scope.$parent.card.settings[this.app.id] = {'frequency': $scope.$parent.card.settings[this.app.id].frequency+1};
53+
54+
// We don't update scope to avoid suddenly changing apps position after click
55+
56+
// We save frequency in storage
57+
Chrome.storage.setAsync({'cards': $scope.$parent.cards});
58+
};
59+
60+
}]);

app/controllers/BookmarkCtrl.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
angular.module('cardboard.controllers')
2+
3+
.controller('BookmarkCtrl', ['$scope','ChromeFactory', function($scope, Chrome){
4+
// init tabs
5+
$('.card.bookmarks .tabs').tabs();
6+
$('.card.bookmarks .tabs').tabs('select_tab', 'recent-bookmarks');
7+
8+
Chrome.bookmarks.getRecentAsync(5).then(function(recents){
9+
$scope.recents = recents;
10+
$scope.$apply();
11+
});
12+
13+
// get root bookmarks
14+
Chrome.bookmarks.getChildrenAsync("0").then(function(root){
15+
$scope.tree = root;
16+
$scope.$apply();
17+
});
18+
19+
$scope.getChildren = function(id){
20+
Chrome.bookmarks.getChildrenAsync(id).then(function(children){
21+
if(children.length > 0){
22+
$scope.tree = children;
23+
return Chrome.bookmarks.getAsync(children[0].parentId);
24+
}
25+
else
26+
return Promise.reject("Empty");
27+
})
28+
.then(function(parent){
29+
$scope.parentNode = parent[0];
30+
$scope.$apply();
31+
})
32+
.catch(function(error){
33+
toast(error, 4000);
34+
});
35+
};
36+
}]);

0 commit comments

Comments
 (0)