From 09ecf4b4eb10cc1dc87dbcd91068dc92164e540d Mon Sep 17 00:00:00 2001 From: Sergey Shliakhov Date: Tue, 11 Feb 2020 07:12:42 +0100 Subject: [PATCH] Generate legacy image placeholder text by taking first letters https://github.com/nextcloud/server/issues/19335 Signed-off-by: Sergey Shliakhov Signed-off-by: Christoph Wurst Signed-off-by: npmbuildbot[bot] --- core/js/dist/main.js | 2 +- core/js/dist/main.js.map | 2 +- core/js/tests/specs/jquery.placeholderSpec.js | 43 +++++++++++++++++++ core/src/jquery/placeholder.js | 3 +- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 core/js/tests/specs/jquery.placeholderSpec.js diff --git a/core/js/dist/main.js b/core/js/dist/main.js index ca84196d6a..6575858cf0 100644 --- a/core/js/dist/main.js +++ b/core/js/dist/main.js @@ -893,7 +893,7 @@ o.a.fn.filterAttr=function(e,t){return this.filter((function(){return o()(this). * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -o.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=o()('
').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,o()(document).on("keydown keyup",(function(t){if(t.target===e.$dialog.get(0)||0!==e.$dialog.find(o()(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(o()(t.target)).length){var n=e.$buttonrow.find("button.primary");n&&!n.prop("disabled")&&n.trigger("click")}else e.$buttonrow&&o()(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=o()('

'+t+"

");this.$title=i.prependTo(this.$dialog)}this._setSizes();break;case"buttons":if(this.$buttonrow)this.$buttonrow.empty();else{var r=o()('
');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"),o.a.each(t,(function(e,t){var i=o()("