summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 03:55:52 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-09-11 03:55:52 +0200
commitea9ebd4826fe9807af5bc17e786b3dc58f163970 (patch)
tree2894b40614ebe977797cea5745b215e2a2851f61
parent594b92f649d8ed8a705f1af23639463078170d46 (diff)
port to es5 and add es6 shims for object prototypes instead
-rw-r--r--js/Gruntfile.js25
-rw-r--r--js/app/App.js2
-rw-r--r--js/app/Config.js18
-rw-r--r--js/app/Run.js54
-rw-r--r--js/bower.json2
-rw-r--r--js/build/app.js2746
-rw-r--r--js/build/app.min.js2
-rw-r--r--js/controller/AppController.js3
-rw-r--r--js/controller/ContentController.js52
-rw-r--r--js/controller/NavigationController.js70
-rw-r--r--js/controller/SettingsController.js12
-rw-r--r--js/directive/AppNavigationEntryUtils.js16
-rw-r--r--js/directive/NewsAudio.js15
-rw-r--r--js/directive/NewsAutoFocus.js4
-rw-r--r--js/directive/NewsBindUnsafeHtml.js6
-rw-r--r--js/directive/NewsDraggable.js6
-rw-r--r--js/directive/NewsDroppable.js10
-rw-r--r--js/directive/NewsFocus.js10
-rw-r--r--js/directive/NewsReadFile.js12
-rw-r--r--js/directive/NewsScroll.js45
-rw-r--r--js/directive/NewsStopPropagation.js8
-rw-r--r--js/directive/NewsTimeout.js10
-rw-r--r--js/directive/NewsTitleUnreadCount.js10
-rw-r--r--js/directive/NewsTriggerClick.js6
-rw-r--r--js/filter/TrustUrl.js4
-rw-r--r--js/filter/UnreadCountFormatter.js4
-rw-r--r--js/gui/KeyboardShortcuts.js64
-rw-r--r--js/karma.conf.js19
-rw-r--r--js/package.json6
-rw-r--r--js/service/FeedResource.js305
-rw-r--r--js/service/FolderResource.js133
-rw-r--r--js/service/ItemResource.js199
-rw-r--r--js/service/Loading.js4
-rw-r--r--js/service/Publisher.js31
-rw-r--r--js/service/Resource.js117
-rw-r--r--js/service/SettingsResource.js22
-rw-r--r--js/utility/Iterators.js70
-rw-r--r--js/vendor/es6-shim/.bower.json41
-rw-r--r--js/vendor/es6-shim/CHANGELOG.md163
-rw-r--r--js/vendor/es6-shim/Gruntfile.js98
-rw-r--r--js/vendor/es6-shim/README.md221
-rw-r--r--js/vendor/es6-shim/bower.json29
-rw-r--r--js/vendor/es6-shim/component.json23
-rw-r--r--js/vendor/es6-shim/es6-sham.js106
-rw-r--r--js/vendor/es6-shim/es6-sham.map1
-rw-r--r--js/vendor/es6-shim/es6-sham.min.js2
-rw-r--r--js/vendor/es6-shim/es6-shim.js1928
-rw-r--r--js/vendor/es6-shim/es6-shim.map1
-rw-r--r--js/vendor/es6-shim/es6-shim.min.js2
-rw-r--r--js/vendor/es6-shim/package.json69
-rw-r--r--js/vendor/es6-shim/test-sham/index.html22
-rw-r--r--js/vendor/es6-shim/test-sham/set-prototype-of.js24
-rw-r--r--js/vendor/es6-shim/testling.html35
-rw-r--r--js/vendor/momentjs/.bower.json10
-rw-r--r--js/vendor/momentjs/CHANGELOG.md16
-rw-r--r--js/vendor/momentjs/bower.json2
-rw-r--r--js/vendor/momentjs/locale/ar.js78
-rw-r--r--js/vendor/momentjs/locale/cs.js2
-rw-r--r--js/vendor/momentjs/min/locales.js80
-rw-r--r--js/vendor/momentjs/min/locales.min.js2
-rw-r--r--js/vendor/momentjs/min/moment-with-locales.js177
-rw-r--r--js/vendor/momentjs/min/moment-with-locales.min.js12
-rw-r--r--js/vendor/momentjs/min/moment.min.js5
-rw-r--r--js/vendor/momentjs/moment.js97
-rw-r--r--js/vendor/traceur-runtime/.bower.json21
-rw-r--r--js/vendor/traceur-runtime/README.md35
-rw-r--r--js/vendor/traceur-runtime/bower.json11
-rw-r--r--js/vendor/traceur-runtime/traceur-runtime.js2412
-rw-r--r--js/vendor/traceur-runtime/traceur-runtime.min.js2412
-rw-r--r--js/vendor/traceur-runtime/traceur-runtime.min.map1
70 files changed, 5259 insertions, 7001 deletions
diff --git a/js/Gruntfile.js b/js/Gruntfile.js
index f2df36050..71f2fea30 100644
--- a/js/Gruntfile.js
+++ b/js/Gruntfile.js
@@ -20,9 +20,6 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-wrap');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-ng-annotate');
- // buggy, wait until it uses traceur 0.0.60
- // grunt.loadNpmTasks('grunt-traceur');
- grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-protractor-runner');
grunt.loadNpmTasks('grunt-protractor-webdriver');
@@ -65,26 +62,6 @@ module.exports = function (grunt) {
}
}
},
- // in place because grunt-traceur is buggy, remove when traceur 0.0.60
- // is supported
- shell: {
- traceur: {
- command: 'node_modules/traceur/traceur --block-binding true --out build/app.js --experimental --script build/app.js'
- }
- },
- /*traceur: {
- app: {
- files: [{
- src: ['<%= meta.production %>app.js'],
- dest: '<%= meta.production %>test.js'
- }]
- },
- options: {
- experimental: true,
- modules: 'inline'
- }
- },*/
-
wrap: {
basic: {
src: ['<%= meta.production %>app.js'],
@@ -183,7 +160,7 @@ module.exports = function (grunt) {
});
// make tasks available under simpler commands
- grunt.registerTask('default', ['jshint', 'concat', 'wrap', 'shell:traceur', 'ngAnnotate', 'uglify']);
+ grunt.registerTask('default', ['jshint', 'concat', 'wrap', 'ngAnnotate', 'uglify']);
grunt.registerTask('dev', ['watch:concat']);
grunt.registerTask('test', ['karma:unit']);
grunt.registerTask('php', ['watch:phpunit']);
diff --git a/js/app/App.js b/js/app/App.js
index 3dbc907da..947a68a2e 100644
--- a/js/app/App.js
+++ b/js/app/App.js
@@ -7,4 +7,4 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-let app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); \ No newline at end of file
+var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); \ No newline at end of file
diff --git a/js/app/Config.js b/js/app/Config.js
index 986699090..b922e0aa1 100644
--- a/js/app/Config.js
+++ b/js/app/Config.js
@@ -10,7 +10,7 @@
app.config(function ($routeProvider, $provide, $httpProvider) {
'use strict';
- const feedType = {
+ var feedType = {
FEED: 0,
FOLDER: 1,
STARRED: 2,
@@ -25,9 +25,9 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
$provide.constant('FEED_TYPE', feedType);
// make sure that the CSRF header is only sent to the ownCloud domain
- $provide.factory('CSRFInterceptor', ($q, BASE_URL) => {
+ $provide.factory('CSRFInterceptor', function ($q, BASE_URL) {
return {
- request: (config) => {
+ request: function (config) {
if (config.url.indexOf(BASE_URL) === 0) {
config.headers.requesttoken = csrfToken;
}
@@ -39,7 +39,7 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
$httpProvider.interceptors.push('CSRFInterceptor');
// routing
- const getResolve = (type) => {
+ var getResolve = function (type) {
return {
// request to items also returns feeds
data: [
@@ -48,9 +48,9 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
'$q',
'BASE_URL',
'ITEM_BATCH_SIZE',
- ($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) => {
+ function ($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) {
- const parameters = {
+ var parameters = {
type: type,
limit: ITEM_BATCH_SIZE
};
@@ -59,13 +59,13 @@ app.config(function ($routeProvider, $provide, $httpProvider) {
parameters.id = $route.current.params.id;
}
- let deferred = $q.defer();
+ var deferred = $q.defer();
$http({
- url: `${BASE_URL}/items`,
+ url: BASE_URL + '/items',
method: 'GET',
params: parameters
- }).success((data) => {
+ }).success(function (data) {
deferred.resolve(data);
});
diff --git a/js/app/Run.js b/js/app/Run.js
index 9b068910c..33c75c2b4 100644
--- a/js/app/Run.js
+++ b/js/app/Run.js
@@ -7,9 +7,9 @@
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
-app.run(($rootScope, $location, $http, $q, $interval, Loading, ItemResource,
- FeedResource, FolderResource, SettingsResource, Publisher, BASE_URL,
- FEED_TYPE, REFRESH_RATE) => {
+app.run(function ($rootScope, $location, $http, $q, $interval, Loading,
+ ItemResource, FeedResource, FolderResource, SettingsResource,
+ Publisher, BASE_URL, FEED_TYPE, REFRESH_RATE) {
'use strict';
// show Loading screen
@@ -17,32 +17,32 @@ app.run(($rootScope, $location, $http, $q, $interval, Loading, ItemResource,
// listen to keys in returned queries to automatically distribute the
// incoming values to models
- Publisher.subscribe(ItemResource).toChannels('items', 'newestItemId',
- 'starred');
- Publisher.subscribe(FolderResource).toChannels('folders');
- Publisher.subscribe(FeedResource).toChannels('feeds');
- Publisher.subscribe(SettingsResource).toChannels('settings');
+ Publisher.subscribe(ItemResource).toChannels(['items', 'newestItemId',
+ 'starred']);
+ Publisher.subscribe(FolderResource).toChannels(['folders']);
+ Publisher.subscribe(FeedResource).toChannels(['feeds']);
+ Publisher.subscribe(SettingsResource).toChannels(['settings']);
// load feeds, settings and last read feed
- let settingsDeferred = $q.defer();
- $http.get(`${BASE_URL}/settings`).success((data) => {
+ var settingsDeferred = $q.defer();
+ $http.get(BASE_URL + '/settings').success(function (data) {
Publisher.publishAll(data);
settingsDeferred.resolve();
});
- let activeFeedDeferred = $q.defer();
- let path = $location.path();
- $http.get(`${BASE_URL}/feeds/active`).success((data) => {
- let url;
+ var activeFeedDeferred = $q.defer();
+ var path = $location.path();
+ $http.get(BASE_URL + '/feeds/active').success(function (data) {
+ var url;
switch (data.activeFeed.type) {
case FEED_TYPE.FEED:
- url = `/items/feeds/${data.activeFeed.id}`;
+ url = '/items/feeds/' + data.activeFeed.id;
break;
case FEED_TYPE.FOLDER:
- url = `/items/folders/${data.activeFeed.id}`;
+ url = '/items/folders/' + data.activeFeed.id;
break;
case FEED_TYPE.STARRED:
@@ -61,14 +61,14 @@ app.run(($rootScope, $location, $http, $q, $interval, Loading, ItemResource,
activeFeedDeferred.resolve();
});
- let folderDeferred = $q.defer();
- $http.get(`${BASE_URL}/folders`).success((data) => {
+ var folderDeferred = $q.defer();
+ $http.get(BASE_URL + '/folders').success(function (data) {
Publisher.publishAll(data);
folderDeferred.resolve();
});
- let feedDeferred = $q.defer();
- $http.get(`${BASE_URL}/feeds`).success((data) => {
+ var feedDeferred = $q.defer();
+ $http.get(BASE_URL + '/feeds').success(function (data) {
Publisher.publishAll(data);
feedDeferred.resolve();
});
@@ -82,27 +82,27 @@ app.run(($rootScope, $location, $http, $q, $interval, Loading, ItemResource,
folderDeferred.promise
]
)
- .then(() => {
+ .then(function () {
Loading.setLoading('global', false);
});
// refresh feeds and folders
- $interval(() => {
- $http.get(`${BASE_URL}/feeds`);
- $http.get(`${BASE_URL}/folders`);
+ $interval(function () {
+ $http.get(BASE_URL + '/feeds');
+ $http.get(BASE_URL + '/folders');
}, REFRESH_RATE * 1000);
- $rootScope.$on('$routeChangeStart', () => {
+ $rootScope.$on('$routeChangeStart', function () {
Loading.setLoading('content', true);
});
- $rootScope.$on('$routeChangeSuccess', () => {
+ $rootScope.$on('$routeChangeSuccess', function () {
Loading.setLoading('content', false);
});
// in case of wrong id etc show all items
- $rootScope.$on('$routeChangeError', () => {
+ $rootScope.$on('$routeChangeError', function () {
$location.path('/items');
});
diff --git a/js/bower.json b/js/bower.json
index a069fe820..034b43979 100644
--- a/js/bower.json
+++ b/js/bower.json
@@ -31,6 +31,6 @@
"angular-animate": "~1.3.*",
"jquery": "~2.*",
"momentjs": "~2.8.*",
- "traceur-runtime": "~0.0.61"
+ "es6-shim": "~0.18.0"
}
}
diff --git a/js/build/app.js b/js/build/app.js
index 3cfe28892..34dea4dec 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -1,1420 +1,1692 @@
-(function(window, document, angular, $, OC, csrfToken, undefined) {
- 'use strict';
- var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']);
- app.config(["$routeProvider", "$provide", "$httpProvider", function($routeProvider, $provide, $httpProvider) {
+(function(window, document, angular, $, OC, csrfToken, undefined){
+
+'use strict';
+
+
+var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']);
+app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvider, $provide, $httpProvider) {
'use strict';
+
var feedType = {
- FEED: 0,
- FOLDER: 1,
- STARRED: 2,
- SUBSCRIPTIONS: 3,
- SHARED: 4
- };
- $provide.constant('REFRESH_RATE', 60);
- $provide.constant('ITEM_BATCH_SIZE', 50);
+ FEED: 0,
+ FOLDER: 1,
+ STARRED: 2,
+ SUBSCRIPTIONS: 3,
+ SHARED: 4
+ };
+
+ // constants
+ $provide.constant('REFRESH_RATE', 60); // seconds
+ $provide.constant('ITEM_BATCH_SIZE', 50); // how many items to autopage by
$provide.constant('BASE_URL', OC.generateUrl('/apps/news'));
$provide.constant('FEED_TYPE', feedType);
- $provide.factory('CSRFInterceptor', (["$q", "BASE_URL", function($q, BASE_URL) {
- return {request: (function(config) {
- if (config.url.indexOf(BASE_URL) === 0) {
- config.headers.requesttoken = csrfToken;
- }
- return config || $q.when(config);
- })};
- }]));
+
+ // make sure that the CSRF header is only sent to the ownCloud domain
+ $provide.factory('CSRFInterceptor', ["$q", "BASE_URL", function ($q, BASE_URL) {
+ return {
+ request: function (config) {
+ if (config.url.indexOf(BASE_URL) === 0) {
+ config.headers.requesttoken = csrfToken;
+ }
+
+ return config || $q.when(config);
+ }
+ };
+ }]);
$httpProvider.interceptors.push('CSRFInterceptor');
- var getResolve = (function(type) {
- return {data: ['$http', '$route', '$q', 'BASE_URL', 'ITEM_BATCH_SIZE', (function($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) {
- var parameters = {
- type: type,
- limit: ITEM_BATCH_SIZE
- };
- if ($route.current.params.id !== undefined) {
- parameters.id = $route.current.params.id;
- }
- var deferred = $q.defer();
- $http({
- url: (BASE_URL + "/items"),
- method: 'GET',
- params: parameters
- }).success((function(data) {
- deferred.resolve(data);
- }));
- return deferred.promise;
- })]};
- });
- $routeProvider.when('/items', {
- controller: 'ContentController as Content',
- templateUrl: 'content.html',
- resolve: getResolve(feedType.SUBSCRIPTIONS),
- type: feedType.SUBSCRIPTIONS
- }).when('/items/starred', {
- controller: 'ContentController as Content',
- templateUrl: 'content.html',
- resolve: getResolve(feedType.STARRED),
- type: feedType.STARRED
- }).when('/items/feeds/:id', {
- controller: 'ContentController as Content',
- templateUrl: 'content.html',
- resolve: getResolve(feedType.FEED),
- type: feedType.FEED
- }).when('/items/folders/:id', {
- controller: 'ContentController as Content',
- templateUrl: 'content.html',
- resolve: getResolve(feedType.FOLDER),
- type: feedType.FOLDER
- });
- }]);
- app.run((["$rootScope", "$location", "$http", "$q", "$interval", "Loading", "ItemResource", "FeedResource", "FolderResource", "SettingsResource", "Publisher", "BASE_URL", "FEED_TYPE", "REFRESH_RATE", function($rootScope, $location, $http, $q, $interval, Loading, ItemResource, FeedResource, FolderResource, SettingsResource, Publisher, BASE_URL, FEED_TYPE, REFRESH_RATE) {
+
+ // routing
+ var getResolve = function (type) {
+ return {
+ // request to items also returns feeds
+ data: [
+ '$http',
+ '$route',
+ '$q',
+ 'BASE_URL',
+ 'ITEM_BATCH_SIZE',
+ function ($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) {
+
+ var parameters = {
+ type: type,
+ limit: ITEM_BATCH_SIZE
+ };
+
+ if ($route.current.params.id !== undefined) {
+ parameters.id = $route.current.params.id;
+ }
+
+ var deferred = $q.defer();
+
+ $http({
+ url: BASE_URL + '/items',
+ method: 'GET',
+ params: parameters
+ }).success(function (data) {
+ deferred.resolve(data);
+ });
+
+ return deferred.promise;
+ }
+ ]
+ };
+ };
+
+ $routeProvider
+ .when('/items', {
+ controller: 'ContentController as Content',
+ templateUrl: 'content.html',
+ resolve: getResolve(feedType.SUBSCRIPTIONS),
+ type: feedType.SUBSCRIPTIONS
+ })
+ .when('/items/starred', {
+ controller: 'ContentController as Content',
+ templateUrl: 'content.html',
+ resolve: getResolve(feedType.STARRED),
+ type: feedType.STARRED
+ })
+ .when('/items/feeds/:id', {
+ controller: 'ContentController as Content',
+ templateUrl: 'content.html',
+ resolve: getResolve(feedType.FEED),
+ type: feedType.FEED
+ })
+ .when('/items/folders/:id', {
+ controller: 'ContentController as Content',
+ templateUrl: 'content.html',
+ resolve: getResolve(feedType.FOLDER),
+ type: feedType.FOLDER
+ });
+
+}]);
+
+
+app.run(["$rootScope", "$location", "$http", "$q", "$interval", "Loading", "ItemResource", "FeedResource", "FolderResource", "SettingsResource", "Publisher", "BASE_URL", "FEED_TYPE", "REFRESH_RATE", function ($rootScope, $location, $http, $q, $interval, Loading,
+ ItemResource, FeedResource, FolderResource, SettingsResource,
+ Publisher, BASE_URL, FEED_TYPE, REFRESH_