| | |
| | | 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); |
| | |
| | | |
| | | /*** mail task ***/ |
| | | if (rcmail.env.task == 'mail') { |
| | | rcmail.addEventListener('menu-open', menu_open); |
| | | rcmail.addEventListener('menu-save', menu_save); |
| | | rcmail.addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') }); |
| | | rcmail.addEventListener('menu-open', menu_open) |
| | | .addEventListener('menu-save', menu_save) |
| | | .addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') }); |
| | | |
| | | var dragmenu = $('#dragmessagemenu'); |
| | | if (dragmenu.length) { |
| | |
| | | } |
| | | |
| | | if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') { |
| | | rcmail.addEventListener('enable-command', enable_command); |
| | | rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); }); |
| | | rcmail.addEventListener('afterhide-headers', function() { layout_messageview(); }); |
| | | rcmail.addEventListener('enable-command', enable_command) |
| | | .addEventListener('aftershow-headers', function() { layout_messageview(); }) |
| | | .addEventListener('afterhide-headers', function() { layout_messageview(); }); |
| | | $('#previewheaderstoggle').click(function(e){ toggle_preview_headers(); return false }); |
| | | |
| | | // add menu link for each attachment |
| | | $('#attachment-list > li').each(function() { |
| | | $(this).append($('<a class="drop"></a>').click(function() { attachmentmenu(this); })); |
| | | }); |
| | | |
| | | if (get_pref('previewheaders') == '1') { |
| | | toggle_preview_headers(); |
| | | } |
| | | } |
| | | else if (rcmail.env.action == 'compose') { |
| | | rcmail.addEventListener('aftertoggle-editor', function(e){ |
| | | window.setTimeout(function(){ layout_composeview() }, 200); |
| | | if (e && e.mode) |
| | | $("select[name='editorSelector']").val(e.mode); |
| | | }); |
| | | rcmail.addEventListener('aftersend-attachment', show_uploadform); |
| | | rcmail.addEventListener('add-recipient', function(p){ show_header_row(p.field, true); }); |
| | | rcmail.addEventListener('aftersend-attachment', show_uploadform) |
| | | .addEventListener('add-recipient', function(p){ show_header_row(p.field, true); }) |
| | | .addEventListener('aftertoggle-editor', function(e){ |
| | | window.setTimeout(function(){ layout_composeview() }, 200); |
| | | if (e && e.mode) |
| | | $("select[name='editorSelector']").val(e.mode); |
| | | }); |
| | | |
| | | // Show input elements with non-empty value |
| | | var f, v, field, fields = ['cc', 'bcc', 'replyto', 'followupto']; |
| | |
| | | if (previewframe) |
| | | mailviewsplit.init(); |
| | | |
| | | new rcube_scroller('#folderlist-content', '#folderlist-header', '#folderlist-footer'); |
| | | |
| | | rcmail.addEventListener('setquota', update_quota); |
| | | rcmail.addEventListener('enable-command', enable_command); |
| | | rcmail.addEventListener('afterimport-messages', show_uploadform); |
| | | rcmail.addEventListener('setquota', update_quota) |
| | | .addEventListener('enable-command', enable_command) |
| | | .addEventListener('afterimport-messages', show_uploadform); |
| | | } |
| | | else if (rcmail.env.action == 'get') { |
| | | new rcube_splitter({ id:'mailpartsplitterv', p1:'#messagepartheader', p2:'#messagepartcontainer', |
| | |
| | | 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 == 'responses') { |
| | | new rcube_splitter({ id:'responseviewsplitter', p1:'#identitieslist', p2:'#identity-details', |
| | | orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
| | | } |
| | | else if (rcmail.env.action == 'preferences' || !rcmail.env.action) { |
| | | new rcube_splitter({ id:'prefviewsplitter', p1:'#sectionslist', p2:'#preferences-box', |
| | | orientation:'v', relative:true, start:266, min:180, size:12 }).init(); |
| | |
| | | } |
| | | /*** addressbook task ***/ |
| | | else if (rcmail.env.task == 'addressbook') { |
| | | rcmail.addEventListener('afterupload-photo', show_uploadform); |
| | | rcmail.addEventListener('beforepushgroup', push_contactgroup); |
| | | rcmail.addEventListener('beforepopgroup', pop_contactgroup); |
| | | rcmail.addEventListener('afterupload-photo', show_uploadform) |
| | | .addEventListener('beforepushgroup', push_contactgroup) |
| | | .addEventListener('beforepopgroup', pop_contactgroup); |
| | | |
| | | 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(); |
| | | new rcube_splitter({ id:'addressviewsplitter', p1:'#addresslist', p2:'#contacts-box', |
| | | orientation:'v', relative:true, start:286, min:270, size:12 }).init(); |
| | | |
| | | new rcube_scroller('#directorylist-content', '#directorylist-header', '#directorylist-footer'); |
| | | } |
| | | |
| | | var dragmenu = $('#dragcontactmenu'); |
| | |
| | | function body_mouseup(e) |
| | | { |
| | | var config, obj, target = e.target; |
| | | |
| | | if (target.className == 'inner') |
| | | target = e.target.parentNode; |
| | | |
| | | for (var id in popups) { |
| | | obj = popups[id]; |
| | | config = popupconfig[id]; |
| | | if (obj.is(':visible') |
| | | && target.id != id+'link' |
| | | && target != obj.get(0) // check if scroll bar was clicked (#1489832) |
| | | && !config.toggle |
| | | && (!config.editable || !target_overlaps(target, obj.get(0))) |
| | | && (!config.sticky || !rcube_mouse_is_over(e, obj.get(0))) |
| | | && !$(target).is('.folder-selector-link') |
| | | ) { |
| | | var myid = id+''; |
| | | window.setTimeout(function(){ show_popupmenu(myid, false) }, 10); |
| | | window.setTimeout(function() { show_popupmenu(myid, false); }, 10); |
| | | } |
| | | } |
| | | } |
| | |
| | | minHeight: 90 |
| | | }).show(); |
| | | |
| | | me.message_timer = window.setTimeout(dialog_close, p.timeout); |
| | | if (p.timeout > 0) |
| | | me.message_timer = window.setTimeout(dialog_close, p.timeout); |
| | | } |
| | | } |
| | | |
| | |
| | | // $('#composeformbuttons')[(btns ? 'show' : 'hide')](); |
| | | |
| | | var abooks = $('#directorylist'); |
| | | $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight()); |
| | | if (abooks.length) |
| | | $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight()); |
| | | } |
| | | |
| | | |
| | |
| | | button.attr('href', '#hide').removeClass('add').addClass('remove') |
| | | else |
| | | button.attr('href', '#details').removeClass('remove').addClass('add') |
| | | |
| | | save_pref('previewheaders', full.is(':visible') ? '1' : '0'); |
| | | } |
| | | |
| | | |
| | |
| | | this.resize = function() |
| | | { |
| | | if (this.horizontal) { |
| | | this.p1.css('height', Math.floor(this.pos - this.p1pos.top - this.halfsize) + 'px'); |
| | | this.p2.css('top', Math.ceil(this.pos + this.halfsize + 2) + 'px'); |
| | | this.p1.css('height', Math.floor(this.pos - this.p1pos.top - Math.floor(this.halfsize)) + 'px'); |
| | | this.p2.css('top', Math.ceil(this.pos + Math.ceil(this.halfsize) + 2) + 'px'); |
| | | this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px'); |
| | | if (bw.ie) { |
| | | var new_height = parseInt(this.p2.parent().outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0); |
| | |
| | | } |
| | | } |
| | | else { |
| | | this.p1.css('width', Math.floor(this.pos - this.p1pos.left - this.halfsize) + 'px'); |
| | | this.p2.css('left', Math.ceil(this.pos + this.halfsize) + 'px'); |
| | | this.p1.css('width', Math.floor(this.pos - this.p1pos.left - Math.floor(this.halfsize)) + 'px'); |
| | | this.p2.css('left', Math.ceil(this.pos + Math.ceil(this.halfsize)) + 'px'); |
| | | this.handle.css('left', Math.round(this.pos - this.halfsize + this.offset + 3)+'px'); |
| | | if (bw.ie) { |
| | | var new_width = parseInt(this.p2.parent().outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ; |
| | |
| | | |
| | | if (me.horizontal) { |
| | | if (((pos.y - me.halfsize) > me.p1pos.top) && ((pos.y + me.halfsize) < (me.p2pos.top + me.p2.outerHeight()))) { |
| | | me.pos = Math.max(me.min, pos.y - me.offset); |
| | | me.pos = Math.max(me.min, pos.y - Math.max(0, me.offset)); |
| | | me.resize(); |
| | | } |
| | | } |
| | | else { |
| | | if (((pos.x - me.halfsize) > me.p1pos.left) && ((pos.x + me.halfsize) < (me.p2pos.left + me.p2.outerWidth()))) { |
| | | me.pos = Math.max(me.min, pos.x - me.offset); |
| | | me.pos = Math.max(me.min, pos.x - Math.max(0, me.offset)); |
| | | me.resize(); |
| | | } |
| | | } |