diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/Gruntfile.coffee | 1 | ||||
-rw-r--r-- | js/app/directives/audio.coffee | 4 | ||||
-rw-r--r-- | js/app/filters/trusturl.coffee | 25 | ||||
-rw-r--r-- | js/config/karma.js | 1 | ||||
-rw-r--r-- | js/package.json | 4 | ||||
-rw-r--r-- | js/public/app.js | 36 |
6 files changed, 67 insertions, 4 deletions
diff --git a/js/Gruntfile.coffee b/js/Gruntfile.coffee index e7b25cc6a..169fabc4f 100644 --- a/js/Gruntfile.coffee +++ b/js/Gruntfile.coffee @@ -57,6 +57,7 @@ module.exports = (grunt) -> src: [ '<%= meta.build %>app/app.js' '<%= meta.build %>app/directives/*.js' + '<%= meta.build %>app/filters/*.js' '<%= meta.build %>app/controllers/*.js' '<%= meta.build %>app/services/**/*.js' ] diff --git a/js/app/directives/audio.coffee b/js/app/directives/audio.coffee index f180cfbeb..3d6d94062 100644 --- a/js/app/directives/audio.coffee +++ b/js/app/directives/audio.coffee @@ -29,9 +29,9 @@ angular.module('News').directive 'newsAudio', -> transclude: true template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + - '<source src="{{ src }}">' + + '<source ng-src="{{ src|trustUrl }}">' + '</audio>' + - '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' + + '<a ng-href="{{ src|trustUrl }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>' link: (scope, elm, attrs) -> source = elm.children().children('source')[0] diff --git a/js/app/filters/trusturl.coffee b/js/app/filters/trusturl.coffee new file mode 100644 index 000000000..d63eafd28 --- /dev/null +++ b/js/app/filters/trusturl.coffee @@ -0,0 +1,25 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. + +### + +angular.module('News').filter 'trustUrl', ['$sce', ($sce) -> + return (url) -> $sce.trustAsResourceUrl(url) +] diff --git a/js/config/karma.js b/js/config/karma.js index 4fe0db5e2..c6c983bb6 100644 --- a/js/config/karma.js +++ b/js/config/karma.js @@ -41,6 +41,7 @@ module.exports = function(config) { 'tests/stubs/modules.js', 'build/app/directives/*.js', 'build/app/services/**/*.js', + 'build/app/filters/**/*.js', 'build/app/controllers/**/*.js', 'build/tests/**/*Spec.js' ], diff --git a/js/package.json b/js/package.json index 3da2cbe60..0b9c906f3 100644 --- a/js/package.json +++ b/js/package.json @@ -27,7 +27,9 @@ "grunt-wrap": "*", "grunt-phpunit": "*", "karma-jasmine": "*", - "karma-phantomjs-launcher": "*" + "karma-phantomjs-launcher": "*", + "karma-chrome-launcher": "*", + "karma-firefox-launcher": "*" }, "engine": "node >= 0.8" } diff --git a/js/public/app.js b/js/public/app.js index 0c94f1a57..c1c2363be 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -102,7 +102,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. type: '@' }, transclude: true, - template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source src="{{ src }}">' + '</audio>' + '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>', + template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source ng-src="{{ src|trustUrl }}">' + '</audio>' + '<a ng-href="{{ src|trustUrl }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>', link: function(scope, elm, attrs) { var cantPlay, source; source = elm.children().children('source')[0]; @@ -940,6 +940,40 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ownCloud - News +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +(function() { + angular.module('News').filter('trustUrl', [ + '$sce', function($sce) { + return function(url) { + return $sce.trustAsResourceUrl(url); + }; + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + @author Alessandro Cosentino @copyright 2013 Alessandro Cosentino cosenal@gmail.com |