From 107c29bd3ea8bde0bcf9d1c9382eb5ad8c47ce59 Mon Sep 17 00:00:00 2001 From: hamza221 Date: Tue, 24 Oct 2023 18:23:53 +0200 Subject: [PATCH] Fix:non responsive app navigation toggle Signed-off-by: hamza221 --- core/src/init.js | 31 ++----------------------------- dist/core-main.js | 4 ++-- dist/core-main.js.map | 2 +- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/core/src/init.js b/core/src/init.js index ae8db0abf4920..30257d0409459 100644 --- a/core/src/init.js +++ b/core/src/init.js @@ -140,44 +140,17 @@ export const initCore = () => { $('#app-content').prepend('') - // keep track whether snapper is currently animating, and - // prevent to call open or close while that is the case - // to avoid duplicating events (snap.js doesn't check this) - let animating = false - snapper.on('animating', () => { - // we need this because the trigger button - // is also implicitly wired to close by snapper - animating = true - }) - snapper.on('animated', () => { - animating = false - }) - snapper.on('start', () => { - // we need this because dragging triggers that - animating = true - }) - snapper.on('end', () => { - // we need this because dragging stop triggers that - animating = false - }) - - // These are necessary because calling open or close - // on snapper during an animation makes it trigger an - // unfinishable animation, which itself will continue - // triggering animating events and cause high CPU load, - // - // Ref https://github.com/jakiestfu/Snap.js/issues/216 const oldSnapperOpen = snapper.open const oldSnapperClose = snapper.close const _snapperOpen = () => { - if (animating || snapper.state().state !== 'closed') { + if (snapper.state().state !== 'closed') { return } oldSnapperOpen('left') } const _snapperClose = () => { - if (animating || snapper.state().state === 'closed') { + if (snapper.state().state === 'closed') { return } oldSnapperClose() diff --git a/dist/core-main.js b/dist/core-main.js index c1b399dd6f259..9fd4c3f47cc12 100644 --- a/dist/core-main.js +++ b/dist/core-main.js @@ -1,3 +1,3 @@ /*! For license information please see core-main.js.LICENSE.txt */ -!function(){var e,i={6772:function(){Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null})},97782:function(t,e,n){var i=n(25108);if(void 0===i||void 0===i.log){window.console||(window.console={});for(var o=function(){},a=["log","debug","warn","info","error","assert","time","timeEnd"],r=0;r").join(">").split('"').join(""").split("'").join("'")}(t),e);return n.toastElement.toastify=n,c()(n.toastElement)},showUpdate:function(t){return this.updatableNotification&&this.updatableNotification.hideToast(),this.updatableNotification=(0,m.PV)(t,{timeout:m.Rl}),this.updatableNotification.toastElement.toastify=this.updatableNotification,c()(this.updatableNotification.toastElement)},showTemporary:function(t,e){(e=e||{}).timeout=e.timeout||m.TN;var n=(0,m.PV)(t,e);return n.toastElement.toastify=n,c()(n.toastElement)},isHidden:function(){return!c()("#content").find(".toastify").length}},C=h.ZP.throttle((function(){v.showTemporary(t("core","Connection to server lost"))}),7e3,{trailing:!1}),b=!1,w={enableDynamicSlideToggle:function(){b=!0},showAppSidebar:function(t){(t||c()("#app-sidebar")).removeClass("disappear").show(),c()("#app-content").trigger(new(c().Event)("appresized"))},hideAppSidebar:function(t){(t||c()("#app-sidebar")).hide().addClass("disappear"),c()("#app-content").trigger(new(c().Event)("appresized"))}};function y(t,e,n){"post"!==t&&"delete"!==t||!ae.PasswordConfirmation.requiresPasswordConfirmation()?(n=n||{},c().ajax({type:t.toUpperCase(),url:(0,d.generateOcsUrl)("apps/provisioning_api/api/v1/config/apps")+e,data:n.data||{},success:n.success,error:n.error})):ae.PasswordConfirmation.requirePasswordConfirmation(_.bind(y,this,t,e,n))}function x(t){y("get","",t)}function k(t,e){y("get","/"+t,e)}function P(t,e,n,i){(i=i||{}).data={defaultValue:n},y("get","/"+t+"/"+e,i)}function E(t,e,n,i){(i=i||{}).data={value:n},y("post","/"+t+"/"+e,i)}function B(t,e,n){y("delete","/"+t+"/"+e,n)}var O=window.oc_appconfig||{},T={getValue:function(t,e,n,i){P(t,e,n,{success:i})},setValue:function(t,e,n){E(t,e,n)},getApps:function(t){x({success:t})},getKeys:function(t,e){k(t,{success:e})},deleteKey:function(t,e){B(t,e)}},D=o(25108),I=void 0!==window._oc_appswebroots&&window._oc_appswebroots,j=o(72316),z=o.n(j),S=o(76591),N=o(25108),U={create:"POST",update:"PROPPATCH",patch:"PROPPATCH",delete:"DELETE",read:"PROPFIND"};function M(t,e){if(h.ZP.isArray(t))return h.ZP.map(t,(function(t){return M(t,e)}));var n={href:t.href};return h.ZP.each(t.propStat,(function(t){if("HTTP/1.1 200 OK"===t.status)for(var i in t.properties){var o=i;i in e&&(o=e[i]),n[o]=t.properties[i]}})),n.id||(n.id=L(n.href)),n}function L(t){var e=t.indexOf("?");e>0&&(t=t.substr(0,e));var n,i=t.split("/");do{n=i[i.length-1],i.pop()}while(!n&&i.length>0);return n}function F(t){return t>=200&&t<=299}function R(t,e,n,i){return t.propPatch(e.url,function(t,e){var n,i={};for(n in t){var o=e[n],a=t[n];o||(N.warn('No matching DAV property for property "'+n),o=n),(h.ZP.isBoolean(a)||h.ZP.isNumber(a))&&(a=""+a),i[o]=a}return i}(n.changed,e.davProperties),i).then((function(t){F(t.status)?h.ZP.isFunction(e.success)&&e.success(n.toJSON()):h.ZP.isFunction(e.error)&&e.error(t)}))}var Q=z().noConflict();Object.assign(Q,{davCall:function(t,e){var n=new S.dav.Client({baseUrl:t.url,xmlNamespaces:h.ZP.extend({"DAV:":"d","http://owncloud.org/ns":"oc"},t.xmlNamespaces||{})});n.resolveUrl=function(){return t.url};var i=h.ZP.extend({"X-Requested-With":"XMLHttpRequest",requesttoken:OC.requestToken},t.headers);return"PROPFIND"===t.type?function(t,e,n,i){return t.propFind(e.url,h.ZP.values(e.davProperties)||[],e.depth,i).then((function(t){if(F(t.status)){if(h.ZP.isFunction(e.success)){var n=h.ZP.invert(e.davProperties),i=M(t.body,n);e.depth>0&&i.shift(),e.success(i)}}else h.ZP.isFunction(e.error)&&e.error(t)}))}(n,t,0,i):"PROPPATCH"===t.type?R(n,t,e,i):"MKCOL"===t.type?function(t,e,n,i){return t.request(e.type,e.url,i,null).then((function(o){F(o.status)?R(t,e,n,i):h.ZP.isFunction(e.error)&&e.error(o)}))}(n,t,e,i):function(t,e,n,i){return i["Content-Type"]="application/json",t.request(e.type,e.url,i,e.data).then((function(t){if(F(t.status)){if(h.ZP.isFunction(e.success)){if("PUT"===e.type||"POST"===e.type||"MKCOL"===e.type){var i=t.body||n.toJSON(),o=t.xhr.getResponseHeader("Content-Location");return"POST"===e.type&&o&&(i.id=L(o)),void e.success(i)}if(207===t.status){var a=h.ZP.invert(e.davProperties);e.success(M(t.body,a))}else e.success(t.body)}}else h.ZP.isFunction(e.error)&&e.error(t)}))}(n,t,e,i)},davSync:function(t){return function(e,n,i){var o={type:U[e]||e},a=n instanceof t.Collection;if("update"===e&&(n.hasInnerCollection?o.type="MKCOL":(n.usePUT||n.collection&&n.collection.usePUT)&&(o.type="PUT")),i.url||(o.url=h.ZP.result(n,"url")||function(){throw new Error('A "url" property or function must be specified')}()),null!=i.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(o.data=JSON.stringify(i.attrs||n.toJSON(i))),"PROPFIND"!==o.type&&(o.processData=!1),"PROPFIND"===o.type||"PROPPATCH"===o.type){var r=n.davProperties;!r&&n.model&&(r=n.model.prototype.davProperties),r&&(h.ZP.isFunction(r)?o.davProperties=r.call(n):o.davProperties=r),o.davProperties=h.ZP.extend(o.davProperties||{},i.davProperties),h.ZP.isUndefined(i.depth)&&(i.depth=a?1:0)}var s=i.error;i.error=function(t,e,n){i.textStatus=e,i.errorThrown=n,s&&s.call(i.context,t,e,n)};var l=i.xhr=t.davCall(h.ZP.extend(o,i),n);return n.trigger("request",n,l,i),l}}(Q)});var G=Q,H=o(65358),Z=window._oc_config||{},K=o(25108),Y=j.Model.extend({defaults:{fullName:"",lastMessage:"",actions:[],hasOneAction:!1,hasTwoActions:!1,hasManyActions:!1},initialize:function(){0===this.get("actions").length?this.set("hasOneAction",!0):1===this.get("actions").length?(this.set("hasTwoActions",!0),this.set("secondAction",this.get("actions")[0])):this.set("hasManyActions",!0);var e=this.get("fullName");this.get("avatar")&&e&&this.set("avatarLabel",t("core","Avatar of {fullName}",{fullName:e}))}}),q=j.Collection.extend({model:Y}),W=j.View.extend({_collection:void 0,_subViews:[],tagName:"ul",initialize:function(t){this._collection=t.collection},render:function(){var t=this;return t.$el.html(""),t._subViews=[],t._collection.forEach((function(e){var n=new J({model:e});n.render(),t.$el.append(n.$el),n.on("toggle:actionmenu",t._onChildActionMenuToggle,t),t._subViews.push(n)})),t},_onChildActionMenuToggle:function(t){this._subViews.forEach((function(e){e.trigger("parent:toggle:actionmenu",t)}))}}),J=j.View.extend({className:"contact",tagName:"li",_template:void 0,_model:void 0,_actionMenuShown:!1,events:{"click .icon-more":"_onToggleActionsMenu"},contactTemplate:o(10944),template:function(t){return this.contactTemplate(t)},initialize:function(t){this._model=t.model,this.on("parent:toggle:actionmenu",this._onOtherActionMenuOpened,this)},render:function(){return this.$el.html(this.template({contact:this._model.toJSON()})),this.delegateEvents(),this.$("div.avatar").imageplaceholder(this._model.get("fullName")),this},_onToggleActionsMenu:function(){this._actionMenuShown=!this._actionMenuShown,this._actionMenuShown?this.$(".menu").show():this.$(".menu").hide(),this.trigger("toggle:actionmenu",this.$el)},_onOtherActionMenuOpened:function(t){this.$el.is(t)||(this._actionMenuShown=!1,this.$(".menu").hide())}}),V=j.View.extend({_loadingTemplate:void 0,_errorTemplate:void 0,_contentTemplate:void 0,_contactsTemplate:void 0,_contacts:void 0,_searchTerm:"",events:{"input #contactsmenu-search":"_onSearch"},templates:{loading:o(95386),error:o(20421),menu:o(66115),list:o(34083)},_onSearch:h.ZP.debounce((function(t){var e=this.$("#contactsmenu-search").val();e!==this._searchTerm&&(this.trigger("search",this.$("#contactsmenu-search").val()),this._searchTerm=e)}),700),loadingTemplate:function(t){return this.templates.loading(t)},errorTemplate:function(e){return this.templates.error(h.ZP.extend({couldNotLoadText:t("core","Could not load your contacts")},e))},contentTemplate:function(e){return this.templates.menu(h.ZP.extend({searchContactsText:t("core","Search contacts …")},e))},contactsTemplate:function(e){return this.templates.list(h.ZP.extend({noContactsFoundText:t("core","No contacts found"),showAllContactsText:t("core","Show all contacts …"),contactsAppMgmtText:t("core","Install the Contacts app")},e))},initialize:function(t){this.options=t},showLoading:function(t){this.render(),this._contacts=void 0,this.$(".content").html(this.loadingTemplate({loadingText:t}))},showError:function(){this.render(),this._contacts=void 0,this.$(".content").html(this.errorTemplate())},showContacts:function(t,e){this._contacts=t.contacts,this.render({contacts:t.contacts});var n=new W({collection:t.contacts});n.render(),this.$(".content").html(this.contactsTemplate({contacts:t.contacts,searchTerm:e,contactsAppEnabled:t.contactsAppEnabled,contactsAppURL:ae.generateUrl("/apps/contacts"),canInstallApp:ae.isUserAdmin(),contactsAppMgmtURL:ae.generateUrl("/settings/apps/social/contacts")})),this.$("#contactsmenu-contacts").html(n.$el)},render:function(t){var e=this.$("#contactsmenu-search").val();return this.$el.html(this.contentTemplate(t)),this.$("#contactsmenu-search").val(e),this.$("#contactsmenu-search").focus(),this}}),X=function(t){this.initialize(t)};X.prototype={$el:void 0,_view:void 0,_contactsPromise:void 0,initialize:function(t){this.$el=c()(t.el),this._view=new V({el:this.$el}),this._view.on("search",(function(t){this.loadContacts(t)}),this)},_getContacts:function(t){var e=ae.generateUrl("/contactsmenu/contacts");return Promise.resolve(c().ajax(e,{method:"POST",data:{filter:t}}))},loadContacts:function(e){var n=this;return n._contactsPromise||(n._contactsPromise=n._getContacts(e)),h.ZP.isUndefined(e)||""===e?n._view.showLoading(t("core","Loading your contacts …")):n._view.showLoading(t("core","Looking for {term} …",{term:e})),n._contactsPromise.then((function(t){t.contacts=new q(t.contacts),n._view.showContacts(t,e)}),(function(t){n._view.showError(),K.error("There was an error loading your contacts",t)})).then((function(){delete n._contactsPromise})).catch(K.error.bind(this))}};var $=X,tt=document.getElementsByTagName("head")[0].getAttribute("data-user"),et=document.getElementsByTagName("head")[0].getAttribute("data-user-displayname"),nt=void 0!==tt&&tt,it=o(25108);function ot(t,e){for(var n=0;n");A.attr("type",r?"password":"text").attr("id",l+"-input").attr("placeholder",a);var p=c()("