nextcloud/apps/comments/js/comments.js

2 lines
11 KiB
JavaScript

!function(n){var e={};function t(a){if(e[a])return e[a].exports;var l=e[a]={i:a,l:!1,exports:{}};return n[a].call(l.exports,l,l.exports,t),l.l=!0,l.exports}t.m=n,t.c=e,t.d=function(n,e,a){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:a})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var a=Object.create(null);if(t.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var l in n)t.d(a,l,function(e){return n[e]}.bind(null,l));return a},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="/js/",t(t.s=612)}({612:function(n,e,t){"use strict";t.r(e);t(613),t(614),t(615),t(616);window.OCA.Comments=OCA.Comments},613:function(n,e){OCA.Comments||(OCA.Comments={})},614:function(n,e){function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}var a,l;a=Handlebars.template,(l=OCA.Comments.Templates=OCA.Comments.Templates||{}).comment=a({1:function(n,e,t,a,l){return" unread"},3:function(n,e,t,a,l){return" collapsed"},5:function(n,e,t,a,l){return" currentUser"},7:function(n,e,t,a,l){var s;return'data-username="'+n.escapeExpression("function"==typeof(s=null!=(s=t.actorId||(null!=e?e.actorId:e))?s:t.helperMissing)?s.call(null!=e?e:n.nullContext||{},{"name":"actorId","hash":{},"data":l}):s)+'"'},9:function(n,e,t,a,l){return'\t\t\t<a href="#" class="action more icon icon-more has-tooltip"></a>\n\t\t\t<div class="deleteLoading icon-loading-small hidden"></div>\n'},11:function(n,e,t,a,l){return'\t\t<div class="message-overlay"></div>\n'},"compiler":[7,">= 4.0.0"],"main":function(n,e,a,l,s){var i,o,r=null!=e?e:n.nullContext||{},c=a.helperMissing,m="function",u=n.escapeExpression;return'<li class="comment'+(null!=(i=a.if.call(r,null!=e?e.isUnread:e,{"name":"if","hash":{},"fn":n.program(1,s,0),"inverse":n.noop,"data":s}))?i:"")+(null!=(i=a.if.call(r,null!=e?e.isLong:e,{"name":"if","hash":{},"fn":n.program(3,s,0),"inverse":n.noop,"data":s}))?i:"")+'" data-id="'+u(t(o=null!=(o=a.id||(null!=e?e.id:e))?o:c)===m?o.call(r,{"name":"id","hash":{},"data":s}):o)+'">\n\t<div class="authorRow">\n\t\t<div class="avatar'+(null!=(i=a.if.call(r,null!=e?e.isUserAuthor:e,{"name":"if","hash":{},"fn":n.program(5,s,0),"inverse":n.noop,"data":s}))?i:"")+'" '+(null!=(i=a.if.call(r,null!=e?e.actorId:e,{"name":"if","hash":{},"fn":n.program(7,s,0),"inverse":n.noop,"data":s}))?i:"")+'> </div>\n\t\t<div class="author'+(null!=(i=a.if.call(r,null!=e?e.isUserAuthor:e,{"name":"if","hash":{},"fn":n.program(5,s,0),"inverse":n.noop,"data":s}))?i:"")+'">'+u(t(o=null!=(o=a.actorDisplayName||(null!=e?e.actorDisplayName:e))?o:c)===m?o.call(r,{"name":"actorDisplayName","hash":{},"data":s}):o)+"</div>\n"+(null!=(i=a.if.call(r,null!=e?e.isUserAuthor:e,{"name":"if","hash":{},"fn":n.program(9,s,0),"inverse":n.noop,"data":s}))?i:"")+'\t\t<div class="date has-tooltip live-relative-timestamp" data-timestamp="'+u(t(o=null!=(o=a.timestamp||(null!=e?e.timestamp:e))?o:c)===m?o.call(r,{"name":"timestamp","hash":{},"data":s}):o)+'" title="'+u(t(o=null!=(o=a.altDate||(null!=e?e.altDate:e))?o:c)===m?o.call(r,{"name":"altDate","hash":{},"data":s}):o)+'">'+u(t(o=null!=(o=a.date||(null!=e?e.date:e))?o:c)===m?o.call(r,{"name":"date","hash":{},"data":s}):o)+'</div>\n\t</div>\n\t<div class="message">'+(null!=(i=t(o=null!=(o=a.formattedMessage||(null!=e?e.formattedMessage:e))?o:c)===m?o.call(r,{"name":"formattedMessage","hash":{},"data":s}):o)?i:"")+"</div>\n"+(null!=(i=a.if.call(r,null!=e?e.isLong:e,{"name":"if","hash":{},"fn":n.program(11,s,0),"inverse":n.noop,"data":s}))?i:"")+"</li>\n"},"useData":!0}),l.commentsmodifymenu=a({1:function(n,e,a,l,s){var i,o,r=null!=e?e:n.nullContext||{},c=a.helperMissing,m=n.escapeExpression;return'\t\t<li>\n\t\t\t<a href="#" class="menuitem action '+m("function"===t(o=null!=(o=a.name||(null!=e?e.name:e))?o:c)?o.call(r,{"name":"name","hash":{},"data":s}):o)+' permanent" data-action="'+m("function"===t(o=null!=(o=a.name||(null!=e?e.name:e))?o:c)?o.call(r,{"name":"name","hash":{},"data":s}):o)+'">\n'+(null!=(i=a.if.call(r,null!=e?e.iconClass:e,{"name":"if","hash":{},"fn":n.program(2,s,0),"inverse":n.program(4,s,0),"data":s}))?i:"")+"\t\t\t\t<span>"+m("function"===t(o=null!=(o=a.displayName||(null!=e?e.displayName:e))?o:c)?o.call(r,{"name":"displayName","hash":{},"data":s}):o)+"</span>\n\t\t\t</a>\n\t\t</li>\n"},2:function(n,e,t,a,l){var s;return'\t\t\t\t\t<span class="icon '+n.escapeExpression("function"==typeof(s=null!=(s=t.iconClass||(null!=e?e.iconClass:e))?s:t.helperMissing)?s.call(null!=e?e:n.nullContext||{},{"name":"iconClass","hash":{},"data":l}):s)+'"></span>\n'},4:function(n,e,t,a,l){return'\t\t\t\t\t<span class="no-icon"></span>\n'},"compiler":[7,">= 4.0.0"],"main":function(n,e,t,a,l){var s;return"<ul>\n"+(null!=(s=t.each.call(null!=e?e:n.nullContext||{},null!=e?e.items:e,{"name":"each","hash":{},"fn":n.program(1,l,0),"inverse":n.noop,"data":l}))?s:"")+"</ul>\n"},"useData":!0}),l.edit_comment=a({1:function(n,e,t,a,l){var s;return'\t\t\t<div class="action-container">\n\t\t\t\t<a href="#" class="action cancel icon icon-close has-tooltip" title="'+n.escapeExpression("function"==typeof(s=null!=(s=t.cancelText||(null!=e?e.cancelText:e))?s:t.helperMissing)?s.call(null!=e?e:n.nullContext||{},{"name":"cancelText","hash":{},"data":l}):s)+'"></a>\n\t\t\t</div>\n'},"compiler":[7,">= 4.0.0"],"main":function(n,e,a,l,s){var i,o,r=null!=e?e:n.nullContext||{},c=a.helperMissing,m="function",u=n.escapeExpression;return"<"+u(t(o=null!=(o=a.tag||(null!=e?e.tag:e))?o:c)===m?o.call(r,{"name":"tag","hash":{},"data":s}):o)+' class="newCommentRow comment" data-id="'+u(t(o=null!=(o=a.id||(null!=e?e.id:e))?o:c)===m?o.call(r,{"name":"id","hash":{},"data":s}):o)+'">\n\t<div class="authorRow">\n\t\t<div class="avatar currentUser" data-username="'+u(t(o=null!=(o=a.actorId||(null!=e?e.actorId:e))?o:c)===m?o.call(r,{"name":"actorId","hash":{},"data":s}):o)+'"></div>\n\t\t<div class="author currentUser">'+u(t(o=null!=(o=a.actorDisplayName||(null!=e?e.actorDisplayName:e))?o:c)===m?o.call(r,{"name":"actorDisplayName","hash":{},"data":s}):o)+"</div>\n"+(null!=(i=a.if.call(r,null!=e?e.isEditMode:e,{"name":"if","hash":{},"fn":n.program(1,s,0),"inverse":n.noop,"data":s}))?i:"")+'\t</div>\n\t<form class="newCommentForm">\n\t\t<div contentEditable="true" class="message" data-placeholder="'+u(t(o=null!=(o=a.newMessagePlaceholder||(null!=e?e.newMessagePlaceholder:e))?o:c)===m?o.call(r,{"name":"newMessagePlaceholder","hash":{},"data":s}):o)+'">'+u(t(o=null!=(o=a.message||(null!=e?e.message:e))?o:c)===m?o.call(r,{"name":"message","hash":{},"data":s}):o)+'</div>\n\t\t<input class="submit icon-confirm has-tooltip" type="submit" value="" title="'+u(t(o=null!=(o=a.submitText||(null!=e?e.submitText:e))?o:c)===m?o.call(r,{"name":"submitText","hash":{},"data":s}):o)+'"/>\n\t\t<div class="submitLoading icon-loading-small hidden"></div>\n\t</form>\n</'+u(t(o=null!=(o=a.tag||(null!=e?e.tag:e))?o:c)===m?o.call(r,{"name":"tag","hash":{},"data":s}):o)+">\n"},"useData":!0}),l.filesplugin=a({"compiler":[7,">= 4.0.0"],"main":function(n,e,a,l,s){var i,o=null!=e?e:n.nullContext||{},r=a.helperMissing,c=n.escapeExpression;return'<a class="action action-comment permanent" title="'+c("function"===t(i=null!=(i=a.countMessage||(null!=e?e.countMessage:e))?i:r)?i.call(o,{"name":"countMessage","hash":{},"data":s}):i)+'" href="#">\n\t<img class="svg" src="'+c("function"===t(i=null!=(i=a.iconUrl||(null!=e?e.iconUrl:e))?i:r)?i.call(o,{"name":"iconUrl","hash":{},"data":s}):i)+'"/>\n</a>\n'},"useData":!0}),l.view=a({"compiler":[7,">= 4.0.0"],"main":function(n,e,a,l,s){var i,o=null!=e?e:n.nullContext||{},r=a.helperMissing,c=n.escapeExpression;return'<ul class="comments">\n</ul>\n<div class="emptycontent hidden"><div class="icon-comment"></div>\n\t<p>'+c("function"===t(i=null!=(i=a.emptyResultLabel||(null!=e?e.emptyResultLabel:e))?i:r)?i.call(o,{"name":"emptyResultLabel","hash":{},"data":s}):i)+'</p></div>\n<input type="button" class="showMore hidden" value="'+c("function"===t(i=null!=(i=a.moreLabel||(null!=e?e.moreLabel:e))?i:r)?i.call(o,{"name":"moreLabel","hash":{},"data":s}):i)+'" name="show-more" id="show-more" />\n<div class="loading hidden" style="height: 50px"></div>\n'},"useData":!0})},615:function(e,a){_.extend(OC.Files.Client,{PROPERTY_COMMENTS_UNREAD:"{"+OC.Files.Client.NS_OWNCLOUD+"}comments-unread"}),OCA.Comments=_.extend({},OCA.Comments),OCA.Comments||(OCA.Comments={}),OCA.Comments.FilesPlugin={ignoreLists:["trashbin","files.public"],_formatCommentCount:function(e){return OCA.Comments.Templates.filesplugin({count:e,countMessage:n("comments","%n unread comment","%n unread comments",e),iconUrl:OC.imagePath("core","actions/comment")})},attach:function(e){var a=this;if(!(this.ignoreLists.indexOf(e.id)>=0)){var l=e._getWebdavProperties;e._getWebdavProperties=function(){var n=l.apply(this,arguments);return n.push(OC.Files.Client.PROPERTY_COMMENTS_UNREAD),n},e.filesClient.addFileInfoParser((function(n){var e={},t=n.propStat[0].properties[OC.Files.Client.PROPERTY_COMMENTS_UNREAD];return _.isUndefined(t)||""===t||(e.commentsUnread=parseInt(t,10)),e})),e.$el.addClass("has-comments");var s=e._createRow;e._createRow=function(n){var e=s.apply(this,arguments);return n.commentsUnread&&e.attr("data-comments-unread",n.commentsUnread),e},e.fileActions.registerAction({name:"Comment",displayName:function(e){if(e&&e.$file){var a=parseInt(e.$file.data("comments-unread"),10);if(a>=0)return n("comments","1 new comment","{unread} new comments",a,{unread:a})}return t("comments","Comment")},mime:"all",order:-140,iconClass:"icon-comment",permissions:OC.PERMISSION_READ,type:OCA.Files.FileActions.TYPE_INLINE,render:function(n,e,t){var l=t.$file.data("comments-unread");if(l){var s=$(a._formatCommentCount(l));return t.$file.find("a.name>span.fileactions").append(s),s}return""},actionHandler:function(n,e){e.$file.find(".action-comment").tooltip("hide"),OCA.Files.Sidebar.setActiveTab("comments"),OCA.Files.Sidebar.open("/"+n)}});var i=e.elementToFile;e.elementToFile=function(n){var e=i.apply(this,arguments),t=n.data("comments-unread");return t&&(e.commentsUnread=t),e}}}},OC.Plugins.register("OCA.Files.FileList",OCA.Comments.FilesPlugin)},616:function(n,e){OCA.Comments.ActivityTabViewPlugin={prepareModelForDisplay:function(n,e,t){if("comments"===n.get("app")&&"comments"===n.get("type")&&"ActivityTabView"===t&&(e.addClass("comment"),n.get("message")&&this._isLong(n.get("message")))){e.addClass("collapsed");var a=$("<div>").addClass("message-overlay");e.find(".activitymessage").after(a),e.on("click",this._onClickCollapsedComment)}},_onClickCollapsedComment:function(n){var e=$(n.target);e.is(".comment")||(e=e.closest(".comment")),e.removeClass("collapsed")},_isLong:function(n){return n.length>250||(n.match(/\n/g)||[]).length>1}},OC.Plugins.register("OCA.Activity.RenderingPlugins",OCA.Comments.ActivityTabViewPlugin)}});
//# sourceMappingURL=comments.js.map