mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
handle middle clicks and ctrl clicks on entries (#4)
This commit is contained in:
@@ -61,20 +61,6 @@
|
||||
margin: 5px 0px 5px 0px;
|
||||
}
|
||||
|
||||
#feed-accordion .collapse {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
#feed-accordion .accordion-group {
|
||||
margin-bottom: 0px;
|
||||
border: none;
|
||||
-webkit-border-radius: none;
|
||||
-moz-border-radius: none;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
#feed-accordion .entry {
|
||||
border-bottom: 1px solid #CCCCCC;
|
||||
}
|
||||
@@ -85,12 +71,15 @@
|
||||
margin-top: 80px;
|
||||
}
|
||||
|
||||
#feed-accordion .accordion-inner {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#feed-accordion .entry-heading {
|
||||
padding: 6px 0px;
|
||||
display: block;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#feed-accordion a.entry-heading:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#feed-accordion .entry-heading.open {
|
||||
@@ -101,17 +90,7 @@
|
||||
background-color: #EBEBEB;
|
||||
}
|
||||
|
||||
#feed-accordion a.accordion-toggle {
|
||||
color: black;
|
||||
display: block;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#feed-accordion a.accordion-toggle:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#feed-accordion a.accordion-toggle .unread {
|
||||
#feed-accordion .entry-heading.unread {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ module.run(function($rootScope) {
|
||||
});
|
||||
});
|
||||
|
||||
module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location, $route,
|
||||
SubscriptionService) {
|
||||
module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
|
||||
$route, SubscriptionService) {
|
||||
|
||||
$scope.$on('$routeChangeSuccess', function() {
|
||||
$scope.selectedType = $routeParams._type;
|
||||
@@ -51,7 +51,7 @@ module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
|
||||
}
|
||||
|
||||
$scope.feedClicked = function(id) {
|
||||
if($scope.selectedType == 'feed' && id == $scope.selectedId) {
|
||||
if ($scope.selectedType == 'feed' && id == $scope.selectedId) {
|
||||
$route.reload();
|
||||
} else {
|
||||
$location.path('/feeds/view/feed/' + id);
|
||||
@@ -59,10 +59,10 @@ module.controller('CategoryTreeCtrl', function($scope, $routeParams, $location,
|
||||
};
|
||||
|
||||
$scope.categoryClicked = function(id) {
|
||||
if($scope.selectedType == 'category' && id == $scope.selectedId) {
|
||||
if ($scope.selectedType == 'category' && id == $scope.selectedId) {
|
||||
$route.reload();
|
||||
} else {
|
||||
$location.path('/feeds/view/category/' + id);
|
||||
$location.path('/feeds/view/category/' + id);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -102,7 +102,7 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||
$scope.limit = 20;
|
||||
$scope.busy = false;
|
||||
$scope.hasMore = true;
|
||||
|
||||
|
||||
$scope.refreshList = function() {
|
||||
if ($scope.settings.readingMode) {
|
||||
$scope.entryList = EntryService.get({
|
||||
@@ -114,15 +114,15 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.loadMoreEntries = function() {
|
||||
if(!$scope.hasMore)
|
||||
if (!$scope.hasMore)
|
||||
return;
|
||||
if (!$scope.entryList || !$scope.entryList.entries)
|
||||
return;
|
||||
if ($scope.busy)
|
||||
return;
|
||||
if (!$scope.settings.readingMode)
|
||||
if (!$scope.settings.readingMode)
|
||||
return;
|
||||
$scope.busy = true;
|
||||
EntryService.get({
|
||||
@@ -154,15 +154,20 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.isOpen = false
|
||||
$scope.toggle = function(entry) {
|
||||
if ($scope.current != entry) {
|
||||
$scope.isOpen = true;
|
||||
} else {
|
||||
$scope.isOpen = !$scope.isOpen;
|
||||
}
|
||||
$scope.current = entry;
|
||||
|
||||
$scope.isOpen = false;
|
||||
$scope.entryClicked = function(entry, event) {
|
||||
console.log('click !')
|
||||
$scope.mark(entry, true);
|
||||
if (!event.ctrlKey && event.which != 2) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
if ($scope.current != entry) {
|
||||
$scope.isOpen = true;
|
||||
} else {
|
||||
$scope.isOpen = !$scope.isOpen;
|
||||
}
|
||||
$scope.current = entry;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,25 +4,21 @@
|
||||
<h3><span>{{entryList.name}} </span><span ng-show="entryList.name && selectedType == 'category'"> »</span></h3>
|
||||
</div>
|
||||
|
||||
<div id="feed-accordion" infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1">
|
||||
<accordion close-others="true">
|
||||
<accordion-group ng-repeat="entry in entryList.entries" class="entry">
|
||||
<accordion-heading>
|
||||
<div class="entry-heading" ng-click="toggle(entry)" ng-class="{unread: entry.read == false, open: current == entry, closed: current != entry}">
|
||||
<span ng-show="selectedType == 'category'">{{entry.feedName}}
|
||||
- </span>{{entry.title}} <span class="pull-right">{{entry.date}}</span>
|
||||
</div>
|
||||
</accordion-heading>
|
||||
<div class="entry-body">
|
||||
<div>
|
||||
<h4>
|
||||
<a href="{{entry.url}}" target="_blank">{{entry.title}}</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div ng-bind-html-unsafe="entry.content" ui-if="isOpen && current == entry"></div>
|
||||
</div>
|
||||
</accordion-group>
|
||||
</accordion>
|
||||
<div infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy" infinite-scroll-distance="1" id="feed-accordion">
|
||||
<div ng-repeat="entry in entryList.entries" class="entry">
|
||||
<a href="{{entry.url}}" target="_blank" class="entry-heading" ng-click="entryClicked(entry, $event)" ng-class="{unread: entry.read == false, open: current == entry, closed: current != entry}">
|
||||
<span ng-show="selectedType == 'category'">{{entry.feedName}}
|
||||
- </span>{{entry.title}} <span class="pull-right">{{entry.date}}</span>
|
||||
</a>
|
||||
<div class="entry-body" ui-if="isOpen && current == entry">
|
||||
<div>
|
||||
<h4>
|
||||
<a href="{{entry.url}}" target="_blank">{{entry.title}}</a>
|
||||
</h4>
|
||||
</div>
|
||||
<div ng-bind-html-unsafe="entry.content"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="no-entries" ng-show="entryList.entries.length == 0">"{{entryList.name}}" has no unread items.</div>
|
||||
<div ng-show="busy">Loading data...</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user