diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/menu.js | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/js/menu.js b/js/menu.js index 90c623f6f..25f5ae135 100644 --- a/js/menu.js +++ b/js/menu.js @@ -135,12 +135,10 @@ var News = News || {}; * @param html the html to add */ Menu.prototype.addNode = function(parentId, html){ - parentId = parseInt(parentId); + parentId = parseInt(parentId, 10); var $parentNode; var $html = $(html); - console.log($html); - if(parentId === 0){ $parentNode = this._$root; } else { @@ -172,7 +170,7 @@ var News = News || {}; */ Menu.prototype.updateNode = function(type, id, data){ var $node = this._getNodeFromTypeAndId(type, id); - id = parseInt(id); + id = parseInt(id, 10); if(data.title !== undefined){ // prevent xss @@ -188,10 +186,10 @@ var News = News || {}; /** * Removes a node and its subnodes from the menu * @param type the type (MenuNodeType) - * @param id the id + * @param id the id */ Menu.prototype.removeNode = function(type, id){ - id = parseInt(id); + id = parseInt(id, 10); var $node = this._getNodeFromTypeAndId(type, id); $node.remove(); }; @@ -276,9 +274,9 @@ var News = News || {}; */ Menu.prototype.getFeedIdsOfFolder = function(folderId) { $folder = this._getNodeFromTypeAndId(MenuNodeType.Folder, folderId); - var ids = new Array(); + var ids = []; $folder.children('ul').children('li').each(function(){ - ids.push(parseInt($(this).data('id'))); + ids.push(parseInt($(this).data('id'), 10)); }); return ids; }; @@ -546,7 +544,6 @@ var News = News || {}; Menu.prototype._edit = function(type, id){ var $node = this._getNodeFromTypeAndId(type, id); var name = $node.children('.title').html(); - var id = $node.data('id'); $('#changefolder_dialog').find('input[type=text]').val(name); $('#changefolder_dialog').find('input[type=hidden]').val(id); $('#changefolder_dialog').dialog('open'); @@ -590,7 +587,7 @@ var News = News || {}; $.post(OC.filePath('news', 'ajax', 'setallitemsread.php'), data, function(jsonData) { if(jsonData.status == 'success'){ - self._setUnreadCount(type, id, parseInt(jsonData.data.unreadCount)); + self._setUnreadCount(type, id, parseInt(jsonData.data.unreadCount, 10)); } else { OC.dialogs.alert(jsonData.data.message, t('news', 'Error')); } @@ -692,7 +689,7 @@ var News = News || {}; */ Menu.prototype._getAndRemoveUnreadCount = function($listItem){ var $unreadCounter = $listItem.children('.unread_items_counter'); - var unreadCount = parseInt($unreadCounter.html()); + var unreadCount = parseInt($unreadCounter.html(), 10); $unreadCounter.remove(); return unreadCount; }; @@ -720,7 +717,7 @@ var News = News || {}; */ Menu.prototype._getIdAndTypeFromNode = function($listItem) { return { - id: parseInt($listItem.data('id')), + id: parseInt($listItem.data('id'), 10), type: this._listItemToMenuNodeType($listItem) }; }; @@ -782,7 +779,7 @@ var News = News || {}; * @param unreadCount the count of unread items */ Menu.prototype._setUnreadCount = function(type, id, unreadCount){ - unreadCount = parseInt(unreadCount); + unreadCount = parseInt(unreadCount, 10); if(unreadCount < 0){ unreadCount = 0; } @@ -865,9 +862,9 @@ var News = News || {}; var $dropped = $(this); var $dragged = $(ui.draggable); - var feedId = parseInt($dragged.data('id')); - var folderId = parseInt($dropped.data('id')); - var fromFolderId = parseInt($dragged.parent().data('id')); + var feedId = parseInt($dragged.data('id'), 10); + var folderId = parseInt($dropped.data('id'), 10); + var fromFolderId = parseInt($dragged.parent().data('id'), 10); // ignore when dragged to the same folder if(folderId === fromFolderId){ |