Deprecate marked, escapeHTML, formatDate, getURLParameter, humanFileSize, relative_modified_date and select2

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-03-14 22:34:35 +01:00 committed by Roeland Jago Douma
parent c01019b536
commit b4dd12e50c
No known key found for this signature in database
GPG Key ID: F941078878347C0C
3 changed files with 36 additions and 20 deletions

20
core/js/dist/main.js vendored
View File

@ -727,10 +727,10 @@ function se(e){return e.toString().split("&").join("&amp;").split("<").join("&lt
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
@ -747,7 +747,7 @@ function se(e){return e.toString().split("&").join("&amp;").split("<").join("&lt
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 <christoph@winzerhof-wurst.at>
*
@ -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 <http://www.gnu.org/licenses/>.
*/,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 <christoph@winzerhof-wurst.at>
*
@ -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 <http://www.gnu.org/licenses/>.
*/
var ae=i(490);a.a.fn.contactsMenu=function(e,n,i){if(-1!==[0,4,6].indexOf(n)){var r=this;i.append('<div class="menu popovermenu menu-left hidden contactsmenu-popover"> <ul> <li> <a> <span class="icon-loading-small"></span> </a> </li> </ul></div>');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('<div class="menu popovermenu menu-left hidden contactsmenu-popover"> <ul> <li> <a> <span class="icon-loading-small"></span> </a> </li> </ul></div>');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 <christoph@winzerhof-wurst.at>
*
@ -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 <http://www.gnu.org/licenses/>.
*/
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()('<div class="oc-dialog" />').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()('<h2 class="oc-dialog-title">'+t+"</h2>");this.$title=i.prependTo(this.$dialog)}this._setSizes();break;case"buttons":if(this.$buttonrow)this.$buttonrow.empty();else{var r=a()('<div class="oc-dialog-buttonrow" />');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()("<button>").text(t.text);t.classes&&i.addClass(t.classes),t.defaultButton&&(i.addClass("primary"),n.$defaultButton=i),n.$buttonrow.append(i),i.click(function(){t.click.apply(n.element[0],arguments)})}),this.$buttonrow.find("button").on("focus",function(e){n.$buttonrow.find("button").removeClass("primary"),a()(this).addClass("primary")}),this._setSizes();break;case"style":void 0!==t.buttons&&this.$buttonrow.addClass(t.buttons);break;case"closeButton":if(t){var s=a()('<a class="oc-dialog-close"></a>');this.$dialog.prepend(s),s.on("click",function(){n.close()})}else this.$dialog.find(".oc-dialog-close").remove();break;case"width":this.$dialog.css("width",t);break;case"height":this.$dialog.css("height",t);break;case"close":this.closeCB=t}a.a.Widget.prototype._setOption.apply(this,arguments)},_setOptions:function(e){a.a.Widget.prototype._setOptions.apply(this,arguments)},_setSizes:function(){var e=0;this.$title&&(e+=this.$title.outerHeight(!0)),this.$buttonrow&&(e+=this.$buttonrow.outerHeight(!0)),this.element.css({height:"calc(100% - "+e+"px)"})},_createOverlay:function(){if(this.options.modal){var e=this;this.overlay=a()("<div>").addClass("oc-dialog-dim").appendTo(a()("#content")),this.overlay.on("click keydown keyup",function(t){if(t.target!==e.$dialog.get(0)&&0===e.$dialog.find(a()(t.target)).length)return t.preventDefault(),void t.stopPropagation()})}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(this.overlay.off("click keydown keyup"),this.overlay.remove(),this.overlay=null)},widget:function(){return this.$dialog},setEnterCallback:function(e){this.enterCallback=e},unsetEnterCallback:function(){this.enterCallback=null},close:function(){this._destroyOverlay();var e=this;setTimeout(function(){e._trigger("close",e)},200),e.$dialog.remove(),this.destroy()},destroy:function(){this.$title&&this.$title.remove(),this.$buttonrow&&this.$buttonrow.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),this.element.removeClass("oc-dialog-content").css(this.originalCss).detach().insertBefore(this.$dialog),this.$dialog.remove()}});var le={init:function(e,t,n){this.vars=e,this.options=a.a.extend({},this.options,t),this.elem=n;if("function"==typeof this.options.escapeFunction)for(var i=Object.keys(this.vars),r=0;r<i.length;r++)"string"==typeof this.vars[i[r]]&&(this.vars[i[r]]=this.options.escapeFunction(this.vars[i[r]]));var s=this._build(this.vars);return a()(s)},_build:function(e){var t="text/template"===this.elem.attr("type")?this.elem.html():this.elem.get(0).outerHTML;try{return t.replace(/{([^{}]*)}/g,function(t,n){var i=e[n];return"string"==typeof i||"number"==typeof i?i:t})}catch(e){console.error(e,"data:",t)}},options:{escapeFunction:se}};function ue(e){return(ue="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
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()('<div class="oc-dialog" />').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()('<h2 class="oc-dialog-title">'+t+"</h2>");this.$title=i.prependTo(this.$dialog)}this._setSizes();break;case"buttons":if(this.$buttonrow)this.$buttonrow.empty();else{var r=a()('<div class="oc-dialog-buttonrow" />');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()("<button>").text(t.text);t.classes&&i.addClass(t.classes),t.defaultButton&&(i.addClass("primary"),n.$defaultButton=i),n.$buttonrow.append(i),i.click(function(){t.click.apply(n.element[0],arguments)})}),this.$buttonrow.find("button").on("focus",function(e){n.$buttonrow.find("button").removeClass("primary"),a()(this).addClass("primary")}),this._setSizes();break;case"style":void 0!==t.buttons&&this.$buttonrow.addClass(t.buttons);break;case"closeButton":if(t){var s=a()('<a class="oc-dialog-close"></a>');this.$dialog.prepend(s),s.on("click",function(){n.close()})}else this.$dialog.find(".oc-dialog-close").remove();break;case"width":this.$dialog.css("width",t);break;case"height":this.$dialog.css("height",t);break;case"close":this.closeCB=t}a.a.Widget.prototype._setOption.apply(this,arguments)},_setOptions:function(e){a.a.Widget.prototype._setOptions.apply(this,arguments)},_setSizes:function(){var e=0;this.$title&&(e+=this.$title.outerHeight(!0)),this.$buttonrow&&(e+=this.$buttonrow.outerHeight(!0)),this.element.css({height:"calc(100% - "+e+"px)"})},_createOverlay:function(){if(this.options.modal){var e=this;this.overlay=a()("<div>").addClass("oc-dialog-dim").appendTo(a()("#content")),this.overlay.on("click keydown keyup",function(t){if(t.target!==e.$dialog.get(0)&&0===e.$dialog.find(a()(t.target)).length)return t.preventDefault(),void t.stopPropagation()})}},_destroyOverlay:function(){this.options.modal&&this.overlay&&(this.overlay.off("click keydown keyup"),this.overlay.remove(),this.overlay=null)},widget:function(){return this.$dialog},setEnterCallback:function(e){this.enterCallback=e},unsetEnterCallback:function(){this.enterCallback=null},close:function(){this._destroyOverlay();var e=this;setTimeout(function(){e._trigger("close",e)},200),e.$dialog.remove(),this.destroy()},destroy:function(){this.$title&&this.$title.remove(),this.$buttonrow&&this.$buttonrow.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),this.element.removeClass("oc-dialog-content").css(this.originalCss).detach().insertBefore(this.$dialog),this.$dialog.remove()}});var ue={init:function(e,t,n){this.vars=e,this.options=a.a.extend({},this.options,t),this.elem=n;if("function"==typeof this.options.escapeFunction)for(var i=Object.keys(this.vars),r=0;r<i.length;r++)"string"==typeof this.vars[i[r]]&&(this.vars[i[r]]=this.options.escapeFunction(this.vars[i[r]]));var s=this._build(this.vars);return a()(s)},_build:function(e){var t="text/template"===this.elem.attr("type")?this.elem.html():this.elem.get(0).outerHTML;try{return t.replace(/{([^{}]*)}/g,function(t,n){var i=e[n];return"string"==typeof i||"number"==typeof i?i:t})}catch(e){console.error(e,"data:",t)}},options:{escapeFunction:se}};function ce(e){return(ce="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@ -892,7 +892,7 @@ a.a.widget("oc.ocdialog",{options:{width:"auto",height:"auto",closeButton:!0,clo
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/a.a.fn.octemplate=function(e,t){if(e=e||{},this.length)return Object.create(le).init(e,t,this)},String.prototype.toRgb=function(){var e=this.toLowerCase();function t(e,t,n){this.r=e,this.g=t,this.b=n}function n(e,n,i){var r=new Array;r.push(n);for(var s=function(e,t){var n=new Array(3);return n[0]=(t[1].r-t[0].r)/e,n[1]=(t[1].g-t[0].g)/e,n[2]=(t[1].b-t[0].b)/e,n}(e,[n,i]),o=1;o<e;o++){var a=parseInt(n.r+s[0]*o),l=parseInt(n.g+s[1]*o),u=parseInt(n.b+s[2]*o);r.push(new t(a,l,u))}return r}null===e.match(/^([0-9a-f]{4}-?){8}$/)&&(e=md5(e)),e=e.replace(/[^0-9a-f]/g,"");var i=new t(182,70,157),r=new t(221,203,85),s=new t(0,130,201),o=n(6,i,r),a=n(6,r,s),l=n(6,s,i);return o.concat(a).concat(l)[function(e,t){for(var n=0,i=Array(),r=0;r<e.length;r++)i.push(parseInt(e.charAt(r),16)%16);for(var s in i)n+=i[s];return parseInt(parseInt(n)%t)}(e,18)]},a.a.fn.imageplaceholder=function(e,t,n){t=t||e;var i=e.toRgb();this.css("background-color","rgb("+i.r+", "+i.g+", "+i.b+")");var r=this.height()||n||32;this.height(r),this.width(r),this.css("color","#fff"),this.css("font-weight","normal"),this.css("text-align","center"),this.css("line-height",r+"px"),this.css("font-size",.55*r+"px"),null!==e&&e.length&&this.html(t[0].toUpperCase())},a.a.fn.clearimageplaceholder=function(){this.css("background-color",""),this.css("color",""),this.css("font-weight",""),this.css("text-align",""),this.css("line-height",""),this.css("font-size",""),this.html(""),this.removeClass("icon-loading"),this.removeClass("icon-loading-small")},
*/a.a.fn.octemplate=function(e,t){if(e=e||{},this.length)return Object.create(ue).init(e,t,this)},String.prototype.toRgb=function(){var e=this.toLowerCase();function t(e,t,n){this.r=e,this.g=t,this.b=n}function n(e,n,i){var r=new Array;r.push(n);for(var s=function(e,t){var n=new Array(3);return n[0]=(t[1].r-t[0].r)/e,n[1]=(t[1].g-t[0].g)/e,n[2]=(t[1].b-t[0].b)/e,n}(e,[n,i]),o=1;o<e;o++){var a=parseInt(n.r+s[0]*o),l=parseInt(n.g+s[1]*o),u=parseInt(n.b+s[2]*o);r.push(new t(a,l,u))}return r}null===e.match(/^([0-9a-f]{4}-?){8}$/)&&(e=md5(e)),e=e.replace(/[^0-9a-f]/g,"");var i=new t(182,70,157),r=new t(221,203,85),s=new t(0,130,201),o=n(6,i,r),a=n(6,r,s),l=n(6,s,i);return o.concat(a).concat(l)[function(e,t){for(var n=0,i=Array(),r=0;r<e.length;r++)i.push(parseInt(e.charAt(r),16)%16);for(var s in i)n+=i[s];return parseInt(parseInt(n)%t)}(e,18)]},a.a.fn.imageplaceholder=function(e,t,n){t=t||e;var i=e.toRgb();this.css("background-color","rgb("+i.r+", "+i.g+", "+i.b+")");var r=this.height()||n||32;this.height(r),this.width(r),this.css("color","#fff"),this.css("font-weight","normal"),this.css("text-align","center"),this.css("line-height",r+"px"),this.css("font-size",.55*r+"px"),null!==e&&e.length&&this.html(t[0].toUpperCase())},a.a.fn.clearimageplaceholder=function(){this.css("background-color",""),this.css("color",""),this.css("font-weight",""),this.css("text-align",""),this.css("line-height",""),this.css("font-size",""),this.html(""),this.removeClass("icon-loading"),this.removeClass("icon-loading-small")},
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@ -934,7 +934,7 @@ a.a.fn.selectRange=function(e,t){return this.each(function(){if(this.setSelectio
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
a.a.fn.extend({showPassword:function(e){var t={fn:null,args:{}};t.fn=e;var n=function(e,t){t.val(e.val())},i=function(e,t,i){e.is(":checked")?(n(t,i),i.show(),t.hide()):(n(i,t),i.hide(),t.show())};return this.each(function(){var e=a()(this),r=a()(e.data("typetoggle")),s=function(e){var t=a()(e),n=a()("<input />");return n.attr({type:"text",class:t.attr("class"),style:t.attr("style"),size:t.attr("size"),name:t.attr("name")+"-clone",tabindex:t.attr("tabindex"),autocomplete:"off"}),void 0!==t.attr("placeholder")&&n.attr("placeholder",t.attr("placeholder")),n}(e);s.insertAfter(e),t.fn&&(t.args.input=e,t.args.checkbox=r,t.args.clone=s),r.bind("click",function(){i(r,e,s)}),e.bind("keyup",function(){n(e,s)}),s.bind("keyup",function(){n(s,e),e.trigger("keyup")}),s.bind("blur",function(){e.trigger("focusout")}),i(r,e,s),s.closest("form").submit(function(e){s.prop("type","password")}),t.fn&&t.fn(t.args)})}}),a.a.fn.tipsy=function(e){if(console.warn("Deprecation warning: tipsy is deprecated. Use tooltip instead."),"object"===ue(e)&&null!==e){var t={placement:"bottom",delay:{show:0,hide:0},trigger:"hover",html:!1,container:"body"};if(e.gravity)switch(e.gravity){case"n":case"nw":case"ne":t.placement="bottom";break;case"s":case"sw":case"se":t.placement="top";break;case"w":t.placement="right";break;case"e":t.placement="left"}e.trigger&&(t.trigger=e.trigger),e.delayIn&&(t.delay.show=e.delayIn),e.delayOut&&(t.delay.hide=e.delayOut),e.html&&(t.html=!0),e.fallback&&(t.title=e.fallback),a.a.fn.tooltip.call(this,"destroy"),a.a.fn.tooltip.call(this,t)}else this.tooltip(e),a.a.fn.tooltip.call(this,e);return this},a.a.ui.autocomplete.prototype._resizeMenu=function(){this.menu.element.outerWidth(this.element.outerWidth())};i(491),i(498);var ce=i(73);
a.a.fn.extend({showPassword:function(e){var t={fn:null,args:{}};t.fn=e;var n=function(e,t){t.val(e.val())},i=function(e,t,i){e.is(":checked")?(n(t,i),i.show(),t.hide()):(n(i,t),i.hide(),t.show())};return this.each(function(){var e=a()(this),r=a()(e.data("typetoggle")),s=function(e){var t=a()(e),n=a()("<input />");return n.attr({type:"text",class:t.attr("class"),style:t.attr("style"),size:t.attr("size"),name:t.attr("name")+"-clone",tabindex:t.attr("tabindex"),autocomplete:"off"}),void 0!==t.attr("placeholder")&&n.attr("placeholder",t.attr("placeholder")),n}(e);s.insertAfter(e),t.fn&&(t.args.input=e,t.args.checkbox=r,t.args.clone=s),r.bind("click",function(){i(r,e,s)}),e.bind("keyup",function(){n(e,s)}),s.bind("keyup",function(){n(s,e),e.trigger("keyup")}),s.bind("blur",function(){e.trigger("focusout")}),i(r,e,s),s.closest("form").submit(function(e){s.prop("type","password")}),t.fn&&t.fn(t.args)})}}),a.a.fn.tipsy=function(e){if(console.warn("Deprecation warning: tipsy is deprecated. Use tooltip instead."),"object"===ce(e)&&null!==e){var t={placement:"bottom",delay:{show:0,hide:0},trigger:"hover",html:!1,container:"body"};if(e.gravity)switch(e.gravity){case"n":case"nw":case"ne":t.placement="bottom";break;case"s":case"sw":case"se":t.placement="top";break;case"w":t.placement="right";break;case"e":t.placement="left"}e.trigger&&(t.trigger=e.trigger),e.delayIn&&(t.delay.show=e.delayIn),e.delayOut&&(t.delay.hide=e.delayOut),e.html&&(t.html=!0),e.fallback&&(t.title=e.fallback),a.a.fn.tooltip.call(this,"destroy"),a.a.fn.tooltip.call(this,t)}else this.tooltip(e),a.a.fn.tooltip.call(this,e);return this},a.a.ui.autocomplete.prototype._resizeMenu=function(){this.menu.element.outerWidth(this.element.outerWidth())};i(491),i(498);var de=i(73);
/*
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
*
@ -955,5 +955,5 @@ a.a.fn.extend({showPassword:function(e){var t={fn:null,args:{}};t.fn=e;var n=fun
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
a()(document).ready(function(){Object(ce.b)()})}]);
a()(document).ready(function(){Object(de.b)()})}]);
//# sourceMappingURL=main.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
/*
* @copyright 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2018 Christoph Wurst <christoph@winzerhof-wurst.at>
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @license GNU AGPL version 3 or any later version
*
@ -19,6 +19,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
* @param {Function} func the library to deprecate
* @param {String} funcName the name of the library
*/
const deprecate = (func, funcName) => {
const oldFunc = func
const newFunc = function() {
console.warn(`The ${funcName} library is deprecated! It will be removed in nextcloud 19.`)
return oldFunc.apply(this, arguments)
}
Object.assign(newFunc, oldFunc)
return newFunc
}
import _ from 'underscore'
import $ from 'jquery'
import 'jquery-migrate/dist/jquery-migrate.min'
@ -71,18 +86,19 @@ window['Handlebars'] = Handlebars
window['jstimezonedetect'] = jstimezonedetect
window['jstz'] = jstimezonedetect
window['jQuery'] = $
window['marked'] = marked
window['marked'] = deprecate(marked, 'marked')
window['md5'] = md5
window['moment'] = moment
window['OC'] = OC
window['OCP'] = OCP
window['OCA'] = OCA
window['escapeHTML'] = escapeHTML
window['formatDate'] = formatDate
window['getURLParameter'] = getURLParameter
window['humanFileSize'] = humanFileSize
window['relative_modified_date'] = relative_modified_date
window['escapeHTML'] = deprecate(escapeHTML, 'escapeHTML')
window['formatDate'] = deprecate(formatDate, 'formatDate')
window['getURLParameter'] = deprecate(getURLParameter, 'getURLParameter')
window['humanFileSize'] = deprecate(humanFileSize, 'humanFileSize')
window['relative_modified_date'] = deprecate(relative_modified_date, 'relative_modified_date')
$.fn.select2 = deprecate($.fn.select2, 'select2')
/**
* translate a string