1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 07:41:26 +00:00

[file view] added 'back to top'

This commit is contained in:
llj
2014-07-29 17:21:17 +08:00
parent 8abbdbfe1e
commit 26f97371a1
3 changed files with 37 additions and 16 deletions

View File

@@ -2597,7 +2597,7 @@ textarea:-moz-placeholder {/* for FF */
position:fixed;
right:0;
}
#fileview-toolbar .item {
.fileview-toolbar .item {
width:59px;
height:40px;
padding-top:18px;
@@ -2608,11 +2608,11 @@ textarea:-moz-placeholder {/* for FF */
border-right:0;
border-top:0;
}
#fileview-toolbar .item:first-child {
.fileview-toolbar .item:first-child {
border-top:1px solid #c0c0c0;
border-top-left-radius:3px;
}
#fileview-toolbar .item:last-child {
.fileview-toolbar .item:last-child {
border-bottom-left-radius:3px;
}
/* shareadmin & useradmin */

BIN
media/img/top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

View File

@@ -9,6 +9,7 @@
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/file_view_extra.css" />
<style type="text/css">
#header, #footer { display:none; }
#view-hd { margin-top: 4px; }
#star {
vertical-align:middle;
margin-left:3px;
@@ -116,7 +117,8 @@
{% include "snippets/file_share_popup.html" %}
<ul id="fileview-toolbar">
<div id="fileview-toolbar">
<ul class="fileview-toolbar">
{% if groups %}
<li class="item" id="file-discuss-icon"><img src="{{MEDIA_URL}}img/discuss.png" alt="{% trans "discuss" %}" /></li>
<li id="file-group-icon" class="item"><img src="{{MEDIA_URL}}img/groups.png" alt="{% trans "group" %}" /></li>
@@ -128,6 +130,7 @@
<li id="history" class="item" data-url="{% url 'file_revisions' repo.id %}?p={{ path|urlencode }}"><img src="{{MEDIA_URL}}img/history.png" alt="{% trans "history"%}" />
{% endif %}
</ul>
<div>
{% if groups %}
<div id="discuss-to-group" class="hide">
@@ -228,12 +231,30 @@ $('#star').click(function() {
// set 'side toolbar' & 'groups' popup position
function setToolbarPos() {
var toolbar = $('#fileview-toolbar');
// set toolbar pos
toolbar.css({'top': ($(window).height() - toolbar.outerHeight())/2});
// set 'groups' popup position
$('#to-group').css({'top': parseInt(toolbar.css('top')) + 59});
}
$(window).load(setToolbarPos).resize(setToolbarPos);
$(window).load(function() {
// if page needs scroll, show 'back-to-top' icon
if ($(document).height() > $(window).height()) {
var to_top = $('<ul class="fileview-toolbar hide" style="margin-top:3px;"><li class="item"><img src="{{MEDIA_URL}}img/top.png" alt="{% trans "top" %}" /></li></ul>');
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);
// handle discussions after fetch them
function handleDiscussions(html) {