From cb2048f1634f6dab61c474209056d607110e3a29 Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 2 Oct 2020 12:40:33 +0200 Subject: [PATCH] cleanup some code --- dev/Common/Enums.js | 31 +------------------ dev/Common/Links.js | 10 ++---- dev/Knoin/AbstractModel.js | 4 +-- dev/Knoin/AbstractScreen.js | 2 +- dev/Knoin/AbstractViewNext.js | 2 +- dev/Knoin/Knoin.js | 12 +++---- dev/View/Popup/Domain.js | 26 ++++++++-------- dev/View/User/AbstractSystemDropDown.js | 4 +-- dev/View/User/MailBox/MessageList.js | 2 +- dev/View/User/MailBox/MessageView.js | 6 ++-- vendors/jua/jua.js | 2 +- vendors/jua/jua.min.js | 2 +- .../build/output/knockout-latest.debug.js | 23 -------------- vendors/knockout/src/virtualElements.js | 23 -------------- 14 files changed, 32 insertions(+), 117 deletions(-) diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js index 32d2436e0..b166fa736 100644 --- a/dev/Common/Enums.js +++ b/dev/Common/Enums.js @@ -83,23 +83,6 @@ export const Focused = { FolderList: 'folder-list' }; -/** - * @enum {number} - */ -export const State = { - Empty: 10, - Login: 20, - Auth: 30 -}; - -/** - * @enum {number} - */ -export const StateType = { - Webmail: 0, - Admin: 1 -}; - /** * @enum {string} */ @@ -108,7 +91,6 @@ export const Capa = { TwoFactorForce: 'TWO_FACTOR_FORCE', OpenPGP: 'OPEN_PGP', Prefetch: 'PREFETCH', - Gravatar: 'GRAVATAR', Folders: 'FOLDERS', Composer: 'COMPOSER', Contacts: 'CONTACTS', @@ -252,7 +234,7 @@ export const ClientSideKeyName = { LastSignMe: 7, ComposeLastIdentityID: 8, MessageHeaderFullInfo: 9, - MessageAttachmnetControls: 10 + MessageAttachmentControls: 10 }; /** @@ -432,17 +414,6 @@ export const ContactPropertyType = { Custom: 250 }; -/** - * @enum {number} - */ -export const Ports = { - Imap: 143, - ImapSsl: 993, - Smtp: 25, - SmtpSsl: 465, - SmtpStartTls: 587 -}; - /** * @enum {number} */ diff --git a/dev/Common/Links.js b/dev/Common/Links.js index 3b6ec9ed2..a22db388d 100644 --- a/dev/Common/Links.js +++ b/dev/Common/Links.js @@ -7,11 +7,7 @@ const SERVER_PREFIX = './?', SUB_QUERY_PREFIX = '&q[]=', VERSION = Settings.app('version'), - WEB_PREFIX = Settings.app('webPath') || '', VERSION_PREFIX = Settings.app('webVersionPath') || 'rainloop/v/' + VERSION + '/', - STATIC_PREFIX = VERSION_PREFIX + 'static/', - ADMIN_HOST_USE = !!Settings.app('adminHostUse'), - ADMIN_PATH = Settings.app('adminPath') || 'admin', getHash = () => Settings.get('AuthAccountHash') || '0'; @@ -34,7 +30,7 @@ export function root(startupUrl = '') { * @returns {string} */ export function rootAdmin() { - return ADMIN_HOST_USE ? ROOT : SERVER_PREFIX + ADMIN_PATH; + return Settings.app('adminHostUse') ? ROOT : SERVER_PREFIX + (Settings.app('adminPath') || 'admin'); } /** @@ -238,7 +234,7 @@ export function exportContactsCsv() { * @returns {string} */ export function staticPrefix(path) { - return STATIC_PREFIX + path; + return VERSION_PREFIX + 'static/' + path; } /** @@ -292,7 +288,7 @@ export function themePreviewLink(theme) { let prefix = VERSION_PREFIX; if ('@custom' === theme.substr(-7)) { theme = theme.substr(0, theme.length - 7).trim(); - prefix = WEB_PREFIX; + prefix = Settings.app('webPath') || ''; } return prefix + 'themes/' + encodeURI(theme) + '/images/preview.png'; diff --git a/dev/Knoin/AbstractModel.js b/dev/Knoin/AbstractModel.js index 97c5d1ff4..acbe9417a 100644 --- a/dev/Knoin/AbstractModel.js +++ b/dev/Knoin/AbstractModel.js @@ -18,9 +18,7 @@ export class AbstractModel { regDisposables(value) { if (Array.isArray(value)) { - value.forEach((item) => { - this.disposables.push(item); - }); + value.forEach(item => this.disposables.push(item)); } else if (value) { this.disposables.push(value); } diff --git a/dev/Knoin/AbstractScreen.js b/dev/Knoin/AbstractScreen.js index 3740b64e2..e367ad960 100644 --- a/dev/Knoin/AbstractScreen.js +++ b/dev/Knoin/AbstractScreen.js @@ -32,7 +32,7 @@ export class AbstractScreen { /** * @returns {?Object} */ - __cross() { + get __cross() { return this.oCross; } diff --git a/dev/Knoin/AbstractViewNext.js b/dev/Knoin/AbstractViewNext.js index f92f0bcda..d0be60624 100644 --- a/dev/Knoin/AbstractViewNext.js +++ b/dev/Knoin/AbstractViewNext.js @@ -9,7 +9,7 @@ export class AbstractViewNext { sDefaultKeyScope = KeyState.None; sCurrentKeyScope = KeyState.None; - viewModelVisibility = ko.observable(false); + viewModelVisible = false; modalVisibility = ko.observable(false).extend({ rateLimit: 0 }); viewModelName = ''; diff --git a/dev/Knoin/Knoin.js b/dev/Knoin/Knoin.js index 3c3b47b89..260fbb0fc 100644 --- a/dev/Knoin/Knoin.js +++ b/dev/Knoin/Knoin.js @@ -249,8 +249,7 @@ export function isPopupVisible(ViewModelClassToShow) { */ function screenOnRoute(screenName, subPart) { let vmScreen = null, - isSameScreen = false, - cross = null; + isSameScreen = false; if (null == screenName || '' == screenName) { screenName = defaultScreenName; @@ -295,7 +294,7 @@ function screenOnRoute(screenName, subPart) { ViewType.Popup !== ViewModelClass.__vm.viewModelPosition ) { ViewModelClass.__dom.hidden = true; - ViewModelClass.__vm.viewModelVisibility(false); + ViewModelClass.__vm.viewModelVisible = false; ViewModelClass.__vm.onHide && ViewModelClass.__vm.onHide(); ViewModelClass.__vm.onHideWithDelay && setTimeout(()=>ViewModelClass.__vm.onHideWithDelay(), 500); @@ -321,7 +320,7 @@ function screenOnRoute(screenName, subPart) { ViewModelClass.__vm.onBeforeShow && ViewModelClass.__vm.onBeforeShow(); ViewModelClass.__dom.hidden = false; - ViewModelClass.__vm.viewModelVisibility(true); + ViewModelClass.__vm.viewModelVisible = true; ViewModelClass.__vm.onShow && ViewModelClass.__vm.onShow(); @@ -334,10 +333,7 @@ function screenOnRoute(screenName, subPart) { } // -- - cross = vmScreen && vmScreen.__cross ? vmScreen.__cross() : null; - if (cross) { - cross.parse(subPart); - } + vmScreen && vmScreen.__cross && vmScreen.__cross.parse(subPart); }, 1); } } diff --git a/dev/View/Popup/Domain.js b/dev/View/Popup/Domain.js index f58129205..73762b7d5 100644 --- a/dev/View/Popup/Domain.js +++ b/dev/View/Popup/Domain.js @@ -1,6 +1,6 @@ import ko from 'ko'; -import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums'; +import { StorageResultType, ServerSecure, Notification } from 'Common/Enums'; import { pInt, pString } from 'Common/Utils'; import { i18n } from 'Common/Translator'; @@ -125,19 +125,19 @@ class DomainPopupView extends AbstractViewNext { value && this.imapServer() && !this.smtpServer() && this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp')) ); - this.imapSecure.subscribe((value) => { + this.imapSecure.subscribe(value => { if (this.enableSmartPorts()) { const port = pInt(this.imapPort()); switch (pString(value)) { case '0': case '2': - if (Ports.ImapSsl === port) { - this.imapPort(pString(Ports.Imap)); + if (993 === port) { + this.imapPort('143'); } break; case '1': - if (Ports.Imap === port) { - this.imapPort(pString(Ports.ImapSsl)); + if (143 === port) { + this.imapPort('993'); } break; // no default @@ -145,23 +145,23 @@ class DomainPopupView extends AbstractViewNext { } }); - this.smtpSecure.subscribe((value) => { + this.smtpSecure.subscribe(value => { if (this.enableSmartPorts()) { const port = pInt(this.smtpPort()); switch (pString(value)) { case '0': - if (Ports.SmtpSsl === port || Ports.SmtpStartTls === port) { - this.smtpPort(pString(Ports.Smtp)); + if (465 === port || 587 === port) { + this.smtpPort('25'); } break; case '1': - if (Ports.Smtp === port || Ports.SmtpStartTls === port) { - this.smtpPort(pString(Ports.SmtpSsl)); + if (25 === port || 587 === port) { + this.smtpPort('465'); } break; case '2': - if (Ports.Smtp === port || Ports.SmtpSsl === port) { - this.smtpPort(pString(Ports.SmtpStartTls)); + if (25 === port || 465 === port) { + this.smtpPort('587'); } break; // no default diff --git a/dev/View/User/AbstractSystemDropDown.js b/dev/View/User/AbstractSystemDropDown.js index 3c90c69b8..a279c3b4c 100644 --- a/dev/View/User/AbstractSystemDropDown.js +++ b/dev/View/User/AbstractSystemDropDown.js @@ -82,7 +82,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext { onBuild() { shortcuts.add('`', '', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => { - if (this.viewModelVisibility()) { + if (this.viewModelVisible) { MessageStore.messageFullScreenMode(false); this.accountMenuDropdownTrigger(true); } @@ -90,7 +90,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext { // shortcuts help shortcuts.add('/', 'shift', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => { - if (this.viewModelVisibility()) { + if (this.viewModelVisible) { showScreenPopup(require('View/Popup/KeyboardShortcutsHelp')); return false; } diff --git a/dev/View/User/MailBox/MessageList.js b/dev/View/User/MailBox/MessageList.js index 3daf2caa9..8587a7612 100644 --- a/dev/View/User/MailBox/MessageList.js +++ b/dev/View/User/MailBox/MessageList.js @@ -872,7 +872,7 @@ class MessageListMailBoxUserView extends AbstractViewNext { } prefetchNextTick() { - if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisibility()) { + if (ifvisible && !this.bPrefetch && !ifvisible.now() && this.viewModelVisible) { const message = this.messageList().find( item => item && !hasRequestedMessage(item.folderFullNameRaw, item.uid) ); diff --git a/dev/View/User/MailBox/MessageView.js b/dev/View/User/MailBox/MessageView.js index 33b22b1bf..bafed6799 100644 --- a/dev/View/User/MailBox/MessageView.js +++ b/dev/View/User/MailBox/MessageView.js @@ -109,7 +109,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext { this.showAttachmnetControls = ko.observable(false); - this.showAttachmnetControlsState = v => Local.set(ClientSideKeyName.MessageAttachmnetControls, !!v); + this.showAttachmnetControlsState = v => Local.set(ClientSideKeyName.MessageAttachmentControls, !!v); this.allowAttachmnetControls = ko.computed( () => this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions) @@ -220,7 +220,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext { if (message) { this.showAttachmnetControls(false); - if (Local.get(ClientSideKeyName.MessageAttachmnetControls)) { + if (Local.get(ClientSideKeyName.MessageAttachmentControls)) { setTimeout(() => { this.showAttachmnetControls(true); }, 50); @@ -509,7 +509,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext { * @returns {boolean} */ escShortcuts() { - if (this.viewModelVisibility() && this.message()) { + if (this.viewModelVisible && this.message()) { const preview = Layout.NoPreview !== this.layout(); if (this.fullScreenMode()) { this.fullScreenMode(false); diff --git a/vendors/jua/jua.js b/vendors/jua/jua.js index 317e3b960..19e1f3b58 100644 --- a/vendors/jua/jua.js +++ b/vendors/jua/jua.js @@ -494,7 +494,7 @@ while (iLen--) fakeMd5 += '0123456789abcdefghijklmnopqrstuvwxyz'.substr(Math.round(Math.random() * 36), 1); - this.addFile('jua-uid-' + fakeMd5 + '-' + (new Date()).getTime().toString(), oFileInfo); + this.addFile('jua-uid-' + fakeMd5 + '-' + (Date.now().toString()), oFileInfo); } /** diff --git a/vendors/jua/jua.min.js b/vendors/jua/jua.min.js index 65121a561..e8cfe4c54 100644 --- a/vendors/jua/jua.min.js +++ b/vendors/jua/jua.min.js @@ -1,2 +1,2 @@ /* RainLoop Webmail (c) RainLoop Team | MIT */ -(e=>{const t=20,n=e=>void 0!==e,r=(e,r,i,o)=>{if(e&&e.length){let a=i=n(i)?parseInt(i||0,10):t,s=null,u=0{e&&(!u||0<=--i?(s=l(e))&&r(s):u&&!d&&0>i&&o&&(d=!0,o(a)))})}},i=(e,t)=>{Object.entries(t).forEach(([t,n])=>e.addEventListener(t,n))},l=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},o=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,l=new FormData,o=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",o,!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),l.append("jua-post-type","ajax"),l.append(this.oOptions.name,t.File),Object.entries(a).forEach(([e,n])=>l.append(e,("function"==typeof n?n(t):n).toString())),i.send(l),this.oXhrs[e]=i,!0}catch(e){console.error(e)}return!1}generateNewInput(t){if(t){const n=this,i=e.createElement("input"),l=()=>i.click();i.type="file",i.tabIndex=-1,i.style.display="none",i.multiple=!n.oOptions.disableMultiple,t.addEventListener("click",l),i.addEventListener("input",()=>{const e=e=>{n.oJua.addNewFile(e),setTimeout(()=>{i.remove(),t.removeEventListener("click",l),n.generateNewInput(t)},10)};i.files&&i.files.length?r(i.files,e,n.oOptions.multipleSizeLimit,n.oJua.getEvent("onLimitReached")):e({FileName:i.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 l=this;l.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||{}),l.oQueue=new s(n.queueSize),l.oDriver=new a(l,n);let u=n.clickElement;if(u&&(u.style.position="relative",u.style.overflow="hidden","inline"===u.style.display&&(u.style.display="inline-block"),l.oDriver.generateNewInput(u)),u=n.dragAndDropElement){let t=n.dragAndDropBodyElement||e;n.disableDocumentDropPrevent||e.addEventListener("dragover",e=>{if(o(e))try{e.dataTransfer.dropEffect="none",e.preventDefault()}catch(e){console.error(e)}}),t&&i(t,{dragover:()=>l.docTimer.clear(),dragenter:e=>{o(e)&&(l.docTimer.clear(),e.preventDefault(),l.runEvent("onBodyDragEnter",[e]))},dragleave:e=>e.dataTransfer&&l.docTimer.start(()=>l.runEvent("onBodyDragLeave",[e])),drop:e=>{if(e.dataTransfer){let t=o(e);return t&&e.preventDefault(),l.runEvent("onBodyDragLeave",[e]),!t}return!1}}),i(u,{dragenter:e=>{o(e)&&(l.docTimer.clear(),e.preventDefault(),l.runEvent("onDragEnter",[u,e]))},dragover:e=>{if(o(e))try{let t=e.dataTransfer.effectAllowed;l.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)||(l.docTimer.clear(),l.runEvent("onDragLeave",[u,t]))}},drop:e=>{o(e)&&(e.preventDefault(),r(e.files||e.dataTransfer.files,e=>{e&&(l.addNewFile(e),l.docTimer.clear())},n.multipleSizeLimit,l.getEvent("onLimitReached"))),l.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}},this.Jua=u})(document); +(e=>{const t=20,n=e=>void 0!==e,r=(e,r,i,o)=>{if(e&&e.length){let a=i=n(i)?parseInt(i||0,10):t,s=null,u=0{e&&(!u||0<=--i?(s=l(e))&&r(s):u&&!d&&0>i&&o&&(d=!0,o(a)))})}},i=(e,t)=>Object.entries(t).forEach(([t,n])=>e.addEventListener(t,n)),l=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},o=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,l=new FormData,o=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",o,!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),l.append("jua-post-type","ajax"),l.append(this.oOptions.name,t.File),Object.entries(a).forEach(([e,n])=>l.append(e,("function"==typeof n?n(t):n).toString())),i.send(l),this.oXhrs[e]=i,!0}catch(e){console.error(e)}return!1}generateNewInput(t){if(t){const n=this,i=e.createElement("input"),l=()=>i.click();i.type="file",i.tabIndex=-1,i.style.display="none",i.multiple=!n.oOptions.disableMultiple,t.addEventListener("click",l),i.addEventListener("input",()=>{const e=e=>{n.oJua.addNewFile(e),setTimeout(()=>{i.remove(),t.removeEventListener("click",l),n.generateNewInput(t)},10)};i.files&&i.files.length?r(i.files,e,n.oOptions.multipleSizeLimit,n.oJua.getEvent("onLimitReached")):e({FileName:i.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 l=this;l.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||{}),l.oQueue=new s(n.queueSize),l.oDriver=new a(l,n);let u=n.clickElement;if(u&&(u.style.position="relative",u.style.overflow="hidden","inline"===u.style.display&&(u.style.display="inline-block"),l.oDriver.generateNewInput(u)),u=n.dragAndDropElement){let t=n.dragAndDropBodyElement||e;n.disableDocumentDropPrevent||e.addEventListener("dragover",e=>{if(o(e))try{e.dataTransfer.dropEffect="none",e.preventDefault()}catch(e){console.error(e)}}),t&&i(t,{dragover:()=>l.docTimer.clear(),dragenter:e=>{o(e)&&(l.docTimer.clear(),e.preventDefault(),l.runEvent("onBodyDragEnter",[e]))},dragleave:e=>e.dataTransfer&&l.docTimer.start(()=>l.runEvent("onBodyDragLeave",[e])),drop:e=>{if(e.dataTransfer){let t=o(e);return t&&e.preventDefault(),l.runEvent("onBodyDragLeave",[e]),!t}return!1}}),i(u,{dragenter:e=>{o(e)&&(l.docTimer.clear(),e.preventDefault(),l.runEvent("onDragEnter",[u,e]))},dragover:e=>{if(o(e))try{let t=e.dataTransfer.effectAllowed;l.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)||(l.docTimer.clear(),l.runEvent("onDragLeave",[u,t]))}},drop:e=>{o(e)&&(e.preventDefault(),r(e.files||e.dataTransfer.files,e=>{e&&(l.addNewFile(e),l.docTimer.clear())},n.multipleSizeLimit,l.getEvent("onLimitReached"))),l.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+"-"+Date.now().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}},this.Jua=u})(document); diff --git a/vendors/knockout/build/output/knockout-latest.debug.js b/vendors/knockout/build/output/knockout-latest.debug.js index da1534664..a683a3628 100644 --- a/vendors/knockout/build/output/knockout-latest.debug.js +++ b/vendors/knockout/build/output/knockout-latest.debug.js @@ -2341,7 +2341,6 @@ ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.ex var startCommentRegex = /^\s*ko(?:\s+([\s\S]+))?\s*$/; var endCommentRegex = /^\s*\/ko\s*$/; - var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true }; function isStartComment(node) { return (node.nodeType == 8) && startCommentRegex.test(node.nodeValue); @@ -2389,28 +2388,6 @@ ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.ex return null; // Must have no matching end comment, and allowUnbalanced is true } - function getUnbalancedChildTags(node) { - // e.g., from
OK
Another, returns: Another - // from
OK
, returns: - var childNode = node.firstChild, captureRemaining = null; - if (childNode) { - do { - if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes - captureRemaining.push(childNode); - else if (isStartComment(childNode)) { - var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true); - if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set - childNode = matchingEndComment; - else - captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point - } else if (isEndComment(childNode)) { - captureRemaining = [childNode]; // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing - } - } while (childNode = childNode.nextSibling); - } - return captureRemaining; - } - ko.virtualElements = { allowedBindings: {}, diff --git a/vendors/knockout/src/virtualElements.js b/vendors/knockout/src/virtualElements.js index 6e842356b..8cd1fd5ef 100644 --- a/vendors/knockout/src/virtualElements.js +++ b/vendors/knockout/src/virtualElements.js @@ -9,7 +9,6 @@ var startCommentRegex = /^\s*ko(?:\s+([\s\S]+))?\s*$/; var endCommentRegex = /^\s*\/ko\s*$/; - var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true }; function isStartComment(node) { return (node.nodeType == 8) && startCommentRegex.test(node.nodeValue); @@ -57,28 +56,6 @@ return null; // Must have no matching end comment, and allowUnbalanced is true } - function getUnbalancedChildTags(node) { - // e.g., from
OK
Another, returns: Another - // from
OK
, returns: - var childNode = node.firstChild, captureRemaining = null; - if (childNode) { - do { - if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes - captureRemaining.push(childNode); - else if (isStartComment(childNode)) { - var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true); - if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set - childNode = matchingEndComment; - else - captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point - } else if (isEndComment(childNode)) { - captureRemaining = [childNode]; // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing - } - } while (childNode = childNode.nextSibling); - } - return captureRemaining; - } - ko.virtualElements = { allowedBindings: {},