From b4dd12e50ce643c63ced0f7d1d224ddfc7e50945 Mon Sep 17 00:00:00 2001 From: =?utf8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 14 Mar 2019 22:34:35 +0100 Subject: [PATCH] Deprecate marked, escapeHTML, formatDate, getURLParameter, humanFileSize, relative_modified_date and select2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- core/js/dist/main.js | 20 ++++++++++---------- core/js/dist/main.js.map | 2 +- core/src/globals.js | 34 +++++++++++++++++++++++++--------- 3 files changed, 36 insertions(+), 20 deletions(-) diff --git a/core/js/dist/main.js b/core/js/dist/main.js index 1ba9ffffb23..976cd340593 100644 --- a/core/js/dist/main.js +++ b/core/js/dist/main.js @@ -727,10 +727,10 @@ function se(e){return e.toString().split("&").join("&").split("<").join("< * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -/* - * @copyright 2018 Christoph Wurst +/** + * @copyright 2019 Christoph Wurst * - * @author 2018 Christoph Wurst + * @author 2019 Christoph Wurst * * @license GNU AGPL version 3 or any later version * @@ -747,7 +747,7 @@ function se(e){return e.toString().split("&").join("&").split("<").join("< * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -window._=s.a,window.$=a.a,window.autosize=u.a,window.Backbone=d.a,window.Clipboard=p.a,window.ClipboardJS=p.a,window.cssVars=W,window.dav=U.a,window.DOMPurify=q.a,window.Handlebars=V.a,window.jstimezonedetect=K.a,window.jstz=K.a,window.jQuery=a.a,window.marked=Z.a,window.md5=ee.a,window.moment=ne.a,window.OC=ie.a,window.OCP=re.a,window.OCA={},window.escapeHTML=se,window.formatDate=function(e){return console.warn("formatDate is deprecated, use OC.Util.formatDate instead"),ie.a.Util.formatDate(e)} +var ae=function(e,t){var n=e,i=function(){return console.warn("The ".concat(t," library is deprecated! It will be removed in nextcloud 19.")),n.apply(this,arguments)};return Object.assign(i,n),i};window._=s.a,window.$=a.a,window.autosize=u.a,window.Backbone=d.a,window.Clipboard=p.a,window.ClipboardJS=p.a,window.cssVars=W,window.dav=U.a,window.DOMPurify=q.a,window.Handlebars=V.a,window.jstimezonedetect=K.a,window.jstz=K.a,window.jQuery=a.a,window.marked=ae(Z.a,"marked"),window.md5=ee.a,window.moment=ne.a,window.OC=ie.a,window.OCP=re.a,window.OCA={},window.escapeHTML=ae(se,"escapeHTML"),window.formatDate=ae(function(e){return console.warn("formatDate is deprecated, use OC.Util.formatDate instead"),ie.a.Util.formatDate(e)} /* * @copyright 2019 Christoph Wurst * @@ -767,7 +767,7 @@ window._=s.a,window.$=a.a,window.autosize=u.a,window.Backbone=d.a,window.Clipboa * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . - */,window.getURLParameter=function(e){return decodeURIComponent((new RegExp("[?|&]"+e+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||""},window.humanFileSize=oe.a,window.relative_modified_date=function(e){return console.warn("relative_modified_date is deprecated, use OC.Util.relativeModifiedDate instead"),ie.a.Util.relativeModifiedDate(1e3*e)},window.t=s.a.bind(ie.a.L10N.translate,ie.a.L10N),window.n=s.a.bind(ie.a.L10N.translatePlural,ie.a.L10N), + */,"formatDate"),window.getURLParameter=ae(function(e){return decodeURIComponent((new RegExp("[?|&]"+e+"=([^&;]+?)(&|#|;|$)").exec(location.search)||[,""])[1].replace(/\+/g,"%20"))||""},"getURLParameter"),window.humanFileSize=ae(oe.a,"humanFileSize"),window.relative_modified_date=ae(function(e){return console.warn("relative_modified_date is deprecated, use OC.Util.relativeModifiedDate instead"),ie.a.Util.relativeModifiedDate(1e3*e)},"relative_modified_date"),a.a.fn.select2=ae(a.a.fn.select2,"select2"),window.t=s.a.bind(ie.a.L10N.translate,ie.a.L10N),window.n=s.a.bind(ie.a.L10N.translatePlural,ie.a.L10N), /* * @copyright 2018 Christoph Wurst * @@ -809,7 +809,7 @@ a.a.fn.avatar=function(e,t,n,i,r,s){var o=function(e){e.imageplaceholder("?"),e. * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -var ae=i(490);a.a.fn.contactsMenu=function(e,n,i){if(-1!==[0,4,6].indexOf(n)){var r=this;i.append('');var s=i.find("div.contactsmenu-popover");r.click(function(){if(!s.hasClass("hidden"))return s.addClass("hidden"),void s.hide();s.removeClass("hidden"),s.show(),s.hasClass("loaded")||(s.addClass("loaded"),a.a.ajax(ie.a.generateUrl("/contactsmenu/findOne"),{method:"POST",data:{shareType:n,shareWith:e}}).then(function(e){var n;s.find("ul").find("li").addClass("hidden"),(n=e.topAction?[e.topAction].concat(e.actions):[{hyperlink:"#",title:t("core","No action available")}]).forEach(function(e){var t=ae;s.find("ul").append(t(e))}),n.length},function(e){var n;s.find("ul").find("li").addClass("hidden"),n=404===e.status?t("core","No action available"):t("core","Error fetching contact actions");var i=ae;s.find("ul").append(i({hyperlink:"#",title:n}))}))}),a()(document).click(function(e){var t=s.has(e.target).length>0,n=r.has(e.target).length>0;r.each(function(){a()(this).is(e.target)&&(n=!0)}),t||n||(s.addClass("hidden"),s.hide())})}}, +var le=i(490);a.a.fn.contactsMenu=function(e,n,i){if(-1!==[0,4,6].indexOf(n)){var r=this;i.append('');var s=i.find("div.contactsmenu-popover");r.click(function(){if(!s.hasClass("hidden"))return s.addClass("hidden"),void s.hide();s.removeClass("hidden"),s.show(),s.hasClass("loaded")||(s.addClass("loaded"),a.a.ajax(ie.a.generateUrl("/contactsmenu/findOne"),{method:"POST",data:{shareType:n,shareWith:e}}).then(function(e){var n;s.find("ul").find("li").addClass("hidden"),(n=e.topAction?[e.topAction].concat(e.actions):[{hyperlink:"#",title:t("core","No action available")}]).forEach(function(e){var t=le;s.find("ul").append(t(e))}),n.length},function(e){var n;s.find("ul").find("li").addClass("hidden"),n=404===e.status?t("core","No action available"):t("core","Error fetching contact actions");var i=le;s.find("ul").append(i({hyperlink:"#",title:n}))}))}),a()(document).click(function(e){var t=s.has(e.target).length>0,n=r.has(e.target).length>0;r.each(function(){a()(this).is(e.target)&&(n=!0)}),t||n||(s.addClass("hidden"),s.hide())})}}, /* * @copyright 2019 Christoph Wurst * @@ -872,7 +872,7 @@ a.a.fn.filterAttr=function(e,t){return this.filter(function(){return a()(this).a * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -a.a.widget("oc.ocdialog",{options:{width:"auto",height:"auto",closeButton:!0,closeOnEscape:!0,modal:!1},_create:function(){var e=this;this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,height:this.element[0].style.height},this.originalTitle=this.element.attr("title"),this.options.title=this.options.title||this.originalTitle,this.$dialog=a()('
').attr({tabIndex:-1,role:"dialog"}).insertBefore(this.element),this.$dialog.append(this.element.detach()),this.element.removeAttr("title").addClass("oc-dialog-content").appendTo(this.$dialog),this.$dialog.css({display:"inline-block",position:"fixed"}),this.enterCallback=null,a()(document).on("keydown keyup",function(t){if(t.target===e.$dialog.get(0)||0!==e.$dialog.find(a()(t.target)).length){if(27===t.keyCode&&"keydown"===t.type&&e.options.closeOnEscape)return t.stopImmediatePropagation(),e.close(),!1;if(13===t.keyCode){if(t.stopImmediatePropagation(),null!==e.enterCallback)return e.enterCallback(),t.preventDefault(),!1;if("keyup"===t.type)return t.preventDefault(),!1;if(e.$buttonrow&&0===e.$buttonrow.find(a()(t.target)).length){var n=e.$buttonrow.find("button.primary");n&&!n.prop("disabled")&&n.trigger("click")}else e.$buttonrow&&a()(t.target).trigger("click");return!1}}}),this._setOptions(this.options),this._createOverlay()},_init:function(){this.$dialog.focus(),this._trigger("open")},_setOption:function(e,t){var n=this;switch(e){case"title":if(this.$title)this.$title.text(t);else{var i=a()('

'+t+"

");this.$title=i.prependTo(this.$dialog)}this._setSizes();break;case"buttons":if(this.$buttonrow)this.$buttonrow.empty();else{var r=a()('
');this.$buttonrow=r.appendTo(this.$dialog)}1===t.length?this.$buttonrow.addClass("onebutton"):2===t.length?this.$buttonrow.addClass("twobuttons"):3===t.length&&this.$buttonrow.addClass("threebuttons"),a.a.each(t,function(e,t){var i=a()("