/** * Roundcube functions for default skin interface * * Copyright (c) 2013, The Roundcube Dev Team * * The contents are subject to the Creative Commons Attribution-ShareAlike * License. It is allowed to copy, distribute, transmit and to adapt the work * by keeping credits to the original autors in the README file. * See http://creativecommons.org/licenses/by-sa/3.0/ for details. * * @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0 */ /* magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0 */ function rcube_mail_ui(){function e(a){p||(p=rcmail.local_storage_get_item("prefs.larry",{}));if(null==p[a]){var c=rcmail.get_cookie(a);null!=c&&(p[a]=c,rcmail.local_storage_set_item("prefs.larry",p)&&rcmail.set_cookie(a,c,new Date))}return p[a]}function q(a,c){p[a]=c;if(!rcmail.local_storage_set_item("prefs.larry",p)){var d=new Date;d.setYear(d.getFullYear()+1);rcmail.set_cookie(a,c,d)}}function r(a){a=a?10:0;rcmail.resize_timeout&&window.clearTimeout(rcmail.resize_timeout);rcmail.resize_timeout= window.setTimeout(function(){"mail"==rcmail.env.task&&("show"==rcmail.env.action||"preview"==rcmail.env.action?b():"compose"==rcmail.env.action&&t());$("body.iframe .footerleft").each(function(){var a=$(this),d=$(document.body),b=a.hasClass("floating"),f=d.outerHeight(!0)>$(window).height();f!=b&&(b=f?"addClass":"removeClass",a[b]("floating"),d[b]("floatingbuttons"))})},a)}function k(a){var c=$(a.object).siblings("div");c.length&&$(a.object).insertBefore(c.first());if("error"==a.type&&"login"!=rcmail.env.task){rcmail.hide_message(a.object); l.message_timer&&window.clearTimeout(l.message_timer);l.messagedialog||(l.messagedialog=$("
").addClass("popupdialog").hide());c=a.message;var d=function(){l.messagedialog.is(":visible")&&l.messagedialog.dialog("destroy").hide()};l.messagedialog.is(":visible")&&l.messagedialog.text()!=c&&(c=l.messagedialog.html()+"

"+a.message+"

");l.messagedialog.html(c).dialog({resizable:!1,closeOnEscape:!0,dialogClass:a.type,title:rcmail.gettext("errortitle"),close:d,hide:{effect:"fadeOut"},width:420, minHeight:90}).show();l.messagedialog.closest("div[role=dialog]").attr("role","alertdialog");0 .mailvelope");if(a.length){var c=$("#messagecontent").length?$("#messagecontent").height()-16:$(window).height()-a.offset().top-2;a.height(c)}}function n(a){}function I(a){}function J(a){if("TEXTAREA"==a.nodeName){var c=$(a),d=a.scrollHeight;c.css("height",14*(80 div").width(c+8);$("#composebody_ifr").height(d+4-$("div.mce-toolbar").height());$("#googie_edit_layer").width(c).height(d);a=$("#directorylist");a.length&&$("#compose-contacts .scroller").css("top",a.position().top+a.outerHeight())}function D(a){var c=$("#quotadisplay"),d=$("#quotamenu"),b=a.total?24*Math.ceil(a.percent/100*20):0;a.total&&480==b&&100>a.percent&&(b-= 24);c.css("background-position","0 -"+b+"px");c.attr("class","countdisplay p"+10*Math.round(a.percent/10));a.table&&(d.length||(d=$('
').appendTo($("body"))),d.html(a.table),c.css("cursor","pointer").off("click").on("click",function(a){return rcmail.command("menu-open","quotamenu",a.target,a)}))}function K(a){$(".boxtitle a.search",a).click(function(c){var d=$(".boxtitle",a),b=$(".listsearchbox",a),f=b.is(":visible")?-1:1,m=34+($("select",b).length?22:0);b.slideToggle({duration:160, progress:function(c,b){0>f&&(b=1-b);$(".scroller",a).css("top",d.outerHeight()+m*b+"px")},complete:function(){b.toggleClass("expanded");b.is(":visible")?(b.find("input[type=text]").focus(),m=34+($("select",b).length?$("select",b).outerHeight()+4:0),$(".scroller",a).css("top",d.outerHeight()+m+"px")):$("a.reset",b).click()}});return!1})}function P(a){"reply-list"==a.command&&1==rcmail.env.reply_all_mode?(a=rcmail.gettext(a.status?"replylist":"replyall"),"preview"==rcmail.env.action?$("a.button.replyall").attr("title", a):$("a.button.reply-all").text(a).attr("title",a)):"compose-encrypted"==a.command&&$("a.button.encrypt").show()}function E(a,c){var b=z[a]=$("#"+a);b.appendTo(document.body);b.length&&(u[a]=$.extend(u[a]||{},c||{}))}function L(){$("#preview-shortheaders").toggle();var a=$("#preview-allheaders").toggle(),c=$("a#previewheaderstoggle");a.is(":visible")?c.attr("href","#hide").removeClass("add").addClass("remove").attr("aria-expanded","true"):c.attr("href","#details").removeClass("remove").addClass("add").attr("aria-expanded", "false");q("previewheaders",a.is(":visible")?"1":"0")}function A(a,c){if(c||!$("#mail"+a+"mode").hasClass("disabled"))$("#maillistmode, #mailthreadmode").removeClass("selected").attr("tabindex","0").attr("aria-disabled","false"),$("#mail"+a+"mode").addClass("selected").attr("tabindex","-1").attr("aria-disabled","true")}function B(a){if(a&&"messagelistmenu"==a.name)Q(a);else if(a){var c=u[a.name]||{},b=$(c.link||"#"+a.name+"link"),g=a.obj&&a.obj.is(":visible");if(a.obj&&g&&b.length){var f=b.parent(); $(window);f.hasClass("dropbutton")&&(b=f);if(c.above||b.hasClass("dropbutton"))f=b.offset(),a.obj.css({left:f.left+"px",top:f.top+(c.above?-a.obj.height():b.outerHeight())+"px"})}a.obj&&c.iconized&&a.obj.children("ul").addClass("iconized");a.obj&&c.editable&&a.obj.attr("data-editable","true");"function"==typeof c.callback&&c.callback(g,a)}}function R(a,c){var b=a.parentNode.id.replace(/^attach/,"");$.each(["open","download","rename"],function(){var a=this;$("#attachmenu"+a).off("click").attr("onclick", "").click(function(c){return rcmail.command(a+"-attachment",b,this)})});u.attachmentmenu.link=a;rcmail.command("menu-open",{menu:"attachmentmenu",id:b},a,c)}function F(a){a=$(a);a.children(".drop").length||a.append($('Show options').on("click keypress",function(a){if("keypress"!=a.type||13==rcube_event.get_keycode(a))return R(this,a),!1}))}function Q(a){var b=$("#listoptions");b.is(":visible")?b.dialog("close",a.originalEvent):($('input[name="sort_col"][value="'+ rcmail.env.sort_col+'"]').prop("checked",!0),$('input[name="sort_ord"][value="DESC"]').prop("checked","DESC"==rcmail.env.sort_order),$('input[name="sort_ord"][value="ASC"]').prop("checked","DESC"!=rcmail.env.sort_order),$.each(["widescreen","desktop","list"],function(){$('input[name="layout"][value="'+this+'"]').prop("checked",rcmail.env.layout==this)}),$("#listoptions-columns",b)["widescreen"==rcmail.env.layout?"hide":"show"](),$('input[name="list_col[]"]').each(function(){$(this).prop("checked", -1!=$.inArray(this.value,rcmail.env.listcols))}),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(a){setTimeout(function(){b.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(a){b.dialog("destroy").hide();a.originalEvent&&rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus()},minWidth:500,width:b.width()+25}).show())}function S(a){$("#listoptions").dialog("close");rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus(); a=$('input[name="sort_col"]:checked').val();var b=$('input[name="sort_ord"]:checked').val(),d=$('input[name="layout"]:checked').val(),g=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(g,a,b,rcmail.env.threading,d)}function T(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden");a.clone().css({position:"absolute",top:"0",left:"0",width:a.width()+"px","z-index":10}).appendTo(b).animate({left:-(a.width()+5)+"px"},300,"swing",function(){$(this).remove(); b.css("overflow","auto")})}function U(a){a=$("#contacts-table");var b=a.parent().css("overflow","hidden"),d=a.clone().appendTo(b);a.css({position:"absolute",top:"0",left:-(a.width()+5)+"px",width:a.width()+"px",height:a.height()+"px","z-index":10}).animate({left:"0"},300,"linear",function(){d.remove();$(this).css({position:"relative",left:"0",width:"100%",height:"auto","z-index":1});b.css("overflow","auto")})}function C(a){var b=$("#upload-dialog");b.is(":visible")?b.dialog("close"):rcmail.mailvelope_editor|| ("compose"!=rcmail.env.action||b.data("extended")||($("").addClass("iconlink add").attr("href","#add").html("Add").appendTo($('input[type="file"]',b).parent()).click(M),b.data("extended",!0)),b.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:b.attr("title"),open:function(a){document.all||$("input[type=file]",b).first().click()},close:function(){try{$("#upload-dialog form").get(0).reset()}catch(d){}b.dialog("destroy").hide();$("div.addline",b).remove()},width:480}).show())}function M(a){a= $(this).parent();a=a.clone().addClass("addline").insertAfter(a);a.children(".iconlink").click(M);a.children("input").val("");document.all||$("input[type=file]",a).click()}function G(a,b){var c=$("#compose-"+a);if(!c.is(":visible"))return H[a]&&!b&&$("#_"+a).val(H[a]),c.show(),$("#"+a+"-link").hide(),t(),$("input,textarea",c).focus(),!1}function N(a,b){a=$(a);var c=a.get(0).id,g=a.children("fieldset");if(g.length){c||(c="rcmtabcontainer",a.attr("id",c));var f=$("
    ").addClass("tabsbar").prependTo(a); g.each(function(a){var b=$(this),d=b.children("legend"),m=c+"-t"+a;var g=$("").text(d.text()).attr("href","#"+m);a=$("
  • ").addClass("tablink");d.remove();b.attr("id",m);a.append(g).appendTo(f)});a.tabs({active:b||0,heightStyle:"content",activate:function(a,b){r()}})}}var v={},z={},u={forwardmenu:{editable:1},searchmenu:{editable:1,callback:function(a){if(a&&rcmail.env.search_mods){var b;a=$('input:checkbox[name="s_mods[]"]',z.searchmenu);var d=rcmail.env.mailbox,g=rcmail.env.search_mods,f=rcmail.env.search_scope|| "base";if("mail"==rcmail.env.task){"all"==f&&(d="*");g=g[d]?g[d]:g["*"];var m="text";$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+f).prop("checked",!0)}else m="*";if(g[m])a.map(function(){this.checked=!0;this.disabled=this.value!=m});else for(b in a.prop("disabled",!1).prop("checked",!1),g)$("#s_mod_"+b).prop("checked",!0)}}},attachmentmenu:{},listoptions:{editable:1},groupmenu:{above:1},mailboxmenu:{above:1},spellmenu:{callback:function(a,b){var c,g=rcmail.spellcheck_lang(), f=$("ul",b.obj);if(!f.length){f=$('