For enthusiasts, some help to track user-selected pages in backend. Works across paginated pages. Script uses JS Cookie plugin (https://github.com/js-cookie/js-cookie). Tracking is echoed to browser's console.

Possible application is an action over multiple selected pages at once (especially helpful in paginated list-view or gallery-view) -
  • publish / unpublish
  • delete
  • export as ..
  • move to a folder
  • relate to some other page

Code: Select all

    <cms:html>
        <cms:admin_load_js path="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js" />
    </cms:html>

    <cms:script>

        _selectDeselect = function(){

            if (typeof Cookies == "undefined") {
                console.warn('Warning - js.cookie.min.js is not loaded.');
                return;
            }

            if (typeof Cookies.get('mySelectedPages') == "undefined") {
                Cookies.set('mySelectedPages', '', { expires: 1 });
            }

            COUCH.el.$content.find( ".checkbox-item" ).not( ":disabled" ).on( "change", function( e ) {

                var myPageId = e.target.value;
                var checked = e.target.checked;

                if( checked ){
                    /* console.log( 'Selected page(s) id: ' + myPageId ); */

                    text = Cookies.get('mySelectedPages').split(/\s*(?:,|$)\s*/);
                    text.push(myPageId);

                    var replacement = [];
                    for(var i =0; i < text.length ; i++){
                       if(replacement.indexOf(text[i]) == -1) replacement.push(text[i]);
                    }

                } else {
                    /* console.log( 'Deselected page(s) id: ' + myPageId ); */

                    text = Cookies.get('mySelectedPages').split(/\s*(?:,|$)\s*/);
                    var replacement = [];
                    for(var i =0; i < text.length ; i++){
                       if( text[i].indexOf(myPageId) == -1 ) replacement.push(text[i]);
                    }

                }

                replacement = replacement.join(', ');
                Cookies.set('mySelectedPages', replacement, { expires: 1 });

                if (replacement.length > 0)
                     console.log( 'Selected: ' + Cookies.get('mySelectedPages') );
                else console.log('All deselected');
            });


        };

        $( function (){
            _selectDeselect()
        });

        $( document ).ajaxComplete(function( event, xhr, settings ) {
            _selectDeselect(); // restore functionality after ajax events
        });

    </cms:script>


If you want a feature in backend, but don't know how to make it all work together - PM me for a quote.