Changeset 7148
- Timestamp:
- 11/05/2020 05:06:10 PM (4 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/topics/template.php
r7006 r7148 2852 2852 'link_after' => '', 2853 2853 'reply_text' => esc_html_x( 'Reply', 'verb', 'bbpress' ), 2854 'add_below' => 'post', 2855 'respond_id' => 'new-reply-' . bbp_get_topic_id(), 2854 2856 ), 'get_topic_reply_link' ); 2855 2857 … … 2862 2864 } 2863 2865 2864 // Add $uri to the array, to be passed through the filter 2865 $r['uri'] = '#new-post'; 2866 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link">' . $r['reply_text'] . '</a>' . $r['link_after']; 2866 // Only add onclick if replies are threaded 2867 $onclick = bbp_thread_replies() 2868 ? ' onclick="return addReply.cancelForm();"' 2869 : ''; 2870 2871 // Add $uri to the array, to be passed through the filter 2872 $r['uri'] = remove_query_arg( array( 'bbp_reply_to', '_wpnonce' ) ) . '#new-post'; 2873 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link"' . $onclick . '>' . $r['reply_text'] . '</a>' . $r['link_after']; 2867 2874 2868 2875 // Filter & return -
trunk/src/templates/default/js/reply.js
r7056 r7148 63 63 */ 64 64 cancel.onclick = function () { 65 var r = addReply, 66 temp = r.getElement( 'bbp-temp-form-div' ), 67 respond = r.getElement( r.respondId ); 68 69 r.removeEditor(); 70 71 if ( ! temp || ! respond ) { 72 return; 73 } 74 75 r.getElement( 'bbp_reply_to' ).value = '0'; 76 77 temp.parentNode.insertBefore( respond, temp ); 78 temp.parentNode.removeChild( temp ); 79 80 this.style.display = 'none'; 81 this.onclick = null; 82 83 r.addEditor(); 65 t.cancelForm( this ); 84 66 }; 85 67 86 68 t.scrollToForm(); 87 69 70 /* Prevent click from going through */ 71 return false; 72 }, 73 74 /** 75 * Cancel the reply form. 76 * 77 * @since 2.6.6 78 * @returns {void} 79 */ 80 cancelForm: function () { 81 var r = addReply, 82 temp = r.getElement( 'bbp-temp-form-div' ), 83 cancel = r.getElement( 'bbp-cancel-reply-to-link' ), 84 respond = r.getElement( r.respondId ); 85 86 r.removeEditor(); 87 88 /* Allow click to go through */ 89 if ( ! temp || ! respond ) { 90 return; 91 } 92 93 r.getElement( 'bbp_reply_to' ).value = '0'; 94 95 temp.parentNode.insertBefore( respond, temp ); 96 temp.parentNode.removeChild( temp ); 97 98 cancel.style.display = 'none'; 99 cancel.onclick = null; 100 101 r.addEditor(); 102 r.scrollToForm(); 103 104 /* Prevent click from going through */ 88 105 return false; 89 106 },
Note: See TracChangeset
for help on using the changeset viewer.