User:Asked42/LeadManager

The Lead Manager script is designed to simplify the updating and creation of new leads. It primarily offers three different options for updating the leads. The default option is automatic sequential shuffling, which shuffles all the lead templates in order. The second option, "Single Update," updates only the selected lead template. The third option, "Explicit Update," allows users to specify a custom shuffle pattern to update the leads according to their preferences.

In addition to the updating operations, the script provides a quick mechanism for users to retrieve article content. Users can enter short keywords, such as "ML1," in the title field to fetch the description and image from the most recently published article, instead of using the article's name.

Inspired by the Make Lead script and Bawolff's lead generator script, this tool was initially developed for Bengali Wikinews and later adapted for English Wikinews, with added features to suit specific needs.

Installation

edit

To install the script, copy the following code and paste it into your common.js page in your user space.

mw.loader.load('//en.wikinews.org/w/index.php?title=User:Asked42/LeadManager.js&action=raw&ctype=text/javascript');

Once the script is installed, return to this page. You will now find a form under the Lead Manager Form section below.

Alternatively, after installing the script, you can access the lead manager form by using <div id="lead-manager-container"></div> on any other page as well, such as in your sandbox.

Usage

edit

Instructions

edit
A screen recorded video demonstrating basic usage of the form.
  • To start, enter the title, choose the number of sentences for the description, and click the "Fetch Automatically" button.
  • Alternatively, instead of entering the title, you can use keywords to fetch the most recent article from the published category. Use "ML1" for the most recent published article, "ML2" for the second most recent, and so on, up to "ML5". (know more)
  • Additional Options: You can adjust the image size here. By default, it shows "150x150px (100x100px)." The "150x150px" is used for the selected lead template, and the value inside the brackets is used for other templates during shuffling. To use a common size for all leads, remove the value inside the brackets. (know more)
  • The "Lead Article Template" dropdown lets you pick which template to update with new lead data. By default, updates start with the selected template and continue shuffling in order. If you select "Single Update" only the chosen template will be updated.
  • The "Explicit Update" option lets you create a custom shuffle pattern. When you check this option, an input field will appear. Enter your pattern using the lead numbers and an "->" symbol to show "move from which lead to which lead." For example, entering "1->2, 2->3" moves content from Lead 1 to Lead 2, Lead 2 to Lead 3, and adds new content to Lead 1. (See more examples and conditions.)
  • Finally, click the "Start Update!" button. Confirm the changes, and the tool will update the templates automatically.

Lead Manger Form

edit


The Lead Manager script has not been loaded or installed. Once loaded, a form will appear here. For a preview see File:Lead Manager Usage en wn version Jan 2025.webm



More description and examples

edit

Fetching Methods

edit

Using the Article's Title: On this method, the user enters the article's title in the title field. By clicking the "Fetch Automatically" button, the article's first image, summary, and type will be extracted and used to fill the corresponding fields in the form.

If the user initially selects "4 sentences" for the summary and finds it too long after extraction, they can choose a smaller number of sentences and click the button again. The previous summary will be replaced with the new one based on the updated selection.

Using Shortcut Keywords: This method offers an alternative to entering the article's title manually. Users can enter the "ML<number>" keyword to refer to the most recently added articles in the published category. For example: "ML1" represents the latest article in the category. "ML2" refers to the second latest, and so on, up to ML5.

After clicking "Fetch Automatically", the keyword will be replaced with the actual article's title, and the corresponding image and summary will be populated in the form.

From Current Lead Contents: This method allows users to extract content directly from a current lead template instead of an article. Users can use the Lead<number> keyword to refer to a specific lead template. For example, Lead1 fetches data from lead template 1, Lead2 fetches from lead template 2, and so on

The Image Size

edit

The image size field can have two values: one for the selected lead template (as per the "Lead Article Template" dropdown) and another for the other lead templates.

For example, if the image size is set to "150x150px (100x100px)" and the selected lead template is Lead 1, then the size 150x150px will be used for Lead 1, while the size 100x100px will be used for Lead 2 through Lead 5.

If the "Single Update" option is selected, the value in brackets will be ignored, and the size 150x150px will only apply to the selected lead template.

If you don't use a value in brackets and only enter "150x150px", this size will be used for all lead templates, regardless of the update mode.

Explicit Update

edit

The "Explicit Update" option allows you to define a custom pattern for shuffling content between lead templates.

For example, a pattern like "1->2" moves the content of Lead 1 to Lead 2 and adds new content to Lead 1, leaving other leads unchanged.

You can specify multiple moves separated by commas, such as "1->3, 3->2, 2->5". This means:

  • Content from Lead 1 moves to Lead 3
  • Content from Lead 3 moves to Lead 2
  • Content from Lead 2 moves to Lead 5
  • Lead 4 remains unchanged


Conditions for Valid Patterns:

  • First Number Matches the Selected Template: The first number in the pattern must match the lead template selected in the "Lead Article Template" dropdown. For example, if Lead 1 is selected, a pattern like "2->1, 1->3" is invalid because it starts with 2 instead of 1.
  • No Empty Templates: All templates must remain filled after the update. For example, the pattern "1->3, 4->5" is invalid because Lead 4 would end up empty.

Other Scripts

edit
  • QuickCat: This script is designed to make the creation of date and month categories, as well as date and month list pages, quick and easy.