/*! jquery-comments.js 1.4.0 * * (c) 2017 Joona Tykkyläinen, Viima Solutions Oy * jquery-comments may be freely distributed under the MIT license. * For all details and documentation: * http://viima.github.io/jquery-comments/ */!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=function(t,n){return void 0===n&&(n="undefined"!=typeof window?require("jquery"):require("jquery")(t)),e(n),n}:e(jQuery)}((function(e){var t={$el:null,commentsById:{},dataFetched:!1,currentSortKey:"",options:{},preferences:{},events:{click:"closeDropdowns",paste:"preSavePastedAttachments","keydown [contenteditable]":"saveOnKeydown","focus [contenteditable]":"saveEditableContent","keyup [contenteditable]":"checkEditableContentForChange","paste [contenteditable]":"checkEditableContentForChange","input [contenteditable]":"checkEditableContentForChange","blur [contenteditable]":"checkEditableContentForChange","paste [contenteditable]":"transformPastedText","keyup [contenteditable]":"flagShiftEnter","click .navigation li.count":"countElementClicked","click .navigation li[data-sort-key]":"navigationElementClicked","click .navigation li[data-comment-count]":"youNavigationElementClicked","click .navigation li.dynamic-setting":"dynamicSettingsClicked","click .navigation li.title":"toggleNavigationDropdown","click .commenting-field.main .textarea":"showMainCommentingField","click .commenting-field.main .close":"hideMainCommentingField","click .commenting-field .textarea":"increaseTextareaHeight","change .commenting-field .textarea":"increaseTextareaHeight textareaContentChanged","click .commenting-field:not(.main) .close":"removeCommentingField","focus .commenting-field:not(.main) .textarea":"isolateCommentingFieldOnFocus","focusout .commenting-field:not(.main) .textarea":"restoreCommentingFieldOnBlur","mousedown .commenting-field:not(.main) .close":"mouseDownCommentingButton","mousedown .commenting-field:not(.main) .save":"mouseDownCommentingButton","click .commenting-field .send.enabled":"postComment","click .commenting-field .update.enabled":"putComment","click .commenting-field .attachments .attachment .delete":"preDeleteAttachment",'change .commenting-field .upload.enabled input[type="file"]':"fileInputChanged","click li.comment .profile-picture":"commentPictureOrNameClicked","click li.comment .name":"commentPictureOrNameClicked","click li.comment button.upvote":"voteOnComment","click li.comment button.downvote":"voteOnComment","click li.comment .hashtag":"hashtagClicked","click li.comment .ping":"pingClicked","click li.comment .truncated + span":"toggleTruncated","click li.comment ul.child-comments .toggle-all":"toggleReplies","click li.comment button.reply":"replyButtonClicked","click li.comment button.edit":"editButtonClicked","click li.comment button.pin":"pinOrUnpinButtonClicked","click li.comment button.unpin":"pinOrUnpinButtonClicked","click li.comment button.delete":"deleteButtonClicked","click li.comment button.mute":"muteButtonClicked","click li.comment button.flag":"flagButtonClicked","click li.comment button.block":"blockButtonClicked","dragstart li.comment:not(.edit) .comment-wrapper":"handleDragStartContent","drop .commenting-field:not(.main) .textarea":"flagDropCommentingField",dragenter:"showDroppableOverlay","dragenter .droppable-overlay":"handleDragEnter","dragleave .droppable-overlay":"handleDragLeaveForOverlay","dragenter .droppable-overlay .droppable":"handleDragEnter","dragleave .droppable-overlay .droppable":"handleDragLeaveForDroppable","dragover .droppable-overlay":"handleDragOverForOverlay","drop .droppable-overlay":"handleDrop","click .dropdown.autocomplete":"stopPropagation","mousedown .dropdown.autocomplete":"stopPropagation","touchstart .dropdown.autocomplete":"stopPropagation"},anonymousEventMethodOverrides:["showMainCommentingField","replyButtonClicked","voteOnComment","muteButtonClicked","flagButtonClicked"],anonymousEventHandler:function(){e(".video-actions a[data-original-title='Favorites']").click()},transformPastedText:function(e){e.preventDefault(),document.execCommand("insertText",!1,e.originalEvent.clipboardData.getData("text/plain").replace(/\r/g,""))},getDefaultOptions:function(){return{ownerId:null,ownerName:null,profilePictureURL:"",currentUserIsAdmin:!1,currentUserIsSupporter:!1,currentUserId:null,spinnerIconURL:"",upvoteIconURL:"",replyIconURL:"",uploadIconURL:"",attachmentIconURL:"",noCommentsIconURL:"",closeIconURL:"",textareaPlaceholderText:"Add a comment",newestText:"Newest",oldestText:"Oldest",popularText:"Popular",attachmentsText:"Attachments",sendText:"Send",replyText:"Reply",editText:"Edit",editedText:"Edited",flagText:"Flag",flaggedText:"Flagged",blockText:"Block",blockedText:"Blocked",unblockText:"Unblock",youText:"You",saveText:"Save",deleteText:"Delete",newText:"New",muteText:"Mute",mutedText:"Muted",pinText:"Pin",unmuteText:"Unmute",unpinText:"Unpin",areYouSureYouWantToText:"Are you sure you want to ",viewAllRepliesText:"View all __replyCount__ replies",hideRepliesText:"Hide replies",noCommentsText:"No comments",noAttachmentsText:"No attachments",attachmentDropText:"Drop files here",showMoreText:"[show more]",showLessText:"[show less]",removedByUserText:"[comment removed by user]",removedByAdminText:"[comment removed by admin]",blockedFromCommentingText:"You are blocked from commenting on this channel.",closeCommentingFieldText:"close commenting field?",textFormatter:function(e){return e},enableReplying:!0,enableEditing:!0,enableVoting:!0,enableDeleting:!0,enableAttachments:!1,enableHashtags:!1,enablePinging:!1,enableDeletingCommentWithReplies:!1,enableNavigation:!0,postCommentOnEnter:!1,forceResponsive:!1,readOnly:!1,defaultNavigationSortKey:"newest",highlightColor:"#2793e6",scrollContainer:this.$el,roundProfilePictures:!1,textareaRows:2,textareaRowsOnFocus:2,textareaMaxRows:5,textTruncateLength:330,textTruncateLines:3,maxRepliesVisible:2,fieldMappings:{id:"id",parent:"parent",created:"created",modified:"modified",content:"content",isContentEncoded:"is_content_encoded",attachments:"attachments",pings:"pings",creator:"creator",fullname:"fullname",profilePictureURL:"profile_picture_url",isNew:"is_new",createdByAdmin:"created_by_admin",createdByCurrentUser:"created_by_current_user",upVoteCount:"up_vote_count",downVoteCount:"down_vote_count",userVote:"user_vote",isUniversalPin:"is_universal"},searchUsers:function(e,t,n){t([])},getComments:function(e,t){e([])},postComment:function(e,t,n){t(e)},putComment:function(e,t,n){t(e)},deleteComment:function(e,t,n){t()},flagComment:function(){},blockUser:function(){},voteOnComment:function(e,t,n){t(e)},validateAttachments:function(e,t){return t(e)},hashtagClicked:function(e){},pingClicked:function(e){},refresh:function(){},refreshAction:function(){},timeFormatter:function(e){return new Date(e).toLocaleDateString()}}},init:function(t,n){var i=this;this.$el=e(n),this.$el.addClass("jquery-comments"+(t.currentUserIsBlocked?" blocked":"")),this.options=e.extend(!0,{},this.getDefaultOptions(),t);var o=e(".owner a");o.length&&(this.options.ownerId=(o.attr("href").match(/\/([^\/]+)\/?$/)||"")[1],this.options.ownerName=o.text()),this.preferences=e.extend(this.preferences,{dynamic:"true"==Cookies.get("dynamicUpdates")},Cookies.getJSON("cf_preferences"),JSON.parse(localStorage.getItem("cf_preferences")));var a,r="function"==typeof cleanupMainEventHandlersAndTimers;if(cleanupMainEventHandlersAndTimers=function(){commentRefreshTimeoutId=getCommentsTime=clearTimeout(window.commentRefreshTimeoutId),i.undelegateEvents(),i.preferences.dynamic&&i.cleanupDynamic()},!r&&/\?comments?=(.+)/.test(window.location.search)){var s=function(){this.pause(),e(this).off("play",s)};e("#player").on("play",s)}this.delegateEvents(),a=navigator.userAgent||navigator.vendor||window.opera,(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)),e.browser.mobile&&this.$el.addClass("mobile"),e.browser.firefox=null!=(navigator.userAgent||"").match(/ Firefox\//),this.options.readOnly&&this.$el.addClass("read-only"),this.currentSortKey=this.preferences.sortKey||this.options.defaultNavigationSortKey,this.createCssDeclarations(),this.preferences.semiAutoPIP&&!r&&this.semiAutoPIP(),this.fetchDataAndRender(r)},delegateEvents:function(){this.bindEvents(!1)},undelegateEvents:function(){this.bindEvents(!0)},bindEvents:function(t){var n=t?"off":"on";for(var i in this.events){var o=i.split(" ")[0],a=i.split(" ").slice(1).join(" "),r=this.events[i].split(" ");for(var s in r)if(r.hasOwnProperty(s)){var l=r[s],c="anonymous"==this.options.currentUserId&&this.anonymousEventMethodOverrides.includes(l)?this.anonymousEventHandler:e.proxy(this[l],this);""==a?this.$el[n](o,c):this.$el[n](o,a,c)}}},semiAutoPIP:function(){if(videoPlayer=e("#player")[0],videoPlayer){history.scrollRestoration&&(history.scrollRestoration="manual");var t=e('.plyr__control[data-plyr="pip"]');t.focus(),t.on("keypress",(function(t){e(this).off("keypress"),this.blur(),32==t.which&&videoPlayer.currentTime>0&&!videoPlayer.paused&&videoPlayer.pause()}))}},fetchDataAndRender:function(t){var n=this;this.commentsById={},this.$el.empty();var i=this.createMainCommentingFieldElement();this.createHTML(i),this.preferences.semiAutoPIP&&this.scrollToSortationButtons(!0),this.options.getComments((function(o){var a="";if(n.options.currentUserIsAdmin){var r=e("
");i.find(".control-row").prepend(r),e("[data-toggle='tooltip']",r).tooltip({container:document.body})}var s=e("",{html:".commenting-field");a.length&&a.remove(),a.find(".textarea").attr("data-parent")!=o&&(a=this.createCommentingFieldElement(o),i.find(".child-comments").append(a),this.preferences.dynamic&&this.preferences.fullyDynamic&&this.isolateCommentingField(a),this.moveCursorToEndTextarea(a),this.ensureElementStaysVisible(a))},editButtonClicked:function(t){var n=e(t.currentTarget).parents("li.comment").first(),i=n.data().model;n.addClass("edit");var o=this.createCommentingFieldElement(i.parent,i);n.find(".comment-wrapper").first().append(o),this.preferences.dynamic&&this.preferences.fullyDynamic&&this.isolateCommentingField(o),this.moveCursorToEndTextarea(o),this.ensureElementStaysVisible(o)},mouseDownCommentingButton:function(t){e(t.currentTarget).parents(".commenting-field")[0].isActionButtonDown=!0},isolateCommentingFieldOnFocus:function(t){var n=this;if(this.preferences.dynamic&&this.preferences.fullyDynamic){this.dynamicScrollHandler&&this.dynamicScrollHandler();var i=e(t.currentTarget).parents(".commenting-field");!i[0].$placeholder&&i.parents("ul.main")[0].id&&(this.isDropCommentingField?(setTimeout((function(){n.isolateCommentingField(i),n.moveCursorToEndTextarea(i)}),100),this.isDropCommentingField=!1):(this.isolateCommentingField(i),this.moveCursorToEndTextarea(i)))}},isolateCommentingField:function(t){const n="child-comments";var i=e("#comments-container"),o=t.parent(),a=!o.hasClass(n),r=t.find(".textarea").attr("data-parent"),s=e("ul.main:not(#comment-list) .child-comments");s.length||e("
"+a+" | "+c+"
---|
"+s.replace(/\n(?:[ \t]*\n){2,}/g,"\n\n").replace(/\n/g,"
")+"