| | |
| | | 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); |
| | |
| | | |
| | | new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right', |
| | | 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'); |
| | |
| | | orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
| | | |
| | | 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', |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | |
| | | form.css('overflow', ovflw > 0 ? 'auto' : 'hidden'); |
| | | |
| | | w = body.parent().width() - 5; |
| | | h = body.parent().height() - 8; |
| | | h = body.parent().height() - 16; |
| | | body.width(w).height(h); |
| | | |
| | | $('#composebodycontainer > div').width(w+8); |
| | |
| | | |
| | | 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 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) |
| | | { |