WordPress.org

Making WordPress.org

Changeset 9610


Ignore:
Timestamp:
03/20/2020 03:15:13 AM (6 months ago)
Author:
dd32
Message:

Support: Code block expand/contract: Add translation support for the buttons.

See #4835.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-code-blocks-expand-contract
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-code-blocks-expand-contract/wporg-bbp-code-blocks-expand-contract.css

    r9607 r9610  
    44}
    55
    6 #bbpress-forums div.bbp-reply-content a.wporg-bbp-code-expand,
    7 #bbpress-forums div.bbp-topic-content a.wporg-bbp-code-expand {
     6#bbpress-forums div.bbp-reply-content .wporg-bbp-code-tools a.wporg-bbp-code-expand,
     7#bbpress-forums div.bbp-topic-content .wporg-bbp-code-tools a.wporg-bbp-code-expand {
    88    background: #f0f0f0;
    99    display: inline-block;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-code-blocks-expand-contract/wporg-bbp-code-blocks-expand-contract.js

    r9607 r9610  
    44
    55        if ( typeof this.scrollHeight !== 'undefined' && $el.height() < this.scrollHeight ) {
    6             var btn = $( '<div class="wporg-bbp-code-tools"><a class="wporg-bbp-code-expand" href="#">Expand</a></div>' );
     6            var btn = $( '<div class="wporg-bbp-code-tools"><a class="wporg-bbp-code-expand" href="#"></a></div>' );
     7
     8            btn.find( 'a' ).text( bbpCodeBlocksExpandContract.expand );
    79
    810            btn.insertAfter( $el.closest( 'pre' ) )
     
    3032            code.css( 'max-height', maxHeightGoal );
    3133            code.animate( { height: heightGoal });
    32             $( this ).text( 'Contract' );
     34            $( this ).text( bbpCodeBlocksExpandContract.contract );
    3335        } else {
    3436            $( [document.documentElement, document.body] ).animate({
     
    4345            );
    4446
    45             $( this ).text( 'Expand' );
     47            $( this ).text( bbpCodeBlocksExpandContract.expand );
    4648        }
    4749
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-code-blocks-expand-contract/wporg-bbp-code-blocks-expand-contract.php

    r9608 r9610  
    11<?php
     2namespace WordPressdotorg\BBP_Code_Blocks_Expand_Contract;
    23/**
    3  * Plugin Name: bbPress: Code blocks formatter
    4  * Description: Convert wiki markup links into HTML WordPress Codex links.
     4 * Plugin Name: bbPress: Code blocks Expand/Contract
     5 * Description: Adds an Expander to code blocks which are higher than the default code block size.
    56 * Version:     1.0
    67 * Author:      WordPress.org
     
    2425 */
    2526
    26 if ( ! defined( 'ABSPATH' ) ) exit;
    27 
    28 if ( ! class_exists( 'WPORG_bbPress_Code_Blocks' ) ) {
    29 class WPORG_bbPress_Code_Blocks {
    30     public function __construct() {
    31         wp_enqueue_script( 'wporg-bbp-code-blocks-expand-contract', plugins_url( 'wporg-bbp-code-blocks-expand-contract.js', __FILE__ ), [ 'jquery' ], 1, true );
    32         wp_enqueue_style( 'wporg-bbp-code-blocks-expand-contract', plugins_url( 'wporg-bbp-code-blocks-expand-contract.css', __FILE__ ), [], 1 );
    33     }
    34 } }
    35 
    36 new WPORG_bbPress_Code_Blocks;
     27function wp_head() {
     28    wp_enqueue_script( 'wporg-bbp-code-blocks-expand-contract', plugins_url( 'wporg-bbp-code-blocks-expand-contract.js', __FILE__ ), [ 'jquery' ], 1, true );
     29    wp_localize_script( 'wporg-bbp-code-blocks-expand-contract', 'bbpCodeBlocksExpandContract', [
     30        'expand'   => __( 'Expand', 'wporg' ),
     31        'contract' => __( 'Contract', 'wporg' ),
     32    ] );
     33    wp_enqueue_style( 'wporg-bbp-code-blocks-expand-contract', plugins_url( 'wporg-bbp-code-blocks-expand-contract.css', __FILE__ ), [], 1 );
     34}
     35add_action( 'wp_head', __NAMESPACE__ . '\wp_head' );
Note: See TracChangeset for help on using the changeset viewer.