{"version":3,"file":"commenting.min.js","sources":["commenting.js"],"sourcesContent":[";(function( $ ) {\n $( document ).ready( function() {\n /*\n jQuery Replacement for the normal WP comment reply JS.\n As I'm using jQuery anyway may as well include an easier to read/maintin\n comment reply code. Also alows me to animate things should I want to.\n */\n\n window.addComment = {\n\n interval: 0,\n /**\n * The ID of the comment we're replying to.\n * @type {Number}\n */\n replying: 0,\n action_id: 0,\n showOne: commentingL10n.rpl_show_1.replace( '%name%', '' ).replace( '%count%', ' ' ),\n hideOne: commentingL10n.rpl_hide_1.replace( '%name%', '' ).replace( '%count%', ' ' ),\n showMany: commentingL10n.rpl_show_2.replace( '%name%', '' ).replace( '%count%', ' ' ),\n hideMany: commentingL10n.rpl_hide_2.replace( '%name%', '' ).replace( '%count%', ' ' ),\n scrollOff: parseInt( commentingL10n.scroll_off, 10 ),\n\n /**\n * We won't move the form to under the comment, it's messy and I don't like\n * it. Instead we'll take some content from the comment we're replying to\n * and show that next to the form. This is called moveForm to match WP's\n * function.\n */\n moveForm: function( belowID, commentID, formID, postID ) {\n var str = $( '#' + belowID + ' > .comment-body .comment-meta' ).next().text(),\n to = $( '#' + belowID + ' > .comment-body cite.fn' ).text();\n\n if ( addComment.replying )\n addComment.cancelReply();\n\n addComment.replying = commentID;\n\n $( '#comment-form #comment' ).before( $( '
' + to + '' ).hide() ).prev( '.reply-quote' ).slideDown();\n $( '#comment-form input#comment_parent' ).attr( { value: commentID } );\n $( '#' + belowID + ' > .comment-body ' ).find( '.comment-reply-link' ).hide();\n $( '#comment-form #cancel-comment-reply-link' ).show();\n\n if ( typeof $.scrollTo == 'function' ) {\n $.scrollTo( '#respond', {\n offset: addComment.scrollOff, duration: 500, axis: 'y', onAfter: function( e ) {\n $( '#comment' ).focus();\n }\n } );\n }\n\n return false;\n },\n\n /**\n * [cancelReply description]\n * @param {[type]} [description]\n * @return {[type]} [description]\n */\n cancelReply: function() {\n if ( addComment.replying !== 0 ) {\n addComment.replying = 0;\n $( '#comment-form .reply-quote' ).slideUp( 500, function() {\n $( this ).remove();\n } );\n $( '#comment-form input#comment_parent' ).attr( { value: 0 } );\n $( '#comment-form #cancel-comment-reply-link' ).hide();\n $( '#commentlist' ).find( '.comment-reply-link' ).show();\n }\n // Make sure the submit button is still around.\n $( '#comment-form .submit' ).removeAttr( 'disabled' ).removeClass( 'disabled' );\n addComment.startInterval( true );\n },\n\n /**\n * Take the depth class assigned to the comment and turn into an int.\n * @param {[type]} id [description]\n * @return {[type]} [description]\n */\n commentDepth: function( id ) {\n var c;\n if ( id ) {\n c = $( 'li#comment-' + id ).attr( 'class' ).match( /\\bdepth-(\\d+)\\b/i );\n return [1] !== undefined && parseInt( c[ 1 ], 10 ) > 0 ? parseInt( c[ 1 ], 10 ) : 1;\n }\n else {\n // No id passed then we have no comment so 0 is good.\n return 0;\n }\n },\n\n /**\n * [error description]\n * @param {[type]} msg [description]\n * @return {[type]} [description]\n */\n error: function( msg ) {\n if ( typeof msg !== 'string' )\n return false;\n\n $( '#comment-form .textarea-border' ).after( $( '' + (str.length > 130 ? str.substring( 0, 129 ) + '…' : str) + '