diff --git a/media/js/base.js b/media/js/base.js index ee42ba60a8..c9468c57e4 100644 --- a/media/js/base.js +++ b/media/js/base.js @@ -70,10 +70,18 @@ $(function() { // set a notice to be read when in it is clicked $('.unread a', notice_list).click(function() { var notice_id = $(this).parents('.unread').data('id'); + var link_href = $(this).attr('href'); $.ajax({ url: notice_list.data('url') + '?notice_id=' + e(notice_id), - dataType:'json' + dataType:'json', + success: function(data) { + location.href = link_href; + }, + error: function() { + location.href = link_href; + } }); + return false; }); $('.detail', notice_list).click(function() { diff --git a/seahub/templates/view_file_base.html b/seahub/templates/view_file_base.html index e19d494d01..c66acfa426 100644 --- a/seahub/templates/view_file_base.html +++ b/seahub/templates/view_file_base.html @@ -239,20 +239,17 @@ function setToolbarPos() { $('#to-group').css({'top': parseInt(toolbar.css('top')) + 59}); } $(window).load(function() { - // if page needs scroll, show 'back-to-top' icon - if ($(document).height() > $(window).height()) { - var to_top = $(''); - to_top.click(function() { - $(window).scrollTop(0); - }).appendTo($('#fileview-toolbar')); - $(window).scroll(function() { - if ($(window).scrollTop() > 0) { - to_top.show(); - } else { - to_top.hide(); - } - }); - } + var to_top = $(''); + to_top.click(function() { + $(window).scrollTop(0); + }).appendTo($('#fileview-toolbar')); + $(window).scroll(function() { + if ($(window).scrollTop() > 0) { + to_top.show(); + } else { + to_top.hide(); + } + }); setToolbarPos(); }).resize(setToolbarPos);