diff --git a/dev/External/SquireUI.js b/dev/External/SquireUI.js index 68395b148..a05aeaa12 100644 --- a/dev/External/SquireUI.js +++ b/dev/External/SquireUI.js @@ -58,7 +58,7 @@ const doc = document, tpl.querySelectorAll(':not('+allowedElements+',signature)').forEach(el => el.replaceWith(getFragmentOfChildren(el))); tpl.querySelectorAll('*').forEach(el => { if (el.hasAttributes()) { - Array.from(el.attributes).forEach(attr => { + [...el.attributes].forEach(attr => { let name = attr.name.toLowerCase(); if (!allowedAttributes.includes(name)) { el.removeAttribute(name); diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index 1327c7dda..c9a9adf04 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -397,8 +397,28 @@ class MessageViewMailBoxUserView extends AbstractViewNext { * @param {Object} oAttachment * @returns {boolean} */ - attachmentPreview() { - // TODO: add lightgallery alternative? + attachmentPreview(/*attachment*/) { +/* + if (attachment && attachment.isImage() && !attachment.isLinked && this.message() && this.message().attachments()) { + const items = this.message().attachments().map(item => { + if (item && !item.isLinked && item.isImage()) { + if (item === attachment) { + index = listIndex; + } + ++listIndex; + return { + src: item.linkPreview(), + msrc: item.linkThumbnail(), + title: item.fileName + }; + } + return null; + }).filter(value => !!value); + + if (items.length) { + } + } +*/ return true; } diff --git a/vendors/bootstrap/js/bootstrap.native.js b/vendors/bootstrap/js/bootstrap.native.js index 6fc5caef2..055133376 100644 --- a/vendors/bootstrap/js/bootstrap.native.js +++ b/vendors/bootstrap/js/bootstrap.native.js @@ -67,7 +67,7 @@ window.BSN = (() => { self.show = () => { menu = parent.querySelector('.dropdown-menu'); menuItems = []; - Array.from(menu.children).forEach(child => { + [...menu.children].forEach(child => { child.children.length && (child.children[0].tagName === 'A' && menuItems.push(child.children[0])); child.tagName === 'A' && menuItems.push(child); }); diff --git a/vendors/bootstrap/js/bootstrap.native.min.js b/vendors/bootstrap/js/bootstrap.native.min.js index 5ec582c1d..a49ef4c7c 100644 --- a/vendors/bootstrap/js/bootstrap.native.min.js +++ b/vendors/bootstrap/js/bootstrap.native.min.js @@ -4,4 +4,4 @@ * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ -window.BSN=(()=>{"use strict";const e=document,t=e=>e.focus?e.focus():e.setActive();return{Dropdown:function(s){let o,n=[];const r=this,a=s.parentNode,i=e=>{const t=e.target,s=t.href||t.parentNode&&t.parentNode.href;s&&"#"===s.slice(-1)&&e.preventDefault()},c=()=>{let t=s.open?"addEventListener":"removeEventListener";e[t]("click",d,!1),e[t]("keydown",h,!1),e[t]("keyup",p,!1),e[t]("focus",d,!1)},d=e=>{let t=e.target,n=o.contains(t),a=t&&(t.getAttribute("data-toggle")||t.parentNode&&t.parentNode.getAttribute("data-toggle"));"focus"===e.type&&(t===s||n)||a&&n||(r.hide(),i(e))},l=e=>{r.show(),i(e)},h=e=>("ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault(),p=a=>{let i=e.activeElement,c=i===s,d=o.contains(i),l=i.parentNode===o||i.parentNode.parentNode===o,h=n.indexOf(i);l&&(h=c?0:"ArrowUp"===a.code?h>1?h-1:0:"ArrowDown"===a.code&&h{o=a.querySelector(".dropdown-menu"),n=[],Array.from(o.children).forEach(e=>{e.children.length&&"A"===e.children[0].tagName&&n.push(e.children[0]),"A"===e.tagName&&n.push(e)}),!("tabindex"in o)&&o.setAttribute("tabindex","0"),o.classList.add("show"),a.classList.add("show"),s.setAttribute("aria-expanded",!0),s.open=!0,s.removeEventListener("click",l,!1),setTimeout(()=>{t(o.getElementsByTagName("INPUT")[0]||s),c()},1)}),r.hide=(()=>{o.classList.remove("show"),a.classList.remove("show"),s.setAttribute("aria-expanded",!1),s.open=!1,c(),t(s),setTimeout(()=>s.Dropdown&&s.addEventListener("click",l,!1),1)}),r.toggle=(()=>a.classList.contains("show")&&s.open?r.hide():r.show()),s.addEventListener("click",l,!1),s.open=!1,s.Dropdown=r},Tab:class{constructor(e){this.element=e,e.Tab=this,e.addEventListener("click",e=>{e.preventDefault(),this.show()})}show(){const t=this.element,s=t.closest("li");if(!s.classList.contains("active")){const o=t.closest("ul").querySelector(".active a");o.closest("li").classList.remove("active"),e.querySelector(o.getAttribute("href")).classList.remove("active"),s.classList.add("active"),e.querySelector(t.getAttribute("href")).classList.add("active")}}}}})(); +window.BSN=(()=>{"use strict";const e=document,t=e=>e.focus?e.focus():e.setActive();return{Dropdown:function(s){let o,n=[];const r=this,i=s.parentNode,a=e=>{const t=e.target,s=t.href||t.parentNode&&t.parentNode.href;s&&"#"===s.slice(-1)&&e.preventDefault()},c=()=>{let t=s.open?"addEventListener":"removeEventListener";e[t]("click",d,!1),e[t]("keydown",h,!1),e[t]("keyup",p,!1),e[t]("focus",d,!1)},d=e=>{let t=e.target,n=o.contains(t),i=t&&(t.getAttribute("data-toggle")||t.parentNode&&t.parentNode.getAttribute("data-toggle"));"focus"===e.type&&(t===s||n)||i&&n||(r.hide(),a(e))},l=e=>{r.show(),a(e)},h=e=>("ArrowUp"===e.code||"ArrowDown"===e.code)&&e.preventDefault(),p=i=>{let a=e.activeElement,c=a===s,d=o.contains(a),l=a.parentNode===o||a.parentNode.parentNode===o,h=n.indexOf(a);l&&(h=c?0:"ArrowUp"===i.code?h>1?h-1:0:"ArrowDown"===i.code&&h{o=i.querySelector(".dropdown-menu"),n=[],[...o.children].forEach(e=>{e.children.length&&"A"===e.children[0].tagName&&n.push(e.children[0]),"A"===e.tagName&&n.push(e)}),!("tabindex"in o)&&o.setAttribute("tabindex","0"),o.classList.add("show"),i.classList.add("show"),s.setAttribute("aria-expanded",!0),s.open=!0,s.removeEventListener("click",l,!1),setTimeout(()=>{t(o.getElementsByTagName("INPUT")[0]||s),c()},1)}),r.hide=(()=>{o.classList.remove("show"),i.classList.remove("show"),s.setAttribute("aria-expanded",!1),s.open=!1,c(),t(s),setTimeout(()=>s.Dropdown&&s.addEventListener("click",l,!1),1)}),r.toggle=(()=>i.classList.contains("show")&&s.open?r.hide():r.show()),s.addEventListener("click",l,!1),s.open=!1,s.Dropdown=r},Tab:class{constructor(e){this.element=e,e.Tab=this,e.addEventListener("click",e=>{e.preventDefault(),this.show()})}show(){const t=this.element,s=t.closest("li");if(!s.classList.contains("active")){const o=t.closest("ul").querySelector(".active a");o.closest("li").classList.remove("active"),e.querySelector(o.getAttribute("href")).classList.remove("active"),s.classList.add("active"),e.querySelector(t.getAttribute("href")).classList.add("active")}}}}})(); diff --git a/vendors/jua/jua.js b/vendors/jua/jua.js index 96b980f17..183c1269f 100644 --- a/vendors/jua/jua.js +++ b/vendors/jua/jua.js @@ -24,7 +24,7 @@ bCallLimit = false ; - Array.from(aItems).forEach(oItem => { + [...aItems].forEach(oItem => { if (oItem) { if (!bUseLimit || 0 <= --iLimit) diff --git a/vendors/jua/jua.min.js b/vendors/jua/jua.min.js index 1b3fb1935..371cd9ed5 100644 --- a/vendors/jua/jua.min.js +++ b/vendors/jua/jua.min.js @@ -1,2 +1,2 @@ /* RainLoop Webmail (c) RainLoop Team | MIT */ -(()=>{"use strict";const e=document,t=20,n=e=>void 0!==e,r=(e,r,i,l)=>{if(e&&e.length){let a=i=n(i)?parseInt(i||0,10):t,s=null,u=0{e&&(!u||0<=--i?(s=o(e))&&r(s):u&&!d&&0>i&&l&&(d=!0,l(a)))})}},i=(e,t)=>{Object.entries(t).forEach(([t,n])=>e.addEventListener(t,n))},o=e=>{let t=n(e.fileName)?e.fileName:n(e.name)?e.name:null,r=n(e.fileSize)?e.fileSize:n(e.size)?e.size:null,i=n(e.type)?e.type:null;return"/"===t.charAt(0)&&(t=t.substr(1)),i||0!==r?{FileName:t,Size:r,Type:i,Folder:"",File:e}:null},l=e=>{try{return e.dataTransfer.types.includes("Files")}catch(e){return!1}};class a{constructor(e,t){this.oXhrs={},this.oUids={},this.oJua=e,this.oOptions=Object.assign({action:"",name:"juaFile",hidden:{},disableMultiple:!1},t)}regTaskUid(e){this.oUids[e]=!0}uploadTask(e,t){if(!1===this.oUids[e]||!t||!t.File)return!1;try{const r=this,i=new XMLHttpRequest,o=new FormData,l=this.oOptions.action,a=this.oOptions.hidden,s=this.oJua.getEvent("onStart"),u=this.oJua.getEvent("onComplete"),d=this.oJua.getEvent("onProgress");return i.open("POST",l,!0),d&&i.upload&&(i.upload.onprogress=function(t){t&&t.lengthComputable&&n(t.loaded)&&n(t.total)&&d(e,t.loaded,t.total)}),i.onreadystatechange=function(){if(4===i.readyState&&200===i.status){if(u){let t=!1,n=null;try{n=JSON.parse(i.responseText),t=!0}catch(e){n=null}u(e,t,n)}n(r.oXhrs[e])&&(r.oXhrs[e]=null)}else 4===i.readyState&&u(e,!1,null)},s&&s(e),o.append("jua-post-type","ajax"),o.append(this.oOptions.name,t.File),Object.entries(a).forEach(([e,n])=>o.append(e,("function"==typeof n?n(t):n).toString())),i.send(o),this.oXhrs[e]=i,!0}catch(e){console.error(e)}return!1}generateNewInput(t){if(t){const n=this,i=e.createElement("label"),o=i.appendChild(e.createElement("input"));o.type="file",o.tabIndex=-1,o.style.cssText="position:absolute;left:-9999px;",o.multiple=!n.oOptions.disableMultiple,i.style.cssText="position:absolute;background-color:#fff;right:0;top:0;left:0;bottom:0;margin:0;padding:0;cursor:pointer;opacity:0",t.append(i),o.addEventListener("input",()=>{const e=e=>{n.oJua.addNewFile(e),n.generateNewInput(t),setTimeout(()=>i.remove(),10)};o.files&&o.files.length?r(o.files,e,n.oOptions.multipleSizeLimit,n.oJua.getEvent("onLimitReached")):e({FileName:o.value.split("\\").pop().split("/").pop(),Size:null,Type:null,Folder:"",File:null})})}}cancel(e){if(this.oUids[e]=!1,this.oXhrs[e]){try{this.oXhrs[e].abort&&this.oXhrs[e].abort()}catch(e){console.error(e)}this.oXhrs[e]=null}}}class s extends Array{constructor(e){super(),this.limit=parseInt(e||0,10)}push(e,...t){this.limit>this.length&&(super.push([e,t]),this.call())}call(){if(!this.running){let e;for(this.running=!0;e=this.shift();)e[0](...e[1]);this.running=!1}}}class u{constructor(n){const o=this;o.oEvents={onSelect:null,onStart:null,onComplete:null,onProgress:null,onDragEnter:null,onDragLeave:null,onBodyDragEnter:null,onBodyDragLeave:null,onLimitReached:null},n=Object.assign({queueSize:10,clickElement:null,dragAndDropElement:null,dragAndDropBodyElement:null,disableDocumentDropPrevent:!1,multipleSizeLimit:t},n||{}),o.oQueue=new s(n.queueSize),o.oDriver=new a(o,n);let u=n.clickElement;if(u&&(u.style.position="relative",u.style.overflow="hidden","inline"===u.style.display&&(u.style.display="inline-block"),o.oDriver.generateNewInput(u)),u=n.dragAndDropElement){let t=n.dragAndDropBodyElement||e;n.disableDocumentDropPrevent||e.addEventListener("dragover",e=>{if(l(e))try{e.dataTransfer.dropEffect="none",e.preventDefault()}catch(e){console.error(e)}}),t&&i(t,{dragover:()=>o.docTimer.clear(),dragenter:e=>{l(e)&&(o.docTimer.clear(),e.preventDefault(),o.runEvent("onBodyDragEnter",[e]))},dragleave:e=>e.dataTransfer&&o.docTimer.start(()=>o.runEvent("onBodyDragLeave",[e])),drop:e=>{if(e.dataTransfer){let t=l(e);return t&&e.preventDefault(),o.runEvent("onBodyDragLeave",[e]),!t}return!1}}),i(u,{dragenter:e=>{l(e)&&(o.docTimer.clear(),e.preventDefault(),o.runEvent("onDragEnter",[u,e]))},dragover:e=>{if(l(e))try{let t=e.dataTransfer.effectAllowed;o.docTimer.clear(),e.dataTransfer.dropEffect="move"===t||"linkMove"===t?"move":"copy",e.stopPropagation(),e.preventDefault()}catch(e){console.error(e)}},dragleave:t=>{if(t.dataTransfer){let n=e.elementFromPoint(t.clientX,t.clientY);n&&u.contains(n)||(o.docTimer.clear(),o.runEvent("onDragLeave",[u,t]))}},drop:e=>{l(e)&&(e.preventDefault(),r(e.files||e.dataTransfer.files,e=>{e&&(o.addNewFile(e),o.docTimer.clear())},n.multipleSizeLimit,o.getEvent("onLimitReached"))),o.runEvent("onDragLeave",[e])}})}}on(e,t){return this.oEvents[e]=t,this}runEvent(e,t){this.oEvents[e]&&this.oEvents[e].apply(null,t||[])}getEvent(e){return this.oEvents[e]||null}cancel(e){this.oDriver.cancel(e)}addNewFile(e){let t=16,n="";for(;t--;)n+="0123456789abcdefghijklmnopqrstuvwxyz".substr(Math.round(36*Math.random()),1);this.addFile("jua-uid-"+n+"-"+(new Date).getTime().toString(),e)}addFile(e,t){const n=this.getEvent("onSelect");!t||n&&!1===n(e,t)?this.oDriver.cancel(e):(this.oDriver.regTaskUid(e),this.oQueue.push((...e)=>this.oDriver.uploadTask(...e),e,t))}}u.prototype.docTimer={start:function(e){this.clear(),this.timer=setTimeout(e,200)},clear:function(){this.timer&&clearTimeout(this.timer),this.timer=0}},window.Jua=u})(); +(()=>{"use strict";const e=document,t=20,n=e=>void 0!==e,r=(e,r,i,l)=>{if(e&&e.length){let a=i=n(i)?parseInt(i||0,10):t,s=null,u=0{e&&(!u||0<=--i?(s=o(e))&&r(s):u&&!d&&0>i&&l&&(d=!0,l(a)))})}},i=(e,t)=>{Object.entries(t).forEach(([t,n])=>e.addEventListener(t,n))},o=e=>{let t=n(e.fileName)?e.fileName:n(e.name)?e.name:null,r=n(e.fileSize)?e.fileSize:n(e.size)?e.size:null,i=n(e.type)?e.type:null;return"/"===t.charAt(0)&&(t=t.substr(1)),i||0!==r?{FileName:t,Size:r,Type:i,Folder:"",File:e}:null},l=e=>{try{return e.dataTransfer.types.includes("Files")}catch(e){return!1}};class a{constructor(e,t){this.oXhrs={},this.oUids={},this.oJua=e,this.oOptions=Object.assign({action:"",name:"juaFile",hidden:{},disableMultiple:!1},t)}regTaskUid(e){this.oUids[e]=!0}uploadTask(e,t){if(!1===this.oUids[e]||!t||!t.File)return!1;try{const r=this,i=new XMLHttpRequest,o=new FormData,l=this.oOptions.action,a=this.oOptions.hidden,s=this.oJua.getEvent("onStart"),u=this.oJua.getEvent("onComplete"),d=this.oJua.getEvent("onProgress");return i.open("POST",l,!0),d&&i.upload&&(i.upload.onprogress=function(t){t&&t.lengthComputable&&n(t.loaded)&&n(t.total)&&d(e,t.loaded,t.total)}),i.onreadystatechange=function(){if(4===i.readyState&&200===i.status){if(u){let t=!1,n=null;try{n=JSON.parse(i.responseText),t=!0}catch(e){n=null}u(e,t,n)}n(r.oXhrs[e])&&(r.oXhrs[e]=null)}else 4===i.readyState&&u(e,!1,null)},s&&s(e),o.append("jua-post-type","ajax"),o.append(this.oOptions.name,t.File),Object.entries(a).forEach(([e,n])=>o.append(e,("function"==typeof n?n(t):n).toString())),i.send(o),this.oXhrs[e]=i,!0}catch(e){console.error(e)}return!1}generateNewInput(t){if(t){const n=this,i=e.createElement("label"),o=i.appendChild(e.createElement("input"));o.type="file",o.tabIndex=-1,o.style.cssText="position:absolute;left:-9999px;",o.multiple=!n.oOptions.disableMultiple,i.style.cssText="position:absolute;background-color:#fff;right:0;top:0;left:0;bottom:0;margin:0;padding:0;cursor:pointer;opacity:0",t.append(i),o.addEventListener("input",()=>{const e=e=>{n.oJua.addNewFile(e),n.generateNewInput(t),setTimeout(()=>i.remove(),10)};o.files&&o.files.length?r(o.files,e,n.oOptions.multipleSizeLimit,n.oJua.getEvent("onLimitReached")):e({FileName:o.value.split("\\").pop().split("/").pop(),Size:null,Type:null,Folder:"",File:null})})}}cancel(e){if(this.oUids[e]=!1,this.oXhrs[e]){try{this.oXhrs[e].abort&&this.oXhrs[e].abort()}catch(e){console.error(e)}this.oXhrs[e]=null}}}class s extends Array{constructor(e){super(),this.limit=parseInt(e||0,10)}push(e,...t){this.limit>this.length&&(super.push([e,t]),this.call())}call(){if(!this.running){let e;for(this.running=!0;e=this.shift();)e[0](...e[1]);this.running=!1}}}class u{constructor(n){const o=this;o.oEvents={onSelect:null,onStart:null,onComplete:null,onProgress:null,onDragEnter:null,onDragLeave:null,onBodyDragEnter:null,onBodyDragLeave:null,onLimitReached:null},n=Object.assign({queueSize:10,clickElement:null,dragAndDropElement:null,dragAndDropBodyElement:null,disableDocumentDropPrevent:!1,multipleSizeLimit:t},n||{}),o.oQueue=new s(n.queueSize),o.oDriver=new a(o,n);let u=n.clickElement;if(u&&(u.style.position="relative",u.style.overflow="hidden","inline"===u.style.display&&(u.style.display="inline-block"),o.oDriver.generateNewInput(u)),u=n.dragAndDropElement){let t=n.dragAndDropBodyElement||e;n.disableDocumentDropPrevent||e.addEventListener("dragover",e=>{if(l(e))try{e.dataTransfer.dropEffect="none",e.preventDefault()}catch(e){console.error(e)}}),t&&i(t,{dragover:()=>o.docTimer.clear(),dragenter:e=>{l(e)&&(o.docTimer.clear(),e.preventDefault(),o.runEvent("onBodyDragEnter",[e]))},dragleave:e=>e.dataTransfer&&o.docTimer.start(()=>o.runEvent("onBodyDragLeave",[e])),drop:e=>{if(e.dataTransfer){let t=l(e);return t&&e.preventDefault(),o.runEvent("onBodyDragLeave",[e]),!t}return!1}}),i(u,{dragenter:e=>{l(e)&&(o.docTimer.clear(),e.preventDefault(),o.runEvent("onDragEnter",[u,e]))},dragover:e=>{if(l(e))try{let t=e.dataTransfer.effectAllowed;o.docTimer.clear(),e.dataTransfer.dropEffect="move"===t||"linkMove"===t?"move":"copy",e.stopPropagation(),e.preventDefault()}catch(e){console.error(e)}},dragleave:t=>{if(t.dataTransfer){let n=e.elementFromPoint(t.clientX,t.clientY);n&&u.contains(n)||(o.docTimer.clear(),o.runEvent("onDragLeave",[u,t]))}},drop:e=>{l(e)&&(e.preventDefault(),r(e.files||e.dataTransfer.files,e=>{e&&(o.addNewFile(e),o.docTimer.clear())},n.multipleSizeLimit,o.getEvent("onLimitReached"))),o.runEvent("onDragLeave",[e])}})}}on(e,t){return this.oEvents[e]=t,this}runEvent(e,t){this.oEvents[e]&&this.oEvents[e].apply(null,t||[])}getEvent(e){return this.oEvents[e]||null}cancel(e){this.oDriver.cancel(e)}addNewFile(e){let t=16,n="";for(;t--;)n+="0123456789abcdefghijklmnopqrstuvwxyz".substr(Math.round(36*Math.random()),1);this.addFile("jua-uid-"+n+"-"+(new Date).getTime().toString(),e)}addFile(e,t){const n=this.getEvent("onSelect");!t||n&&!1===n(e,t)?this.oDriver.cancel(e):(this.oDriver.regTaskUid(e),this.oQueue.push((...e)=>this.oDriver.uploadTask(...e),e,t))}}u.prototype.docTimer={start:function(e){this.clear(),this.timer=setTimeout(e,200)},clear:function(){this.timer&&clearTimeout(this.timer),this.timer=0}},window.Jua=u})();