Jump to content

Wikipedia talk:WikiProject JavaScript

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
WikiProject iconJavaScript NA‑class
WikiProject iconThis page is within the scope of WikiProject JavaScript, a collaborative effort to improve the coverage of articles related to JavaScript, and to the development of user scripts for use on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
NAThis page does not require a rating on Wikipedia's content assessment scale.

What scripts are you working on or maintaining, or would like to build?

Feel free to share the details of your user script projects, your problems, your ideas, and your JavaScript-related technological fantasies on this page. :) The Transhumanist 01:10, 14 April 2017 (UTC)[reply]

Looking for a userscript demonstrating a function

I'm looking to build a userscript the interacts with a template call, and I was hoping that there's another one out there that I can see how this functionality works. Specifically, I want the userscript to do the following:

  1. Scan a page on load for a particular template call.
  2. Insert a button for openning up a javascript window if the template is found, preferably at the template's location on the page.
  3. Load template parameters into fields in the new javascript window.

Does anyone know of a userscript that does something like this, or a set of userscripts that together do all of these functions? Am I completely crazy thinking this is even possible? It's been about 20 years since I last programmed anything in javascript, so I'm very much looking for a place to start connecting the dots again. Thanks for any help you have. VanIsaacWScont 18:28, 24 June 2020 (UTC)[reply]

For looking for a template call within wikitext, and finding the parameters and their values, you can use the parseTemplates function of MediaWiki:Gadget-libExtraUtil.js (which is a gadget, so can be loading using ResourceLoader's mw.loader.using). Actually finding the parsed html of the template within the page's html is going to be more tricky, and may not be possible, e.g. if the template output is indistinguishable from regular wikitext, such as {{ndash}} or other formatting templates. - Evad37 [talk] 03:24, 25 June 2020 (UTC)[reply]
I've wanted a user script that finds and highlights occurrences of a given template for a while – extending such a user script to meet your specification wouldn't be that hard. Both scripts are completely feasible with Parsoid. However, from my past experience, I know they'll probably be pretty annoying/difficult to write, so I haven't written anything yet. I'd be happy to give advice or an outline of how to proceed to anyone who wants it, though. Enterprisey (talk!) 06:42, 25 June 2020 (UTC)[reply]
It's certainly fine to have this script parse wikitext only while editing if that makes things easier. But since the script is only useful interacting with a few specific templates, it's completely reasonable to just program the templates with custom HTML classes for the script data. I would assume that would vastly simplify extracting those values. VanIsaacWScont 18:04, 25 June 2020 (UTC)[reply]

A little late, but is it supposed to scroll down to where the template is and open up a screen, then load the parameters?

00:37, 15 January 2023 (UTC)

Calling for volunteers for RedWarn - a fast growing new JavaScript counter-vandalism tool

Ultraviolet is a new, fast-growing JavaScript counter-vandalism tool, specifically designed for user friendliness. Ultraviolet has gained over 200 new users and is rapidly growing every day. So far, 40,000+ edits have been made with the tool. Thanks to your help, Ultraviolet is now backed by a team of hard-working and trusted volunteers. If you'd like to join us, you don't need to be a genius, or have any major experience to volunteer — and, to be cliche, it may even be a great thing to put on your resume. Engaging in Ultraviolet's development is a good way to get your work in use by hundreds of editors across the globe. If you've had any JavaScript, PHP, HTML, CSS, design, translation, counter-vandalism, or other experience that would aid in Ultraviolet's development, your contributions would be highly valued!

- Ed6767 talk! 15:09, 15 July 2020 (UTC)[reply]

OneClickUnarchiver

It's not uncommon to need to restore a discussion from a talk venue archive, but it's not easy to do it correctly and exceeds the ability of many editors. I wonder if anyone would be interested in creating a restore-from-archive script modeled after OneClickArchiver. Instead of clicking an "Archive" link on a talk page, one would click a "Restore" link on an archive page. The coding would be a little simpler than OneClickArchiver, which has to worry about whether it's time to create a new archive page. Any taker? ―Mandruss  22:08, 27 November 2020 (UTC)[reply]

Proposal to change the user scripts header message

The Mediawiki:Clearyourcache message should link "scripts" to WP:US. I made a proposal at Template talk:Script doc auto#Proposal: link to WP:US. Enterprisey (talk!) 21:50, 13 December 2020 (UTC)[reply]

So I did this, and then out of curiosity looked at the pageviews stats for WP:US. Looks like they went from 60-80ish daily earlier this year, and then plunged at the beginning of May to 20-40ish daily, where they remain. Did it get de-linked from somewhere big? (pinging people from the discussion at TT:Script doc auto, who definitely didn't ask to get pinged but I figure might still be interested: Sj, SD0001, and DannyS712) Enterprisey (talk!) 09:25, 19 December 2020 (UTC)[reply]
Interesting. Can't think of a reason... – SJ + 03:12, 24 December 2020 (UTC)[reply]

Moving snippets to user space

Hi there! I am going to suggest moving these user script "snippets" formerly managed by WikiProject User scripts to be migrated to user space. This brings multiple advantages, but mainly improves security (they would be interface-admin protected essentially), and readability / ease-of-use (the pages that are not currently marked as JS in terms of content model would be able to be installed using scripts like scriptinstaller). 🐶 EpicPupper (he/him | talk) 19:13, 13 March 2022 (UTC)[reply]