Plugin Directory

Changeset 3807983


Ignore:
Timestamp:
11/17/2026 06:18:16 PM (109 minutes ago)
Author:
mbenneke
Message:

Release 0.7.2: scripts and styles inline (cache-proof updates), sidebar scroll fix, Arrange sidebar link

Location:
sortivo-tabs-organizer
Files:
2 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sortivo-tabs-organizer/tags/0.7.2/assets/admin.css

    r3801054 r3807983  
    114114}
    115115
     116/* A link-style button; themes that style all buttons don't get to turn it into a box. */
     117.ptabs-bar .ptabs-arrange-open {
     118        -webkit-appearance: none;
     119        appearance: none;
     120        min-height: 0;
     121        margin: 0;
     122        padding: 0;
     123        border: 0;
     124        border-radius: 0;
     125        background: none;
     126        box-shadow: none;
     127        color: #2271b1;
     128        font: inherit;
     129        font-size: 12px;
     130        line-height: inherit;
     131        text-decoration: underline;
     132        cursor: pointer;
     133}
     134
     135.ptabs-bar .ptabs-arrange-open:hover,
     136.ptabs-bar .ptabs-arrange-open:focus {
     137        color: #135e96;
     138}
     139
    116140.ptabs-move-wrap {
    117141        white-space: nowrap;
  • sortivo-tabs-organizer/tags/0.7.2/assets/menu.js

    r3803786 r3807983  
    1212        function loadCollapsed() {
    1313                try {
    14                         return JSON.parse( window.localStorage.getItem( KEY ) || '[]' );
     14                        var list = JSON.parse( window.localStorage.getItem( KEY ) || '[]' );
     15                        return Array.isArray( list ) ? list : [];
    1516                } catch ( e ) {
    1617                        return [];
     18                }
     19        }
     20
     21        // The sidebar changed height: let WordPress measure it again. Otherwise a sidebar that was
     22        // pinned while short stays pinned when it grows, and its bottom can't be scrolled into view.
     23        function menuResized() {
     24                if ( window.jQuery ) {
     25                        window.jQuery( document ).trigger( 'wp-pin-menu' );
     26                } else {
     27                        window.dispatchEvent( new Event( 'resize' ) );
    1728                }
    1829        }
    … …  
    117128                        var isCollapsed = ! header.classList.contains( 'is-collapsed' );
    118129                        apply( isCollapsed );
     130                        menuResized();
    119131                        collapsed = collapsed.filter( function ( id ) {
    120132                                return id !== group.id;
    … …  
    154166                toggle.appendChild( toggleLabel );
    155167                toggleItem.appendChild( toggle );
    156                 menu.insertBefore( toggleItem, document.getElementById( 'collapse-menu' ) );
     168                var collapseItem = document.getElementById( 'collapse-menu' );
     169                menu.insertBefore( toggleItem, collapseItem && collapseItem.parentNode === menu ? collapseItem : null );
     170
     171                // The "Arrange sidebar" link on the Plugins page starts arranging too.
     172                document.addEventListener( 'click', function ( e ) {
     173                        var link = e.target.closest && e.target.closest( '.ptabs-arrange-open' );
     174                        if ( link ) {
     175                                e.preventDefault();
     176                                window.scrollTo( 0, 0 );
     177                                start();
     178                        }
     179                } );
    157180
    158181                function button( text, className, onClick ) {
    … …  
    245268                        arranging = true;
    246269                        menu.classList.add( 'ptabs-arranging' );
     270                        // Arranging needs the full sidebar; a folded one comes back after Done or Cancel (page reload).
     271                        document.body.classList.remove( 'folded', 'auto-fold' );
    247272
    248273                        // Every group open while arranging.
    … …  
    292317                        menu.insertBefore( panel, menu.firstElementChild );
    293318                        toggleItem.hidden = true;
    294 
    295                         // Let WordPress recalculate its sticky sidebar for the new height.
    296                         window.dispatchEvent( new Event( 'resize' ) );
     319                        menuResized();
    297320                }
    298321
    … …  
    361384                        }
    362385                        endDrag();
     386                        menuResized();
    363387                } );
    364388
    … …  
    487511                                        menu.insertBefore( emptyHint(), end );
    488512                                        makeDraggable( header );
     513                                        menuResized();
    489514                                } )
    490515                                .catch( function () {} );
  • sortivo-tabs-organizer/tags/0.7.2/includes/class-ptabs-admin.php

    r3801054 r3807983  
    128128                        esc_html__( 'Group the sidebar menu too', 'sortivo-tabs-organizer' )
    129129                );
     130                if ( PTabs_Store::menu_enabled() ) {
     131                        // Starts "Arrange menu" in the sidebar (assets/menu.js).
     132                        echo '<button type="button" class="ptabs-arrange-open">' . esc_html__( 'Arrange sidebar', 'sortivo-tabs-organizer' ) . '</button>';
     133                }
    130134                echo '<a class="ptabs-transfer-link" href="' . esc_url( PTabs_Settings::url() ) . '">' . esc_html__( 'Export / import', 'sortivo-tabs-organizer' ) . '</a>';
    131135                echo '</nav>';
    … …  
    159163                        return;
    160164                }
    161                 wp_enqueue_style( 'ptabs-admin', PTABS_URL . 'assets/admin.css', array(), PTABS_VERSION );
    162                 wp_enqueue_script( 'ptabs-admin', PTABS_URL . 'assets/admin.js', array(), PTABS_VERSION, true );
    163                 wp_localize_script(
     165                // Printed into the page itself, so an update always takes effect (see PTabs_Assets).
     166                PTabs_Assets::style( 'ptabs-admin', 'admin.css' );
     167                PTabs_Assets::script(
    164168                        'ptabs-admin',
     169                        'admin.js',
    165170                        'PTabs',
    166171                        array(
  • sortivo-tabs-organizer/tags/0.7.2/includes/class-ptabs-menu.php

    r3803786 r3807983  
    419419                        return;
    420420                }
    421                 wp_enqueue_style( 'ptabs-menu', PTABS_URL . 'assets/menu.css', array(), PTABS_VERSION );
    422                 wp_enqueue_script( 'ptabs-menu', PTABS_URL . 'assets/menu.js', array(), PTABS_VERSION, true );
    423 
    424421                $data = array(
    425422                        'groups' => self::$groups,
    … …  
    456453                        );
    457454                }
    458                 wp_localize_script( 'ptabs-menu', 'PTabsMenu', $data );
     455                // Printed into the page itself, so an update always takes effect (see PTabs_Assets).
     456                PTabs_Assets::style( 'ptabs-menu', 'menu.css' );
     457                PTabs_Assets::script( 'ptabs-menu', 'menu.js', 'PTabsMenu', $data );
    459458        }
    460459
  • sortivo-tabs-organizer/tags/0.7.2/readme.txt

    r3803786 r3807983  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.7.0
     7Stable tag: 0.7.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2020* **Remembers your tab** - after activating, deactivating or searching you stay in the tab you were in.
    2121* **Tidy sidebar** - the menu items plugins add to the left sidebar are grouped under the same tab names, with a collapsible header per group. No page is moved and no link changes, so every plugin keeps working. Turn it off with one checkbox on the Plugins page.
    22 * **Arrange the sidebar yourself** - click "Arrange menu" at the bottom of the sidebar. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. Make a new group for them, or reset everything with one click. Until you do this, nothing changes.
     22* **Arrange the sidebar yourself** - click "Arrange menu" at the bottom of the sidebar, or "Arrange sidebar" at the top of the Plugins page. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. Make a new group for them, or reset everything with one click. Until you do this, nothing changes.
    2323* **Export / import** - download your layout as a file (Tools > Sortivo Tabs) and import it on other sites, or use WP-CLI: `wp sortivo export` and `wp sortivo import`.
    2424* Works with the All / Active / Inactive / Update filters and with search.
    … …  
    7272== Changelog ==
    7373
     74= 0.7.2 =
     75* Fix: on some hosts an update did not fully take effect, because their server cache kept serving the old script and style of the plugin for days. The plugin now puts its small script and style into the admin page itself, so every update takes effect right away.
     76* Fix: the "Arrange sidebar" link keeps its link style with themes that style all buttons.
     77
     78= 0.7.1 =
     79* Fix: after opening groups in the sidebar you can scroll down to the bottom of the menu again.
     80* New: an "Arrange sidebar" link at the top of the Plugins page, next to "Group the sidebar menu too".
     81
    7482= 0.7.0 =
    7583* New: "Arrange menu" at the bottom of the sidebar. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. The tabs on the Plugins page follow the same order.
  • sortivo-tabs-organizer/tags/0.7.2/sortivo-tabs-organizer.php

    r3803786 r3807983  
    33 * Plugin Name:       Sortivo Tabs Organizer
    44 * Description:       Organize the Plugins page into tabs. Plugins are sorted into categories automatically, and you can move any plugin to another tab or make your own tabs.
    5  * Version:           0.7.0
     5 * Version:           0.7.2
    66 * Requires at least: 6.0
    77 * Requires PHP:      7.4
    … …  
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 define( 'PTABS_VERSION', '0.7.0' );
     16define( 'PTABS_VERSION', '0.7.2' );
    1717define( 'PTABS_FILE', __FILE__ );
    18 define( 'PTABS_URL', plugin_dir_url( __FILE__ ) );
    1918
     19require_once __DIR__ . '/includes/class-ptabs-assets.php';
    2020require_once __DIR__ . '/includes/class-ptabs-categorizer.php';
    2121require_once __DIR__ . '/includes/class-ptabs-store.php';
  • sortivo-tabs-organizer/trunk/assets/admin.css

    r3801054 r3807983  
    114114}
    115115
     116/* A link-style button; themes that style all buttons don't get to turn it into a box. */
     117.ptabs-bar .ptabs-arrange-open {
     118        -webkit-appearance: none;
     119        appearance: none;
     120        min-height: 0;
     121        margin: 0;
     122        padding: 0;
     123        border: 0;
     124        border-radius: 0;
     125        background: none;
     126        box-shadow: none;
     127        color: #2271b1;
     128        font: inherit;
     129        font-size: 12px;
     130        line-height: inherit;
     131        text-decoration: underline;
     132        cursor: pointer;
     133}
     134
     135.ptabs-bar .ptabs-arrange-open:hover,
     136.ptabs-bar .ptabs-arrange-open:focus {
     137        color: #135e96;
     138}
     139
    116140.ptabs-move-wrap {
    117141        white-space: nowrap;
  • sortivo-tabs-organizer/trunk/assets/menu.js

    r3803786 r3807983  
    1212        function loadCollapsed() {
    1313                try {
    14                         return JSON.parse( window.localStorage.getItem( KEY ) || '[]' );
     14                        var list = JSON.parse( window.localStorage.getItem( KEY ) || '[]' );
     15                        return Array.isArray( list ) ? list : [];
    1516                } catch ( e ) {
    1617                        return [];
     18                }
     19        }
     20
     21        // The sidebar changed height: let WordPress measure it again. Otherwise a sidebar that was
     22        // pinned while short stays pinned when it grows, and its bottom can't be scrolled into view.
     23        function menuResized() {
     24                if ( window.jQuery ) {
     25                        window.jQuery( document ).trigger( 'wp-pin-menu' );
     26                } else {
     27                        window.dispatchEvent( new Event( 'resize' ) );
    1728                }
    1829        }
    … …  
    117128                        var isCollapsed = ! header.classList.contains( 'is-collapsed' );
    118129                        apply( isCollapsed );
     130                        menuResized();
    119131                        collapsed = collapsed.filter( function ( id ) {
    120132                                return id !== group.id;
    … …  
    154166                toggle.appendChild( toggleLabel );
    155167                toggleItem.appendChild( toggle );
    156                 menu.insertBefore( toggleItem, document.getElementById( 'collapse-menu' ) );
     168                var collapseItem = document.getElementById( 'collapse-menu' );
     169                menu.insertBefore( toggleItem, collapseItem && collapseItem.parentNode === menu ? collapseItem : null );
     170
     171                // The "Arrange sidebar" link on the Plugins page starts arranging too.
     172                document.addEventListener( 'click', function ( e ) {
     173                        var link = e.target.closest && e.target.closest( '.ptabs-arrange-open' );
     174                        if ( link ) {
     175                                e.preventDefault();
     176                                window.scrollTo( 0, 0 );
     177                                start();
     178                        }
     179                } );
    157180
    158181                function button( text, className, onClick ) {
    … …  
    245268                        arranging = true;
    246269                        menu.classList.add( 'ptabs-arranging' );
     270                        // Arranging needs the full sidebar; a folded one comes back after Done or Cancel (page reload).
     271                        document.body.classList.remove( 'folded', 'auto-fold' );
    247272
    248273                        // Every group open while arranging.
    … …  
    292317                        menu.insertBefore( panel, menu.firstElementChild );
    293318                        toggleItem.hidden = true;
    294 
    295                         // Let WordPress recalculate its sticky sidebar for the new height.
    296                         window.dispatchEvent( new Event( 'resize' ) );
     319                        menuResized();
    297320                }
    298321
    … …  
    361384                        }
    362385                        endDrag();
     386                        menuResized();
    363387                } );
    364388
    … …  
    487511                                        menu.insertBefore( emptyHint(), end );
    488512                                        makeDraggable( header );
     513                                        menuResized();
    489514                                } )
    490515                                .catch( function () {} );
  • sortivo-tabs-organizer/trunk/includes/class-ptabs-admin.php

    r3801054 r3807983  
    128128                        esc_html__( 'Group the sidebar menu too', 'sortivo-tabs-organizer' )
    129129                );
     130                if ( PTabs_Store::menu_enabled() ) {
     131                        // Starts "Arrange menu" in the sidebar (assets/menu.js).
     132                        echo '<button type="button" class="ptabs-arrange-open">' . esc_html__( 'Arrange sidebar', 'sortivo-tabs-organizer' ) . '</button>';
     133                }
    130134                echo '<a class="ptabs-transfer-link" href="' . esc_url( PTabs_Settings::url() ) . '">' . esc_html__( 'Export / import', 'sortivo-tabs-organizer' ) . '</a>';
    131135                echo '</nav>';
    … …  
    159163                        return;
    160164                }
    161                 wp_enqueue_style( 'ptabs-admin', PTABS_URL . 'assets/admin.css', array(), PTABS_VERSION );
    162                 wp_enqueue_script( 'ptabs-admin', PTABS_URL . 'assets/admin.js', array(), PTABS_VERSION, true );
    163                 wp_localize_script(
     165                // Printed into the page itself, so an update always takes effect (see PTabs_Assets).
     166                PTabs_Assets::style( 'ptabs-admin', 'admin.css' );
     167                PTabs_Assets::script(
    164168                        'ptabs-admin',
     169                        'admin.js',
    165170                        'PTabs',
    166171                        array(
  • sortivo-tabs-organizer/trunk/includes/class-ptabs-menu.php

    r3803786 r3807983  
    419419                        return;
    420420                }
    421                 wp_enqueue_style( 'ptabs-menu', PTABS_URL . 'assets/menu.css', array(), PTABS_VERSION );
    422                 wp_enqueue_script( 'ptabs-menu', PTABS_URL . 'assets/menu.js', array(), PTABS_VERSION, true );
    423 
    424421                $data = array(
    425422                        'groups' => self::$groups,
    … …  
    456453                        );
    457454                }
    458                 wp_localize_script( 'ptabs-menu', 'PTabsMenu', $data );
     455                // Printed into the page itself, so an update always takes effect (see PTabs_Assets).
     456                PTabs_Assets::style( 'ptabs-menu', 'menu.css' );
     457                PTabs_Assets::script( 'ptabs-menu', 'menu.js', 'PTabsMenu', $data );
    459458        }
    460459
  • sortivo-tabs-organizer/trunk/readme.txt

    r3803786 r3807983  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 0.7.0
     7Stable tag: 0.7.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    2020* **Remembers your tab** - after activating, deactivating or searching you stay in the tab you were in.
    2121* **Tidy sidebar** - the menu items plugins add to the left sidebar are grouped under the same tab names, with a collapsible header per group. No page is moved and no link changes, so every plugin keeps working. Turn it off with one checkbox on the Plugins page.
    22 * **Arrange the sidebar yourself** - click "Arrange menu" at the bottom of the sidebar. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. Make a new group for them, or reset everything with one click. Until you do this, nothing changes.
     22* **Arrange the sidebar yourself** - click "Arrange menu" at the bottom of the sidebar, or "Arrange sidebar" at the top of the Plugins page. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. Make a new group for them, or reset everything with one click. Until you do this, nothing changes.
    2323* **Export / import** - download your layout as a file (Tools > Sortivo Tabs) and import it on other sites, or use WP-CLI: `wp sortivo export` and `wp sortivo import`.
    2424* Works with the All / Active / Inactive / Update filters and with search.
    … …  
    7272== Changelog ==
    7373
     74= 0.7.2 =
     75* Fix: on some hosts an update did not fully take effect, because their server cache kept serving the old script and style of the plugin for days. The plugin now puts its small script and style into the admin page itself, so every update takes effect right away.
     76* Fix: the "Arrange sidebar" link keeps its link style with themes that style all buttons.
     77
     78= 0.7.1 =
     79* Fix: after opening groups in the sidebar you can scroll down to the bottom of the menu again.
     80* New: an "Arrange sidebar" link at the top of the Plugins page, next to "Group the sidebar menu too".
     81
    7482= 0.7.0 =
    7583* New: "Arrange menu" at the bottom of the sidebar. Drag groups up and down, and drag any menu item into a group, also WordPress's own items like Posts or Settings. The tabs on the Plugins page follow the same order.
  • sortivo-tabs-organizer/trunk/sortivo-tabs-organizer.php

    r3803786 r3807983  
    33 * Plugin Name:       Sortivo Tabs Organizer
    44 * Description:       Organize the Plugins page into tabs. Plugins are sorted into categories automatically, and you can move any plugin to another tab or make your own tabs.
    5  * Version:           0.7.0
     5 * Version:           0.7.2
    66 * Requires at least: 6.0
    77 * Requires PHP:      7.4
    … …  
    1414defined( 'ABSPATH' ) || exit;
    1515
    16 define( 'PTABS_VERSION', '0.7.0' );
     16define( 'PTABS_VERSION', '0.7.2' );
    1717define( 'PTABS_FILE', __FILE__ );
    18 define( 'PTABS_URL', plugin_dir_url( __FILE__ ) );
    1918
     19require_once __DIR__ . '/includes/class-ptabs-assets.php';
    2020require_once __DIR__ . '/includes/class-ptabs-categorizer.php';
    2121require_once __DIR__ . '/includes/class-ptabs-store.php';
Note: See TracChangeset for help on using the changeset viewer.