-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.min.js
13 lines (13 loc) · 25.6 KB
/
ui.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
/**
* Roundcube functions for default skin interface
*
* Copyright (c) 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
*/
function rcube_mail_ui(){var a,o,i,e,s={},n={},r={forwardmenu:{editable:1},searchmenu:{editable:1,callback:function(e){if(e&&rcmail.env.search_mods){var t,i="*",s=n.searchmenu,a=$('input:checkbox[name="s_mods[]"]',s),o=rcmail.env.mailbox,e=rcmail.env.search_mods,s=rcmail.env.search_scope||"base";if("mail"==rcmail.env.task&&(e=e[o]||e["*"],i="text",$('input:radio[name="s_scope"]').prop("checked",!1).filter("#s_scope_"+s).prop("checked",!0)),e[i])a.map(function(){this.checked=!0,this.disabled=this.value!=i});else for(t in a.prop("disabled",!1).prop("checked",!1),e)$("#s_mod_"+t).prop("checked",!0)}}},attachmentmenu:{},listoptions:{editable:1},groupmenu:{above:1},mailboxmenu:{above:1},spellmenu:{callback:function(e,t){var i,s,a=rcmail.spellcheck_lang(),o=$("ul",t.obj);if(!o.length){for(i in o=$('<ul class="toolbarmenu selectable" role="menu">'),rcmail.env.spell_langs)s=$('<li role="menuitem">'),$('<a href="#'+i+'" tabindex="0"></a>').text(rcmail.env.spell_langs[i]).addClass("active").data("lang",i).on("click keypress",function(e){if("keypress"!=e.type||13==rcube_event.get_keycode(e))return rcmail.spellcheck_lang_set($(this).data("lang")),rcmail.hide_menu("spellmenu",e),!1}).appendTo(s),s.appendTo(o);o.appendTo(t.obj)}$("li",o).each(function(){var e=$("a",this);e.data("lang")==a?e.addClass("selected").attr("aria-selected","true"):e.hasClass("selected")&&e.removeClass("selected").removeAttr("aria-selected")})}},"folder-selector":{iconized:1}},l=this,c={};function d(e){var t;return null!=(i=i||rcmail.local_storage_get_item("prefs.larry",{}))[e]||null!=(t=rcmail.get_cookie(e))&&(i[e]=t,rcmail.local_storage_set_item("prefs.larry",i)&&rcmail.set_cookie(e,t,new Date)),i[e]}function p(e,t){i[e]=t,rcmail.local_storage_set_item("prefs.larry",i)||rcmail.set_cookie(e,t,!1)}function m(e){e=e?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?v():"compose"==rcmail.env.action&&k()),$("body.iframe .footerleft").each(function(){var e=$(this),t=$(document.body),i=e.hasClass("floating"),s=t.outerHeight(!0)>$(window).height();s!=i&&(e[s=s?"addClass":"removeClass"]("floating"),t[s]("floatingbuttons"))})},e)}function u(e){var t,i=$(e.object).siblings("div");i.length&&$(e.object).insertBefore(i.first()),"error"==e.type&&"login"!=rcmail.env.task&&(rcmail.hide_message(e.object),l.message_timer&&window.clearTimeout(l.message_timer),l.messagedialog||(l.messagedialog=$("<div>").addClass("popupdialog").hide()),t=e.message,i=function(){l.messagedialog.is(":visible")&&l.messagedialog.dialog("destroy").hide()},l.messagedialog.is(":visible")&&l.messagedialog.text()!=t&&(t=l.messagedialog.html()+"<p>"+e.message+"</p>"),l.messagedialog.html(t).dialog({resizable:!1,closeOnEscape:!0,dialogClass:e.type,title:rcmail.gettext("errortitle"),close:i,hide:{effect:"fadeOut"},width:420,minHeight:90}).show(),l.messagedialog.closest("div[role=dialog]").attr("role","alertdialog"),0<e.timeout&&(l.message_timer=window.setTimeout(i,e.timeout)))}function f(e){var t=e?e.new_layout:rcmail.env.layout,i=$("#mailview-top"),s=$("#mailview-bottom");e&&$("#mainscreencontent").removeClass().addClass(t),$("#mailviewsplitter")["desktop"==t?"show":"hide"](),$("#mailviewsplitter2")["widescreen"==t?"show":"hide"](),$("#mailpreviewframe")["list"!=t?"show":"hide"](),rcmail.env.contentframe="list"==t?null:"messagecontframe","widescreen"==t?($("#countcontrols").detach().appendTo($("#messagelistheader")),i.css({height:"auto",width:394}),s.css({top:0,left:406,height:"auto"}).show(),o?o.resize():(o=new rcube_splitter({id:"mailviewsplitter2",p1:"#mailview-top",p2:"#mailview-bottom",orientation:"v",relative:!0,start:416,min:400,size:12})).init()):"desktop"==t?(i.css({height:270,width:"auto"}),s.css({left:0,top:284,height:"auto"}).show(),a?a.resize():(a=new rcube_splitter({id:"mailviewsplitter",p1:"#mailview-top",p2:"#mailview-bottom",orientation:"h",relative:!0,start:276,min:150,size:12,offset:4})).init()):(i.css({height:"auto",width:"auto"}),s.hide()),e&&"widescreen"==e.old_layout&&$("#countcontrols").detach().appendTo($("#messagelistfooter"))}function v(){$("#messagecontent").css("top",$("#messageheader").outerHeight()+1+"px"),$("#message-objects div a").addClass("button"),$("#attachment-list li").length||($("div.rightcol").hide().attr("aria-hidden","true"),$("div.leftcol").css("margin-right","0"));var e,t=$("#messagebody.mailvelope, #messagebody > .mailvelope");t.length&&(e=$("#messagecontent").length?$("#messagecontent").height()-16:$(window).height()-t.offset().top-2,t.height(e))}function g(e){}function b(e){}function w(){for(var e,t,i=["cc","bcc","replyto","followupto"],s=0;s<i.length;s++)e=i[s],(t=$("#_"+e)).length&&(t.on("change",{v:e},function(e){this.value&&q(e.data.v,!0)}),""!=t.val()&&q(e,!0));$("textarea[name='_to'], textarea[name='_cc'], textarea[name='_bcc']").change(function(e){_(this)}).change(),rcmail.addEventListener("autocomplete_insert",function(e){_(e.field)})}function _(e){var t,i;"TEXTAREA"==e.nodeName&&(t=$(e),i=e.scrollHeight,i=80<e.value.length&&21<i?2:1,t.css("height",14*i+"px"),k())}function k(){var e,t,i=$("#composebody"),s=$("#compose-content"),a=$("#composeview-bottom");s.length&&(t=300-(e=s.height()-a.position().top),a.height(Math.max(300,e)),s.css("overflow",0<t?"auto":"hidden"),s=i.parent().width()-5,t=i.parent().height()-8,i.width(s).height(t),$("#composebodycontainer > div").width(7+s),$("#composebody_ifr").height(4+t-$("div.tox-toolbar").height()),$("#googie_edit_layer").width(s).height(t),(t=$("#directorylist")).length&&$("#compose-contacts .scroller").css("top",t.position().top+t.outerHeight()))}function x(e){var t=$("#quotadisplay"),i=$("#quotamenu"),s=e.total?24*Math.ceil(e.percent/100*20):0;e.total&&480==s&&e.percent<100&&(s-=24),t.css("background-position","0 -"+s+"px"),t.attr("class","countdisplay p"+10*Math.round(e.percent/10)),e.table&&((i=!i.length?$('<div id="quotamenu" class="popupmenu">').appendTo($("body")):i).html(e.table),t.css("cursor","pointer").off("click").on("click",function(e){return rcmail.command("menu-open","quotamenu",e.target,e)}))}function y(o){$(".boxtitle a.search",o).click(function(e){var i=$(".boxtitle",o),t=$(".listsearchbox",o),s=t.is(":visible")?-1:1,a=34+($("select",t).length?22:0);return t.slideToggle({duration:160,progress:function(e,t){s<0&&(t=1-t),$(".scroller",o).css("top",i.outerHeight()+a*t+"px")},complete:function(){t.toggleClass("expanded"),t.is(":visible")?(t.find("input[type=text]").focus(),a=34+($("select",t).length?$("select",t).outerHeight()+4:0),$(".scroller",o).css("top",i.outerHeight()+a+"px")):$("a.reset",t).click()}}),!1})}function z(e){var t;"reply-list"==e.command&&1==rcmail.env.reply_all_mode?(t=rcmail.gettext(e.status?"replylist":"replyall"),("preview"==rcmail.env.action?$("a.button.replyall"):$("a.button.reply-all").text(t)).attr("title",t)):"compose-encrypted"==e.command?$("a.button.encrypt").parent().show():"compose-encrypted-signed"==e.command&&$("#encryptionmenulink").show()}function C(e,t){var i=n[e]=$("#"+e);i.appendTo(document.body),i.length&&(r[e]=$.extend(r[e]||{},t||{}))}function E(){$("#preview-shortheaders").toggle();var e=$("#preview-allheaders").toggle(),t=$("a#previewheaderstoggle");e.is(":visible")?t.attr("href","#hide").removeClass("add").addClass("remove").attr("aria-expanded","true"):t.attr("href","#details").removeClass("remove").addClass("add").attr("aria-expanded","false"),p("previewheaders",e.is(":visible")?"1":"0")}function T(e,t){!t&&$("#mail"+e+"mode").hasClass("disabled")||($("#maillistmode, #mailthreadmode").removeClass("selected").attr("tabindex","0").attr("aria-disabled","false"),$("#mail"+e+"mode").addClass("selected").attr("tabindex","-1").attr("aria-disabled","true"))}function L(e){var t,i,s,a,o;e&&"messagelistmenu"==e.name?(a=e,(o=$("#listoptions")).is(":visible")?o.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",o)["widescreen"==rcmail.env.layout?"hide":"show"](),$('input[name="list_col[]"]').each(function(){$(this).prop("checked",-1!=$.inArray(this.value,rcmail.env.listcols))}),o.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:null,open:function(e){setTimeout(function(){o.find("a, input:not(:disabled)").not("[aria-disabled=true]").first().focus()},100)},close:function(e){o.dialog("destroy").hide(),e.originalEvent&&rcube_event.is_keyboard(e.originalEvent)&&$("#listmenulink").focus()},minWidth:500,width:o.width()+25}).show())):e&&(t=r[e.name]||{},i=$(t.link||"#"+e.name+"link"),s=e.obj&&e.obj.is(":visible"),t.above,e.obj&&s&&i.length&&(a=i.parent(),$(window),a.hasClass("dropbutton")&&(i=a),(t.above||i.hasClass("dropbutton"))&&(a=i.offset(),e.obj.css({left:a.left+"px",top:a.top+(t.above?-e.obj.height():i.outerHeight())+"px"}))),e.obj&&t.iconized&&e.obj.children("ul").addClass("iconized"),e.obj&&t.editable&&e.obj.attr("data-editable","true"),"function"==typeof t.callback&&t.callback(s,e))}function M(e){var t,i,s;(e=$(e)).children(".drop").length||e.is(".no-menu")||(s=rcmail.gettext("options"),i=(t=e.find("a.filename")).attr("tabindex")||0,s=$("<a>").attr({class:"drop skip-content",tabindex:i,"aria-haspopup":!0,title:s}).text(s).on("click keypress",function(e){if("keypress"!=e.type||13==rcube_event.get_keycode(e))return t=e,i=(e=this).parentNode.id.replace(/^attach/,""),$.each(["open","download","rename"],function(){var t=this;$("#attachmenu"+t).off("click").attr("onclick","").click(function(e){return rcmail.command(t+"-attachment",i,this)})}),r.attachmentmenu.link=e,rcmail.command("menu-open",{menu:"attachmentmenu",id:i},e,t),!1;var t,i}),t.length?s.insertAfter(t):s.appendTo(e))}function j(e){$("#listoptions").dialog("close"),rcube_event.is_keyboard(e.originalEvent)&&$("#listmenulink").focus();var t=$('input[name="sort_col"]:checked').val(),i=$('input[name="sort_ord"]:checked').val(),s=$('input[name="layout"]:checked').val(),e=$('input[name="list_col[]"]:checked').map(function(){return this.value}).get();rcmail.set_list_options(e,t,i,rcmail.env.threading,s)}function H(e){var t=$("#contacts-table"),i=t.parent().css("overflow","hidden");t.clone().css({position:"absolute",top:"0",left:"0",width:t.width()+"px","z-index":10}).appendTo(i).animate({left:-(t.width()+5)+"px"},300,"swing",function(){$(this).remove(),i.css("overflow","auto")})}function I(e){var t=$("#contacts-table"),i=t.parent().css("overflow","hidden"),s=t.clone().appendTo(i);t.css({position:"absolute",top:"0",left:-(t.width()+5)+"px",width:t.width()+"px",height:t.height()+"px","z-index":10}).animate({left:"0"},300,"linear",function(){s.remove(),$(this).css({position:"relative",left:"0",width:"100%",height:"auto","z-index":1}),i.css("overflow","auto")})}function q(e,t){var i=$("#compose-"+e);if(!i.is(":visible"))return c[e]&&!t&&$("#_"+e).val(c[e]),i.show(),$("#"+e+"-link").hide(),k(),$("input,textarea",i).focus(),!1}function W(e,t){var o,i=$(e),n=i.get(0).id,e=i.children("fieldset");e.length&&(n||(n="rcmtabcontainer",i.attr("id",n)),o=$("<ul>").addClass("tabsbar").prependTo(i),e.each(function(e){var t=$(this),i=t.children("legend"),s=n+"-t"+e,a=$("<a>").text(i.text()).attr("href","#"+s),e=$("<li>").addClass("tablink");i.remove(),t.attr("id",s),e.append(a).appendTo(o)}),i.tabs({active:t||0,heightStyle:"content",activate:function(e,t){m()}}))}this.set=function(e,t){s[e]=t},this.init=function(){{var e,t;rcmail.addEventListener("message",u),$.widget("ui.dialog",$.ui.dialog,{open:function(){return this._super(),function(e){var t=$(e.uiDialog),i=t.offset(),s=t.position(),a=t.outerWidth(),o=$(window).width(),e=i.top-12;e<0&&t.css("top",s.top-e);i.left+a+12>o&&t.css("left",s.left-12)}(this),this}}),$("#taskbar a").each(function(e,t){$(t).append('<span class="tooltip">'+$(".button-inner",this).html()+"</span>")}),$("#taskbar .minmodetoggle").click(function(e){p("minimalmode",$(document.body).toggleClass("minimal").hasClass("minimal")?1:0),$(window).resize()}),"mail"==rcmail.env.task?(rcmail.addEventListener("menu-open",L).addEventListener("menu-close",L).addEventListener("menu-save",j).addEventListener("enable-command",z).addEventListener("responseafterlist",function(e){T(rcmail.env.threading?"thread":"list",!0)}).addEventListener("responseaftersearch",function(e){T(rcmail.env.threading?"thread":"list",!0)}),(i=$("#dragmessagemenu")).length&&(rcmail.gui_object("dragmenu","dragmessagemenu"),n.dragmenu=i),"show"==rcmail.env.action||"preview"==rcmail.env.action?(rcmail.addEventListener("aftershow-headers",function(){v()}).addEventListener("afterhide-headers",function(){v()}),$("#previewheaderstoggle").click(function(e){return E(),this.blur&&!rcube_event.is_keyboard(e)&&this.blur(),!1}),$("#attachment-list > li").each(function(){M(this)}),"preview"==rcmail.env.action&&"1"==d("previewheaders")&&E(),"show"==rcmail.env.action&&$("#messagecontent").focus()):"compose"==rcmail.env.action?(rcmail.addEventListener("fileappended",function(e){e.attachment.complete&&M(e.item)}).addEventListener("aftertoggle-editor",function(e){window.setTimeout(function(){k()},200)}).addEventListener("compose-encrypted",function(e){$("select[name='editorSelector']").prop("disabled",e.active),$("a.button.attach, a.button.responses")[e.active?"addClass":"removeClass"]("disabled"),$("#responseslist a.insertresponse")[e.active?"removeClass":"addClass"]("active")}),w(),$("#composeoptionstoggle").click(function(e){var t=$("#composeoptions").toggle().is(":visible");return $("#composeoptionstoggle").toggleClass("remove").attr("aria-expanded",t?"true":"false"),k(),p("composeoptions",t?"1":"0"),rcube_event.is_keyboard(e)||this.blur(),!1}).css("cursor","pointer"),"0"!==d("composeoptions")&&$("#composeoptionstoggle").click(),(e=rcmail.opener())&&"compose"==e.env.action&&$("#composeoptionstoggle",opener.document).hasClass("remove")&&$("#composeoptionstoggle").click(),new rcube_splitter({id:"composesplitterv",p1:"#composeview-left",p2:"#composeview-right",orientation:"v",relative:!0,start:206,min:170,size:12,render:k}).init(),$("#attachment-list > li").each(function(){M(this)})):"bounce"==rcmail.env.action?w():"list"!=rcmail.env.action&&rcmail.env.action?"get"==rcmail.env.action&&new rcube_splitter({id:"mailpartsplitterv",p1:"#messagepartheader",p2:"#messagepartcontainer",orientation:"v",relative:!0,start:226,min:150,size:12}).init():(f(),$("#maillistmode").addClass(rcmail.env.threading?"":"selected").click(function(e){return T("list"),!1}),$("#mailthreadmode").addClass(rcmail.env.threading?"selected":"").click(function(e){return T("thread"),!1}),rcmail.init_pagejumper("#pagejumper"),rcmail.addEventListener("setquota",x).addEventListener("layout-change",f)),$("#mailview-left").length&&new rcube_splitter({id:"mailviewsplitterv",p1:"#mailview-left",p2:"#mailview-right",orientation:"v",relative:!0,start:206,min:150,size:12,callback:g,render:b}).init()):"settings"==rcmail.env.task?(rcmail.addEventListener("init",function(){var e="#settingstabpreferences";rcmail.env.action&&(e="#settingstab"+(0<rcmail.env.action.indexOf("identity")?"identities":rcmail.env.action.replace(/\./g,""))),$(e).addClass("selected").children().first().removeAttr("onclick").click(function(){return!1})}),"folders"==rcmail.env.action?(new rcube_splitter({id:"folderviewsplitter",p1:"#folderslist",p2:"#folder-details",orientation:"v",relative:!0,start:266,min:180,size:12}).init(),rcmail.addEventListener("setquota",x),y($("#folderslist"))):"identities"==rcmail.env.action?new rcube_splitter({id:"identviewsplitter",p1:"#identitieslist",p2:"#identity-details",orientation:"v",relative:!0,start:266,min:180,size:12}).init():"responses"==rcmail.env.action?new rcube_splitter({id:"responseviewsplitter",p1:"#responseslist",p2:"#response-details",orientation:"v",relative:!0,start:266,min:180,size:12}).init():"preferences"!=rcmail.env.action&&rcmail.env.action?"edit-prefs"==rcmail.env.action&&(e=$("#preferences-details fieldset.advanced legend"),t=$('<a href="#toggle"></a>').text(rcmail.gettext("toggleadvancedoptions")).attr("title",rcmail.gettext("toggleadvancedoptions")).addClass("advanced-toggle"),e.click(function(e){t.html($(this).hasClass("collapsed")?"▲":"▼"),$(this).toggleClass("collapsed").closest("fieldset").children(".propform").toggle()}).append(t).addClass("collapsed"),bw.mz&&e.parents("form").css("display","inline")):new rcube_splitter({id:"prefviewsplitter",p1:"#sectionslist",p2:"#preferences-box",orientation:"v",relative:!0,start:266,min:180,size:12}).init()):"addressbook"==rcmail.env.task&&(rcmail.addEventListener("beforepushgroup",H).addEventListener("beforepopgroup",I).addEventListener("menu-open",L).addEventListener("menu-close",L),""==rcmail.env.action&&(new rcube_splitter({id:"addressviewsplitterd",p1:"#addressview-left",p2:"#addressview-right",orientation:"v",relative:!0,start:206,min:150,size:12,render:b}).init(),new rcube_splitter({id:"addressviewsplitter",p1:"#addresslist",p2:"#contacts-box",orientation:"v",relative:!0,start:266,min:260,size:12}).init()),(i=$("#dragcontactmenu")).length&&(rcmail.gui_object("dragmenu","dragcontactmenu"),n.dragmenu=i))}$(".tabbed").each(function(e,t){W(t)}),$("select.decorated").each(function(){var e,t,i,s,a,o;bw.opera?$(this).removeClass("decorated"):(t=(e=$(this)).parent(),i=Math.max(e.height(),26)-2,s=e.width()-22,a=$("option",this).first().text(),""!=$("option:selected",this).val()&&(a=$("option:selected",this).text()),(o=$('<a class="menuselector" tabindex="-1"><span class="handle">'+a+"</span></a>").css("position","absolute").offset(e.position()).insertAfter(e)).children().width(s).height(i).css("line-height",i-1+"px"),"absolute"!=t.css("position")&&t.css("position","relative"),e.width(o.width()).on(bw.mz?"change keyup":"change",function(){var e=$("option:selected",this).text();$(this).next().children().text(e)}),e.on("focus",function(e){o.addClass("focus")}).on("blur",function(e){o.removeClass("focus")}))});var i=$("body.minwidth");i.length&&i.css("min-width",$(".toolbar").width()+$("#quicksearchbar").width()+$("#searchfilter").width()+30);(window.onresize=m)()},this.init_tabs=W,this.show_about=function(e){var t=$("<iframe>").attr({id:"aboutframe",src:rcmail.url("settings/about"),frameborder:"0"});h=Math.floor(.75*$(window).height()),buttons={},supportln=$("#supportlink"),supportln.length&&(s.supporturl=supportln.attr("href"))&&(buttons[supportln.html()]=function(e){s.supporturl.indexOf("mailto:")<0?window.open(s.supporturl):location.href=s.supporturl});t.dialog({modal:!0,resizable:!1,closeOnEscape:!0,title:e?e.title||e.innerHTML:null,close:function(){t.dialog("destroy").remove()},buttons:buttons,width:640,height:h}).width(640)},this.show_popup=function(e,t,i){!i&&r[e]||C(e,i);i=r[e]||{};var s=$(i.link||"#"+e+"link"),i=s.offset();s.has(".inner")&&(s=s.children(".inner"));return rcmail.command("menu-open",{menu:e,show:t},s.get(0),$.Event("click",{target:s.get(0),pageX:i.left,pageY:i.top,clientX:i.left,clientY:i.top}))},this.toggle_popup=function(e,t,i){!i&&r[e]||C(e,i);return rcmail.command("menu-open",e,t.target,t)},this.add_popup=C,this.import_dialog=function(){var t=$("#uploadform").clone().removeClass("popupdialog");rcmail.simple_dialog(t,rcmail.gettext("importmessages"),function(e){return rcmail.command("import-messages",$(t.find("form")[0]))},{button:"import",closeOnEscape:!0,minWidth:400})},this.set_searchmod=function(e){var t,i=rcmail.env.task,s=rcmail.env.search_mods||{},a=rcmail.env.mailbox;$('input[name="s_scope"]:checked').val();s="mail"==i?(s[a]||(s[a]=rcube_clone_object(s["*"])),t=s[a],"text"):(t=s,"*");e.checked?t[e.value]=1:delete t[e.value];e.value==s&&$('input:checkbox[name="s_mods[]"]').not(e).map(function(){this.checked=!0,e.checked?(this.disabled=!0,delete t[this.value]):(this.disabled=!1,t[this.value]=1)});rcmail.set_searchmods(t)},this.show_header_row=q,this.hide_header_row=function(e){var t=$("#_"+e);return c[e]=t.val(),t.val(""),$("#compose-"+e).hide(),$("#"+e+"-link").show(),k(),!1},this.update_quota=x,this.get_pref=d,this.save_pref=p,this.folder_search_init=y,window.$&&document.body&&(e=d("minimalmode"),(parseInt(e)||null===e&&$(window).height()<850)&&$(document.body).addClass("minimal"),bw.tablet&&$("#viewport").attr("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"),$(document).ready(function(){l.init()}))}function rcube_scroller(e,t,i){var s=this;this.list=$(e),this.top=$(t),this.bottom=$(i),this.step_size=6,this.step_time=20,this.delay=500,this.top.mouseenter(function(){rcmail.drag_active&&(s.ts=window.setTimeout(function(){s.scroll("down")},s.delay))}).mouseout(function(){s.ts&&window.clearTimeout(s.ts)}),this.bottom.mouseenter(function(){rcmail.drag_active&&(s.ts=window.setTimeout(function(){s.scroll("up")},s.delay))}).mouseout(function(){s.ts&&window.clearTimeout(s.ts)}),this.scroll=function(e){var t=this,i=this.step_size;rcmail.drag_active&&("down"==e&&(i*=-1),this.list.get(0).scrollTop+=i,this.ts=window.setTimeout(function(){t.scroll(e)},this.step_time))}}function rcube_splitter(e){this.p=e,this.id=e.id,this.horizontal="horizontal"==e.orientation||"h"==e.orientation,this.halfsize=(void 0!==e.size?e.size:10)/2,this.pos=e.start||0,this.min=e.min||20,this.offset=e.offset||0,this.relative=!!e.relative,this.drag_active=!1,this.render=e.render,this.callback=e.callback;var i=this;function s(e){(bw.konq||bw.chrome||bw.safari)&&(document.body.style.webkitUserSelect="none"),i.p1pos=i.relative?i.p1.position():i.p1.offset(),i.p2pos=i.relative?i.p2.position():i.p2.offset(),i.drag_active=!0,$(document).on("mousemove."+this.id,t).on("mouseup."+this.id,a),rcmail.message_list&&(rcmail.message_list.drag_active=!0),$("iframe").each(function(e,t){$("<div>").attr("id","iframe-splitter-fix-"+e).addClass("iframe-splitter-fix").css({background:"#fff",width:t.offsetWidth+"px",height:t.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css($(this).offset()).appendTo("body")})}function t(e){return i.drag_active&&(window.clearTimeout(i.ts),i.ts=window.setTimeout(function(){!function(e){var t=rcube_event.get_mouse_pos(e);i.relative&&(e=i.parent.offset(),t.x-=e.left,t.y-=e.top);i.horizontal?t.y-i.halfsize>i.p1pos.top&&t.y+i.halfsize<i.p2pos.top+i.p2.outerHeight()&&(i.pos=Math.max(i.min,t.y-Math.max(0,i.offset)),i.pos>i.min&&(i.pos=Math.min(i.pos,i.parent.height()-i.min)),i.resize()):t.x-i.halfsize>i.p1pos.left&&t.x+i.halfsize<i.p2pos.left+i.p2.outerWidth()&&(i.pos=Math.max(i.min,t.x-Math.max(0,i.offset)),i.pos>i.min&&(i.pos=Math.min(i.pos,i.parent.width()-i.min)),i.resize());i.p1pos=i.relative?i.p1.position():i.p1.offset(),i.p2pos=i.relative?i.p2.position():i.p2.offset()}(e)},1)),!1}function a(e){return(bw.konq||bw.chrome||bw.safari)&&(document.body.style.webkitUserSelect="auto"),$(document).off("."+i.id),i.drag_active=!1,rcmail.message_list&&(rcmail.message_list.drag_active=!1),$("div.iframe-splitter-fix").remove(),i.set_cookie(),"function"==typeof i.callback&&i.callback(i),!!bw.safari||rcube_event.cancel(e)}function o(e){var t;i.horizontal?(t=parseInt(i.parent.outerHeight(),10)-parseInt(i.p2[0].style.top,10),i.p2.css("height",(0<t?t:0)+"px")):(t=parseInt(i.parent.outerWidth(),10)-parseInt(i.p2[0].style.left,10),i.p2.css("width",(0<t?t:0)+"px"))}rcube_splitter._instances[this.id]=i,this.init=function(){var e,t;this.p1=$(this.p.p1),this.p2=$(this.p.p2),this.parent=this.p1.parent(),this.p1.length&&this.p2.length&&(this.p1pos=this.relative?this.p1.position():this.p1.offset(),this.p2pos=this.relative?this.p2.position():this.p2.offset(),this.handle=$("<div>").attr("id",this.id).attr("unselectable","on").attr("role","presentation").addClass("splitter "+(this.horizontal?"splitter-h":"splitter-v")).appendTo(this.parent).mousedown(s),this.horizontal?(e=this.p1pos.top+this.p1.outerHeight(),this.handle.css({left:"0px",top:e+"px"})):(t=this.p1pos.left+this.p1.outerWidth(),this.handle.css({left:t+"px",top:"0px"})),bw.ie&&$(window).resize(o),(t=this.get_cookie())&&!isNaN(t)?(this.pos=parseFloat(t),this.resize()):this.pos&&(this.resize(),this.set_cookie()))},this.resize=function(){var e;this.horizontal?(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"),bw.ie&&(e=parseInt(this.parent.outerHeight(),10)-parseInt(this.p2.css("top"),10),this.p2.css("height",(0<e?e:0)+"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"),bw.ie&&(e=parseInt(this.parent.outerWidth(),10)-parseInt(this.p2.css("left"),10),this.p2.css("width",(0<e?e:0)+"px"))),this.p2.resize(),this.p1.resize(),this.drag_active&&$("iframe").each(function(e,t){var i=$(this).offset();$("#iframe-splitter-fix-"+e).css({top:i.top+"px",left:i.left+"px",width:t.offsetWidth+"px",height:t.offsetHeight+"px"})}),"function"==typeof this.render&&this.render(this)},this.get_cookie=function(){return window.UI?UI.get_pref(this.id):null},this.set_cookie=function(){window.UI&&UI.save_pref(this.id,this.pos)}}rcube_splitter._instances={},rcube_splitter.get_instance=function(e){return rcube_splitter._instances[e]};