move queuelist to it's own file
This commit is contained in:
parent
28c769dfae
commit
735c6e1229
3 changed files with 44 additions and 40 deletions
|
@ -52,8 +52,8 @@ function FeedCtrl($scope, $routeParams, $location, feeds, pageSwitcher) {
|
||||||
pageSwitcher.setBack('feeds');
|
pageSwitcher.setBack('feeds');
|
||||||
}
|
}
|
||||||
|
|
||||||
function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, downloader, newQueueList) {
|
function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, downloader, queueList, pageChanger) {
|
||||||
$scope.queue = newQueueList.getQueueList();
|
$scope.queue = queueList.getQueueList();
|
||||||
|
|
||||||
$scope.playItem = function(id) {
|
$scope.playItem = function(id) {
|
||||||
feedItems.get(id, function(feedItem) {
|
feedItems.get(id, function(feedItem) {
|
||||||
|
|
42
js/queueList.js
Normal file
42
js/queueList.js
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
angular.module('podcasts.queueList', ['podcasts.database'])
|
||||||
|
.run(['queueList', function(queueList) {
|
||||||
|
queueList.rebuildList();
|
||||||
|
}])
|
||||||
|
.service('queueList', ['db', '$rootScope', function(oldDb, $rootScope) {
|
||||||
|
var queueList = [];
|
||||||
|
|
||||||
|
function getQueueList() {
|
||||||
|
return queueList;
|
||||||
|
}
|
||||||
|
|
||||||
|
function rebuildList() {
|
||||||
|
queueList = [];
|
||||||
|
|
||||||
|
oldDb.getCursor("feedItem", function(ixDbCursorReq)
|
||||||
|
{
|
||||||
|
if(typeof ixDbCursorReq !== "undefined") {
|
||||||
|
ixDbCursorReq.onsuccess = function (e) {
|
||||||
|
var cursor = ixDbCursorReq.result || e.result;
|
||||||
|
if (cursor) {
|
||||||
|
// This additional check is necessary, since the index doesn't seem to always catch correctly
|
||||||
|
if (cursor.value.queued) {
|
||||||
|
queueList.push(cursor.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor.continue();
|
||||||
|
} else {
|
||||||
|
$rootScope.$apply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, undefined, IDBKeyRange.only(1), false, 'ixQueued');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
rebuildList: rebuildList,
|
||||||
|
getQueueList: function() {
|
||||||
|
return queueList;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}])
|
||||||
|
;
|
|
@ -545,44 +545,6 @@ angular.module('podcasts.settings', ['podcasts.database'])
|
||||||
}])
|
}])
|
||||||
;
|
;
|
||||||
|
|
||||||
angular.module('podcasts.queueList', ['podcasts.database'])
|
|
||||||
.run(['newQueueList', function(queueList) {
|
|
||||||
queueList.rebuildList();
|
|
||||||
}])
|
|
||||||
.service('newQueueList', ['db', '$rootScope', function(oldDb, $rootScope) {
|
|
||||||
var queueList = [];
|
|
||||||
|
|
||||||
function getQueueList() {
|
|
||||||
return queueList;
|
|
||||||
}
|
|
||||||
|
|
||||||
function rebuildList() {
|
|
||||||
oldDb.getCursor("feedItem", function(ixDbCursorReq)
|
|
||||||
{
|
|
||||||
if(typeof ixDbCursorReq !== "undefined") {
|
|
||||||
ixDbCursorReq.onsuccess = function (e) {
|
|
||||||
var cursor = ixDbCursorReq.result || e.result;
|
|
||||||
if (cursor) {
|
|
||||||
// This additional check is necessary, since the index doesn't seem to always catch correctly
|
|
||||||
if (cursor.value.queued) {
|
|
||||||
queueList.push(cursor.value);
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor.continue();
|
|
||||||
} else {
|
|
||||||
$rootScope.$apply();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, undefined, IDBKeyRange.only(1), false, 'ixQueued');
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
rebuildList: rebuildList,
|
|
||||||
getQueueList: getQueueList
|
|
||||||
};
|
|
||||||
}])
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
angular.module('podcasts.importer', ['podcasts.utilities', 'podcasts.services'])
|
angular.module('podcasts.importer', ['podcasts.utilities', 'podcasts.services'])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue