Page MenuHomePhabricator

Implement a Cat-a-lot a feature for saving selections to temporary list
Open, Needs TriagePublic

Description

Currently, when using Cat-a-lot to organize files in Wikimedia Commons users will select images, categories from pages where they currently are and they can do actions to those pages. To improve usability, this task will involve creating a persistent "scratchpad" where users can temporarily store selected files.

Key Requirements:

    • Scratchpad view features **
  • Ensure the scratchpad vie follows the normal Cat-a-lot category page html structure so Cat-a-lot will work there with minimal modification.
  • Ability to select/deselect files in scratchpad view using Cat-a-lot.
  • Support Cat-a-lot batch operations (move, copy, categorize) directly from the scratchpad.
  • Option to remove selected pages individually from the scratchpad.
  • Provide a "Clear Scratchpad" button to reset selections.
  • Allow users to save the scratchpad file list to a specified wikipage through a prompt dialog for entering the page name.

Technical Implementation notes:

Event Timeline

Cat-a-lot Scratchpad Implementation

Project Overview

This project adds a "scratchpad" feature that lets users temporarily store selected files across multiple page loads, making it easier to work with files from different categories.
This is the diff

What Was Implemented

I integrated the scratchpad functionality directly into the main Cat-a-lot code, adding:

  • Local storage for persistent file selection
  • Menu items for adding to and accessing the scratchpad
  • A dedicated scratchpad page that works with all Cat-a-lot operations
  • UI for managing scratchpad items (remove, clear)
  • Export functionality to save scratchpad contents to wiki pages

How to Test

To test the Cat-a-lot scratchpad feature, add these lines to your common.js:

mw.loader.load('//commons.wikimedia.org/w/index.php?title=User:Nenyee/Gadget-Cat-a-lot.js&action=raw&ctype=text/javascript');
mw.loader.load('https://commons.wikimedia.org/wiki/User:Nenyee/cat-a-lot-scratchpad.js?action=raw&ctype=text/javascript');

What to expect:

  1. When you activate Cat-a-lot, you'll see two new menu items:
  • "Add to Scratchpad"
  • "Go to Scratchpad"
  1. The scratchpad page is at: Special:BlankPage/Cat-a-lot_scratchpad
  1. Basic workflow:
  • Select files on any category page
  • Add them to scratchpad
  • Visit the scratchpad page
  • Use Cat-a-lot to categorize your saved files
  • Files remain in scratchpad between sessions

The scratchpad provides persistent storage of selected files across browsing sessions, making it easier to work with files from multiple categories.

@Neyehh, I just tested this. This is working pretty well. The main major issue is that as in T389739 there is no method for external app to notify the Cat-a-lot that the content has been changed. Because this the selected items number etc doesn't update when files are removed from scratchpad.

Some improvement ideas

  • "Scratchpad" title text could be written to title line where currently is text Blank page. Text could be Cat-a-lot scratchpad or something.
  • When user is in the page Special:BlankPage/Cat-a-lot_scratchpad the links Add to scratchpad and Go to scratchpad could be removed as they are only useful when they do something.
  • Go to scratchpad could open the page in a new browser tab instead of in the same window.
  • When it saves the scratchpad content to wikipage it could include the file names as description ( example )

@Zache Thanks for the feedback! I will make these changes shortly.

@Zache All the requested improvements have been successfully implemented:

  1. ✅ Changed the title from "Blank page" to "Cat-a-lot scratchpad" on the scratchpad page
  2. ✅ Hidden the "Add to scratchpad" and "Go to scratchpad" links when on the scratchpad page
  3. ✅ Made "Go to scratchpad" open in a new browser tab
  4. ✅ Added the file names to appear as clickable blue links in the saved wiki page
  5. ✅ Added event handling to update the selection counter when files are removed from the scratchpad

I believe its working properly now, Please let me know of any feedback!

This is the updated diff