Making WordPress.org

Changeset 11571


Ignore:
Timestamp:
02/17/2022 08:05:05 AM (5 years ago)
Author:
dd32
Message:

Support: Attempt to fix the ajaxification of topic admin actions on views.

See #1965.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r11529 r11571  
    4141
    4242        wp_enqueue_script( 'wporg-support-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20181209', true );
    43         wp_enqueue_script( 'wporg-support-forums', get_template_directory_uri() . '/js/forums.js', array( 'jquery' ), '20210407', true );
     43        wp_enqueue_script( 'wporg-support-forums', get_template_directory_uri() . '/js/forums.js', array( 'jquery' ), '20220217', true );
    4444
    4545        wp_localize_script(
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/js/forums.js

    r10876 r11571  
    5555       
    5656                $this.val(
    57                         val.substr( 0, $this.prop('selectionStart') ) +      // Text before cusor/selection
     57                        val.substr( 0, $this.prop('selectionStart') ) +      // Text before cursor/selection
    5858                        "`" + paste + "`" +                                  // The pasted text, wrapping with `
    5959                        val.substr( $this.prop('selectionEnd'), val.length ) // Text after cursor position/selection
    … …  
    6464
    6565        if ( $( 'body' ).is( '.bbp-view' ) ) {
    66                 $( '.bbp-body .bbp-admin-links a' ).click( function( e ) {
     66                $( '.bbp-admin-links a' ).click( function( e ) {
    6767                        var $this = $( this ),
    68                                 $element = $this.closest( '.bbp-body' ),
    69                                 $content = $element.find( '.bbp-topic-content' ),
     68                                $element = $this.parents('.reply,.topic'),
    7069                                type;
    7170
    7271                        // Don't affect open-in-new-tab.
    73                         if ( e.metaKey || e.ctrlKey || e.which === 2 ) {
     72                        if ( e.metaKey || e.ctrlKey || e.shiftKey ) {
    7473                                return;
    7574                        }
    … …  
    9089
    9190                        $.get( $this.prop( 'href' ) ).done( function() {
    92                                 $content.append(
     91                                $this.parent().before(
    9392                                        '<div class="bbp-template-notice">' + wporgSupport.strings[ type ] + '</div>'
    9493                                );
    9594
    96                                 // Remove actions.
    97                                 $this.parent().find('a:not(.bbp-topic-edit-link)').remove();
    98 
    9995                                $element.fadeTo( 250, 1 );
    100                         } ).error( function() {
    101                                 $content.append(
     96                        } ).fail( function() {
     97                                $this.parent().before(
    10298                                        '<div class="bbp-template-notice">' + wporgSupport.strings.action_failed + '</div>'
    10399                                );
Note: See TracChangeset for help on using the changeset viewer.