Skip to content

Commit

Permalink
v0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
psic4t committed Dec 5, 2014
1 parent 20f62b5 commit e322b11
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 60 deletions.
18 changes: 11 additions & 7 deletions css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,35 @@ body {
#header-bar {
background-color:#3C5D70;
padding:3px 15px;
height:35px
height:35px;
box-shadow: 1px 2px 2px;
position:relative;
z-index:1;
}
#header-bar>form {
float:left;
margin:0;
}
#header-bar>form>input {
padding:3px;
padding:5px;
}
.col-xs-2 {
padding:0;
}
.panel {
.panel-narrow {
margin:0;
border:0;
border-radius:0;
}
.panel-heading {
padding:1px 5px;
.panel-default>.panel-heading {
height: 20px;
background-color: #e8e8e8;
padding:3px 5px;
font-weight:bold;
border:none;
border-radius:0;
}
.panel-body {
height: 45%;
.panel-narrow-body {
overflow-y:auto;
padding:0;
}
Expand Down
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@

</head>
<body ng-app="myApp" ng-controller="mainCtrl">
<div id="header-bar">
<form>
<input class="main-search" type="text" ng-model="search" placeholder="Search">
</form>
<a href="#/settings" class="btn btn-default btn-sm" tabindex="-1" style="float:right;margin-left:5px"><span class="glyphicon glyphicon-cog"></span> Settings</a>
</div>
<div class="container">
<div id="header-bar">
<form>
<input class="main-search" type="text" ng-model="search" placeholder="Search">
</form>
<a href="#/settings" class="btn btn-default btn-sm" tabindex="-1" style="float:right;margin-left:5px"><span class="glyphicon glyphicon-cog"></span> Settings</a>
</div>
<div class="container">
<div ng-view></div>
</div>
<script src="js/angular.js"></script>
<script src="js/angular-route.js"></script>
<script src="js/ngStorage.js"></script>
<script src="js/app.js"></script>
</div>
<script src="js/angular.js"></script>
<script src="js/angular-route.js"></script>
<script src="js/ngStorage.js"></script>
<script src="js/app.js"></script>
</body>
</html>
26 changes: 17 additions & 9 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use strict';

//var privateKey = "-FynrgFmtek897_Z93-mME6OwS41XnWHOpKs8zXY8sQ=";
var titleLimit = 34;
var deliciousURL = "http://feeds.delicious.com/v2/json/"
//var deliciousURL = "https://api.del.icio.us/v2/json/"

var app = angular.module('deliciousDashboardApp', ['ngRoute','ngStorage'])
.config(function ($routeProvider) {
Expand All @@ -14,18 +12,28 @@ var app = angular.module('deliciousDashboardApp', ['ngRoute','ngStorage'])
});

app.controller('mainCtrl', function($scope, $localStorage, $location) {
$scope.$storage = $localStorage;
if($scope.$storage.favoritetags) { $scope.mytags = $scope.$storage.favoritetags.split(','); } else { $scope.mytags = ['latest']; }
$scope.$storage = $localStorage.$default({ favoritetags: 'latest' });
if (!$scope.$storage.username) { $location.path('/settings'); }
});

app.controller('dashboardCtrl', function($scope, $window) {
$scope.mytags = $scope.$storage.favoritetags.split(',');
if($scope.mytags.length > 6) {
$scope.columnheight = ($window.innerHeight - 35) / 2 - 20;
} else {
$scope.columnheight = $window.innerHeight - 55;
};
$scope.titleLimit = titleLimit;
angular.forEach(document.querySelectorAll('.main-search'), function(elem) { elem.focus(); });
});

app.controller('getLinksCtrl', function($scope,$http) {
if (!$scope.tag) throw new Error("No Tag for LinksController");
if ($scope.tag == 'latest') { $scope.tag = '' } else { $scope.tag = '/' + $scope.tag };
app.controller('getLinksCtrl', function($scope, $http) {
if (!$scope.thistag) throw new Error("No Tag for LinksController");
if ($scope.thistag == 'latest') { $scope.thistag = '' } else { $scope.thistag = '/' + $scope.thistag };
if ($scope.$storage.privatekey) { var privateKey = ';private=' + $scope.$storage.privatekey; }
$http.get(deliciousURL + $scope.$storage.username + $scope.tag + '?count=100' + privateKey).then(function(articlesResponse) {
$http.get(deliciousURL + $scope.$storage.username + $scope.thistag + '?count=100' + privateKey).then(function(articlesResponse) {
$scope.links = articlesResponse.data;
})
});

app.controller('settingsCtrl', function($scope, $http) {
});
1 change: 0 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"manifest_version": 2,
// "default_locale": "en",
"description": "Displays the links of your favorite tags on the new tab page. Easily searchable + customizeable.",
// "content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"icons": {
"16": "img/deli-16.png",
Expand Down
32 changes: 17 additions & 15 deletions partials/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<div ng-repeat="tag in mytags">
<div class="col-xs-2">
<div class="panel panel-default">
<div class="panel-heading">{{tag}}</div>
<div class="panel-body">
<table class="table" ng-controller="getLinksCtrl" ng-init="{{tag}}">
<tr ng-repeat="link in links | filter:search">
<td title="{{link.d}}">
<a href="{{link.u}}"><img src="http://g.etfv.co/{{link.u}}" />{{link.d}}</a>
</td>
</tr>
</table>
</div>
</div>
</div>
<div ng-controller="dashboardCtrl">
<div ng-repeat="thistag in mytags">
<div class="col-xs-2">
<div class="panel panel-default panel-narrow">
<div class="panel-heading">{{thistag}}</div>
<div class="panel-body panel-narrow-body" ng-style="{height: columnheight}">
<table class="table" ng-controller="getLinksCtrl" ng-init="thistag">
<tr ng-repeat="link in links | filter:search">
<td title="{{link.d}}">
<a href="{{link.u}}"><img src="http://g.etfv.co/{{link.u}}" />{{link.d}}</a>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
41 changes: 25 additions & 16 deletions partials/settings.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
<div ng-controller="settingsCtrl">
<div style="width:70%;margin:auto">
<h2>Settings</h2>
<form novalidate class="simple-form">
<div class="input-group">
<span class="input-group-addon">Username</span>
<input type="text" class="username form-control" ng-model="$storage.username" placeholder="Input your Delicious Username">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Private Key</span>
<input type="text" class="privatekey form-control" ng-model="$storage.privatekey" placeholder="Input your Delicious private key to see private links too.">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Favorite Tags</span>
<input type="text" class="privatekey form-control" ng-model="$storage.favoritetags" placeholder="Input your favorite tags, comma separated, 11 max.">
</div>

<div class="input-group">
<span class="input-group-addon">Username</span>
<input type="text" class="username form-control" ng-model="$storage.username" placeholder="Input your Delicious Username">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Private API Key</span>
<input type="text" class="privatekey form-control" ng-model="$storage.privatekey" placeholder="(Optional) Input your Delicious private key to see private links too.">
</div>
<br>
<div class="input-group">
<span class="input-group-addon">Favorite Tags</span>
<input type="text" class="privatekey form-control" ng-model="$storage.favoritetags" placeholder="Input your favorite tags, comma separated, 11 max.">
</div>
</form>
<p>
<a href="#/" class="btn btn-primary"><span class="glyphicon glyphicon-arrow-left"></span> Back</a>
<div class="panel panel-default">
<div class="panel-body">
<p>Enter up to 12 favorite tags, separated by commas. 'latest' will give you your latest links.</p>
<p>Enter your Delicious API key to get your private links as well. For your API key, go to http://feeds.delicious.com/[your username] and click on "RSS: Private" on the right side. This link includes your API key.</p>
</div>
</div>
</p>
<p>
<a href="#/" class="btn btn-primary" ng-click="updatetags()"><span class="glyphicon glyphicon-arrow-left"></span> Back</a>
</p>
</div>
</div>

0 comments on commit e322b11

Please sign in to comment.