loleaflet/dist/toolbar/toolbar.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
New commits: commit 3233ccee4c24b2c0e2ec3216d346cb00ecb91fda Author: Pranav Kant <pran...@collabora.co.uk> Date: Wed Jan 11 20:14:26 2017 +0530 loleaflet: Mobilify the statusbar Reduce userlist text to now only show the number of users in mobile mode instead of 'x users' string. Drop the 'Document saved' string notification. Change-Id: Ife20a5fcea01301601912c734dae6c3d6504c4f5 diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js index 7d3ee72..7065ebe 100644 --- a/loleaflet/dist/toolbar/toolbar.js +++ b/loleaflet/dist/toolbar/toolbar.js @@ -36,12 +36,14 @@ var statusbarMobileItems = [ 'cancelsearch', 'left', 'right', - 'modifiedstatuslabel', - 'modifiedstatuslabelbreak', + 'userlist', + 'userlistbreak', 'prev', 'next' ]; +var nUsers, oneUser, noUser; + function _mobilify() { var toolbarUp = w2ui['toolbar-up']; var toolbarUpMore = w2ui['toolbar-up-more']; @@ -66,6 +68,11 @@ function _mobilify() { statusbar.hide(id); } } + + nUsers = '%n'; + oneUser = '1'; + noUser = '0'; + updateUserListCount(); } function _unmobilify() { @@ -92,6 +99,11 @@ function _unmobilify() { statusbar.show(id); } } + + nUsers = _('%n users'); + oneUser = _('1 user'); + noUser = _('0 user'); + updateUserListCount(); } function resizeToolbar() { @@ -664,7 +676,7 @@ $(function () { {type: 'html', id: 'modifiedstatuslabel', html: '<div id="modifiedstatuslabel" class="loleaflet-font"></div>'}, {type: 'break', id: 'modifiedstatuslabelbreak'}, {type: 'drop', id: 'userlist', text: _('No users'), html: '<div id="userlist_container"><table id="userlist_table"><tbody></tbody></table></div>' }, - {type: 'break'}, + {type: 'break', id: 'userlistbreak'}, {type: 'button', id: 'prev', img: 'prev', hint: _('Previous page')}, {type: 'button', id: 'next', img: 'next', hint: _('Next page')}, {type: 'break', id: 'prevnextbreak'}, @@ -1503,16 +1515,16 @@ function getUserItem(viewId, userName, color) { return html; } -var nUsers = _('%n users'); + function updateUserListCount() { var userlistItem = w2ui['toolbar-down'].get('userlist'); var count = $(userlistItem.html).find('#userlist_table tbody tr').length; if (count > 1) { userlistItem.text = nUsers.replace('%n', count); } else if (count === 1) { - userlistItem.text = _('1 user'); + userlistItem.text = oneUser; } else { - userlistItem.text = _('No users'); + userlistItem.text = noUser; } var zoomlevel = $('#zoomlevel').html(); commit 11ed5228062c5025bbe6ad15eb34d5d53e7f6ee5 Author: Pranav Kant <pran...@collabora.co.uk> Date: Wed Jan 11 18:34:46 2017 +0530 loleaflet: Mobilify for less than 768, not less than equal Change-Id: I3c499e847674e57ba33859459ace794ff1b97c57 diff --git a/loleaflet/dist/toolbar/toolbar.js b/loleaflet/dist/toolbar/toolbar.js index 6835cc1..7d3ee72 100644 --- a/loleaflet/dist/toolbar/toolbar.js +++ b/loleaflet/dist/toolbar/toolbar.js @@ -4,6 +4,8 @@ /* global $ map closebutton w2ui w2utils vex _ */ +var mobileWidth = 768; + function onDelete(e) { if (e !== false) { map.deletePage(); @@ -97,7 +99,7 @@ function resizeToolbar() { var toolbarUp = w2ui['toolbar-up']; var toolbarUpMore = w2ui['toolbar-up-more']; - if ($(window).width() <= 768) { + if ($(window).width() < mobileWidth) { _mobilify(); } else { _unmobilify(); @@ -116,7 +118,7 @@ function resizeToolbar() { // move items from toolbar-up -> toolbar-up-more while ($('#toolbar-up')[0].scrollWidth > Math.max($(window).width(), parseInt($('body').css('min-width')))) { var itemId = toolbarUp.items[toolbarUp.items.length - 4].id; - if ($(window).width() > 768 && itemId === 'resizebreak') { + if ($(window).width() >= mobileWidth && itemId === 'resizebreak') { return; } item = toolbarUp.get(itemId); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits