diff options
25 files changed, 328 insertions, 315 deletions
diff --git a/css/content.css b/css/content.css index 649d1bce7..ca0e84869 100644 --- a/css/content.css +++ b/css/content.css @@ -141,7 +141,7 @@ background-repeat: no-repeat; } - #app-content .utils .title a { + #app-content .utils .title h1 { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; @@ -153,11 +153,7 @@ font-size: 19px; } - #app-content .utils .title a:hover { - text-decoration: underline; - } - - #app-content .read .utils .title a { + #app-content .read .utils .title h1 { font-weight: normal; color: #888; } @@ -170,7 +166,7 @@ */ #app-content .article { min-height: 69px; - padding: 10px 50px 50px 50px; + padding: 0 50px 50px 50px; } #app-content .compact .article { @@ -202,7 +198,6 @@ #app-content .date { color: #aaa; white-space: nowrap; - float: right; } /** diff --git a/js/build/app.js b/js/build/app.js index 34dea4dec..5a875e21f 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -244,7 +244,7 @@ app.controller('ContentController', this.markRead = function (itemId) { var item = ItemResource.get(itemId); - if (!item.keepUnread) { + if (!item.keepUnread && item.unread === true) { ItemResource.markItemRead(itemId); FeedResource.markItemOfFeedRead(item.feedId); } @@ -266,9 +266,9 @@ app.controller('ContentController', this.orderBy = function () { if (SettingsResource.get('oldestFirst')) { - return 'id'; - } else { return '-id'; + } else { + return 'id'; } }; @@ -306,14 +306,15 @@ app.controller('ContentController', var type = $route.current.$$route.type; var id = $routeParams.id; + var self = this; ItemResource.autoPage(type, id).success(function (data) { Publisher.publishAll(data); if (data.items.length > 0) { - this.isAutoPagingEnabled = true; + self.isAutoPagingEnabled = true; } }).error(function () { - this.isAutoPagingEnabled = true; + self.isAutoPagingEnabled = true; }); }; @@ -738,7 +739,7 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", function (Resource console.log(feed); - /*return this.http({ + return this.http({ method: 'POST', url: this.BASE_URL + '/feeds', data: { @@ -746,7 +747,7 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", function (Resource parentFolderId: folderId, title: title } - });*/ + }); }; @@ -755,7 +756,7 @@ app.factory('FeedResource', ["Resource", "$http", "BASE_URL", function (Resource this.add(this.deleted); return this.http.post( - this.BASE_URL + '/feeds/${this.deleted.id}/restore' + this.BASE_URL + '/feeds/' + this.deleted.id + '/restore' ); } @@ -943,6 +944,7 @@ app.factory('ItemResource', ["Resource", "$http", "BASE_URL", "ITEM_BATCH_SIZE", } this.get(itemId).unread = !isRead; + return this.http({ url: this.BASE_URL + '/items/' + itemId + '/read', method: 'POST', @@ -983,7 +985,7 @@ app.factory('ItemResource', ["Resource", "$http", "BASE_URL", "ITEM_BATCH_SIZE", item.unread = !read; }); - return this.http.post(this.BASE_URL + '/feeds/' + 'feedId' + '/read'); + return this.http.post(this.BASE_URL + '/feeds/' + feedId + '/read'); }; @@ -1186,10 +1188,10 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL) this.settings[key] = value; return $http({ - url: BASE_URL + '/settings', - method: 'PUT', - data: this.settings - }); + url: BASE_URL + '/settings', + method: 'PUT', + data: this.settings + }); }; this.processLanguageCode = function (languageCode) { diff --git a/js/build/app.min.js b/js/build/app.min.js index ac91f09eb..82adb48b4 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",function(a,b,c,d,e,f,h){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||(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.autoPage=function(){this.isAutoPagingEnabled=!1;var b=f.current.$$route.type,d=h.id;c.autoPage(b,d).success(function(b){a.publishAll(b),b.items.length>0&&(this.isAutoPagingEnabled=!0)}).error(function(){this.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",function(a,b,c,d,e,f){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){return c.getById(a).unreadCount},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.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 d.get(a)!==g},this.isAddingFolder=function(){return!0},this.createFolder=function(a){console.log(a.name),a.name=""},this.createFeed=function(a){this.newFolder=!1,console.log(a.url+a.folder),a.url=""},this.renameFeed=function(a){a.editing=!1},this.renameFolder=function(){console.log("TBD")},this.deleteFeed=function(a){a.deleted=!0},this.undeleteFeed=function(a){a.deleted=!1},this.removeFeed=function(a){console.log("remove "+a)},this.deleteFolder=function(a){console.log(a)},this.moveFeed=function(a,b){console.log(a+b)}}]),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",function(a,b,c){var d=function(b,c){a.call(this,b,c,"url"),this.ids={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.deleted=null};return d.prototype=Object.create(a.prototype),d.prototype.receive=function(b){a.prototype.receive.call(this,b),this.updateUnreadCache(),this.updateFolderCache()},d.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)})},d.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)})},d.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==g&&(this.ids[b.id]=this.hashMap[b.url])},d.prototype.delete=function(b){var c=this.get(b);return this.deleted=c,delete this.ids[c.id],a.prototype.delete.call(this,b),this.updateUnreadCache(),this.updateFolderCache(),this.http.delete(this.BASE_URL+"/feeds/"+c.id)},d.prototype.markRead=function(){this.values.forEach(function(a){a.unreadCount=0}),this.unreadCount=0,this.folderUnreadCount={}},d.prototype.markFeedRead=function(a){this.ids[a].unreadCount=0,this.updateUnreadCache()},d.prototype.markFolderRead=function(a){this.values.forEach(function(b){b.folderId===a&&(b.unreadCount=0)}),this.updateUnreadCache()},d.prototype.markItemOfFeedRead=function(a){this.ids[a].unreadCount-=1,this.updateUnreadCache()},d.prototype.markItemsOfFeedsRead=function(a){var b=this;a.forEach(function(a){b.ids[a].unreadCount-=1}),this.updateUnreadCache()},d.prototype.markItemOfFeedUnread=function(a){this.ids[a].unreadCount+=1,this.updateUnreadCache()},d.prototype.getUnreadCount=function(){return this.unreadCount},d.prototype.getFolderUnreadCount=function(a){return this.folderUnreadCount[a]},d.prototype.getByFolderId=function(a){return this.folderIds[a]||[]},d.prototype.getById=function(a){return this.ids[a]},d.prototype.rename=function(a,b){var c=this.get(a);return c.title=b,this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/rename",data:{feedTitle:b}})},d.prototype.move=function(a,b){var c=this.get(a);return c.folderId=b,this.updateFolderCache(),this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/move",data:{parentFolderId:b}})},d.prototype.create=function(a,b,c){c&&(c=c.toUpperCase());var d={url:a,folderId:b,title:c,faviconLink:"../css/loading.gif"};this.get(a)||this.add(d),this.updateFolderCache(),console.log(d)},d.prototype.undoDelete=function(){return this.deleted?(this.add(this.deleted),this.http.post(this.BASE_URL+"/feeds/${this.deleted.id}/restore")):(this.updateFolderCache(),void this.updateUnreadCache())},new d(b,c)}]),h.factory("FolderResource",["Resource","$http","BASE_URL",function(a,b,c){var d=function(b,c){a.call(this,b,c,"name"),this.deleted=null};return d.prototype=Object.create(a.prototype),d.prototype.delete=function(b){var c=this.get(b);return this.deleted=c,a.prototype.delete.call(this,b),this.http.delete(this.BASE_URL+"/folders/"+c.id)},d.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}})},d.prototype.rename=function(a,b){b=b.toUpperCase();var c=this.get(a);return this.get(b)||(c.name=b,delete this.hashMap[a],this.hashMap[b]=c),this.http({url:this.BASE_URL+"/folders/"+c.id+"/rename",method:"POST",data:{folderName:b}})},d.prototype.create=function(a){if(a=a.toUpperCase(),!this.get(a)){var b={name:a};this.add(b)}return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:a}})},d.prototype.undoDelete=function(){return this.deleted?(this.add(this.deleted),this.http.post(this.BASE_URL+"/folders/"+this.deleted.id+"/restore")):void 0},new d(b,c)}]),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/feedId/read")},e.prototype.markRead=function(){return this.values.forEach(function(a){a.unread=!1}),this.http.post(this.BASE_URL+"/items/read")},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){b.scrollTop(a.offset().top-b.offset().top+b.scrollTop())},g=function(a){var b=a.find(".item");b.each(function(b,d){return d=c(d),d.position().top>1?(f(a,d),!1):void 0}),a.scrollTop(a.prop("scrollHeight"))},h=function(a){var b=a.find(".item");b.each(function(b,d){if(d=c(d),d.position().top>=0){var e=d.prev();return e.length>0&&f(a,e),!1}}),b.length>0&&f(a,b.last())},i=function(a){var b=a.find(".item");b.each(function(a,b){return b=c(b),b.height()+b.position().top>30?b:void 0})},j=function(a){var b=i(a);b.find(".keep-unread").trigger("click")},k=function(a){var b=i(a);b.find(".star").trigger("click")},l=function(a){var b=i(a);b.find(".title").trigger("click")},m=function(b){var c=i(b).find(".title a");c.trigger("click"),a.open(c.attr("href"),"_blank")};c(b).keyup(function(a){if(d(c(":focus"))&&e(a)){var b=a.keyCode,f=c("#app-content");[74,78,33].indexOf(b)>=0?(a.preventDefault(),g(f)):[75,80,37].indexOf(b)>=0?(a.preventDefault(),h(f)):[85].indexOf(b)>=0?(a.preventDefault(),j(f)):[69].indexOf(b)>=0?(a.preventDefault(),l(f)):[73,83,76].indexOf(b)>=0?(a.preventDefault(),k(f)):[72].indexOf(b)>=0?(a.preventDefault(),k(f),g(f)):[79].indexOf(b)>=0&&(a.preventDefault(),m(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:'<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(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",function(){return function(a,b,c){c.newsAutofocus?d(c.newsAutofocus).focus():b.focus()}}),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()}}),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","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",function(a,b,c,d,e,f,h){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.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",function(a,b,c,d,e,f){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){return c.getById(a).unreadCount},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.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 d.get(a)!==g},this.isAddingFolder=function(){return!0},this.createFolder=function(a){console.log(a.name),a.name=""},this.createFeed=function(a){this.newFolder=!1,console.log(a.url+a.folder),a.url=""},this.renameFeed=function(a){a.editing=!1},this.renameFolder=function(){console.log("TBD")},this.deleteFeed=function(a){a.deleted=!0},this.undeleteFeed=function(a){a.deleted=!1},this.removeFeed=function(a){console.log("remove "+a)},this.deleteFolder=function(a){console.log(a)},this.moveFeed=function(a,b){console.log(a+b)}}]),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",function(a,b,c){var d=function(b,c){a.call(this,b,c,"url"),this.ids={},this.unreadCount=0,this.folderUnreadCount={},this.folderIds={},this.deleted=null};return d.prototype=Object.create(a.prototype),d.prototype.receive=function(b){a.prototype.receive.call(this,b),this.updateUnreadCache(),this.updateFolderCache()},d.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)})},d.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)})},d.prototype.add=function(b){a.prototype.add.call(this,b),b.id!==g&&(this.ids[b.id]=this.hashMap[b.url])},d.prototype.delete=function(b){var c=this.get(b);return this.deleted=c,delete this.ids[c.id],a.prototype.delete.call(this,b),this.updateUnreadCache(),this.updateFolderCache(),this.http.delete(this.BASE_URL+"/feeds/"+c.id)},d.prototype.markRead=function(){this.values.forEach(function(a){a.unreadCount=0}),this.unreadCount=0,this.folderUnreadCount={}},d.prototype.markFeedRead=function(a){this.ids[a].unreadCount=0,this.updateUnreadCache()},d.prototype.markFolderRead=function(a){this.values.forEach(function(b){b.folderId===a&&(b.unreadCount=0)}),this.updateUnreadCache()},d.prototype.markItemOfFeedRead=function(a){this.ids[a].unreadCount-=1,this.updateUnreadCache()},d.prototype.markItemsOfFeedsRead=function(a){var b=this;a.forEach(function(a){b.ids[a].unreadCount-=1}),this.updateUnreadCache()},d.prototype.markItemOfFeedUnread=function(a){this.ids[a].unreadCount+=1,this.updateUnreadCache()},d.prototype.getUnreadCount=function(){return this.unreadCount},d.prototype.getFolderUnreadCount=function(a){return this.folderUnreadCount[a]},d.prototype.getByFolderId=function(a){return this.folderIds[a]||[]},d.prototype.getById=function(a){return this.ids[a]},d.prototype.rename=function(a,b){var c=this.get(a);return c.title=b,this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/rename",data:{feedTitle:b}})},d.prototype.move=function(a,b){var c=this.get(a);return c.folderId=b,this.updateFolderCache(),this.http({method:"POST",url:this.BASE_URL+"/feeds/"+c.id+"/move",data:{parentFolderId:b}})},d.prototype.create=function(a,b,c){c&&(c=c.toUpperCase());var d={url:a,folderId:b,title:c,faviconLink:"../css/loading.gif"};return this.get(a)||this.add(d),this.updateFolderCache(),console.log(d),this.http({method:"POST",url:this.BASE_URL+"/feeds",data:{url:a,parentFolderId:b,title:c}})},d.prototype.undoDelete=function(){return this.deleted?(this.add(this.deleted),this.http.post(this.BASE_URL+"/feeds/"+this.deleted.id+"/restore")):(this.updateFolderCache(),void this.updateUnreadCache())},new d(b,c)}]),h.factory("FolderResource",["Resource","$http","BASE_URL",function(a,b,c){var d=function(b,c){a.call(this,b,c,"name"),this.deleted=null};return d.prototype=Object.create(a.prototype),d.prototype.delete=function(b){var c=this.get(b);return this.deleted=c,a.prototype.delete.call(this,b),this.http.delete(this.BASE_URL+"/folders/"+c.id)},d.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}})},d.prototype.rename=function(a,b){b=b.toUpperCase();var c=this.get(a);return this.get(b)||(c.name=b,delete this.hashMap[a],this.hashMap[b]=c),this.http({url:this.BASE_URL+"/folders/"+c.id+"/rename",method:"POST",data:{folderName:b}})},d.prototype.create=function(a){if(a=a.toUpperCase(),!this.get(a)){var b={name:a};this.add(b)}return this.http({url:this.BASE_URL+"/folders",method:"POST",data:{folderName:a}})},d.prototype.undoDelete=function(){return this.deleted?(this.add(this.deleted),this.http.post(this.BASE_URL+"/folders/"+this.deleted.id+"/restore")):void 0},new d(b,c)}]),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")},e.prototype.markRead=function(){return this.values.forEach(function(a){a.unread=!1}),this.http.post(this.BASE_URL+"/items/read")},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){b.scrollTop(a.offset().top-b.offset().top+b.scrollTop())},g=function(a){var b=a.find(".item");b.each(function(b,d){return d=c(d),d.position().top>1?(f(a,d),!1):void 0}),a.scrollTop(a.prop("scrollHeight"))},h=function(a){var b=a.find(".item");b.each(function(b,d){if(d=c(d),d.position().top>=0){var e=d.prev();return e.length>0&&f(a,e),!1}}),b.length>0&&f(a,b.last())},i=function(a){var b=a.find(".item");b.each(function(a,b){return b=c(b),b.height()+b.position().top>30?b:void 0})},j=function(a){var b=i(a);b.find(".keep-unread").trigger("click")},k=function(a){var b=i(a);b.find(".star").trigger("click")},l=function(a){var b=i(a);b.find(".title").trigger("click")},m=function(b){var c=i(b).find(".title a");c.trigger("click"),a.open(c.attr("href"),"_blank")};c(b).keyup(function(a){if(d(c(":focus"))&&e(a)){var b=a.keyCode,f=c("#app-content");[74,78,33].indexOf(b)>=0?(a.preventDefault(),g(f)):[75,80,37].indexOf(b)>=0?(a.preventDefault(),h(f)):[85].indexOf(b)>=0?(a.preventDefault(),j(f)):[69].indexOf(b)>=0?(a.preventDefault(),l(f)):[73,83,76].indexOf(b)>=0?(a.preventDefault(),k(f)):[72].indexOf(b)>=0?(a.preventDefault(),k(f),g(f)):[79].indexOf(b)>=0&&(a.preventDefault(),m(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:'<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(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",function(){return function(a,b,c){c.newsAutofocus?d(c.newsAutofocus).focus():b.focus()}}),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()}}),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/controller/ContentController.js b/js/controller/ContentController.js index ae265f2cf..e09279b25 100644 --- a/js/controller/ContentController.js +++ b/js/controller/ContentController.js @@ -39,7 +39,7 @@ function (Publisher, FeedResource, ItemResource, SettingsResource, data, this.markRead = function (itemId) { var item = ItemResource.get(itemId); - if (!item.keepUnread) { + if (!item.keepUnread && item.unread === true) { ItemResource.markItemRead(itemId); FeedResource.markItemOfFeedRead(item.feedId); } @@ -61,9 +61,9 @@ function (Publisher, FeedResource, ItemResource, SettingsResource, data, this.orderBy = function () { if (SettingsResource.get('oldestFirst')) { - return 'id'; - } else { return '-id'; + } else { + return 'id'; } }; @@ -101,14 +101,15 @@ function (Publisher, FeedResource, ItemResource, SettingsResource, data, var type = $route.current.$$route.type; var id = $routeParams.id; + var self = this; ItemResource.autoPage(type, id).success(function (data) { Publisher.publishAll(data); if (data.items.length > 0) { - this.isAutoPagingEnabled = true; + self.isAutoPagingEnabled = true; } }).error(function () { - this.isAutoPagingEnabled = true; + self.isAutoPagingEnabled = true; }); }; diff --git a/js/karma.conf.js b/js/karma.conf.js index 1ca0d54d7..d16be2dad 100644 --- a/js/karma.conf.js +++ b/js/karma.conf.js @@ -30,7 +30,6 @@ module.exports = function (config) { 'vendor/angular-animate/angular-animate.js', 'tests/unit/stubs/App.js', 'tests/unit/stubs/OC.js', - 'utility/**/*.js', 'controller/**/*.js', 'filter/**/*.js', 'service/**/*.js', diff --git a/js/service/FeedResource.js b/js/service/FeedResource.js index 5c85fdc4e..b91a9a724 100644 --- a/js/service/FeedResource.js +++ b/js/service/FeedResource.js @@ -200,7 +200,7 @@ app.factory('FeedResource', function (Resource, $http, BASE_URL) { console.log(feed); - /*return this.http({ + return this.http({ method: 'POST', url: this.BASE_URL + '/feeds', data: { @@ -208,7 +208,7 @@ app.factory('FeedResource', function (Resource, $http, BASE_URL) { parentFolderId: folderId, title: title } - });*/ + }); }; @@ -217,7 +217,7 @@ app.factory('FeedResource', function (Resource, $http, BASE_URL) { this.add(this.deleted); return this.http.post( - this.BASE_URL + '/feeds/${this.deleted.id}/restore' + this.BASE_URL + '/feeds/' + this.deleted.id + '/restore' ); } diff --git a/js/service/ItemResource.js b/js/service/ItemResource.js index cc67cc003..a25d6c3e7 100644 --- a/js/service/ItemResource.js +++ b/js/service/ItemResource.js @@ -90,6 +90,7 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL, } this.get(itemId).unread = !isRead; + return this.http({ url: this.BASE_URL + '/items/' + itemId + '/read', method: 'POST', @@ -130,7 +131,7 @@ app.factory('ItemResource', function (Resource, $http, BASE_URL, item.unread = !read; }); - return this.http.post(this.BASE_URL + '/feeds/' + 'feedId' + '/read'); + return this.http.post(this.BASE_URL + '/feeds/' + feedId + '/read'); }; diff --git a/js/service/SettingsResource.js b/js/service/SettingsResource.js index 291221472..6051b2918 100644 --- a/js/service/SettingsResource.js +++ b/js/service/SettingsResource.js @@ -49,10 +49,10 @@ app.service('SettingsResource', function ($http, BASE_URL) { this.settings[key] = value; return $http({ - url: BASE_URL + '/settings', - method: 'PUT', - data: this.settings - }); + url: BASE_URL + '/settings', + method: 'PUT', + data: this.settings + }); }; this.processLanguageCode = function (languageCode) { diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js index 772fdc565..90dd0aab8 100644 --- a/js/tests/unit/controller/AppControllerSpec.js +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -7,38 +7,39 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('AppController', () => { +describe('AppController', function () { 'use strict'; - let controller; + var controller; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); })); - beforeEach(inject(($controller) => { + beforeEach(inject(function ($controller) { controller = $controller('AppController'); })); - it('should expose Loading', inject((Loading) => { + it('should expose Loading', inject(function (Loading) { expect(controller.loading).toBe(Loading); })); - it('should expose set firstrun if no feeds and folders', inject(() => { + it('should expose set firstrun if no feeds and folders', function () { expect(controller.isFirstRun()).toBe(true); - })); + }); - it('should expose set firstrun if feeds', inject((FeedResource) => { + it('should expose set firstrun if feeds', inject(function (FeedResource) { FeedResource.add({url: 'test'}); expect(controller.isFirstRun()).toBe(false); })); - it('should expose set firstrun if folders', inject((FolderResource) => { + it('should expose set firstrun if folders', inject( + function (FolderResource) { FolderResource.add({name: 'test'}); expect(controller.isFirstRun()).toBe(false); diff --git a/js/tests/unit/controller/ContentControllerSpec.js b/js/tests/unit/controller/ContentControllerSpec.js index e649219d6..bdea6e16a 100644 --- a/js/tests/unit/controller/ContentControllerSpec.js +++ b/js/tests/unit/controller/ContentControllerSpec.js @@ -7,37 +7,37 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('ContentController', () => { +describe('ContentController', function () { 'use strict'; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.constant('BASE_URL', 'base'); $provide.constant('ITEM_BATCH_SIZE', 5); })); - it('should publish data to models', inject(($controller, Publisher, - FeedResource, ItemResource) => { + it('should publish data to models', inject(function ($controller, Publisher, + FeedResource, ItemResource) { - Publisher.subscribe(ItemResource).toChannels('items'); - Publisher.subscribe(FeedResource).toChannels('feeds'); + Publisher.subscribe(ItemResource).toChannels(['items']); + Publisher.subscribe(FeedResource).toChannels(['feeds']); - let controller = $controller('ContentController', { + var controller = $controller('ContentController', { data: { 'items': [ {id: 3}, {id: 4} ] - }, + } }); expect(controller.getItems().length).toBe(2); })); - it('should clear data on url change', inject(($controller, - ItemResource) => { + it('should clear data on url change', inject(function ($controller, + ItemResource) { ItemResource.clear = jasmine.createSpy('clear'); @@ -49,10 +49,10 @@ describe('ContentController', () => { })); - it('should return order by', inject(($controller, - SettingsResource) => { + it('should return order by', inject(function ($controller, + SettingsResource) { - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { SettingsResource: SettingsResource, data: {}, }); @@ -65,31 +65,38 @@ describe('ContentController', () => { })); - it('should mark read', inject(($controller, - ItemResource, FeedResource, Publisher) => { + it('should mark read', inject(function ($controller, ItemResource, + FeedResource, Publisher) { - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.markItemRead = jasmine.createSpy('markRead'); FeedResource.markItemOfFeedRead = jasmine.createSpy('markRead'); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { ItemResource: ItemResource, FeedResource: FeedResource, data: { 'items': [{ id: 3, - feedId: 4 + feedId: 4, + unread: true }, { id: 5, feedId: 4, keepUnread: true + }, + { + id: 9, + feedId: 5, + unread: false }] }, }); ctrl.markRead(3); ctrl.markRead(5); + ctrl.markRead(9); expect(ItemResource.markItemRead).toHaveBeenCalledWith(3); expect(FeedResource.markItemOfFeedRead).toHaveBeenCalledWith(4); @@ -98,12 +105,12 @@ describe('ContentController', () => { })); - it('should toggle keep unread when unread', inject(($controller, - ItemResource, FeedResource, Publisher) => { + it('should toggle keep unread when unread', inject(function ($controller, + ItemResource, FeedResource, Publisher) { - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { ItemResource: ItemResource, FeedResource: FeedResource, data: { @@ -121,14 +128,14 @@ describe('ContentController', () => { })); - it('should toggle keep unread when read', inject(($controller, - ItemResource, FeedResource, Publisher) => { + it('should toggle keep unread when read', inject(function ($controller, + ItemResource, FeedResource, Publisher) { - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.markItemRead = jasmine.createSpy('markRead'); FeedResource.markItemOfFeedUnread = jasmine.createSpy('markRead'); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { ItemResource: ItemResource, FeedResource: FeedResource, data: { @@ -149,11 +156,12 @@ describe('ContentController', () => { })); - it('should get a feed', inject(($controller, FeedResource, Publisher) => { + it('should get a feed', inject(function ($controller, FeedResource, + Publisher) { - Publisher.subscribe(FeedResource).toChannels('feeds'); + Publisher.subscribe(FeedResource).toChannels(['feeds']); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { FeedResource: FeedResource, data: { 'feeds': [{ @@ -167,11 +175,11 @@ describe('ContentController', () => { })); - it('should toggle starred', inject(($controller, ItemResource) => { + it('should toggle starred', inject(function ($controller, ItemResource) { ItemResource.toggleStar = jasmine.createSpy('star'); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { ItemResource: ItemResource, data: {}, }); @@ -183,11 +191,12 @@ describe('ContentController', () => { - it('should publish compactview', inject(($controller, SettingsResource) => { + it('should publish compactview', inject(function ($controller, + SettingsResource) { SettingsResource.set('compact', true); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { SettingsResource: SettingsResource, data: {}, }); @@ -196,11 +205,12 @@ describe('ContentController', () => { })); - it('should publish markread', inject(($controller, SettingsResource) => { + it('should publish markread', inject(function ($controller, + SettingsResource) { SettingsResource.set('preventReadOnScroll', true); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { SettingsResource: SettingsResource, data: {}, }); @@ -209,8 +219,8 @@ describe('ContentController', () => { })); - it('should publish autopaging', inject(($controller) => { - let ctrl = $controller('ContentController', { + it('should publish autopaging', inject(function ($controller) { + var ctrl = $controller('ContentController', { data: {}, }); @@ -218,14 +228,14 @@ describe('ContentController', () => { })); - it('should mark multiple items read', inject(($controller, - ItemResource, FeedResource, Publisher) => { + it('should mark multiple items read', inject(function ($controller, + ItemResource, FeedResource, Publisher) { - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.markItemsRead = jasmine.createSpy('markRead'); FeedResource.markItemsOfFeedsRead = jasmine.createSpy('markRead'); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { ItemResource: ItemResource, FeedResource: FeedResource, data: { @@ -252,10 +262,10 @@ describe('ContentController', () => { })); - it('should not autopage if less than 0 elements', inject(( - $controller, ItemResource, Publisher) => { + it('should not autopage if less than 0 elements', inject(function ( + $controller, ItemResource, Publisher) { - let $route = { + var $route = { current: { $$route: { type: 3 @@ -263,27 +273,27 @@ describe('ContentController', () => { } }; - let $routeParams = { + var $routeParams = { id: 2 }; - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.autoPage = jasmine.createSpy('autoPage') - .andCallFake(() => { + .andCallFake(function () { return { - success: (callback) => { + success: function (callback) { callback({ 'items': [] }); return { - error: () => {} + error: function () {} }; } }; }); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { $routeParams: $routeParams, $route: $route, Publisher: Publisher, @@ -302,10 +312,10 @@ describe('ContentController', () => { })); - it('should autopage if more than 0 elements', inject(( - $controller, ItemResource, Publisher) => { + it('should autopage if more than 0 elements', inject(function ( + $controller, ItemResource, Publisher) { - let $route = { + var $route = { current: { $$route: { type: 3 @@ -313,27 +323,27 @@ describe('ContentController', () => { } }; - let $routeParams = { + var $routeParams = { id: 2 }; - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.autoPage = jasmine.createSpy('autoPage') - .andCallFake(() => { + .andCallFake(function () { return { - success: (callback) => { + success: function (callback) { callback({ 'items': [{items: [{id: 3}]}] }); return { - error: () => {} + error: function () {} }; } }; }); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { $routeParams: $routeParams, $route: $route, Publisher: Publisher, @@ -350,10 +360,10 @@ describe('ContentController', () => { })); - it('should autopage if error', inject(( - $controller, ItemResource, Publisher) => { + it('should autopage if error', inject(function ( + $controller, ItemResource, Publisher) { - let $route = { + var $route = { current: { $$route: { type: 3 @@ -361,21 +371,21 @@ describe('ContentController', () => { } }; - let $routeParams = { + var $routeParams = { id: 2 }; - Publisher.subscribe(ItemResource).toChannels('items'); + Publisher.subscribe(ItemResource).toChannels(['items']); ItemResource.autoPage = jasmine.createSpy('autoPage') - .andCallFake(() => { + .andCallFake(function () { return { - success: (callback) => { + success: function (callback) { callback({ 'items': [] }); return { - error: (callback) => { + error: function (callback) { callback(); } }; @@ -383,7 +393,7 @@ describe('ContentController', () => { }; }); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { $routeParams: $routeParams, $route: $route, Publisher: Publisher, @@ -399,11 +409,11 @@ describe('ContentController', () => { })); - it('should return relative date', inject(($controller, - SettingsResource) => { + it('should return relative date', inject(function ($controller, + SettingsResource) { SettingsResource.receive({language: 'en'}); - let ctrl = $controller('ContentController', { + var ctrl = $controller('ContentController', { data: {}, }); @@ -411,8 +421,8 @@ describe('ContentController', () => { })); - it('should return relative date empty', inject(($controller) => { - let ctrl = $controller('ContentController', { + it('should return relative date empty', inject(function ($controller) { + var ctrl = $controller('ContentController', { data: {}, }); diff --git a/js/tests/unit/controller/NavigationControllerSpec.js b/js/tests/unit/controller/NavigationControllerSpec.js index 8c646640f..e871a2174 100644 --- a/js/tests/unit/controller/NavigationControllerSpec.js +++ b/js/tests/unit/controller/NavigationControllerSpec.js @@ -7,12 +7,12 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('NavigationController', () => { +describe('NavigationController', function () { 'use strict'; - let controller; + var controller; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); $provide.value('FEED_TYPE', { FEED: 0, @@ -24,7 +24,7 @@ describe('NavigationController', () => { $provide.constant('ITEM_BATCH_SIZE', 5); })); - beforeEach(inject(($controller, FeedResource) => { + beforeEach(inject(function ($controller, FeedResource) { controller = $controller('NavigationController'); FeedResource.receive([ {id: 1, folderId: 3, url: 'ye', unreadCount: 45}, @@ -35,22 +35,22 @@ describe('NavigationController', () => { })); - it('should expose Feeds', inject((FeedResource) => { + it('should expose Feeds', inject(function (FeedResource) { FeedResource.add({url: 1}); expect(controller.getFeeds()).toBe(FeedResource.getAll()); })); - it('should expose Folders', inject((FolderResource) => { + it('should expose Folders', inject(function (FolderResource) { FolderResource.add({name: 1}); expect(controller.getFolders()).toBe(FolderResource.getAll()); })); - it('should mark Folders read', inject(($controller) => { - let FeedResource = { + it('should mark Folders read', inject(function ($controller) { + var FeedResource = { markFolderRead: jasmine.createSpy('folder'), - getByFolderId: () => { + getByFolderId: function () { return [ {id: 3}, {id: 4} @@ -58,7 +58,7 @@ describe('NavigationController', () => { } }; - let ItemResource = { + var ItemResource = { markFeedRead: jasmine.createSpy('feedfolder') }; @@ -74,12 +74,12 @@ describe('NavigationController', () => { })); - it('should mark a feed read', inject(($controller) => { - let FeedResource = { + it('should mark a feed read', inject(function ($controller) { + var FeedResource = { markFeedRead: jasmine.createSpy('folder'), }; - let ItemResource = { + var ItemResource = { markFeedRead: jasmine.createSpy('feedfolder') }; @@ -95,12 +95,12 @@ describe('NavigationController', () => { })); - it('should mark all read', inject(($controller) => { - let FeedResource = { + it('should mark all read', inject(function ($controller) { + var FeedResource = { markRead: jasmine.createSpy('folder'), }; - let ItemResource = { + var ItemResource = { markRead: jasmine.createSpy('feedfolder') }; @@ -116,8 +116,8 @@ describe('NavigationController', () => { })); - it('should mark all read', inject((SettingsResource, $controller) => { - let ctrl = $controller('NavigationController', { + it('should mark all read', inject(function (SettingsResource, $controller) { + var ctrl = $controller('NavigationController', { SettingsResource: SettingsResource, }); @@ -127,8 +127,8 @@ describe('NavigationController', () => { })); - it('should get all of folder', inject((FeedResource, $controller) => { - let ctrl = $controller('NavigationController', { + it('should get all of folder', inject(function (FeedResource, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, }); @@ -139,8 +139,9 @@ describe('NavigationController', () => { })); - it('should get the unreadcount', inject((FeedResource, $controller) => { - let ctrl = $controller('NavigationController', { + it('should get the unreadcount', inject(function (FeedResource, + $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, }); @@ -151,8 +152,9 @@ describe('NavigationController', () => { })); - it('should get the starred count', inject((ItemResource, $controller) => { - let ctrl = $controller('NavigationController', { + it('should get the starred count', inject(function (ItemResource, + $controller) { + var ctrl = $controller('NavigationController', { ItemResource: ItemResource, }); @@ -162,8 +164,8 @@ describe('NavigationController', () => { })); - it('should toggle a folder', inject((FolderResource, $controller) => { - let ctrl = $controller('NavigationController', { + it('should toggle a folder', inject(function (FolderResource, $controller) { + var ctrl = $controller('NavigationController', { FolderResource: FolderResource, }); @@ -175,9 +177,9 @@ describe('NavigationController', () => { })); - it('should check if a folder has feeds', inject((FeedResource, - $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a folder has feeds', inject(function (FeedResource, + $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, }); @@ -186,9 +188,9 @@ describe('NavigationController', () => { })); - it('should check if a subfeed is active', inject((FeedResource, - FEED_TYPE, $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a subfeed is active', inject(function (FeedResource, + FEED_TYPE, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, $route: { current: { @@ -205,9 +207,9 @@ describe('NavigationController', () => { expect(ctrl.subFeedActive(3)).toBe(true); })); - it('should check if a subscriptions is active', inject((FeedResource, - FEED_TYPE, $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a subscriptions is active', inject(function ( + FeedResource, FEED_TYPE, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, $route: { current: { @@ -222,9 +224,9 @@ describe('NavigationController', () => { })); - it('should check if a starred is active', inject((FeedResource, - FEED_TYPE, $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a starred is active', inject(function (FeedResource, + FEED_TYPE, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, $route: { current: { @@ -240,9 +242,9 @@ describe('NavigationController', () => { - it('should check if a feed is active', inject((FeedResource, - FEED_TYPE, $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a feed is active', inject(function (FeedResource, + FEED_TYPE, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, $route: { current: { @@ -260,9 +262,9 @@ describe('NavigationController', () => { })); - it('should check if a folder is active', inject((FeedResource, - FEED_TYPE, $controller) => { - let ctrl = $controller('NavigationController', { + it('should check if a folder is active', inject(function (FeedResource, + FEED_TYPE, $controller) { + var ctrl = $controller('NavigationController', { FeedResource: FeedResource, $route: { current: { @@ -280,7 +282,8 @@ describe('NavigationController', () => { })); - it('should expose check if folder exists', inject((FolderResource) => { + it('should expose check if folder exists', inject(function ( + FolderResource) { expect(controller.folderNameExists('hi')).toBe(false); FolderResource.add({name: 'hi'}); expect(controller.folderNameExists('hi')).toBe(true); diff --git a/js/tests/unit/controller/SettingsControllerSpec.js b/js/tests/unit/controller/SettingsControllerSpec.js index fbe8b3438..ac6d2c9b6 100644 --- a/js/tests/unit/controller/SettingsControllerSpec.js +++ b/js/tests/unit/controller/SettingsControllerSpec.js @@ -7,28 +7,28 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('SettingsController', () => { +describe('SettingsController', function () { 'use strict'; - let route; + var route; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); })); - beforeEach(() => { + beforeEach(function () { route = { reload: jasmine.createSpy('Route') }; }); - it('should set values', inject(($controller) => { - let SettingsResource = { + it('should set values', inject(function ($controller) { + var SettingsResource = { set: jasmine.createSpy('SettingsResource'), - get: key => key + get: function (key) { return key; } }; - let ctrl = $controller('SettingsController', { + var ctrl = $controller('SettingsController', { SettingsResource: SettingsResource, $route: route }); @@ -39,13 +39,13 @@ describe('SettingsController', () => { })); - it('should reload page if set needed', inject(($controller) => { - let SettingsResource = { + it('should reload page if set needed', inject(function ($controller) { + var SettingsResource = { set: jasmine.createSpy('SettingsResource'), - get: key => key + get: function (key) { return key; } }; - let ctrl = $controller('SettingsController', { + var ctrl = $controller('SettingsController', { SettingsResource: SettingsResource, $route: route }); @@ -59,10 +59,10 @@ describe('SettingsController', () => { })); - it('should return feed size', inject(($controller, FeedResource) => { + it('should return feed size', inject(function ($controller, FeedResource) { FeedResource.add({url: 'hi'}); - let ctrl = $controller('SettingsController', { + var ctrl = $controller('SettingsController', { FeedResource: FeedResource, $route: route }); diff --git a/js/tests/unit/filter/UnreadCountFormatterSpec.js b/js/tests/unit/filter/UnreadCountFormatterSpec.js index 14152f047..83a96ebfe 100644 --- a/js/tests/unit/filter/UnreadCountFormatterSpec.js +++ b/js/tests/unit/filter/UnreadCountFormatterSpec.js @@ -7,18 +7,18 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('unreadCountFormatter', () => { +describe('unreadCountFormatter', function () { 'use strict'; - let filter; + var filter; beforeEach(module('News')); - beforeEach(inject(($filter) => { + beforeEach(inject(function ($filter) { filter = $filter('unreadCountFormatter'); })); - it('should format the unread count', () => { + it('should format the unread count', function () { expect(filter(999)).toBe(999); expect(filter(1000)).toBe('999+'); }); diff --git a/js/tests/unit/service/FeedResourceSpec.js b/js/tests/unit/service/FeedResourceSpec.js index d7473cb70..839ae650d 100644 --- a/js/tests/unit/service/FeedResourceSpec.js +++ b/js/tests/unit/service/FeedResourceSpec.js @@ -7,18 +7,23 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('FeedResource', () => { +describe('FeedResource', function () { 'use strict'; - let resource, + var resource, http; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); })); + afterEach(function () { + http.verifyNoOutstandingExpectation(); + http.verifyNoOutstandingRequest(); + }); - beforeEach(inject((FeedResource, $httpBackend) => { + + beforeEach(inject(function (FeedResource, $httpBackend) { resource = FeedResource; http = $httpBackend; FeedResource.receive([ @@ -28,14 +33,14 @@ describe('FeedResource', () => { ]); })); - it('should mark all read', inject((FeedResource) => { + it('should mark all read', inject(function (FeedResource) { FeedResource.markRead(); expect(FeedResource.getUnreadCount()).toBe(0); })); - it('should mark a feed read', inject((FeedResource) => { + it('should mark a feed read', inject(function (FeedResource) { FeedResource.markFeedRead(1); @@ -43,14 +48,14 @@ describe('FeedResource', () => { })); - it('should mark an item read', inject((FeedResource) => { + it('should mark an item read', inject(function (FeedResource) { FeedResource.markItemOfFeedRead(1); expect(FeedResource.get('ye').unreadCount).toBe(44); })); - it('should mark an item unread', inject((FeedResource) => { + it('should mark an item unread', inject(function (FeedResource) { FeedResource.markItemOfFeedUnread(1); @@ -58,16 +63,16 @@ describe('FeedResource', () => { })); - it('should get all of folder', inject((FeedResource) => { + it('should get all of folder', inject(function (FeedResource) { - let folders = FeedResource.getByFolderId(3); + var folders = FeedResource.getByFolderId(3); expect(folders.length).toBe(2); })); - it('should cache unreadcount', inject((FeedResource) => { + it('should cache unreadcount', inject(function (FeedResource) { expect(FeedResource.getUnreadCount()).toBe(70); FeedResource.markItemOfFeedRead(3); @@ -84,7 +89,7 @@ describe('FeedResource', () => { })); - it('should cache folder unreadcount', inject((FeedResource) => { + it('should cache folder unreadcount', inject(function (FeedResource) { expect(FeedResource.getFolderUnreadCount(3)).toBe(45); FeedResource.markItemOfFeedRead(3); @@ -101,14 +106,14 @@ describe('FeedResource', () => { })); - it('should cache unreadcount', inject((FeedResource) => { + it('should cache unreadcount', inject(function (FeedResource) { FeedResource.markItemsOfFeedsRead([1, 2]); expect(FeedResource.getUnreadCount()).toBe(68); })); - it ('should delete a feed', inject((FeedResource) => { + it ('should delete a feed', inject(function (FeedResource) { http.expectDELETE('base/feeds/1').respond(200, {}); FeedResource.delete('ye'); @@ -119,7 +124,7 @@ describe('FeedResource', () => { })); - it ('should rename a feed', inject((FeedResource) => { + it ('should rename a feed', inject(function (FeedResource) { http.expectPOST('base/feeds/3/rename', { feedTitle: 'heho' }).respond(200, {}); @@ -132,7 +137,7 @@ describe('FeedResource', () => { })); - it ('should move a feed', inject((FeedResource) => { + it ('should move a feed', inject(function (FeedResource) { http.expectPOST('base/feeds/3/move', { parentFolderId: 5 }).respond(200, {}); @@ -145,7 +150,7 @@ describe('FeedResource', () => { })); - it ('should create a feed', inject((FeedResource) => { + it ('should create a feed', inject(function (FeedResource) { http.expectPOST('base/feeds', { parentFolderId: 5, url: 'hey', @@ -160,7 +165,8 @@ describe('FeedResource', () => { })); - it ('should not create a feed if it exists', inject((FeedResource) => { + it ('should not create a feed if it exists', inject(function ( + FeedResource) { http.expectPOST('base/feeds', { parentFolderId: 5, url: 'ye', @@ -175,7 +181,7 @@ describe('FeedResource', () => { })); - it ('should undo a delete folder', inject((FeedResource) => { + it ('should undo a delete folder', inject(function (FeedResource) { http.expectDELETE('base/feeds/1').respond(200, {}); FeedResource.delete('ye'); @@ -193,12 +199,4 @@ describe('FeedResource', () => { })); - - - afterEach(() => { - http.verifyNoOutstandingExpectation(); - http.verifyNoOutstandingRequest(); - }); - - }); diff --git a/js/tests/unit/service/FolderResourceSpec.js b/js/tests/unit/service/FolderResourceSpec.js index db8312232..01858bbc6 100644 --- a/js/tests/unit/service/FolderResourceSpec.js +++ b/js/tests/unit/service/FolderResourceSpec.js @@ -7,18 +7,23 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('FolderResource', () => { +describe('FolderResource', function () { 'use strict'; - let resource, + var resource, http; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); })); + afterEach(function () { + http.verifyNoOutstandingExpectation(); + http.verifyNoOutstandingRequest(); + }); - beforeEach(inject((FolderResource, $httpBackend) => { + + beforeEach(inject(function (FolderResource, $httpBackend) { resource = FolderResource; http = $httpBackend; FolderResource.receive([ @@ -29,7 +34,7 @@ describe('FolderResource', () => { })); - it ('should delete a folder', inject((FolderResource) => { + it ('should delete a folder', inject(function (FolderResource) { http.expectDELETE('base/folders/1').respond(200, {}); FolderResource.delete('ye'); @@ -40,7 +45,7 @@ describe('FolderResource', () => { })); - it ('should rename a folder', inject((FolderResource) => { + it ('should rename a folder', inject(function (FolderResource) { http.expectPOST('base/folders/1/rename', { folderName: 'HEHO' }).respond(200, {}); @@ -53,7 +58,8 @@ describe('FolderResource', () => { })); - it ('should not rename a folder if it exists', inject((FolderResource) => { + it ('should not rename a folder if it exists', inject(function ( + FolderResource) { http.expectPOST('base/folders/1/rename', { folderName: 'SYE' }).respond(200, {}); @@ -66,7 +72,7 @@ describe('FolderResource', () => { })); - it ('should open a folder', inject((FolderResource) => { + it ('should open a folder', inject(function (FolderResource) { http.expectPOST('base/folders/3/open', { folderId: 3, open: false, @@ -80,7 +86,7 @@ describe('FolderResource', () => { })); - it ('should create a folder', inject((FolderResource) => { + it ('should create a folder', inject(function (FolderResource) { http.expectPOST('base/folders', { folderName: 'HEY' }).respond(200, {}); @@ -93,7 +99,8 @@ describe('FolderResource', () => { })); - it ('should not create a folder if it exists', inject((FolderResource) => { + it ('should not create a folder if it exists', inject(function ( + FolderResource) { http.expectPOST('base/folders', { folderName: 'SYE' }).respond(200, {}); @@ -106,7 +113,7 @@ describe('FolderResource', () => { })); - it ('should undo a delete folder', inject((FolderResource) => { + it ('should undo a delete folder', inject(function (FolderResource) { http.expectDELETE('base/folders/1').respond(200, {}); FolderResource.delete('ye'); @@ -124,10 +131,4 @@ describe('FolderResource', () => { })); - afterEach(() => { - http.verifyNoOutstandingExpectation(); - http.verifyNoOutstandingRequest(); - }); - - }); diff --git a/js/tests/unit/service/ItemResourceSpec.js b/js/tests/unit/service/ItemResourceSpec.js index f93d92caa..6e32fc5bd 100644 --- a/js/tests/unit/service/ItemResourceSpec.js +++ b/js/tests/unit/service/ItemResourceSpec.js @@ -7,36 +7,41 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('ItemResource', () => { +describe('ItemResource', function () { 'use strict'; - let http; + var http; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); $provide.constant('ITEM_BATCH_SIZE', 5); })); - beforeEach(inject(($httpBackend) => { + beforeEach(inject(function ($httpBackend) { http = $httpBackend; })); + afterEach(function () { + http.verifyNoOutstandingExpectation(); + http.verifyNoOutstandingRequest(); + }); - it('should receive the newestItemId', inject((ItemResource) => { + + it('should receive the newestItemId', inject(function (ItemResource) { ItemResource.receive(3, 'newestItemId'); expect(ItemResource.getNewestItemId()).toBe(3); })); - it('should receive the newestItemId', inject((ItemResource) => { + it('should receive the newestItemId', inject(function (ItemResource) { ItemResource.receive(2, 'starred'); expect(ItemResource.getStarredCount()).toBe(2); })); - it ('should mark item as read', inject((ItemResource) => { + it ('should mark item as read', inject(function (ItemResource) { http.expectPOST('base/items/3/read', {isRead: true}).respond(200, {}); ItemResource.receive([ @@ -60,7 +65,7 @@ describe('ItemResource', () => { })); - it ('should mark multiple item as read', inject((ItemResource) => { + it ('should mark multiple item as read', inject(function (ItemResource) { http.expectPOST('base/items/read/multiple', { itemIds: [3, 4] }).respond(200, {}); @@ -88,7 +93,7 @@ describe('ItemResource', () => { - it ('should star item', inject((ItemResource) => { + it ('should star item', inject(function (ItemResource) { http.expectPOST('base/items/4/a/star', {isStarred: true}) .respond(200, {}); @@ -115,7 +120,7 @@ describe('ItemResource', () => { })); - it ('should mark feed as read', inject((ItemResource) => { + it ('should mark feed as read', inject(function (ItemResource) { http.expectPOST('base/feeds/4/read').respond(200, {}); ItemResource.receive([ @@ -145,7 +150,7 @@ describe('ItemResource', () => { })); - it ('should mark all as read', inject((ItemResource) => { + it ('should mark all as read', inject(function (ItemResource) { http.expectPOST('base/items/read').respond(200, {}); ItemResource.receive([ @@ -176,7 +181,7 @@ describe('ItemResource', () => { })); - it ('toggle star', inject((ItemResource) => { + it ('toggle star', inject(function (ItemResource) { ItemResource.receive([ { id: 3, @@ -198,7 +203,7 @@ describe('ItemResource', () => { })); - it ('should auto page', inject((ItemResource) => { + it ('should auto page', inject(function (ItemResource) { http.expectGET('base/items?id=4&limit=5&offset=3&type=3') .respond(200, {}); @@ -226,10 +231,4 @@ describe('ItemResource', () => { })); - afterEach(() => { - http.verifyNoOutstandingExpectation(); - http.verifyNoOutstandingRequest(); - }); - - });
\ No newline at end of file diff --git a/js/tests/unit/service/LoadingSpec.js b/js/tests/unit/service/LoadingSpec.js index be654641c..2033f33cc 100644 --- a/js/tests/unit/service/LoadingSpec.js +++ b/js/tests/unit/service/LoadingSpec.js @@ -7,18 +7,18 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('Loading', () => { +describe('Loading', function () { 'use strict'; beforeEach(module('News')); - it('should be not load by default', inject((Loading) => { + it('should be not load by default', inject(function (Loading) { expect(Loading.isLoading('global')).toBe(false); expect(Loading.isLoading('content')).toBe(false); expect(Loading.isLoading('autopaging')).toBe(false); })); - it('should set loading', inject((Loading) => { + it('should set loading', inject(function (Loading) { Loading.setLoading('global', true); expect(Loading.isLoading('global')).toBe(true); })); diff --git a/js/tests/unit/service/PublisherSpec.js b/js/tests/unit/service/PublisherSpec.js index 38efa9398..3bd846107 100644 --- a/js/tests/unit/service/PublisherSpec.js +++ b/js/tests/unit/service/PublisherSpec.js @@ -7,17 +7,18 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('Publisher', () => { +describe('Publisher', function () { 'use strict'; beforeEach(module('News')); - it('should should publish on all possible channels', inject((Publisher) => { - let obj = { + it('should should publish on all possible channels', + inject(function (Publisher) { + var obj = { receive: jasmine.createSpy('receive') }; - Publisher.subscribe(obj).toChannels('test'); + Publisher.subscribe(obj).toChannels(['test']); Publisher.publishAll({ test: 'tom' @@ -27,12 +28,13 @@ describe('Publisher', () => { })); - it('should should publish on all possible channels', inject((Publisher) => { + it('should should publish on all possible channels', + inject(function (Publisher) { var obj = { receive: jasmine.createSpy('receive') }; - Publisher.subscribe(obj).toChannels('test', 'tiny'); + Publisher.subscribe(obj).toChannels(['test', 'tiny']); Publisher.publishAll({ tiny: 'tom' @@ -42,7 +44,8 @@ describe('Publisher', () => { })); - it('should not broadcast not subscribed channels', inject((Publisher) => { + it('should not broadcast not subscribed channels', + inject(function (Publisher) { Publisher.publishAll({ test: 'tom' }); diff --git a/js/tests/unit/service/ResourceSpec.js b/js/tests/unit/service/ResourceSpec.js index b1b8ed054..23831613d 100644 --- a/js/tests/unit/service/ResourceSpec.js +++ b/js/tests/unit/service/ResourceSpec.js @@ -7,26 +7,26 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('Resource', () => { +describe('Resource', function () { 'use strict'; - let childResource; + var childResource; beforeEach(module('News')); - beforeEach(inject((Resource, $http) => { - class ChildResource extends Resource { - constructor ($http) { - super($http, 'base'); - } - } + beforeEach(inject(function (Resource, $http) { + var ChildResource = function ($http) { + Resource.call(this, $http, 'base'); + }; + + ChildResource.prototype = Object.create(Resource.prototype); childResource = new ChildResource($http); })); - it('should receive an object', () => { - let objects = [ + it('should receive an object', function () { + var objects = [ { id: 2 }, @@ -41,8 +41,8 @@ describe('Resource', () => { }); - it('should add an object', () => { - let object = { + it('should add an object', function () { + var object = { id: 3, name: 'test' }; @@ -52,14 +52,14 @@ describe('Resource', () => { }); - it('should overwrite an object if it already exists', () => { - let object1 = { + it('should overwrite an object if it already exists', function () { + var object1 = { id: 3, name: 'test', test: 'ho' }; - let object2 = { + var object2 = { id: 3, name: 'test2' }; @@ -73,14 +73,14 @@ describe('Resource', () => { }); - it('should delete a Resource', () => { - let object1 = { + it('should delete a Resource', function () { + var object1 = { id: 3, name: 'test', test: 'ho' }; - let object2 = { + var object2 = { id: 4, name: 'test2' }; @@ -96,14 +96,14 @@ describe('Resource', () => { }); - it('should clear all models', () => { - let object1 = { + it('should clear all models', function () { + var object1 = { id: 3, name: 'test', test: 'ho' }; - let object2 = { + var object2 = { id: 4, name: 'test2' }; @@ -119,14 +119,14 @@ describe('Resource', () => { }); - it('should get all models', () => { - let object1 = { + it('should get all models', function () { + var object1 = { id: 3, name: 'test', test: 'ho' }; - let object2 = { + var object2 = { id: 4, name: 'test2' }; diff --git a/js/tests/unit/service/SettingsResourceSpec.js b/js/tests/unit/service/SettingsResourceSpec.js index 68399707a..a13ed2cec 100644 --- a/js/tests/unit/service/SettingsResourceSpec.js +++ b/js/tests/unit/service/SettingsResourceSpec.js @@ -7,21 +7,27 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2014 */ -describe('SettingsResource', () => { +describe('SettingsResource', function () { 'use strict'; - let http; + var http; - beforeEach(module('News', ($provide) => { + beforeEach(module('News', function ($provide) { $provide.value('BASE_URL', 'base'); })); - beforeEach(inject(($httpBackend) => { + beforeEach(inject(function ($httpBackend) { http = $httpBackend; })); + afterEach(function () { + http.verifyNoOutstandingExpectation(); + http.verifyNoOutstandingRequest(); + }); - it('should receive default SettingsResource', inject((SettingsResource) => { + + it('should receive default SettingsResource', inject( + function (SettingsResource) { SettingsResource.receive({ 'showAll': true }); @@ -30,8 +36,14 @@ describe('SettingsResource', () => { })); - it('should set values', inject((SettingsResource) => { - http.expectPOST('base/settings', {showAll: true}).respond(200, {}); + it('should set values', inject(function (SettingsResource) { + http.expectPUT('base/settings', { + 'language':'en', + 'showAll':true, + 'compact':false, + 'oldestFirst':false, + 'preventReadOnScroll':false + }).respond(200, {}); SettingsResource.set('showAll', true); @@ -41,14 +53,8 @@ describe('SettingsResource', () => { })); - afterEach(() => { - http.verifyNoOutstandingExpectation(); - http.verifyNoOutstandingRequest(); - }); - - - it('should set language codes', inject((SettingsResource) => { - let codes = [ + it('should set language codes', inject(function (SettingsResource) { + var codes = [ 'ar-ma', 'ar', 'bg', 'ca', 'cs', 'cv', 'da', 'de', 'el', 'en-ca', 'en-gb', 'eo', 'es', 'et', 'eu', 'fi', 'fr-ca', 'fr', 'gl', 'he', 'hu', 'id', 'is', 'it', 'ja', 'ka', 'ko', 'lv', 'ms-my', 'nb', 'ne', @@ -56,16 +62,16 @@ describe('SettingsResource', () => { 'tzm-la', 'tzm', 'uk', 'zh-cn', 'zh-tw', 'hi' ]; - for (let code of codes) { + codes.forEach(function (code) { SettingsResource.receive({ language: code }); expect(SettingsResource.get('language')).toBe(code); - } + }); })); - it('should set default language codes', inject((SettingsResource) => { + it('should set default language codes', inject(function (SettingsResource) { SettingsResource.receive({ language: 'abc' }); @@ -73,7 +79,7 @@ describe('SettingsResource', () => { })); - it('should fix broken language codes', inject((SettingsResource) => { + it('should fix broken language codes', inject(function (SettingsResource) { SettingsResource.receive({ language: 'EN_CA' }); @@ -81,8 +87,8 @@ describe('SettingsResource', () => { })); - it('should fall back to more general language code', inject(( - SettingsResource) => { + it('should fall back to more general language code', inject(function ( + SettingsResource) { SettingsResource.receive({ language: 'EN_US' diff --git a/js/tests/unit/stubs/OC.js b/js/tests/unit/stubs/OC.js index 0adf6e481..387469469 100644 --- a/js/tests/unit/stubs/OC.js +++ b/js/tests/unit/stubs/OC.js @@ -8,7 +8,7 @@ * @copyright Bernhard Posselt 2012, 2014 */ window.OC = { - generateUrl () { + generateUrl: function () { 'use strict'; return ''; diff --git a/templates/index.php b/templates/index.php index 259e9f3b4..f84709571 100644 --- a/templates/index.php +++ b/templates/index.php @@ -1,6 +1,6 @@ <?php script('news', [ - 'vendor/traceur-runtime/traceur-runtime.min', + 'vendor/es6-shim/es6-shim.min', 'vendor/angular/angular.min', 'vendor/angular-route/angular-route.min', 'vendor/angular-sanitize/angular-sanitize.min', diff --git a/templates/part.content.php b/templates/part.content.php index b28d0deb2..c0e54def1 100644 --- a/templates/part.content.php +++ b/templates/part.content.php @@ -15,11 +15,7 @@ <li class="title" title="{{ item.title }}" ng-style="{ backgroundImage: 'url(' + Content.getFeed(item.feedId).faviconLink + ')'}"> - <h1> - <a target="_blank" > - {{ item.title }} - </a> - </h1> + <h1>{{ item.title }}</h1> </li> <li ng-click="Content.toggleStar(item.id)" class="util" news-stop-propagation> <button class="star svg" ng-class="{'starred': item.starred}" title="<?php p($l->t('Star')); ?>"></button> @@ -41,12 +37,10 @@ <div class="article"> <div class="subtitle"> - <span class="author" ng-show="item.author"><?php p($l->t('by')) ?> {{ item.author }}</span> - <?php p($l->t('from')) ?> <a ng-href="#/items/feeds/{{ item.feedId }}">{{ Content.getFeed(item.feedId).title }}</a> <time class="date" class="date" title="{{ item.pubDate*1000|date:'yyyy-MM-dd HH:mm:ss' }}" - datetime="{{ item.pubDate*1000|date:'yyyy-MM-ddTHH:mm:ssZ' }}"> - {{ Content.getRelativeDate(item.pubDate) }} - </time> + datetime="{{ item.pubDate*1000|date:'yyyy-MM-ddTHH:mm:ssZ' }}">{{ Content.getRelativeDate(item.pubDate) }}</time>, + <span class="author" ng-show="item.author"><?php p($l->t('by')) ?> {{ item.author }}</span> + <!--<?php p($l->t('from')) ?> <a ng-href="#/items/feeds/{{ item.feedId }}">{{ Content.getFeed(item.feedId).title }}</a>--> </div> <div class="enclosure" ng-if="item.enclosureLink"> diff --git a/templates/part.navigation.feed.php b/templates/part.navigation.feed.php index be3b09372..7b20f3aed 100644 --- a/templates/part.navigation.feed.php +++ b/templates/part.navigation.feed.php @@ -54,7 +54,7 @@ ng-show="feed.id && !feed.editing && !feed.error && !feed.deleted"> <ul> <li class="app-navigation-entry-utils-counter" - ng-show="feed.id && Navigation.getUnreadCount(feed.id) > 0"> + ng-show="feed.id && Navigation.getFeedUnreadCount(feed.id) > 0"> {{ Navigation.getFeedUnreadCount(feed.id) | unreadCountFormatter }} </li> <li class="app-navigation-entry-utils-menu-button"> @@ -72,7 +72,7 @@ <li><button ng-click="Navigation.deleteFeed(feed)" class="icon-delete" title="<?php p($l->t('Delete website')); ?>"></button></li> - <li><button ng-show="Navigation.getUnreadCount(feed.id) > 0" + <li><button ng-show="Navigation.getFeedUnreadCount(feed.id) > 0" class="icon-checkmark" title="<?php p($l->t('Read all')); ?>"></button></li> </ul> diff --git a/templates/part.navigation.folder.php b/templates/part.navigation.folder.php index 2895ed94a..6ae33be95 100644 --- a/templates/part.navigation.folder.php +++ b/templates/part.navigation.folder.php @@ -43,7 +43,7 @@ <span class="unread-counter" - ng-show="Navigation.getUnreadCount(folder.id) > 0 && !folder.editing"> + ng-show="Navigation.getFolderUnreadCount(folder.id) > 0 && !folder.editing"> {{ Navigation.getFolderUnreadCount(folder.id) | unreadCountFormatter }} </span> @@ -55,7 +55,7 @@ oc-tooltip></button> <button class="svg action mark-read-icon" - ng-show="Navigation.getUnreadCount(folder.id) > 0 && folder.id && !folder.editing" + ng-show="Navigation.getFolderUnreadCount(folder.id) > 0 && folder.id && !folder.editing" ng-click="Navigation.markRead(folder.id)" title="<?php p($l->t('Mark read')); ?>" oc-tooltip></button> |