summaryrefslogtreecommitdiffstats
path: root/js/build/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/build/app.js')
-rw-r--r--js/build/app.js96
1 files changed, 52 insertions, 44 deletions
diff --git a/js/build/app.js b/js/build/app.js
index ff4f5d3f4..007521016 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -333,6 +333,10 @@ app.controller('AppController',
this.isFirstRun = function () {
return FeedResource.size() === 0 && FolderResource.size() === 0;
};
+
+ this.play = function (item) {
+ this.playingItem = item;
+ };
}]);
app.controller('ContentController',
["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", "$location", "FEED_TYPE", "ITEM_AUTO_PAGE_SIZE", "Loading", function (Publisher, FeedResource, ItemResource, SettingsResource, data,
@@ -518,6 +522,16 @@ app.controller('ContentController',
$route.reload();
};
+ this.getMediaType = function (type) {
+ if (type && type.indexOf('audio') === 0) {
+ return 'audio';
+ } else if (type && type.indexOf('video') === 0) {
+ return 'video';
+ } else {
+ return undefined;
+ }
+ };
+
}]);
app.controller('ExploreController', ["sites", "$rootScope", "FeedResource", function (sites, $rootScope, FeedResource) {
'use strict';
@@ -2630,50 +2644,6 @@ app.directive('newsDroppable', ["$rootScope", function ($rootScope) {
elem.droppable(details);
};
}]);
-app.directive('newsEnclosure', function () {
- 'use strict';
- return {
- restrict: 'E',
- scope: {
- link: '@',
- type: '@'
- },
- transclude: true,
- template: '<div>' +
- '<video controls preload="none" ' +
- 'ng-show="mediaType==\'video\' && !cantPlay()">' +
- '<source ng-src="{{ link|trustUrl }}" type="{{ type }}">' +
- '</video>' +
- '<audio controls preload="none" ' +
- 'ng-show="mediaType==\'audio\' && !cantPlay()">' +
- '<source ng-src="{{ link|trustUrl }}" type="{{ type }}">' +
- '</audio>' +
- '<div ng-transclude ng-show="cantPlay()"></div>' +
- '</div>',
- link: function (scope, elem) {
- if (scope.type.indexOf('audio') === 0) {
- scope.mediaType = 'audio';
- } else {
- scope.mediaType = 'video';
- }
- var source = elem.children()
- .children(scope.mediaType)
- .children('source')[0];
-
- var cantPlay = false;
-
- scope.cantPlay = function () {
- return cantPlay;
- };
-
- source.addEventListener('error', function () {
- scope.$apply(function () {
- cantPlay = true;
- });
- });
- }
- };
-});
app.directive('newsFinishedTransition', function () {
'use strict';
@@ -2697,6 +2667,26 @@ app.directive('newsFocus', ["$timeout", "$interpolate", function ($timeout, $int
};
}]);
+/**
+ * Pause playback on elements other than the current one
+ */
+app.directive('newsPlayOne', ["$rootScope", function ($rootScope) {
+ 'use strict';
+ return {
+ restrict: 'A',
+ link: function (scope, elem) {
+ elem.on('play', function () {
+ $rootScope.$broadcast('playing', elem);
+ });
+
+ $rootScope.$on('playing', function (scope, args) {
+ if (args[0] !== elem[0]) {
+ elem[0].pause();
+ }
+ });
+ }
+ };
+}]);
app.directive('newsPullToRefresh', ["$rootScope", function ($rootScope) {
'use strict';
@@ -2885,6 +2875,24 @@ app.directive('newsSearch', ["$document", "$location", function ($document, $loc
}
};
}]);
+app.directive('newsStickyMenu', function () {
+ 'use strict';
+
+ return function (scope, elem, attr) {
+ var height = 40;
+
+ $(attr.newsStickyMenu).scroll(function () {
+ var scrollHeight = $(this).scrollTop();
+
+ if (scrollHeight > height) {
+ elem.addClass('fixed');
+ elem.css('top', scrollHeight);
+ } else {
+ elem.removeClass('fixed');
+ }
+ });
+ };
+});
app.directive('newsStopPropagation', function () {
'use strict';
return {