Skip to content

Commit

Permalink
Merge branch 'material'
Browse files Browse the repository at this point in the history
  • Loading branch information
dotlouis committed Feb 20, 2015
2 parents 2a9d453 + 3be3b47 commit 56eee91
Show file tree
Hide file tree
Showing 193 changed files with 2,497 additions and 2,890 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
bower_components/
34 changes: 21 additions & 13 deletions README.md
@@ -1,21 +1,29 @@
Card Board
=========

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

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

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

##Installation

###Permissions
- https://suggestqueries.google.com/* : to get autocomplete suggestions
- downloads : to display your recent downloads (can't be optional due to API/manifest limitation)
(more info here: http://developer.chrome.com/extensions/manifest.html)
- downloads.open is required with the new download card. It allows you to open files you have downloaded when clicking on it.
*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.*

###Optional Permissions:
- bookmarks: to display your bookmarks
- management: to display your apps
- topSites: to display your most visited websites
1. `bower install`
2. open [chrome://extensions/](chrome://extensions/)
3. on top-right corner tick **Developer Mode**
4. Click Load unpack extension and choose the root cardboard folder

## Notes on permissions

- https://hawttrends.appspot.com/api/terms/: to get trends
- **downloads**: to display your recent downloads (can't be optional due to API/manifest limitation)
(see: http://developer.chrome.com/extensions/manifest.html)
- **downloads.open**: to open files you have downloaded from the download card (can't be optional)

- [Optional] **bookmarks**: to display your bookmarks
- [Optional] **management**: to display your apps
- [Optional] **topSites**: to display your most visited websites
230 changes: 230 additions & 0 deletions app/cardboard.js
@@ -0,0 +1,230 @@
angular.module('cardboard', [
'ngRoute',
'angular-packery',
'cardboard.controllers',
'cardboard.factories',
'cardboard.directives',
'cardboard.filters'
])

.config(['$routeProvider','$compileProvider', function($routeProvider, $compileProvider) {
$routeProvider
.when('/feed', {
controller: 'FeedCtrl',
templateUrl: 'app/templates/Feed.html'
})
.when('/settings', {
controller: 'SettingsCtrl',
templateUrl: 'app/templates/Settings.html'
})
// .when('/onboarding', {
// controller: 'OnboardingCtrl',
// templateUrl: 'app/templates/Onboarding.html'
// })
.otherwise({ redirectTo: '/feed'});

// sanitize urls from chrome-extension
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|chrome-extension):/);
}])


.value('DefaultSettings',{
version: { "update": 4, "settings": 4},

// imgur album: https://imgur.com/a/NAaUE
backgrounds : [
{
id: 0,
name: "Austin",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/7ndeJog.png",
day: "https://i.imgur.com/FsJ8mCW.png",
dusk: "https://i.imgur.com/Mmwv5GQ.png",
night: "https://i.imgur.com/brJBKA3.png"
}
},
{
id: 1,
name: "Beach",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/Q5Tn8u9.png",
day: "https://i.imgur.com/dTFXUxt.png",
dusk: "https://i.imgur.com/vdO9Ote.png",
night: "https://i.imgur.com/YaoPX9P.png"
}
},
{
id: 2,
name: "Berlin",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/jG1OdPc.png",
day: "https://i.imgur.com/lnILrRU.png",
dusk: "https://i.imgur.com/ZCJVfSn.png",
night: "https://i.imgur.com/5mN7Iau.png"
}
},
{
id: 3,
name: "Chicago",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/f4HUPlZ.png",
day: "https://i.imgur.com/t5wzT8j.png",
dusk: "https://i.imgur.com/XrJi3O1.png",
night: "https://i.imgur.com/xDWHJ45.png"
}
},
{
id: 4,
name: "Default",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/kJFNQLr.png",
day: "https://i.imgur.com/foVYQ6T.png",
dusk: "https://i.imgur.com/dW217U5.png",
night: "https://i.imgur.com/87UObPk.png"
}
},
{
id: 5,
name: "Great Plains",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/dWzcGbr.png",
day: "https://i.imgur.com/huGlyp2.png",
dusk: "https://i.imgur.com/XNUMKAT.png",
night: "https://i.imgur.com/d7KaqQ1.png"
}
},
{
id: 6,
name: "London",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/ZD0XBoz.jpg",
day: "https://i.imgur.com/C2Sg6JG.jpg",
dusk: "https://i.imgur.com/Qb8PHnA.jpg",
night: "https://i.imgur.com/k0idCJG.jpg"
}
},
{
id: 7,
name: "New York",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/JVK8ID7.png",
day: "https://i.imgur.com/yB93g10.png",
dusk: "https://i.imgur.com/z4elpiG.png",
night: "https://i.imgur.com/lh0LV5L.png"
}
},
{
id: 8,
name: "Paris",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/c3wAjp2.png",
day: "https://i.imgur.com/c3wAjp2.png",
dusk: "https://i.imgur.com/vmfdH9T.png",
night: "https://i.imgur.com/vmfdH9T.png"
}
},
{
id: 9,
name: "San Francisco",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/fqewVsW.png",
day: "https://i.imgur.com/lUZp177.png",
dusk: "https://i.imgur.com/XP6Omxa.png",
night: "https://i.imgur.com/NATsgio.png"
}
},
{
id: 10,
name: "Seatte",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/7nsrzRK.jpg",
day: "https://i.imgur.com/0E2xXb0.jpg",
dusk: "https://i.imgur.com/wYytDhF.jpg",
night: "https://i.imgur.com/ddI0eBh.jpg"
}
},
{
id: 11,
name: "Tahoe",
type: "Google Now",
url: {
dawn: "https://i.imgur.com/ZSXPIkL.jpg",
day: "https://i.imgur.com/xeVYGPU.jpg",
dusk: "https://i.imgur.com/Buxx2Cs.jpg",
night: "https://i.imgur.com/g761v2t.jpg"
}
}
],
backgroundId : 4,
trends : {
url: "https://hawttrends.appspot.com/api/terms/",
enabled: true
},
cards : [
{
name: "apps",
enabled: false,
template: "app/templates/cards/AppCard.html",
permissions: ["management"]
},
{
name: "bookmarks",
enabled: false,
template: "app/templates/cards/BookmarkCard.html",
permissions: ["bookmarks"]
},
{
name: "quick_settings",
enabled: false,
template: "app/templates/cards/QuickSettingsCard.html",
permissions: ["browsingData"]
},
{
name: "downloads",
enabled: false,
template: "app/templates/cards/DownloadCard.html",
permissions: ["downloads"]
},
{
name: "top_sites",
enabled: false,
template: "app/templates/cards/TopSitesCard.html",
permissions: ["topSites"]
},
{
name: "history",
enabled: false,
template: "app/templates/cards/HistoryCard.html",
permissions: ["history"]
},
{
name: "sessions",
enabled: false,
template: "app/templates/cards/SessionsCard.html",
permissions: ["sessions", "tabs"]
},
{
name: "system",
enabled: false,
template: "app/templates/cards/SystemCard.html",
permissions: ["system.cpu", "system.memory", "system.storage"]
}

// {name: "changelog", system: true, enabled: false, template: "app/templates/cards/ChangelogCard.html" }
// {name: "appearance", system: true, enabled: true, template: "app/templates/cards/AppearanceCard.html" },
// {name: "cards", system: true, enabled: true, template: "app/templates/cards/CardsCard.html" },
// {name: "about", system: true, enabled: true, template: "app/templates/cards/AboutCard.html" }
],
faviconURL: "https://www.google.com/s2/favicons?domain_url="
});
60 changes: 60 additions & 0 deletions app/controllers/AppCtrl.js
@@ -0,0 +1,60 @@
angular.module('cardboard.controllers')

.controller('AppCtrl', ['$scope','ChromeFactory', function($scope, Chrome){
$scope.apps = [];
$scope.extensions = [];
$scope.themes = [];

Chrome.management.getAllAsync()
.then(function(all){
angular.forEach(all, function(value, key){
if(value.type == "extension")
$scope.extensions.push(value);
else if (value.type == "theme")
$scope.themes.push(value);
else if(value.enabled){
if($scope.$parent.card.settings && $scope.$parent.card.settings[value.id])
value.frequency = $scope.$parent.card.settings[value.id].frequency;
else
value.frequency = 0;

$scope.apps.push(value);
}
});
$scope.$apply();
$('.card.apps .tooltipped').tooltip({delay: 1000});
});

$scope.launch = function(){
if(this.app.launchType == "OPEN_AS_WINDOW")
Chrome.management.launchApp(this.app.id);
}

$scope.getIcon = function(){
var icon_url;
if(this.app.icons)
icon_url = this.app.icons[this.app.icons.length-1].url;
else
icon_url = "chrome://extension-icon/khopmbdjffemhegeeobelklnbglcdgfh/256/1";
if(!this.app.enabled)
icon_url+="?grayscale=true";
return icon_url;
};

$scope.updateFrequency = function(){
if(!$scope.$parent.card.settings)
$scope.$parent.card.settings = {};

// If frequency not defined we put 1 else we increment it
if(!$scope.$parent.card.settings[this.app.id])
$scope.$parent.card.settings[this.app.id] = {'frequency': 1};
else if($scope.$parent.card.settings[this.app.id].frequency)
$scope.$parent.card.settings[this.app.id] = {'frequency': $scope.$parent.card.settings[this.app.id].frequency+1};

// We don't update scope to avoid suddenly changing apps position after click

// We save frequency in storage
Chrome.storage.setAsync({'cards': $scope.$parent.cards});
};

}]);
36 changes: 36 additions & 0 deletions app/controllers/BookmarkCtrl.js
@@ -0,0 +1,36 @@
angular.module('cardboard.controllers')

.controller('BookmarkCtrl', ['$scope','ChromeFactory', function($scope, Chrome){
// init tabs
$('.card.bookmarks .tabs').tabs();
$('.card.bookmarks .tabs').tabs('select_tab', 'recent-bookmarks');

Chrome.bookmarks.getRecentAsync(5).then(function(recents){
$scope.recents = recents;
$scope.$apply();
});

// get root bookmarks
Chrome.bookmarks.getChildrenAsync("0").then(function(root){
$scope.tree = root;
$scope.$apply();
});

$scope.getChildren = function(id){
Chrome.bookmarks.getChildrenAsync(id).then(function(children){
if(children.length > 0){
$scope.tree = children;
return Chrome.bookmarks.getAsync(children[0].parentId);
}
else
return Promise.reject("Empty");
})
.then(function(parent){
$scope.parentNode = parent[0];
$scope.$apply();
})
.catch(function(error){
toast(error, 4000);
});
};
}]);

0 comments on commit 56eee91

Please sign in to comment.