diff options
-rw-r--r-- | ajax/setallitemsread.php | 2 | ||||
-rw-r--r-- | css/news.css | 15 | ||||
-rw-r--r-- | js/menu.js | 64 | ||||
-rw-r--r-- | templates/part.listfeed.php | 4 |
4 files changed, 47 insertions, 38 deletions
diff --git a/ajax/setallitemsread.php b/ajax/setallitemsread.php index 1a3038550..d767bddde 100644 --- a/ajax/setallitemsread.php +++ b/ajax/setallitemsread.php @@ -53,6 +53,8 @@ foreach($items as $item) { $l = OC_L10N::get('news'); +// FIXME: when we have no items we to mark read we shouldnt throw an error +$success = true; if(!$success) { OCP\JSON::error(array('data' => array('message' => $l->t('Error setting all items as read.')))); OCP\Util::writeLog('news','ajax/setallitemsread.php: Error setting all items as read of feed '. $feedId, OCP\Util::ERROR); diff --git a/css/news.css b/css/news.css index 8f2718030..a1157297e 100644 --- a/css/news.css +++ b/css/news.css @@ -112,7 +112,10 @@ div.add_parentfolder { .dnd_over { -moz-transition: padding-bottom 500ms ease 0s; - transition: padding-bottom 500ms ease 0s; + -o-transition: padding-bottom 500ms ease 0s; + -webkit-transition: padding-bottom 500ms ease 0s; + -ms-transition: padding-bottom 500ms ease 0s; + transition: padding-bottom 500ms ease 0s; } #feeds > ul.dnd_over { @@ -120,12 +123,18 @@ div.add_parentfolder { } .dnd_over > ul { -moz-transition: padding-bottom 500ms ease 0s; + -o-transition: padding-bottom 500ms ease 0s; + -webkit-transition: padding-bottom 500ms ease 0s; + -ms-transition: padding-bottom 500ms ease 0s; transition: padding-bottom 500ms ease 0s; padding-bottom: 2.5em! important; } #feeds > ul ul.dnd_over { -moz-transition: padding-bottom 500ms ease 0s; + -o-transition: padding-bottom 500ms ease 0s; + -webkit-transition: padding-bottom 500ms ease 0s; + -ms-transition: padding-bottom 500ms ease 0s; transition: padding-bottom 500ms ease 0s; padding-bottom: 2.5em !important; } @@ -144,7 +153,7 @@ div.add_parentfolder { } #feeds .buttons button { - margin: .8em .3em 0 0; + margin: .6em .3em 0 0; background-position: center; background-repeat: no-repeat; } @@ -232,7 +241,7 @@ div.add_parentfolder { background-size: 16px 16px; background-repeat: no-repeat; background-position: .2em center; - line-height: 2.8em; + line-height: 2.5em; } #feeds li:hover > a.title { diff --git a/js/menu.js b/js/menu.js index 752cb1bbd..4ee79cb8d 100644 --- a/js/menu.js +++ b/js/menu.js @@ -63,7 +63,7 @@ The default value is false. If you want to toggle this behaviour, theres a short menu.toggleShowAll(); -To hide all articles with read feeds, the setShowAll has to be set to false. The +To hide all articles with read feeds, the setShowAll has to be set to false. The hiding is only triggered after a new feed/folder was being loaded. If you wish to trigger this manually, use: @@ -101,7 +101,7 @@ var News = News || {}; MenuNodeTypeClass[MenuNodeType.Starred] = 'starred'; MenuNodeTypeClass[MenuNodeType.Subscriptions] = 'subscriptions'; - News.MenuNodeType = MenuNodeType; + News.MenuNodeType = MenuNodeType; /*########################################################################## @@ -218,7 +218,7 @@ var News = News || {}; if(!$(this).hasClass('active') && $(this).find('.active').length === 0){ $(this).addClass('hidden'); } - }); + }); } this._resetOpenFolders(); }; @@ -228,7 +228,7 @@ var News = News || {}; */ Menu.prototype.markCurrentFeedRead = function(){ this._markRead(this._activeFeedType, this._activeFeedType); - } + }; /** * Sets the showAll value @@ -240,7 +240,7 @@ var News = News || {}; this.triggerHideRead(); // needed because we have items that are older // but not yet cached. We cache by remembering the newest item id - this._items.emptyItemCache(); + this._items.emptyItemCache(); this.load(this._activeFeedType, this._activeFeedId); }; @@ -268,7 +268,7 @@ var News = News || {}; var self = this; self._setActiveFeed(type, id); - this._items.load(type, id, function(){ + this._items.load(type, id, function(){ self.triggerHideRead(); }); }; @@ -304,7 +304,7 @@ var News = News || {}; default: console.log('Can only set unreadcount of starred items or feeds'); break; - } + } this._setUnreadCount(type, id, unreadCount+1); }; @@ -325,7 +325,7 @@ var News = News || {}; default: console.log('Can only set unreadcount of starred items or feeds'); break; - } + } this._setUnreadCount(type, id, unreadCount-1); }; @@ -347,8 +347,6 @@ var News = News || {}; this._activeFeedType = this._listItemToMenuNodeType(this._$activeFeed); // set timeout to avoid racecondition error - var self = this; - // this is very annoying on start, do we need it? /*setTimeout(function(){ self._updateUnreadCountAll(); @@ -361,7 +359,7 @@ var News = News || {}; * Binds the according handlers and reads in the meta data for each node * @param $listItem the jquery list element */ - Menu.prototype._bindMenuItem = function($listItem){ + Menu.prototype._bindMenuItem = function($listItem){ switch(this._listItemToMenuNodeType($listItem)){ case MenuNodeType.Feed: this._bindFeed($listItem); @@ -431,7 +429,7 @@ var News = News || {}; Menu.prototype._bindFeed = function($listItem){ var self = this; var id = $listItem.data('id'); - this._setUnreadCount(MenuNodeType.Feed, id, + this._setUnreadCount(MenuNodeType.Feed, id, this._getAndRemoveUnreadCount($listItem)); $listItem.children('.title').click(function(){ @@ -439,7 +437,7 @@ var News = News || {}; if($(this).hasClass('noclick')){ $(this).removeClass('noclick'); } else { - self.load(MenuNodeType.Feed, id); + self.load(MenuNodeType.Feed, id); } return false; }); @@ -452,9 +450,9 @@ var News = News || {}; self._markRead(MenuNodeType.Feed, id); }); - $listItem.draggable({ + $listItem.draggable({ revert: true, - stack: '> li', + stack: '> li', zIndex: 1000, axis: 'y', start: function(event, ui){ @@ -469,7 +467,7 @@ var News = News || {}; */ Menu.prototype._bindStarred = function($listItem){ var self = this; - this._setUnreadCount(MenuNodeType.Starred, 0, + this._setUnreadCount(MenuNodeType.Starred, 0, this._getAndRemoveUnreadCount($listItem)); $listItem.children('.title').click(function(){ @@ -510,7 +508,7 @@ var News = News || {}; case MenuNodeType.Feed: confirmMessage = t('news', 'Are you sure you want to delete this feed?'); url = 'deletefeed.php'; - data = { + data = { feedid: id }; break; @@ -518,7 +516,7 @@ var News = News || {}; case MenuNodeType.Folder: confirmMessage = t('news', 'Are you sure you want to delete this folder and all its feeds?'); url = 'deletefolder.php'; - data = { + data = { folderid: id }; break; @@ -577,9 +575,9 @@ var News = News || {}; case MenuNodeType.Subscriptions: this._$root.children('li').each(function(){ var childData = self._getIdAndTypeFromNode($(this)); - if(childData.type === MenuNodeType.Folder || + if(childData.type === MenuNodeType.Folder || childData.type === MenuNodeType.Feed){ - self._markRead(childData.type, childData.id); + self._markRead(childData.type, childData.id); } }); break; @@ -634,8 +632,8 @@ var News = News || {}; this._updatingCount += 1; var self = this; var data = { - 'feedid':feedId, - 'feedurl':feedUrl, + 'feedid':feedId, + 'feedurl':feedUrl, 'folderid':folderId }; $.post(OC.filePath('news', 'ajax', 'updatefeed.php'), data, function(jsondata){ @@ -659,7 +657,7 @@ var News = News || {}; var folderId = this._getIdAndTypeFromNode($listItem).id; var data = { - 'folderId': folderId, + 'folderId': folderId, 'opened': $listItem.hasClass('open') }; @@ -723,7 +721,7 @@ var News = News || {}; Menu.prototype._getIdAndTypeFromNode = function($listItem) { return { id: parseInt($listItem.data('id')), - type: this._listItemToMenuNodeType($listItem), + type: this._listItemToMenuNodeType($listItem) }; }; @@ -756,8 +754,8 @@ var News = News || {}; }; /** - * When feeds are moved to different folders and in the beginning, we - * have to check for folders with children and add the appropriate + * When feeds are moved to different folders and in the beginning, we + * have to check for folders with children and add the appropriate * collapsable classes to give access to the collapasable button */ Menu.prototype._resetOpenFolders = function(){ @@ -814,12 +812,12 @@ var News = News || {}; var folderUnreadCount = 0; var self = this; $folder.children('ul').children('li').each(function(){ - var feedData = self._getIdAndTypeFromNode($(this)); + var feedData = self._getIdAndTypeFromNode($(this)); if(feedData.type === MenuNodeType.Feed){ folderUnreadCount += self._unreadCount.Feed[feedData.id]; - } + } }); - this._applyUnreadCountStyle(MenuNodeType.Folder, folderData.id, + this._applyUnreadCountStyle(MenuNodeType.Folder, folderData.id, folderUnreadCount); } } @@ -830,7 +828,7 @@ var News = News || {}; subscriptionsUnreadCount += value; }); this._unreadCount.Subscriptions = subscriptionsUnreadCount; - this._applyUnreadCountStyle(MenuNodeType.Subscriptions, 0, + this._applyUnreadCountStyle(MenuNodeType.Subscriptions, 0, subscriptionsUnreadCount); // lastly apply the new style to the feed @@ -838,7 +836,7 @@ var News = News || {}; }; /** - * Apply a style on a listitem based on its previous unreadcount and new + * Apply a style on a listitem based on its previous unreadcount and new * unreadcount * @param type the type (MenuNodeType) * @param id the id @@ -849,8 +847,8 @@ var News = News || {}; if(unreadCount === 0){ $node.addClass('all_read'); } else { - $node.removeClass('all_read hidden'); - } + $node.removeClass('all_read hidden'); + } }; /** diff --git a/templates/part.listfeed.php b/templates/part.listfeed.php index cf4277dbd..6012b574d 100644 --- a/templates/part.listfeed.php +++ b/templates/part.listfeed.php @@ -9,7 +9,7 @@ if(isset($_['mock'])) { $favicon = OCP\Util::imagePath('core', 'actions/public.svg'); } else { $feed = isset($_['feed']) ? $_['feed'] : null; - $feedTitle = $feed->getTitle(); + htmlspecialchars_decode($feedTitle = $feed->getTitle()); $feedId = $feed->getId(); $unreadItemsCount = isset($_['unreadItemsCount']) ? $_['unreadItemsCount'] : null; $favicon = $feed->getFavicon(); @@ -19,7 +19,7 @@ if(isset($_['mock'])) { } echo '<li class="feed" data-id="' . $feedId . '">'; - echo '<a style="background-image: url(' . $favicon . ');" href="#" class="title">' . htmlspecialchars($feedTitle, ENT_QUOTES, 'UTF-8') .'</a>'; + echo '<a style="background-image: url(' . $favicon . ');" href="#" class="title">' . $feedTitle .'</a>'; echo '<span class="unread_items_counter">' . $unreadItemsCount . '</span>'; echo '<span class="buttons">'; echo '<button class="svg action feeds_delete" title="' . $l->t('Delete feed') . '"></button>'; |