1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 23:00:57 +00:00

[mobile] added 'updateDirOpBarUI'

This commit is contained in:
llj
2017-01-12 11:39:21 +08:00
parent 7c4d32ac24
commit 01fb83c9b2
4 changed files with 63 additions and 19 deletions

View File

@@ -76,13 +76,16 @@ define([
this.render();
// scroll window: get 'more', fix 'op bar'
var _this = this;
// scroll window: get 'more', fix 'op bar'
$(window).scroll(function() {
if ($(_this.el).is(':visible')) {
_this.onWindowScroll();
}
});
$(window).resize(function() {
_this.updateDirOpBarUI();
});
// hide 'rename form'
$(document).click(function(e) {
@@ -172,6 +175,9 @@ define([
this.$el_con.show();
this.setFileInput();
this.updateDirOpBarUI(); // should be after `setFileInput()`
// there may be a 'style' added via 'onWindowScroll()' when visiting last dir
this.$('.js-dir-content').removeAttr('style');
@@ -200,11 +206,20 @@ define([
this.dir.limit = 100;
this.render_dirents_slice(this.dir.last_start, this.dir.limit);
this.setFileInput();
this.getImageThumbnail();
},
updateDirOpBarUI: function() {
var width;
if ($(window).width() > 500) {
width = this.$('.repo-op').width() - parseInt(this.$('.repo-op-misc').css('margin-left')) - 5;
width -= $('#multi-dirents-op').is(':visible') ? $('#multi-dirents-op').width() : $('#cur-dir-ops').width();
this.$('.repo-op-misc').css({'width': width});
} else {
this.$('.repo-op-misc').removeAttr('style');
}
},
updateMagnificPopupOptions: function() {
var imgs = this.dir.where({is_img: true});
var items = [];
@@ -451,6 +466,7 @@ define([
})))
.removeAttr('style'); // there may be a 'style' added via 'onWindowScroll()' when visiting last dir
if (dir.user_perm == 'rw') {
// add new folder/file
this.new_dropdown = new DropdownView({
@@ -848,6 +864,8 @@ define([
$dirents_op.hide();
$curDirOps.show();
}
this.updateDirOpBarUI();
},
download: function () {