tvbox/ui.min.js

14 lines
60 KiB
JavaScript
Raw Normal View History

2024-01-15 20:23:51 +00:00
/**
* Roundcube webmail functions for the Elastic skin
*
* 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
*/
"use strict";function rcube_elastic_ui(){var a,n,t,i,o,s,r,e,l,c,d,u,p,m,h,f,v=this,g="normal",b="light",_=!1,k=!1,w=rcmail.is_framed(),x={config:{standard_windows:rcmail.env.standard_windows,message_extwin:rcmail.env.message_extwin,compose_extwin:rcmail.env.compose_extwin,help_open_extwin:rcmail.env.help_open_extwin},checkboxes:0,small_screen_config:{standard_windows:!0,message_extwin:!1,compose_extwin:!1,help_open_extwin:!1}},C={},y=[],E=[],T={menu:$("#layout-menu"),sidebar:$("#layout-sidebar"),list:$("#layout-list"),content:$("#layout-content")},L={menu:$("a.task-menu-button"),back_sidebar:$("a.back-sidebar-button"),back_list:$("a.back-list-button"),back_content:$("a.back-content-button")};function j(t,e,a,n){var i=!0,o=$("<a>"),s=t.attr("id")||(new Date).getTime(),r=s+"-clone",l=t[0].className+(a?" "+a:"");return e?(a=t.data("popup"))&&(o.data({popup:a,"toggle-button":t.data("toggle-button")}),G(o[0]),i=!1,rcmail.register_menu_button(o[0],a)):(l=l.replace("btn-primary","primary").replace(/(btn[a-z-]*|button|disabled)/g,"").trim(),l+=" button"+(n?"":" disabled")),o.attr({id:r,href:"#",class:l}).append($('<span class="inner">').text(t.text())),i&&o.on("click",function(e){t.click()}),w&&!e?(o.data("target",t),E.push($.extend({button_id:r},z(t[0].id)))):(s=s,r=r,l=l.replace(" disabled",""),(s=z(s))&&rcmail.register_button(s.command,r,s.data.type,l,s.data.sel)),o}function z(e){var t,a,n;for(n in rcmail.buttons)for(t=0;t<rcmail.buttons[n].length;t++)if((a=rcmail.buttons[n][t]).id==e)return{command:n,index:t,data:a}}function M(){$("[data-list]").filter("ul,table").each(function(){var e,t,a,n,i,o=$(this),s=o.data("list");rcmail[s]&&rcmail[s].multiselect&&((a=(t=(e=o.parents("layout-sidebar,#layout-list,#layout-content").last()).find(".header")).find("ul")).length?(i=a.find("a.select").data("toggle-button"))&&(i=$("#"+i)):a=t,rcmail[s].enable_checkbox_selection(),!0===$e("list-selection")&&o.addClass("withselection"),i||(i=$("<a>").attr({class:"button selection disabled",role:"button",title:rcmail.gettext("select")}).on("click",function(){UI.toggle_list_selection(this,o.attr("id"))}).append($('<span class="inner">').text(rcmail.gettext("select"))),a.is(".menu")?(i.prependTo(a).wrap('<li role="menuitem">'),T.content&&(n=j(i,!0,"hidden-big hidden-large"),$('<li role="menuitem">').append(n).appendTo("#toolbar-menu"),i=i.add(n))):(n=o.data("list-select-replace"))?$(n).replaceWith(i):(i.appendTo(a).addClass("icon"),e.is("#layout-sidebar")||i.addClass("toolbar-button"))),rcmail.addEventListener("listupdate",function(e){e.list&&e.list==rcmail[s]&&(e.rowcount?i.addClass("active").removeClass("disabled").attr("tabindex",0):i.removeClass("active").addClass("disabled").attr("tabindex",-1))})),_&&rcmail[s]&&("function"==typeof rcmail[s].draggable?rcmail[s].draggable("destroy"):"boolean"==typeof rcmail[s].draggable&&(rcmail[s].draggable=!1),rcmail[s].dblclick_time=0)}),window.MutationObserver&&$("[data-label-msg]").filter("ul,table").each(function(){var n=$('<div class="listing-info hidden">').insertAfter(this),i=$(this),e=function(){var e,t=i.data("label-msg"),a=i.is("ul")?i:i.children("tbody");if(!rcmail.env.search_request&&!rcmail.env.qsearch&&t&&!a.children(":visible").length)return e=i.data("label-ext"),a=i.data("create-command"),!e||a&&!rcmail.commands[a]||(t+=" "+e),void n.text(t).removeClass("hidden");n.addClass("hidden")},t=function(){if(rcmail.busy||!i.is(":visible"))return setTimeout(t,250);clearTimeout(x.list_timer),x.list_timer=setTimeout(e,50)};new MutationObserver(t).observe(i[0],{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),t()}),"print"!=rcmail.env.action&&$("#attachment-list > li").each(function(){ie(this)});function t(e){"phone"==g&&rcmail.display_message(rcmail.gettext(e),"confirmation")}var e,a;rcmail.addEventListener("fileappended",function(e){e.attachment.complete&&(ie(e.item),"text/vcard"==e.attachment.mimetype&&rcmail.commands["attach-vcard"]&&t("vcard_attachments.vcardattached"))}).addEventListener("managesieve.insertrow",function(e){O(e.obj)}).addEventListener("add-recipient",function(){t("