| | |
| | | this.update_quota = update_quota; |
| | | this.get_pref = get_pref; |
| | | this.save_pref = save_pref; |
| | | this.folder_search_init = folder_search_init; |
| | | |
| | | |
| | | // set minimal mode on small screens (don't wait for document.ready) |
| | |
| | | function get_pref(key) |
| | | { |
| | | if (!prefs) { |
| | | prefs = window.localStorage ? rcmail.local_storage_get_item('prefs.larry', {}) : {}; |
| | | prefs = rcmail.local_storage_get_item('prefs.larry', {}); |
| | | } |
| | | |
| | | // fall-back to cookies |
| | |
| | | if (cookie != null) { |
| | | prefs[key] = cookie; |
| | | |
| | | // copy value to local storage and remove cookie |
| | | if (window.localStorage) { |
| | | rcmail.local_storage_set_item('prefs.larry', prefs); |
| | | // copy value to local storage and remove cookie (if localStorage is supported) |
| | | if (rcmail.local_storage_set_item('prefs.larry', prefs)) { |
| | | rcmail.set_cookie(key, cookie, new Date()); // expire cookie |
| | | } |
| | | } |
| | |
| | | { |
| | | prefs[key] = val; |
| | | |
| | | // write prefs to local storage |
| | | if (window.localStorage) { |
| | | rcmail.local_storage_set_item('prefs.larry', prefs); |
| | | } |
| | | else { |
| | | // write prefs to local storage (if supported) |
| | | if (!rcmail.local_storage_set_item('prefs.larry', prefs)) { |
| | | // store value in cookie |
| | | var exp = new Date(); |
| | | exp.setYear(exp.getFullYear() + 1); |
| | |
| | | $('#composeoptionstoggle').click(); |
| | | |
| | | new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right', |
| | | orientation:'v', relative:true, start:248, min:170, size:12, render:layout_composeview }).init(); |
| | | orientation:'v', relative:true, start:206, min:170, size:12, render:layout_composeview }).init(); |
| | | |
| | | // enable zen-mode for message body |
| | | if ($.fn.zenForm) { |
| | | $('#composebody').zenForm({ theme: 'light' }) |
| | | .on('zf-initialized', function(event, zenbox) { |
| | | var subject = $('#compose-subject').val(), |
| | | $zenbox = $(zenbox); |
| | | $('<h2>').addClass('zen-forms-subject') |
| | | .text(subject ? subject : rcmail.gettext('nosubject')) |
| | | .insertBefore('.zen-forms-close-button', zenbox); |
| | | |
| | | $zenbox.find('.zen-forms-close-button').attr('title', env.exitfullscreen) |
| | | $zenbox.find('.zen-forms-theme-switch').attr('title', env.switchtheme) |
| | | $zenbox.find('.input').first().focus(); |
| | | }) |
| | | .on('zf-destroyed', function(event) { |
| | | $('#composebody').focus(); |
| | | }); |
| | | } |
| | | } |
| | | else if (rcmail.env.action == 'list' || !rcmail.env.action) { |
| | | var previewframe = $('#mailpreviewframe').is(':visible'); |
| | | $('#mailpreviewtoggle').addClass(previewframe ? 'enabled' : 'closed').attr('aria-expanded', previewframe ? 'true' : 'false').click(function(e){ toggle_preview_pane(e); return false }); |
| | | $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e){ switch_view_mode('list'); return false }); |
| | | $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e){ switch_view_mode('thread'); return false }); |
| | | |
| | | $('#mailpreviewtoggle').addClass(previewframe ? 'enabled' : 'closed').attr('aria-expanded', previewframe ? 'true' : 'false') |
| | | .click(function(e) { toggle_preview_pane(e); return false; }); |
| | | $('#maillistmode').addClass(rcmail.env.threading ? '' : 'selected').click(function(e) { switch_view_mode('list'); return false; }); |
| | | $('#mailthreadmode').addClass(rcmail.env.threading ? 'selected' : '').click(function(e) { switch_view_mode('thread'); return false; }); |
| | | |
| | | mailviewsplit = new rcube_splitter({ id:'mailviewsplitter', p1:'#mailview-top', p2:'#mailview-bottom', |
| | | orientation:'h', relative:true, start:310, min:150, size:12, offset:4 }); |
| | |
| | | |
| | | if ($('#mailview-left').length) { |
| | | new rcube_splitter({ id:'mailviewsplitterv', p1:'#mailview-left', p2:'#mailview-right', |
| | | orientation:'v', relative:true, start:226, min:150, size:12, callback:render_mailboxlist, render:resize_leftcol }).init(); |
| | | orientation:'v', relative:true, start:206, min:150, size:12, callback:render_mailboxlist, render:resize_leftcol }).init(); |
| | | } |
| | | } |
| | | /*** settings task ***/ |
| | |
| | | new rcube_splitter({ id:'folderviewsplitter', p1:'#folderslist', p2:'#folder-details', |
| | | orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
| | | |
| | | new rcube_scroller('#folderslist-content', '#folderslist-header', '#folderslist-footer'); |
| | | |
| | | rcmail.addEventListener('setquota', update_quota); |
| | | |
| | | folder_search_init($('#folderslist')); |
| | | } |
| | | else if (rcmail.env.action == 'identities') { |
| | | new rcube_splitter({ id:'identviewsplitter', p1:'#identitieslist', p2:'#identity-details', |
| | |
| | | orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
| | | } |
| | | else if (rcmail.env.action == 'edit-prefs') { |
| | | $('<a href="#toggle">▼</a>') |
| | | $('<a href="#toggle"></a>') |
| | | .text(env.toggleoptions) |
| | | .attr('title', env.toggleoptions) |
| | | .addClass('advanced-toggle') |
| | | .appendTo('#preferences-details fieldset.advanced legend'); |
| | | |
| | |
| | | |
| | | if (rcmail.env.action == '') { |
| | | new rcube_splitter({ id:'addressviewsplitterd', p1:'#addressview-left', p2:'#addressview-right', |
| | | orientation:'v', relative:true, start:226, min:150, size:12, render:resize_leftcol }).init(); |
| | | orientation:'v', relative:true, start:206, min:150, size:12, render:resize_leftcol }).init(); |
| | | new rcube_splitter({ id:'addressviewsplitter', p1:'#addresslist', p2:'#contacts-box', |
| | | orientation:'v', relative:true, start:286, min:270, size:12 }).init(); |
| | | orientation:'v', relative:true, start:266, min:260, size:12 }).init(); |
| | | } |
| | | |
| | | var dragmenu = $('#dragcontactmenu'); |
| | |
| | | if ($('option:selected', this).val() != '') |
| | | title = $('option:selected', this).text(); |
| | | |
| | | var overlay = $('<a class="menuselector"><span class="handle">' + title + '</span></a>') |
| | | var overlay = $('<a class="menuselector" tabindex="-1"><span class="handle">' + title + '</span></a>') |
| | | .css('position', 'absolute') |
| | | .offset(select.position()) |
| | | .insertAfter(select); |
| | |
| | | |
| | | // re-set original select width to fix click action and options width in some browsers |
| | | select.width(overlay.width()) |
| | | .change(function() { |
| | | .on(bw.mz ? 'change keyup' : 'change', function() { |
| | | var val = $('option:selected', this).text(); |
| | | $(this).next().children().text(val); |
| | | }); |
| | |
| | | |
| | | me.messagedialog.closest('div[role=dialog]').attr('role', 'alertdialog'); |
| | | |
| | | me.message_timer = window.setTimeout(dialog_close, p.timeout); |
| | | if (p.timeout > 0) |
| | | me.message_timer = window.setTimeout(dialog_close, p.timeout); |
| | | } |
| | | } |
| | | |
| | |
| | | w, h, bh, ovflw, btns = 0, |
| | | minheight = 300, |
| | | |
| | | bh = (form.height() - bottom.position().top); |
| | | bh = form.height() - bottom.position().top; |
| | | ovflw = minheight - bh; |
| | | btns = ovflw > -100 ? 0 : 40; |
| | | bottom.css('height', Math.max(minheight, bh) + 'px'); |
| | | bottom.height(Math.max(minheight, bh)); |
| | | form.css('overflow', ovflw > 0 ? 'auto' : 'hidden'); |
| | | |
| | | w = body.parent().width() - 5; |
| | | h = body.parent().height() - 16; |
| | | body.width(w).height(h); |
| | | |
| | | $('#composebody_tbl').width((w+8)+'px').height('').css('margin-top', '1px'); |
| | | $('#composebody_ifr').width((w+8)+'px').height((h-40)+'px'); |
| | | $('#googie_edit_layer').height(h+'px'); |
| | | $('#composebodycontainer > div').width(w+8); |
| | | $('#composebody_ifr').height(h + 4 - $('div.mce-toolbar').height()); |
| | | $('#googie_edit_layer').height(h - 8); |
| | | // $('#composebodycontainer')[(btns ? 'addClass' : 'removeClass')]('buttons'); |
| | | // $('#composeformbuttons')[(btns ? 'show' : 'hide')](); |
| | | |
| | | var abooks = $('#directorylist'); |
| | | $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight()); |
| | | |
| | | // hide zen-mode switch in HTML mode |
| | | $('a.go-zen')[($('#composebody_ifr').is(':visible') ? 'hide' : 'show')](); |
| | | } |
| | | |
| | | |
| | | function update_quota(p) |
| | | { |
| | | var step = 24, step_count = 20, |
| | | var element = $('#quotadisplay'), menu = $('#quotamenu'), |
| | | step = 24, step_count = 20, |
| | | y = p.total ? Math.ceil(p.percent / 100 * step_count) * step : 0; |
| | | |
| | | // never show full-circle if quota is close to 100% but below. |
| | | if (p.total && y == step * step_count && p.percent < 100) |
| | | y -= step; |
| | | |
| | | $('#quotadisplay').css('background-position', '0 -'+y+'px'); |
| | | element.css('background-position', '0 -' + y + 'px'); |
| | | |
| | | if (p.table) { |
| | | if (!menu.length) |
| | | menu = $('<div id="quotamenu" class="popupmenu">').appendTo($('body')); |
| | | |
| | | menu.html(p.table); |
| | | element.css('cursor', 'pointer').off('click').on('click', function(e) { |
| | | return rcmail.command('menu-open', 'quotamenu', e.target, e); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | function folder_search_init(container) |
| | | { |
| | | // animation to unfold list search box |
| | | $('.boxtitle a.search', container).click(function(e) { |
| | | var title = $('.boxtitle', container), |
| | | box = $('.listsearchbox', container), |
| | | dir = box.is(':visible') ? -1 : 1, |
| | | height = 34 + ($('select', box).length ? 22 : 0); |
| | | |
| | | box.slideToggle({ |
| | | duration: 160, |
| | | progress: function(animation, progress) { |
| | | if (dir < 0) progress = 1 - progress; |
| | | $('.scroller', container).css('top', (title.outerHeight() + height * progress) + 'px'); |
| | | }, |
| | | complete: function() { |
| | | box.toggleClass('expanded'); |
| | | if (box.is(':visible')) { |
| | | box.find('input[type=text]').focus(); |
| | | height = 34 + ($('select', box).length ? $('select', box).outerHeight() + 4 : 0); |
| | | $('.scroller', container).css('top', (title.outerHeight() + height) + 'px'); |
| | | } |
| | | else { |
| | | $('a.reset', box).click(); |
| | | } |
| | | // TODO: save state in localStorage |
| | | } |
| | | }); |
| | | |
| | | return false; |
| | | }); |
| | | } |
| | | |
| | | function enable_command(p) |
| | | { |
| | |
| | | topstyles, bottomstyles, uid; |
| | | |
| | | frame.toggle(); |
| | | button.removeClass().toggleClass('enabled closed').attr('aria-expanded', visible ? 'true' : 'false'); |
| | | button.toggleClass('enabled closed').attr('aria-expanded', visible ? 'true' : 'false'); |
| | | |
| | | if (visible) { |
| | | $('#mailview-top').removeClass('fullheight').css({ bottom:'auto' }); |
| | |
| | | |
| | | row.show(); |
| | | $('#' + which + '-link').hide(); |
| | | |
| | | layout_composeview(); |
| | | $('input,textarea', row).focus(); |
| | | |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * Roundcube Scroller class |
| | | * |
| | | * @deprecated Use treelist widget |
| | | */ |
| | | function rcube_scroller(list, top, bottom) |
| | | { |
| | |
| | | return rcube_splitter._instances[id]; |
| | | }; |
| | | |
| | | // @license-end |
| | | // @license-end |