diff options
Diffstat (limited to 'plugins/jetpack/modules/comments/comments.php')
-rw-r--r-- | plugins/jetpack/modules/comments/comments.php | 61 |
1 files changed, 34 insertions, 27 deletions
diff --git a/plugins/jetpack/modules/comments/comments.php b/plugins/jetpack/modules/comments/comments.php index 965769d6..d33ad240 100644 --- a/plugins/jetpack/modules/comments/comments.php +++ b/plugins/jetpack/modules/comments/comments.php @@ -224,7 +224,8 @@ class Jetpack_Comments extends Highlander_Comments_Base { ?> <script type="text/javascript"> - var comm_par = document.getElementById( 'comment_parent' ).value, + var comm_par_el = document.getElementById( 'comment_parent' ), + comm_par = (comm_par_el && comm_par_el.value) ? comm_par_el.value : '', frame = document.getElementById( 'jetpack_remote_comment' ), tellFrameNewParent; @@ -236,42 +237,48 @@ class Jetpack_Comments extends Highlander_Comments_Base { } }; - addComment._Jetpack_moveForm = addComment.moveForm; + <?php if ( get_option( 'thread_comments' ) && get_option( 'thread_comments_depth' ) ) : ?> - addComment.moveForm = function( commId, parentId, respondId, postId ) { - var returnValue = addComment._Jetpack_moveForm( commId, parentId, respondId, postId ), cancelClick, cancel; + if ( 'undefined' !== typeof addComment ) { + addComment._Jetpack_moveForm = addComment.moveForm; - if ( false === returnValue ) { - cancel = document.getElementById( 'cancel-comment-reply-link' ); - cancelClick = cancel.onclick; - cancel.onclick = function() { - var cancelReturn = cancelClick.call( this ); - if ( false !== cancelReturn ) { - return cancelReturn; - } + addComment.moveForm = function( commId, parentId, respondId, postId ) { + var returnValue = addComment._Jetpack_moveForm( commId, parentId, respondId, postId ), cancelClick, cancel; - if ( !comm_par ) { - return cancelReturn; - } + if ( false === returnValue ) { + cancel = document.getElementById( 'cancel-comment-reply-link' ); + cancelClick = cancel.onclick; + cancel.onclick = function() { + var cancelReturn = cancelClick.call( this ); + if ( false !== cancelReturn ) { + return cancelReturn; + } - comm_par = 0; + if ( !comm_par ) { + return cancelReturn; + } - tellFrameNewParent(); + comm_par = 0; - return cancelReturn; - }; - } + tellFrameNewParent(); - if ( comm_par == parentId ) { - return returnValue; - } + return cancelReturn; + }; + } - comm_par = parentId; + if ( comm_par == parentId ) { + return returnValue; + } - tellFrameNewParent(); + comm_par = parentId; - return returnValue; - }; + tellFrameNewParent(); + + return returnValue; + }; + } + + <?php endif; ?> if ( window.postMessage ) { if ( document.addEventListener ) { |