From 218f7821cb9ccb23a0c2c37548fdadadcc8c59f0 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 13 Sep 2014 03:05:47 +0200 Subject: remove angular-animate from build, update bower packages --- js/app/App.js | 2 +- js/bower.json | 1 - js/build/app.js | 2 +- js/build/app.min.js | 2 +- js/karma.conf.js | 1 - js/tests/unit/stubs/App.js | 7 +- js/vendor/angular-animate/.bower.json | 18 - js/vendor/angular-animate/README.md | 54 - js/vendor/angular-animate/angular-animate.js | 1880 -------------------- js/vendor/angular-animate/angular-animate.min.js | 29 - .../angular-animate/angular-animate.min.js.map | 8 - js/vendor/angular-animate/bower.json | 8 - js/vendor/angular-mocks/.bower.json | 10 +- js/vendor/angular-mocks/angular-mocks.js | 4 +- js/vendor/angular-mocks/bower.json | 4 +- js/vendor/angular-route/.bower.json | 10 +- js/vendor/angular-route/angular-route.js | 3 +- js/vendor/angular-route/angular-route.min.js | 2 +- js/vendor/angular-route/angular-route.min.js.map | 2 +- js/vendor/angular-route/bower.json | 4 +- js/vendor/angular-sanitize/.bower.json | 10 +- js/vendor/angular-sanitize/angular-sanitize.js | 2 +- js/vendor/angular-sanitize/angular-sanitize.min.js | 2 +- js/vendor/angular-sanitize/bower.json | 4 +- js/vendor/angular/.bower.json | 8 +- js/vendor/angular/angular.js | 1320 ++++++++------ js/vendor/angular/angular.min.js | 460 ++--- js/vendor/angular/angular.min.js.gzip | Bin 42876 -> 43132 bytes js/vendor/angular/angular.min.js.map | 6 +- js/vendor/angular/bower.json | 2 +- js/vendor/es6-shim/.bower.json | 3 +- templates/index.php | 1 - templates/part.navigation.feed.php | 1 - templates/part.navigation.folder.php | 1 - 34 files changed, 1009 insertions(+), 2862 deletions(-) delete mode 100644 js/vendor/angular-animate/.bower.json delete mode 100644 js/vendor/angular-animate/README.md delete mode 100644 js/vendor/angular-animate/angular-animate.js delete mode 100644 js/vendor/angular-animate/angular-animate.min.js delete mode 100644 js/vendor/angular-animate/angular-animate.min.js.map delete mode 100644 js/vendor/angular-animate/bower.json diff --git a/js/app/App.js b/js/app/App.js index 947a68a2e..4f6a47a96 100644 --- a/js/app/App.js +++ b/js/app/App.js @@ -7,4 +7,4 @@ * @author Bernhard Posselt * @copyright Bernhard Posselt 2014 */ -var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); \ No newline at end of file +var app = angular.module('News', ['ngRoute', 'ngSanitize']); \ No newline at end of file diff --git a/js/bower.json b/js/bower.json index 034b43979..5bc5f1aa9 100644 --- a/js/bower.json +++ b/js/bower.json @@ -28,7 +28,6 @@ "angular-route": "~1.3.*", "angular-mocks": "~1.3.*", "angular-sanitize": "~1.3.*", - "angular-animate": "~1.3.*", "jquery": "~2.*", "momentjs": "~2.8.*", "es6-shim": "~0.18.0" diff --git a/js/build/app.js b/js/build/app.js index 46872de63..ab6c4e8ee 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -3,7 +3,7 @@ 'use strict'; -var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); +var app = angular.module('News', ['ngRoute', 'ngSanitize']); app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvider, $provide, $httpProvider) { 'use strict'; diff --git a/js/build/app.min.js b/js/build/app.min.js index 7cafbc385..05f5ed7b6 100644 --- a/js/build/app.min.js +++ b/js/build/app.min.js @@ -1 +1 @@ -!function(a,b,c,d,e,f,g){"use strict";var h=c.module("News",["ngRoute","ngSanitize","ngAnimate"]);h.config(["$routeProvider","$provide","$httpProvider",function(a,b,c){var d={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4};b.constant("REFRESH_RATE",60),b.constant("ITEM_BATCH_SIZE",50),b.constant("BASE_URL",e.generateUrl("/apps/news")),b.constant("FEED_TYPE",d),b.factory("CSRFInterceptor",["$q","BASE_URL",function(a,b){return{request:function(c){return 0===c.url.indexOf(b)&&(c.headers.requesttoken=f),c||a.when(c)}}}]),c.interceptors.push("CSRFInterceptor");var h=function(a){return{data:["$http","$route","$q","BASE_URL","ITEM_BATCH_SIZE",function(b,c,d,e,f){var h={type:a,limit:f};c.current.params.id!==g&&(h.id=c.current.params.id);var i=d.defer();return b({url:e+"/items",method:"GET",params:h}).success(function(a){i.resolve(a)}),i.promise}]}};a.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.SUBSCRIPTIONS),type:d.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.STARRED),type:d.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FEED),type:d.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FOLDER),type:d.FOLDER})}]),h.run(["$rootScope","$location","$http","$q","$interval","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){f.setLoading("global",!0),k.subscribe(g).toChannels(["items","newestItemId","starred"]),k.subscribe(i).toChannels(["folders"]),k.subscribe(h).toChannels(["feeds"]),k.subscribe(j).toChannels(["settings"]);var o=d.defer();c.get(l+"/settings").success(function(a){k.publishAll(a),o.resolve()});var p=d.defer(),q=b.path();c.get(l+"/feeds/active").success(function(a){var c;switch(a.activeFeed.type){case m.FEED:c="/items/feeds/"+a.activeFeed.id;break;case m.FOLDER:c="/items/folders/"+a.activeFeed.id;break;case m.STARRED:c="/items/starred";break;default:c="/items"}/^\/items(\/(starred|feeds\/\d+|folders\/\d+))?\/?$/.test(q)||b.path(c),p.resolve()});var r=d.defer();c.get(l+"/folders").success(function(a){k.publishAll(a),r.resolve()});var s=d.defer();c.get(l+"/feeds").success(function(a){k.publishAll(a),s.resolve()}),d.all([o.promise,p.promise,s.promise,r.promise]).then(function(){f.setLoading("global",!1)}),e(function(){c.get(l+"/feeds"),c.get(l+"/folders")},1e3*n),a.$on("$routeChangeStart",function(){f.setLoading("content",!0)}),a.$on("$routeChangeSuccess",function(){f.setLoading("content",!1)}),a.$on("$routeChangeError",function(){b.path("/items")})}]),h.controller("AppController",["Loading","FeedResource","FolderResource",function(a,b,c){this.loading=a,this.isFirstRun=function(){return 0===b.size()&&0===c.size()}}]),h.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","FEED_TYPE",function(a,b,c,d,e,f,h,i){c.clear(),a.publishAll(e),this.isAutoPagingEnabled=!0,this.getItems=function(){return c.getAll()},this.toggleStar=function(a){c.toggleStar(a)},this.toggleItem=function(a){this.isCompactView()&&(a.show=!a.show)},this.markRead=function(a){var d=c.get(a);d.keepUnread||d.unread!==!0||(c.markItemRead(a),b.markItemOfFeedRead(d.feedId))},this.getFeed=function(a){return b.getById(a)},this.toggleKeepUnread=function(a){var d=c.get(a);d.unread||(b.markItemOfFeedUnread(d.feedId),c.markItemRead(a,!1)),d.keepUnread=!d.keepUnread},this.orderBy=function(){return d.get("oldestFirst")?"id":"-id"},this.isCompactView=function(){return d.get("compact")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!d.get("preventReadOnScroll")},this.scrollRead=function(a){var d=[],e=[];a.forEach(function(a){var b=c.get(a);b.keepUnread||(d.push(a),e.push(b.feedId))}),b.markItemsOfFeedsRead(e),c.markItemsRead(d)},this.isFeed=function(){return f.current.$$route.type===i.FEED},this.autoPage=function(){this.isAutoPagingEnabled=!1;var b=f.current.$$route.type,d=h.id,e=this;c.autoPage(b,d).success(function(b){a.publishAll(b),b.items.length>0&&(e.isAutoPagingEnabled=!0)}).error(function(){e.isAutoPagingEnabled=!0})},this.getRelativeDate=function(a){if(a!==g&&""!==a){var b=d.get("language"),c=moment.unix(a).locale(b).fromNow()+"";return c}return""}}]),h.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location",function(a,b,c,d,e,f,h,i,j){this.feedError="",this.folderError="",this.getFeeds=function(){return c.getAll()},this.getFolders=function(){return d.getAll()},this.markFolderRead=function(a){c.markFolderRead(a),c.getByFolderId(a).forEach(function(a){e.markFeedRead(a.id)})},this.markFeedRead=function(a){e.markFeedRead(a),c.markFeedRead(a)},this.markRead=function(){e.markRead(),c.markRead()},this.isShowAll=function(){return f.get("showAll")},this.getFeedsOfFolder=function(a){return c.getByFolderId(a)},this.getUnreadCount=function(){return c.getUnreadCount()},this.getFeedUnreadCount=function(a){var b=c.getById(a);return b!==g?b.unreadCount:0},this.getFolderUnreadCount=function(a){return c.getFolderUnreadCount(a)},this.getStarredCount=function(){return e.getStarredCount()},this.toggleFolder=function(a){d.toggleOpen(a)},this.hasFeeds=function(a){return c.getFolderUnreadCount(a)!==g},this.subFeedActive=function(d){var e=a.current.$$route.type;if(e===b.FEED){var f=c.getById(a.current.params.id);if(f!==g&&f.folderId===d)return!0}return!1},this.isSubscriptionsActive=function(){return a.current&&a.current.$$route.type===b.SUBSCRIPTIONS},this.isStarredActive=function(){return a.current&&a.current.$$route.type===b.STARRED},this.isFolderActive=function(c){var d=parseInt(a.current.params.id,10);return a.current&&a.current.$$route.type===b.FOLDER&&d===c},this.isFeedActive=function(c){var d=parseInt(a.current.params.id,10);return a.current&&a.current.$$route.type===b.FEED&&d===c},this.folderNameExists=function(a){return a=a||"",d.get(a.trim())!==g},this.feedUrlExists=function(a){return a=a||"",a=a.trim(),c.get(a)!==g||c.get("http://"+a)!==g},this.createFeed=function(a){var b=this;this.newFolder=!1,this.addingFeed=!0;var e=a.newFolder,f=a.existingFolder||{id:0};e===g?(f.getsFeed=!0,c.create(a.url,f.id,g).then(function(a){h.publishAll(a),j.path("/items/feeds/"+a.feeds[0].id+"/")}).finally(function(){f.getsFeed=g,a.url="",b.addingFeed=!1})):d.create(e).then(function(c){h.publishAll(c),a.existingFolder=d.get(c.folders[0].name),a.newFolder=g,b.createFeed(a)})},this.createFolder=function(a){var b=this;this.addingFolder=!0,d.create(a.name).then(function(a){h.publishAll(a)}).finally(function(){b.addingFolder=!1,a.name=""})},this.moveFeed=function(b,d){var e=!1,f=c.getById(b);f.folderId!==d&&((this.isFolderActive(f.folderId)||this.isFolderActive(d))&&(e=!0),c.move(b,d),e&&a.reload())},this.renameFeed=function(a){c.rename(a.id,a.title),a.editing=!1},this.renameFolder=function(a,b){a.renameError="",this.renamingFolder=!0;var c=this;a.name===b?(a.renameError="",a.editing=!1,this.renamingFolder=!1):d.rename(a.name,b).then(function(){a.renameError="",a.editing=!1},function(b){a.renameError=b}).finally(function(){c.renamingFolder=!1})},this.reversiblyDeleteFeed=function(a){a.deleted=!0,c.reversiblyDelete(a.id)},this.undoDeleteFeed=function(a){a.deleted=!1,c.undoDelete(a.id)},this.deleteFeed=function(a){c.delete(a.id)},this._deletedFeedsBackup={},this.reversiblyDeleteFolder=function(a){a.deleted=!0;var b=this,e=c.getByFolderId(a.id);e.forEach(function(d){b._deletedFeedsBackup[a.name]=b._deletedFeedsBackup[a.name]||[],b._deletedFeedsBackup[a.name].push(d),c.delete(d.id)}),d.reversiblyDelete(a.id)},this.undoDeleteFolder=function(a){a.deleted=!1;var b=this._deletedFeedsBackup[a.name];b!==g&&c.receive(b),d.undoDelete(a.id)},this.deleteFolder=function(a){delete this._deletedFeedsBackup[a.name],d.delete(a.name)};var k=this;i.$on("moveFeedToFolder",function(a,b){k.moveFeed(b.feedId,b.folderId)})}]),h.controller("SettingsController",["$route","SettingsResource","FeedResource",function(a,b,c){this.importing=!1,this.opmlImportError=!1,this.articleImportError=!1;var d=function(c,d){b.set(c,d),["showAll","oldestFirst"].indexOf(c)>=0&&a.reload()};this.toggleSetting=function(a){d(a,!this.getSetting(a))},this.getSetting=function(a){return b.get(a)},this.feedSize=function(){return c.size()},this.importOpml=function(a){console.log(a)},this.importArticles=function(a){console.log(a)}}]),h.filter("trustUrl",["$sce",function(a){return function(b){return a.trustAsResourceUrl(b)}}]),h.filter("unreadCountFormatter",function(){return function(a){return a>999?"999+":a}}),h.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"url"),this.ids={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=d};return e.prototype=Object.create(a.prototype),e.prototype.receive=function(b){a.prototype.receive.call(this,b),this.updateUnreadCache(),this.updateFolderCache()},e.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var a=this;this.values.forEach(function(b){b.unreadCount&&(a.unreadCount+=b.unreadCount),b.folderId!==g&&(a.folderUnreadCount[b.folderId]=a.folderUnreadCount[b.folderId]||0,a.folderUnreadCount[b.folderId]+=b.unreadCount)})},e.prototype.updateFolderCache=function(){this.folderIds={};var a=this;this.values.forEach(function(b){a.folderIds[b.folderId]=a.folderIds[b.folderId]||[],a.folderIds[b.folderId].push(b)})},e.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==g&&(this.ids[b.id]=this.hashMap[b.url])},e.prototype.markRead=function(){this.values.forEach(function(a){a.unreadCount=0}),this.unreadCount=0,this.folderUnreadCount={}},e.prototype.markFeedRead=function(a){this.ids[a].unreadCount=0,this.updateUnreadCache()},e.prototype.markFolderRead=function(a){this.values.forEach(function(b){b.folderId===a&&(b.unreadCount=0)}),this.updateUnreadCache()},e.prototype.markItemOfFeedRead=function(a){this.ids[a].unreadCount-=1,this.updateUnreadCache()},e.prototype.markItemsOfFeedsRead=function(a){var b=this;a.forEach(function(a){b.ids[a].unreadCount-=1}),this.updateUnreadCache()},e.prototype.markItemOfFeedUnread=function(a){this.ids[a].unreadCount+=1,this.updateUnreadCache()},e.prototype.getUnreadCount=function(){return this.unreadCount},e.prototype.getFolderUnreadCount=function(a){return this.folderUnreadCount[a]},e.prototype.getByFolderId=function(a){return this.folderIds[a]||[]},e.prototype.getById=function(a){return this.ids[a]},e.prototype.rename=function(a,b){return this.http({method:"POST",url:this.BASE_URL+"/feeds/"+a+"/rename",data:{feedTitle:b}})},e.prototype.move=function(a,b){var c=this.getById(a);return c.folderId=b,this.updateFolderCache(),this.updateUnreadCache(),this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/move",data:{parentFolderId:b}})},e.prototype.create=function(a,b,c){a=a.trim(),a.startsWith("http")||(a="http://"+a),c!==g&&(c=c.trim());var d={url:a,folderId:b||0,title:c||a,unreadCount:0};this.add(d),this.updateFolderCache();var e=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:a,parentFolderId:b||0,title:c}}).success(function(a){e.resolve(a)}).error(function(a){d.faviconLink="",d.error=a.message,e.reject()}),e.promise},e.prototype.reversiblyDelete=function(a){return this.http.delete(this.BASE_URL+"/feeds/"+a)},e.prototype.delete=function(b){var c=this.ids[b],d=c.url;return delete this.ids[b],a.prototype.delete.call(this,d),this.updateUnreadCache(),this.updateFolderCache(),c},e.prototype.undoDelete=function(a){return this.http.post(this.BASE_URL+"/feeds/"+a+"/restore")},new e(b,c,d)}]),h.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"name"),this.deleted=null,this.$q=d};return e.prototype=Object.create(a.prototype),e.prototype.toggleOpen=function(a){var b=this.get(a);return b.opened=!b.opened,this.http({url:this.BASE_URL+"/folders/"+b.id+"/open",method:"POST",data:{folderId:b.id,open:b.opened}})},e.prototype.rename=function(a,b){var c=this.get(a),d=this.$q.defer(),e=this;return this.http({url:this.BASE_URL+"/folders/"+c.id+"/rename",method:"POST",data:{folderName:b}}).success(function(){c.name=b,delete e.hashMap[a],e.hashMap[b]=c,d.resolve()}).error(function(a){d.reject(a.message)}),d.promise},e.prototype.create=function(a){a=a.trim();var b={name:a};this.add(b);var c=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:a}}).success(function(a){c.resolve(a)}).error(function(a){b.error=a.message}),c.promise},e.prototype.reversiblyDelete=function(a){return this.http.delete(this.BASE_URL+"/folders/"+a)},e.prototype.undoDelete=function(a){return this.http.post(this.BASE_URL+"/folders/"+a+"/restore")},new e(b,c,d)}]),h.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c),this.starredCount=0,this.batchSize=d};return e.prototype=Object.create(a.prototype),e.prototype.receive=function(b,c){switch(c){case"newestItemId":this.newestItemId=b;break;case"starred":this.starredCount=b;break;default:a.prototype.receive.call(this,b,c)}},e.prototype.getNewestItemId=function(){return this.newestItemId},e.prototype.getStarredCount=function(){return this.starredCount},e.prototype.star=function(a,b){b===g&&(b=!0);var c=this.get(a),d=this.BASE_URL+"/items/"+c.feedId+"/"+c.guidHash+"/star";return c.starred=b,b?this.starredCount+=1:this.starredCount-=1,this.http({url:d,method:"POST",data:{isStarred:b}})},e.prototype.toggleStar=function(a){this.get(a).starred?this.star(a,!1):this.star(a,!0)},e.prototype.markItemRead=function(a,b){return b===g&&(b=!0),this.get(a).unread=!b,this.http({url:this.BASE_URL+"/items/"+a+"/read",method:"POST",data:{isRead:b}})},e.prototype.markItemsRead=function(a){var b=this;return a.forEach(function(a){b.get(a).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:a}})},e.prototype.markFeedRead=function(a,b){b===g&&(b=!0);var c=this.values.filter(function(b){return b.feedId===a});return c.forEach(function(a){a.unread=!b}),this.http.post(this.BASE_URL+"/feeds/"+a+"/read",{highestItemId:this.getNewestItemId()})},e.prototype.markRead=function(){return this.values.forEach(function(a){a.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},e.prototype.autoPage=function(a,b){return this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:a,id:b,offset:this.size(),limit:this.batchSize}})},new e(b,c,d)}]),h.service("Loading",function(){this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(a,b){this.loading[a]=b},this.isLoading=function(a){return this.loading[a]}}),h.service("Publisher",function(){this.channels={},this.subscribe=function(a){var b=this;return{toChannels:function(c){c.forEach(function(c){b.channels[c]=b.channels[c]||[],b.channels[c].push(a)})}}},this.publishAll=function(a){var b=this;Object.keys(a).forEach(function(c){var d=b.channels[c];d!==g&&d.forEach(function(b){b.receive(a[c],c)})})}}),h.factory("Resource",function(){var a=function(a,b,c){this.id=c||"id",this.values=[],this.hashMap={},this.http=a,this.BASE_URL=b};return a.prototype.receive=function(a){var b=this;a.forEach(function(a){b.add(a)})},a.prototype.add=function(a){var b=this.hashMap[a[this.id]];b===g?(this.values.push(a),this.hashMap[a[this.id]]=a):Object.keys(a).forEach(function(c){b[c]=a[c]})},a.prototype.size=function(){return this.values.length},a.prototype.get=function(a){return this.hashMap[a]},a.prototype.delete=function(a){var b=this,c=this.values.findIndex(function(c){return c[b.id]===a});c!==g&&this.values.splice(c,1),this.hashMap[a]!==g&&delete this.hashMap[a]},a.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},a.prototype.getAll=function(){return this.values},a}),h.service("SettingsResource",["$http","BASE_URL",function(a,b){this.settings={language:"en",showAll:!1,compact:!1,oldestFirst:!1,preventReadOnScroll:!1},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.receive=function(a){var b=this;Object.keys(a).forEach(function(c){var d=a[c];"language"===c&&(d=b.processLanguageCode(d)),b.settings[c]=d})},this.get=function(a){return this.settings[a]},this.set=function(c,d){return this.settings[c]=d,a({url:b+"/settings",method:"PUT",data:this.settings})},this.processLanguageCode=function(a){return a=a.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(a)<0&&(a=a.split("-")[0]),this.supportedLanguageCodes.indexOf(a)<0&&(a=this.defaultLanguageCode),a}}]),function(a,b,c){var d=function(a){return!(a.is("input")||a.is("select")||a.is("textarea")||a.is("checkbox"))},e=function(a){return!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey)},f=function(a,b){var d=a.find(".item");d.each(function(a,d){return d=c(d),d.height()+d.position().top>30?(b(d),!1):void 0})},g=function(a){f(a,function(a){a.find(".toggle-keep-unread").trigger("click")})},h=function(a){f(a,function(a){a.find(".star").trigger("click")})},i=function(a){f(a,function(a){a.find(".utils").trigger("click")})},j=function(b){f(b,function(b){b.trigger("click"),a.open(b.find(".external").attr("href"),"_blank")})},k=function(a,b,c){a.scrollTop(b.offset().top-a.offset().top+a.scrollTop()),c&&f(a,function(a){a.hasClass("open")||a.find(".utils").trigger("click")})},l=function(a,b){var d=a.find(".item"),e=!1;d.each(function(d,f){return f=c(f),f.position().top>1?(k(a,f,b),e=!0,!1):void 0}),e||a.scrollTop(a.prop("scrollHeight"))},m=function(a,b){var d=a.find(".item"),e=!1;d.each(function(d,f){if(f=c(f),f.position().top>=0){var g=f.prev();return g.length>0&&k(a,g,b),e=!0,!1}}),!e&&d.length>0&&k(a,d.last())};c(b).keyup(function(a){if(d(c(":focus"))&&e(a)){var b=a.keyCode,f=c("#app-content"),k=c("#app-content-wrapper > .compact").length>0;[74,78,39].indexOf(b)>=0?(a.preventDefault(),l(f,k)):[75,80,37].indexOf(b)>=0?(a.preventDefault(),m(f,k)):[85].indexOf(b)>=0?(a.preventDefault(),g(f)):[69].indexOf(b)>=0?(a.preventDefault(),i(f)):[73,83,76].indexOf(b)>=0?(a.preventDefault(),h(f)):[72].indexOf(b)>=0?(a.preventDefault(),h(f),l(f)):[79].indexOf(b)>=0&&(a.preventDefault(),j(f))}})}(a,b,d),h.run(["$document","$rootScope",function(a,b){a.click(function(a){b.$broadcast("documentClicked",a)})}]),h.directive("appNavigationEntryUtils",function(){return{restrict:"C",link:function(a,b){var c=b.siblings(".app-navigation-entry-menu"),e=d(b).find(".app-navigation-entry-utils-menu-button button");e.click(function(){c.toggleClass("open")}),a.$on("documentClicked",function(a,b){b.target!==e[0]&&c.removeClass("open")})}}}),h.directive("newsAudio",function(){return{restrict:"E",scope:{src:"@",type:"@"},transclude:!0,template:'',link:function(a,b){var c=b.children().children("source")[0],d=!1;c.addEventListener("error",function(){a.$apply(function(){d=!0})}),a.cantPlay=function(){return d}}}}),h.directive("newsAutoFocus",["$timeout",function(a){return function(b,c,e){var f=c;e.newsAutoFocus&&(f=d(e.newsAutoFocus)),a(function(){f.focus()},0)}}]),h.directive("newsBindHtmlUnsafe",function(){return function(a,b,c){a.$watch(c.newsBindHtmlUnsafe,function(){b.html(a.$eval(c.newsBindHtmlUnsafe))})}}),h.directive("newsDraggable",function(){return function(a,b,d){var e=a.$eval(d.newsDraggable);c.isDefined(e)?b.draggable(e):b.draggable(),d.$observe("newsDraggableDisable",function(a){b.draggable("true"===a?"disable":"enable")})}}),h.directive("newsDroppable",["$rootScope",function(a){return function(b,c,e){var f={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(f,g){d(".drag-and-drop").removeClass("drag-and-drop");var h={folderId:parseInt(c.data("id"),10),feedId:parseInt(d(g.draggable).data("id"),10)};a.$broadcast("moveFeedToFolder",h),b.$apply(e.droppable)}};c.droppable(f)}}]),h.directive("newsFocus",["$timeout","$interpolate",function(a,b){return function(c,e,f){e.click(function(){var e=d(b(f.newsFocus)(c));a(function(){e.focus()},500)})}}]),h.directive("newsReadFile",function(){return function(a,b,c){b.change(function(){var d=b[0].files[0],e=new FileReader;e.onload=function(d){b[0].value=0,a.$fileContent=d.target.result,a.$apply(c.newsReadFile)},e.readAsText(d)})}}),h.directive("newsScroll",["$timeout",function(a){var b=function(a,b,c,e){if(a)for(var f=0,g=c.find(".item"),h=g.length-1;h>=0;h-=1){var i=d(g[h]);if(f>=b)break;if(i.position().top<0){e.$apply(e.newsScrollAutoPage);break}f+=1}},c=function(a,b,c){if(a){var e=[],f=b.find(".item:not(.read)");f.each(function(a,b){var c=d(b);return c.position().top<=-50?void e.push(parseInt(c.data("id"),10)):!1}),c.itemIds=e,c.$apply(c.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"=",newsScrollEnabledAutoPage:"=",newsScrollMarkReadTimeout:"@",newsScrollTimeout:"@",newsScrollAutoPageWhenLeft:"@"},link:function(d,e){var f=!0,g=d.newsScrollTimeout||1,h=d.newsScrollMarkReadTimeout||1,i=d.newsScrollAutoPageWhenLeft||50,j=function(){f&&(f=!1,a(function(){f=!0},1e3*g),b(d.newsScrollEnabledAutoPage,i,e,d),a(function(){c(d.newsScrollEnabledMarkRead,e,d)},1e3*h))};e.on("scroll",j),d.$on("$destroy",function(){e.off("scroll",j)})}}}]),h.directive("newsStopPropagation",function(){return{restrict:"A",link:function(a,b){b.bind("click",function(a){a.stopPropagation()})}}}),h.directive("newsTimeout",["$timeout",function(a){return{restrict:"A",scope:{newsTimeout:"&"},link:function(b){var c=7,d=a(b.newsTimeout,1e3*c);b.$on("$destroy",function(){a.cancel(d)})}}}]),h.directive("newsTitleUnreadCount",["$window",function(a){var b=a.document.title;return{restrict:"E",scope:{unreadCount:"@"},link:function(c,d,e){e.$observe("unreadCount",function(c){var d=b.split("-");"0"!==c&&(a.document.title=d[0]+"("+c+") - "+d[1])})}}}]),h.directive("newsTriggerClick",function(){return function(a,b,c){b.click(function(){d(c.newsTriggerClick).trigger("click")})}})}(window,document,angular,jQuery,OC,oc_requesttoken); \ No newline at end of file +!function(a,b,c,d,e,f,g){"use strict";var h=c.module("News",["ngRoute","ngSanitize"]);h.config(["$routeProvider","$provide","$httpProvider",function(a,b,c){var d={FEED:0,FOLDER:1,STARRED:2,SUBSCRIPTIONS:3,SHARED:4};b.constant("REFRESH_RATE",60),b.constant("ITEM_BATCH_SIZE",50),b.constant("BASE_URL",e.generateUrl("/apps/news")),b.constant("FEED_TYPE",d),b.factory("CSRFInterceptor",["$q","BASE_URL",function(a,b){return{request:function(c){return 0===c.url.indexOf(b)&&(c.headers.requesttoken=f),c||a.when(c)}}}]),c.interceptors.push("CSRFInterceptor");var h=function(a){return{data:["$http","$route","$q","BASE_URL","ITEM_BATCH_SIZE",function(b,c,d,e,f){var h={type:a,limit:f};c.current.params.id!==g&&(h.id=c.current.params.id);var i=d.defer();return b({url:e+"/items",method:"GET",params:h}).success(function(a){i.resolve(a)}),i.promise}]}};a.when("/items",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.SUBSCRIPTIONS),type:d.SUBSCRIPTIONS}).when("/items/starred",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.STARRED),type:d.STARRED}).when("/items/feeds/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FEED),type:d.FEED}).when("/items/folders/:id",{controller:"ContentController as Content",templateUrl:"content.html",resolve:h(d.FOLDER),type:d.FOLDER})}]),h.run(["$rootScope","$location","$http","$q","$interval","Loading","ItemResource","FeedResource","FolderResource","SettingsResource","Publisher","BASE_URL","FEED_TYPE","REFRESH_RATE",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){f.setLoading("global",!0),k.subscribe(g).toChannels(["items","newestItemId","starred"]),k.subscribe(i).toChannels(["folders"]),k.subscribe(h).toChannels(["feeds"]),k.subscribe(j).toChannels(["settings"]);var o=d.defer();c.get(l+"/settings").success(function(a){k.publishAll(a),o.resolve()});var p=d.defer(),q=b.path();c.get(l+"/feeds/active").success(function(a){var c;switch(a.activeFeed.type){case m.FEED:c="/items/feeds/"+a.activeFeed.id;break;case m.FOLDER:c="/items/folders/"+a.activeFeed.id;break;case m.STARRED:c="/items/starred";break;default:c="/items"}/^\/items(\/(starred|feeds\/\d+|folders\/\d+))?\/?$/.test(q)||b.path(c),p.resolve()});var r=d.defer();c.get(l+"/folders").success(function(a){k.publishAll(a),r.resolve()});var s=d.defer();c.get(l+"/feeds").success(function(a){k.publishAll(a),s.resolve()}),d.all([o.promise,p.promise,s.promise,r.promise]).then(function(){f.setLoading("global",!1)}),e(function(){c.get(l+"/feeds"),c.get(l+"/folders")},1e3*n),a.$on("$routeChangeStart",function(){f.setLoading("content",!0)}),a.$on("$routeChangeSuccess",function(){f.setLoading("content",!1)}),a.$on("$routeChangeError",function(){b.path("/items")})}]),h.controller("AppController",["Loading","FeedResource","FolderResource",function(a,b,c){this.loading=a,this.isFirstRun=function(){return 0===b.size()&&0===c.size()}}]),h.controller("ContentController",["Publisher","FeedResource","ItemResource","SettingsResource","data","$route","$routeParams","FEED_TYPE",function(a,b,c,d,e,f,h,i){c.clear(),a.publishAll(e),this.isAutoPagingEnabled=!0,this.getItems=function(){return c.getAll()},this.toggleStar=function(a){c.toggleStar(a)},this.toggleItem=function(a){this.isCompactView()&&(a.show=!a.show)},this.markRead=function(a){var d=c.get(a);d.keepUnread||d.unread!==!0||(c.markItemRead(a),b.markItemOfFeedRead(d.feedId))},this.getFeed=function(a){return b.getById(a)},this.toggleKeepUnread=function(a){var d=c.get(a);d.unread||(b.markItemOfFeedUnread(d.feedId),c.markItemRead(a,!1)),d.keepUnread=!d.keepUnread},this.orderBy=function(){return d.get("oldestFirst")?"id":"-id"},this.isCompactView=function(){return d.get("compact")},this.autoPagingEnabled=function(){return this.isAutoPagingEnabled},this.markReadEnabled=function(){return!d.get("preventReadOnScroll")},this.scrollRead=function(a){var d=[],e=[];a.forEach(function(a){var b=c.get(a);b.keepUnread||(d.push(a),e.push(b.feedId))}),b.markItemsOfFeedsRead(e),c.markItemsRead(d)},this.isFeed=function(){return f.current.$$route.type===i.FEED},this.autoPage=function(){this.isAutoPagingEnabled=!1;var b=f.current.$$route.type,d=h.id,e=this;c.autoPage(b,d).success(function(b){a.publishAll(b),b.items.length>0&&(e.isAutoPagingEnabled=!0)}).error(function(){e.isAutoPagingEnabled=!0})},this.getRelativeDate=function(a){if(a!==g&&""!==a){var b=d.get("language"),c=moment.unix(a).locale(b).fromNow()+"";return c}return""}}]),h.controller("NavigationController",["$route","FEED_TYPE","FeedResource","FolderResource","ItemResource","SettingsResource","Publisher","$rootScope","$location",function(a,b,c,d,e,f,h,i,j){this.feedError="",this.folderError="",this.getFeeds=function(){return c.getAll()},this.getFolders=function(){return d.getAll()},this.markFolderRead=function(a){c.markFolderRead(a),c.getByFolderId(a).forEach(function(a){e.markFeedRead(a.id)})},this.markFeedRead=function(a){e.markFeedRead(a),c.markFeedRead(a)},this.markRead=function(){e.markRead(),c.markRead()},this.isShowAll=function(){return f.get("showAll")},this.getFeedsOfFolder=function(a){return c.getByFolderId(a)},this.getUnreadCount=function(){return c.getUnreadCount()},this.getFeedUnreadCount=function(a){var b=c.getById(a);return b!==g?b.unreadCount:0},this.getFolderUnreadCount=function(a){return c.getFolderUnreadCount(a)},this.getStarredCount=function(){return e.getStarredCount()},this.toggleFolder=function(a){d.toggleOpen(a)},this.hasFeeds=function(a){return c.getFolderUnreadCount(a)!==g},this.subFeedActive=function(d){var e=a.current.$$route.type;if(e===b.FEED){var f=c.getById(a.current.params.id);if(f!==g&&f.folderId===d)return!0}return!1},this.isSubscriptionsActive=function(){return a.current&&a.current.$$route.type===b.SUBSCRIPTIONS},this.isStarredActive=function(){return a.current&&a.current.$$route.type===b.STARRED},this.isFolderActive=function(c){var d=parseInt(a.current.params.id,10);return a.current&&a.current.$$route.type===b.FOLDER&&d===c},this.isFeedActive=function(c){var d=parseInt(a.current.params.id,10);return a.current&&a.current.$$route.type===b.FEED&&d===c},this.folderNameExists=function(a){return a=a||"",d.get(a.trim())!==g},this.feedUrlExists=function(a){return a=a||"",a=a.trim(),c.get(a)!==g||c.get("http://"+a)!==g},this.createFeed=function(a){var b=this;this.newFolder=!1,this.addingFeed=!0;var e=a.newFolder,f=a.existingFolder||{id:0};e===g?(f.getsFeed=!0,c.create(a.url,f.id,g).then(function(a){h.publishAll(a),j.path("/items/feeds/"+a.feeds[0].id+"/")}).finally(function(){f.getsFeed=g,a.url="",b.addingFeed=!1})):d.create(e).then(function(c){h.publishAll(c),a.existingFolder=d.get(c.folders[0].name),a.newFolder=g,b.createFeed(a)})},this.createFolder=function(a){var b=this;this.addingFolder=!0,d.create(a.name).then(function(a){h.publishAll(a)}).finally(function(){b.addingFolder=!1,a.name=""})},this.moveFeed=function(b,d){var e=!1,f=c.getById(b);f.folderId!==d&&((this.isFolderActive(f.folderId)||this.isFolderActive(d))&&(e=!0),c.move(b,d),e&&a.reload())},this.renameFeed=function(a){c.rename(a.id,a.title),a.editing=!1},this.renameFolder=function(a,b){a.renameError="",this.renamingFolder=!0;var c=this;a.name===b?(a.renameError="",a.editing=!1,this.renamingFolder=!1):d.rename(a.name,b).then(function(){a.renameError="",a.editing=!1},function(b){a.renameError=b}).finally(function(){c.renamingFolder=!1})},this.reversiblyDeleteFeed=function(a){a.deleted=!0,c.reversiblyDelete(a.id)},this.undoDeleteFeed=function(a){a.deleted=!1,c.undoDelete(a.id)},this.deleteFeed=function(a){c.delete(a.id)},this._deletedFeedsBackup={},this.reversiblyDeleteFolder=function(a){a.deleted=!0;var b=this,e=c.getByFolderId(a.id);e.forEach(function(d){b._deletedFeedsBackup[a.name]=b._deletedFeedsBackup[a.name]||[],b._deletedFeedsBackup[a.name].push(d),c.delete(d.id)}),d.reversiblyDelete(a.id)},this.undoDeleteFolder=function(a){a.deleted=!1;var b=this._deletedFeedsBackup[a.name];b!==g&&c.receive(b),d.undoDelete(a.id)},this.deleteFolder=function(a){delete this._deletedFeedsBackup[a.name],d.delete(a.name)};var k=this;i.$on("moveFeedToFolder",function(a,b){k.moveFeed(b.feedId,b.folderId)})}]),h.controller("SettingsController",["$route","SettingsResource","FeedResource",function(a,b,c){this.importing=!1,this.opmlImportError=!1,this.articleImportError=!1;var d=function(c,d){b.set(c,d),["showAll","oldestFirst"].indexOf(c)>=0&&a.reload()};this.toggleSetting=function(a){d(a,!this.getSetting(a))},this.getSetting=function(a){return b.get(a)},this.feedSize=function(){return c.size()},this.importOpml=function(a){console.log(a)},this.importArticles=function(a){console.log(a)}}]),h.filter("trustUrl",["$sce",function(a){return function(b){return a.trustAsResourceUrl(b)}}]),h.filter("unreadCountFormatter",function(){return function(a){return a>999?"999+":a}}),h.factory("FeedResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"url"),this.ids={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.$q=d};return e.prototype=Object.create(a.prototype),e.prototype.receive=function(b){a.prototype.receive.call(this,b),this.updateUnreadCache(),this.updateFolderCache()},e.prototype.updateUnreadCache=function(){this.unreadCount=0,this.folderUnreadCount={};var a=this;this.values.forEach(function(b){b.unreadCount&&(a.unreadCount+=b.unreadCount),b.folderId!==g&&(a.folderUnreadCount[b.folderId]=a.folderUnreadCount[b.folderId]||0,a.folderUnreadCount[b.folderId]+=b.unreadCount)})},e.prototype.updateFolderCache=function(){this.folderIds={};var a=this;this.values.forEach(function(b){a.folderIds[b.folderId]=a.folderIds[b.folderId]||[],a.folderIds[b.folderId].push(b)})},e.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==g&&(this.ids[b.id]=this.hashMap[b.url])},e.prototype.markRead=function(){this.values.forEach(function(a){a.unreadCount=0}),this.unreadCount=0,this.folderUnreadCount={}},e.prototype.markFeedRead=function(a){this.ids[a].unreadCount=0,this.updateUnreadCache()},e.prototype.markFolderRead=function(a){this.values.forEach(function(b){b.folderId===a&&(b.unreadCount=0)}),this.updateUnreadCache()},e.prototype.markItemOfFeedRead=function(a){this.ids[a].unreadCount-=1,this.updateUnreadCache()},e.prototype.markItemsOfFeedsRead=function(a){var b=this;a.forEach(function(a){b.ids[a].unreadCount-=1}),this.updateUnreadCache()},e.prototype.markItemOfFeedUnread=function(a){this.ids[a].unreadCount+=1,this.updateUnreadCache()},e.prototype.getUnreadCount=function(){return this.unreadCount},e.prototype.getFolderUnreadCount=function(a){return this.folderUnreadCount[a]},e.prototype.getByFolderId=function(a){return this.folderIds[a]||[]},e.prototype.getById=function(a){return this.ids[a]},e.prototype.rename=function(a,b){return this.http({method:"POST",url:this.BASE_URL+"/feeds/"+a+"/rename",data:{feedTitle:b}})},e.prototype.move=function(a,b){var c=this.getById(a);return c.folderId=b,this.updateFolderCache(),this.updateUnreadCache(),this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/move",data:{parentFolderId:b}})},e.prototype.create=function(a,b,c){a=a.trim(),a.startsWith("http")||(a="http://"+a),c!==g&&(c=c.trim());var d={url:a,folderId:b||0,title:c||a,unreadCount:0};this.add(d),this.updateFolderCache();var e=this.$q.defer();return this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:a,parentFolderId:b||0,title:c}}).success(function(a){e.resolve(a)}).error(function(a){d.faviconLink="",d.error=a.message,e.reject()}),e.promise},e.prototype.reversiblyDelete=function(a){return this.http.delete(this.BASE_URL+"/feeds/"+a)},e.prototype.delete=function(b){var c=this.ids[b],d=c.url;return delete this.ids[b],a.prototype.delete.call(this,d),this.updateUnreadCache(),this.updateFolderCache(),c},e.prototype.undoDelete=function(a){return this.http.post(this.BASE_URL+"/feeds/"+a+"/restore")},new e(b,c,d)}]),h.factory("FolderResource",["Resource","$http","BASE_URL","$q",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c,"name"),this.deleted=null,this.$q=d};return e.prototype=Object.create(a.prototype),e.prototype.toggleOpen=function(a){var b=this.get(a);return b.opened=!b.opened,this.http({url:this.BASE_URL+"/folders/"+b.id+"/open",method:"POST",data:{folderId:b.id,open:b.opened}})},e.prototype.rename=function(a,b){var c=this.get(a),d=this.$q.defer(),e=this;return this.http({url:this.BASE_URL+"/folders/"+c.id+"/rename",method:"POST",data:{folderName:b}}).success(function(){c.name=b,delete e.hashMap[a],e.hashMap[b]=c,d.resolve()}).error(function(a){d.reject(a.message)}),d.promise},e.prototype.create=function(a){a=a.trim();var b={name:a};this.add(b);var c=this.$q.defer();return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:a}}).success(function(a){c.resolve(a)}).error(function(a){b.error=a.message}),c.promise},e.prototype.reversiblyDelete=function(a){return this.http.delete(this.BASE_URL+"/folders/"+a)},e.prototype.undoDelete=function(a){return this.http.post(this.BASE_URL+"/folders/"+a+"/restore")},new e(b,c,d)}]),h.factory("ItemResource",["Resource","$http","BASE_URL","ITEM_BATCH_SIZE",function(a,b,c,d){var e=function(b,c,d){a.call(this,b,c),this.starredCount=0,this.batchSize=d};return e.prototype=Object.create(a.prototype),e.prototype.receive=function(b,c){switch(c){case"newestItemId":this.newestItemId=b;break;case"starred":this.starredCount=b;break;default:a.prototype.receive.call(this,b,c)}},e.prototype.getNewestItemId=function(){return this.newestItemId},e.prototype.getStarredCount=function(){return this.starredCount},e.prototype.star=function(a,b){b===g&&(b=!0);var c=this.get(a),d=this.BASE_URL+"/items/"+c.feedId+"/"+c.guidHash+"/star";return c.starred=b,b?this.starredCount+=1:this.starredCount-=1,this.http({url:d,method:"POST",data:{isStarred:b}})},e.prototype.toggleStar=function(a){this.get(a).starred?this.star(a,!1):this.star(a,!0)},e.prototype.markItemRead=function(a,b){return b===g&&(b=!0),this.get(a).unread=!b,this.http({url:this.BASE_URL+"/items/"+a+"/read",method:"POST",data:{isRead:b}})},e.prototype.markItemsRead=function(a){var b=this;return a.forEach(function(a){b.get(a).unread=!1}),this.http({url:this.BASE_URL+"/items/read/multiple",method:"POST",data:{itemIds:a}})},e.prototype.markFeedRead=function(a,b){b===g&&(b=!0);var c=this.values.filter(function(b){return b.feedId===a});return c.forEach(function(a){a.unread=!b}),this.http.post(this.BASE_URL+"/feeds/"+a+"/read",{highestItemId:this.getNewestItemId()})},e.prototype.markRead=function(){return this.values.forEach(function(a){a.unread=!1}),this.http({url:this.BASE_URL+"/items/read",method:"POST",data:{highestItemId:this.getNewestItemId()}})},e.prototype.autoPage=function(a,b){return this.http({url:this.BASE_URL+"/items",method:"GET",params:{type:a,id:b,offset:this.size(),limit:this.batchSize}})},new e(b,c,d)}]),h.service("Loading",function(){this.loading={global:!1,content:!1,autopaging:!1},this.setLoading=function(a,b){this.loading[a]=b},this.isLoading=function(a){return this.loading[a]}}),h.service("Publisher",function(){this.channels={},this.subscribe=function(a){var b=this;return{toChannels:function(c){c.forEach(function(c){b.channels[c]=b.channels[c]||[],b.channels[c].push(a)})}}},this.publishAll=function(a){var b=this;Object.keys(a).forEach(function(c){var d=b.channels[c];d!==g&&d.forEach(function(b){b.receive(a[c],c)})})}}),h.factory("Resource",function(){var a=function(a,b,c){this.id=c||"id",this.values=[],this.hashMap={},this.http=a,this.BASE_URL=b};return a.prototype.receive=function(a){var b=this;a.forEach(function(a){b.add(a)})},a.prototype.add=function(a){var b=this.hashMap[a[this.id]];b===g?(this.values.push(a),this.hashMap[a[this.id]]=a):Object.keys(a).forEach(function(c){b[c]=a[c]})},a.prototype.size=function(){return this.values.length},a.prototype.get=function(a){return this.hashMap[a]},a.prototype.delete=function(a){var b=this,c=this.values.findIndex(function(c){return c[b.id]===a});c!==g&&this.values.splice(c,1),this.hashMap[a]!==g&&delete this.hashMap[a]},a.prototype.clear=function(){for(this.hashMap={};this.values.length>0;)this.values.pop()},a.prototype.getAll=function(){return this.values},a}),h.service("SettingsResource",["$http","BASE_URL",function(a,b){this.settings={language:"en",showAll:!1,compact:!1,oldestFirst:!1,preventReadOnScroll:!1},this.defaultLanguageCode="en",this.supportedLanguageCodes=["ar-ma","ar","bg","ca","cs","cv","da","de","el","en-ca","en-gb","eo","es","et","eu","fi","fr-ca","fr","gl","he","hi","hu","id","is","it","ja","ka","ko","lv","ms-my","nb","ne","nl","pl","pt-br","pt","ro","ru","sk","sl","sv","th","tr","tzm-la","tzm","uk","zh-cn","zh-tw"],this.receive=function(a){var b=this;Object.keys(a).forEach(function(c){var d=a[c];"language"===c&&(d=b.processLanguageCode(d)),b.settings[c]=d})},this.get=function(a){return this.settings[a]},this.set=function(c,d){return this.settings[c]=d,a({url:b+"/settings",method:"PUT",data:this.settings})},this.processLanguageCode=function(a){return a=a.replace("_","-").toLowerCase(),this.supportedLanguageCodes.indexOf(a)<0&&(a=a.split("-")[0]),this.supportedLanguageCodes.indexOf(a)<0&&(a=this.defaultLanguageCode),a}}]),function(a,b,c){var d=function(a){return!(a.is("input")||a.is("select")||a.is("textarea")||a.is("checkbox"))},e=function(a){return!(a.shiftKey||a.altKey||a.ctrlKey||a.metaKey)},f=function(a,b){var d=a.find(".item");d.each(function(a,d){return d=c(d),d.height()+d.position().top>30?(b(d),!1):void 0})},g=function(a){f(a,function(a){a.find(".toggle-keep-unread").trigger("click")})},h=function(a){f(a,function(a){a.find(".star").trigger("click")})},i=function(a){f(a,function(a){a.find(".utils").trigger("click")})},j=function(b){f(b,function(b){b.trigger("click"),a.open(b.find(".external").attr("href"),"_blank")})},k=function(a,b,c){a.scrollTop(b.offset().top-a.offset().top+a.scrollTop()),c&&f(a,function(a){a.hasClass("open")||a.find(".utils").trigger("click")})},l=function(a,b){var d=a.find(".item"),e=!1;d.each(function(d,f){return f=c(f),f.position().top>1?(k(a,f,b),e=!0,!1):void 0}),e||a.scrollTop(a.prop("scrollHeight"))},m=function(a,b){var d=a.find(".item"),e=!1;d.each(function(d,f){if(f=c(f),f.position().top>=0){var g=f.prev();return g.length>0&&k(a,g,b),e=!0,!1}}),!e&&d.length>0&&k(a,d.last())};c(b).keyup(function(a){if(d(c(":focus"))&&e(a)){var b=a.keyCode,f=c("#app-content"),k=c("#app-content-wrapper > .compact").length>0;[74,78,39].indexOf(b)>=0?(a.preventDefault(),l(f,k)):[75,80,37].indexOf(b)>=0?(a.preventDefault(),m(f,k)):[85].indexOf(b)>=0?(a.preventDefault(),g(f)):[69].indexOf(b)>=0?(a.preventDefault(),i(f)):[73,83,76].indexOf(b)>=0?(a.preventDefault(),h(f)):[72].indexOf(b)>=0?(a.preventDefault(),h(f),l(f)):[79].indexOf(b)>=0&&(a.preventDefault(),j(f))}})}(a,b,d),h.run(["$document","$rootScope",function(a,b){a.click(function(a){b.$broadcast("documentClicked",a)})}]),h.directive("appNavigationEntryUtils",function(){return{restrict:"C",link:function(a,b){var c=b.siblings(".app-navigation-entry-menu"),e=d(b).find(".app-navigation-entry-utils-menu-button button");e.click(function(){c.toggleClass("open")}),a.$on("documentClicked",function(a,b){b.target!==e[0]&&c.removeClass("open")})}}}),h.directive("newsAudio",function(){return{restrict:"E",scope:{src:"@",type:"@"},transclude:!0,template:'',link:function(a,b){var c=b.children().children("source")[0],d=!1;c.addEventListener("error",function(){a.$apply(function(){d=!0})}),a.cantPlay=function(){return d}}}}),h.directive("newsAutoFocus",["$timeout",function(a){return function(b,c,e){var f=c;e.newsAutoFocus&&(f=d(e.newsAutoFocus)),a(function(){f.focus()},0)}}]),h.directive("newsBindHtmlUnsafe",function(){return function(a,b,c){a.$watch(c.newsBindHtmlUnsafe,function(){b.html(a.$eval(c.newsBindHtmlUnsafe))})}}),h.directive("newsDraggable",function(){return function(a,b,d){var e=a.$eval(d.newsDraggable);c.isDefined(e)?b.draggable(e):b.draggable(),d.$observe("newsDraggableDisable",function(a){b.draggable("true"===a?"disable":"enable")})}}),h.directive("newsDroppable",["$rootScope",function(a){return function(b,c,e){var f={accept:".feed",hoverClass:"drag-and-drop",greedy:!0,drop:function(f,g){d(".drag-and-drop").removeClass("drag-and-drop");var h={folderId:parseInt(c.data("id"),10),feedId:parseInt(d(g.draggable).data("id"),10)};a.$broadcast("moveFeedToFolder",h),b.$apply(e.droppable)}};c.droppable(f)}}]),h.directive("newsFocus",["$timeout","$interpolate",function(a,b){return function(c,e,f){e.click(function(){var e=d(b(f.newsFocus)(c));a(function(){e.focus()},500)})}}]),h.directive("newsReadFile",function(){return function(a,b,c){b.change(function(){var d=b[0].files[0],e=new FileReader;e.onload=function(d){b[0].value=0,a.$fileContent=d.target.result,a.$apply(c.newsReadFile)},e.readAsText(d)})}}),h.directive("newsScroll",["$timeout",function(a){var b=function(a,b,c,e){if(a)for(var f=0,g=c.find(".item"),h=g.length-1;h>=0;h-=1){var i=d(g[h]);if(f>=b)break;if(i.position().top<0){e.$apply(e.newsScrollAutoPage);break}f+=1}},c=function(a,b,c){if(a){var e=[],f=b.find(".item:not(.read)");f.each(function(a,b){var c=d(b);return c.position().top<=-50?void e.push(parseInt(c.data("id"),10)):!1}),c.itemIds=e,c.$apply(c.newsScrollMarkRead)}};return{restrict:"A",scope:{newsScrollAutoPage:"&",newsScrollMarkRead:"&",newsScrollEnabledMarkRead:"=",newsScrollEnabledAutoPage:"=",newsScrollMarkReadTimeout:"@",newsScrollTimeout:"@",newsScrollAutoPageWhenLeft:"@"},link:function(d,e){var f=!0,g=d.newsScrollTimeout||1,h=d.newsScrollMarkReadTimeout||1,i=d.newsScrollAutoPageWhenLeft||50,j=function(){f&&(f=!1,a(function(){f=!0},1e3*g),b(d.newsScrollEnabledAutoPage,i,e,d),a(function(){c(d.newsScrollEnabledMarkRead,e,d)},1e3*h))};e.on("scroll",j),d.$on("$destroy",function(){e.off("scroll",j)})}}}]),h.directive("newsStopPropagation",function(){return{restrict:"A",link:function(a,b){b.bind("click",function(a){a.stopPropagation()})}}}),h.directive("newsTimeout",["$timeout",function(a){return{restrict:"A",scope:{newsTimeout:"&"},link:function(b){var c=7,d=a(b.newsTimeout,1e3*c);b.$on("$destroy",function(){a.cancel(d)})}}}]),h.directive("newsTitleUnreadCount",["$window",function(a){var b=a.document.title;return{restrict:"E",scope:{unreadCount:"@"},link:function(c,d,e){e.$observe("unreadCount",function(c){var d=b.split("-");"0"!==c&&(a.document.title=d[0]+"("+c+") - "+d[1])})}}}]),h.directive("newsTriggerClick",function(){return function(a,b,c){b.click(function(){d(c.newsTriggerClick).trigger("click")})}})}(window,document,angular,jQuery,OC,oc_requesttoken); \ No newline at end of file diff --git a/js/karma.conf.js b/js/karma.conf.js index 24e6f3a83..fa61c1aca 100644 --- a/js/karma.conf.js +++ b/js/karma.conf.js @@ -28,7 +28,6 @@ module.exports = function (config) { 'vendor/angular-mocks/angular-mocks.js', 'vendor/angular-route/angular-route.js', 'vendor/angular-sanitize/angular-sanitize.js', - 'vendor/angular-animate/angular-animate.js', 'tests/unit/stubs/App.js', 'tests/unit/stubs/OC.js', 'controller/**/*.js', diff --git a/js/tests/unit/stubs/App.js b/js/tests/unit/stubs/App.js index dc512f5e1..5c32b1b76 100644 --- a/js/tests/unit/stubs/App.js +++ b/js/tests/unit/stubs/App.js @@ -7,9 +7,4 @@ * @author Bernhard Posselt * @copyright Bernhard Posselt 2012, 2014 */ -window.app = angular.module('News', [ - 'ngRoute', - 'ngSanitize', - 'ngAnimate', - 'ngMock' -]); \ No newline at end of file +window.app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngMock']); \ No newline at end of file diff --git a/js/vendor/angular-animate/.bower.json b/js/vendor/angular-animate/.bower.json deleted file mode 100644 index 2e26346f5..000000000 --- a/js/vendor/angular-animate/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "angular-animate", - "version": "1.3.0-rc.0", - "main": "./angular-animate.js", - "dependencies": { - "angular": "1.3.0-rc.0" - }, - "homepage": "https://github.com/angular/bower-angular-animate", - "_release": "1.3.0-rc.0", - "_resolution": { - "type": "version", - "tag": "v1.3.0-rc.0", - "commit": "f9d83fc0b0cdee44ce13fd57411e4da9fa68537c" - }, - "_source": "git://github.com/angular/bower-angular-animate.git", - "_target": "~1.3.*", - "_originalSource": "angular-animate" -} \ No newline at end of file diff --git a/js/vendor/angular-animate/README.md b/js/vendor/angular-animate/README.md deleted file mode 100644 index de4c61b89..000000000 --- a/js/vendor/angular-animate/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# bower-angular-animate - -This repo is for distribution on `bower`. The source for this module is in the -[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate). -Please file issues and pull requests against that repo. - -## Install - -Install with `bower`: - -```shell -bower install angular-animate -``` - -Add a ` -``` - -And add `ngAnimate` as a dependency for your app: - -```javascript -angular.module('myApp', ['ngAnimate']); -``` - -## Documentation - -Documentation is available on the -[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate). - -## License - -The MIT License - -Copyright (c) 2010-2012 Google, Inc. http://angularjs.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/js/vendor/angular-animate/angular-animate.js b/js/vendor/angular-animate/angular-animate.js deleted file mode 100644 index 7b25c2489..000000000 --- a/js/vendor/angular-animate/angular-animate.js +++ /dev/null @@ -1,1880 +0,0 @@ -/** - * @license AngularJS v1.3.0-rc.0 - * (c) 2010-2014 Google, Inc. http://angularjs.org - * License: MIT - */ -(function(window, angular, undefined) {'use strict'; - -/* jshint maxlen: false */ - -/** - * @ngdoc module - * @name ngAnimate - * @description - * - * The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives. - * - *
- * - * # Usage - * - * To see animations in action, all that is required is to define the appropriate CSS classes - * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are: - * `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation - * by using the `$animate` service. - * - * Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives: - * - * | Directive | Supported Animations | - * |-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------| - * | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move | - * | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave | - * | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave | - * | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave | - * | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave | - * | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove (the CSS class(es) present) | - * | {@link ng.directive:ngShow#usage_animations ngShow} & {@link ng.directive:ngHide#usage_animations ngHide} | add and remove (the ng-hide class value) | - * | {@link ng.directive:form#usage_animations form} & {@link ng.directive:ngModel#usage_animations ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) | - * | {@link ngMessages.directive:ngMessage#usage_animations ngMessages} | add and remove (ng-active & ng-inactive) | - * | {@link ngMessages.directive:ngMessage#usage_animations ngMessage} | enter and leave | - * - * You can find out more information about animations upon visiting each directive page. - * - * Below is an example of how to apply animations to a directive that supports animation hooks: - * - * ```html - * - * - * - * - * ``` - * - * Keep in mind that, by default, if an animation is running, any child elements cannot be animated - * until the parent element's animation has completed. This blocking feature can be overridden by - * placing the `ng-animate-children` attribute on a parent container tag. - * - * ```html - *
- *
- *
- * ... - *
- *
- *
- * ``` - * - * When the `on` expression value changes and an animation is triggered then each of the elements within - * will all animate without the block being applied to child elements. - * - * ## Are animations run when the application starts? - * No they are not. When an application is bootstrapped Angular will disable animations from running to avoid - * a frenzy of animations from being triggered as soon as the browser has rendered the screen. For this to work, - * Angular will wait for two digest cycles until enabling animations. From there on, any animation-triggering - * layout changes in the application will trigger animations as normal. - * - * In addition, upon bootstrap, if the routing system or any directives or load remote data (via $http) then Angular - * will automatically extend the wait time to enable animations once **all** of the outbound HTTP requests - * are complete. - * - *

CSS-defined Animations

- * The animate service will automatically apply two CSS classes to the animated element and these two CSS classes - * are designed to contain the start and end CSS styling. Both CSS transitions and keyframe animations are supported - * and can be used to play along with this naming structure. - * - * The following code below demonstrates how to perform animations using **CSS transitions** with Angular: - * - * ```html - * - * - *
- *
- *
- * ``` - * - * The following code below demonstrates how to perform animations using **CSS animations** with Angular: - * - * ```html - * - * - *
- *
- *
- * ``` - * - * Both CSS3 animations and transitions can be used together and the animate service will figure out the correct duration and delay timing. - * - * Upon DOM mutation, the event class is added first (something like `ng-enter`), then the browser prepares itself to add - * the active class (in this case `ng-enter-active`) which then triggers the animation. The animation module will automatically - * detect the CSS code to determine when the animation ends. Once the animation is over then both CSS classes will be - * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end - * immediately resulting in a DOM element that is at its final state. This final state is when the DOM element - * has no CSS transition/animation classes applied to it. - * - * ### Structural transition animations - * - * Structural transitions (such as enter, leave and move) will always apply a `0s none` transition - * value to force the browser into rendering the styles defined in the setup (.ng-enter, .ng-leave - * or .ng-move) class. This means that any active transition animations operating on the element - * will be cut off to make way for the enter, leave or move animation. - * - * ### Class-based transition animations - * - * Class-based transitions refer to transition animations that are triggered when a CSS class is - * added to or removed from the element (via `$animate.addClass`, `$animate.removeClass`, - * `$animate.setClass`, or by directives such as `ngClass`, `ngModel` and `form`). - * They are different when compared to structural animations since they **do not cancel existing - * animations** nor do they **block successive transitions** from rendering on the same element. - * This distinction allows for **multiple class-based transitions** to be performed on the same element. - * - * In addition to ngAnimate supporting the default (natural) functionality of class-based transition - * animations, ngAnimate also decorates the element with starting and ending CSS classes to aid the - * developer in further styling the element throughout the transition animation. Earlier versions - * of ngAnimate may have caused natural CSS transitions to break and not render properly due to - * $animate temporarily blocking transitions using `0s none` in order to allow the setup CSS class - * (the `-add` or `-remove` class) to be applied without triggering an animation. However, as of - * **version 1.3**, this workaround has been removed with ngAnimate and all non-ngAnimate CSS - * class transitions are compatible with ngAnimate. - * - * There is, however, one special case when dealing with class-based transitions in ngAnimate. - * When rendering class-based transitions that make use of the setup and active CSS classes - * (e.g. `.fade-add` and `.fade-add-active` for when `.fade` is added) be sure to define - * the transition value **on the active CSS class** and not the setup class. - * - * ```css - * .fade-add { - * /* remember to place a 0s transition here - * to ensure that the styles are applied instantly - * even if the element already has a transition style */ - * transition:0s linear all; - * - * /* starting CSS styles */ - * opacity:1; - * } - * .fade-add.fade-add-active { - * /* this will be the length of the animation */ - * transition:1s linear all; - * opacity:0; - * } - * ``` - * - * The setup CSS class (in this case `.fade-add`) also has a transition style property, however, it - * has a duration of zero. This may not be required, however, incase the browser is unable to render - * the styling present in this CSS class instantly then it could be that the browser is attempting - * to perform an unnecessary transition. - * - * This workaround, however, does not ap