Jump to content

Wikipedia:User scripts/Requests/Archive 6

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 06:26, 18 September 2022 (Archiving 2 discussion(s) from Wikipedia:User scripts/Requests) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 4Archive 5Archive 6Archive 7Archive 8Archive 9

Please Read the FAQ

I hope this doesn't seem bitey, but it would be so helpful to have a script that could let me answer/close a post with a kindly-worded "Please read the FAQ" message on articles that are getting huge numbers of redundant posts for days and weeks on end after a major incident. It's a major time-waster for editors. —valereee (talk) 18:42, 11 November 2020 (UTC)

Valereee, is this just a script to reply to a person on a talk page with that message, your signature, maybe a ping, and using the proper indent? Does the script need to add {{archivetop}}{{archivebottom}} around it? Any other requirements? –Novem Linguae (talk) 14:03, 10 December 2020 (UTC)
Novem Linguae, ideally it would be able to answer and close a discussion or semi-protected edit request, in the case of a semi-protected edit request also mark it answered, but not archive it. I usually don't archive early as I'm hoping other new editors coming in to make similar requests will see there are already ten on the page and maybe not ask after all. :) —valereee (talk) 15:32, 10 December 2020 (UTC)
Some sort of language like, "Hi, and welcome to Wikipedia. The edit you're requesting has been discussed multiple times. For more information, see the FAQ at the top of this page. Thank you!" —valereee (talk) 15:33, 10 December 2020 (UTC)
 In progress User:Novem_Linguae/Scripts/edit-request-read-faq.jsNovem Linguae (talk) 17:37, 10 December 2020 (UTC)
Sorry. I haven't had as much time to work on this as I would like. I will try to finish this when I get some free time. Also, I ran across another tool that doesn't do exactly this, but might be helpful for quickly replying to edit requests: User:Jackmcbarn/editProtectedHelperNovem Linguae (talk) 07:32, 28 December 2020 (UTC)
@Novem Linguae, that .js -- is that safe to install and try, or were you saying it's not quite ready for prime time yet? —valereee (talk) 11:09, 12 June 2021 (UTC)
 Done. Valereee. Hello there! I'm happy to report that I spent a few hours on it this morning and got it working. Feel free to install and use. It probably has some bugs, please check carefully each time you use it, and please report any buggy diffs. Happy editing. –Novem Linguae (talk) 14:03, 12 June 2021 (UTC)
Wow, thanks! Will do! —valereee (talk) 14:05, 12 June 2021 (UTC)
@Valereee: I think this one is relevant and probably may be reused: User:Enterprisey/reply-link. You can configure it in your commons.js to point out to the FAQ like so: window.replyLinkPreloadPingTpl = "Please, READ [[Wikipedia:FAQ]]"; . AXONOV (talk) 09:46, 14 May 2021 (UTC)
An addition to DannyS712's User:DannyS712/DiscussionCloser.js ? Cabayi (talk) 10:31, 14 May 2021 (UTC)

The idea would be to identify a list common sources in the publication= field of a news citation, and use the script to wikilink them to the relevant page.

For example, Reuters to Reuters or New York Times to The New York Times. — Preceding unsigned comment added by RoanokeVirginia (talkcontribs) 10:28, 7 June 2021 (UTC)

There is no |publication= parameter in cs1|2. When Reuters or AP or AFP or other news agencies are directly referenced, their name goes in |work=. When The New York Times or San Francisco Chronicle or other news papers are referenced, their names (without italic markup) go in |newspaper= (or optionally, |work=). When citing a news source that is using work from a news agency (Reuters, AP, AFP, etc), the agency name goes in |agency= and the news source name goes in the appropriate 'work' parameter. None of these types of names belong in |publisher=.
I would otherwise object to this script because, in general, wikilinking every news source name just because it is a news source name seems to me to be sea-of-blue-like clutter. Wikilink news sources that are not familiar so that readers can easily evaluate that source's reliability; common sources, like the two you mentioned, do not need to be wikilinked to establish their reliability.
Trappist the monk (talk) 15:08, 14 June 2021 (UTC)

A script for changing external links to internal links if applicable. ― Qwerfjkl | 𝕋𝔸𝕃𝕂  (please use {{reply to|Qwerfjkl}} on reply) 20:32, 23 June 2021 (UTC)

meta:User:TMg/autoFormatter claims to fix this problem. You can find a list of pages at CheckWiki error 90. – Jonesey95 (talk) 21:46, 23 June 2021 (UTC)

Previous warnings

It would be a timesaver for me to have a script that would show me previous "month year" sections heads on user talks, which is commonly how warnings are sectioned, maybe allowing me to limit to just the past year or two. I usually scan the section heads in the history, but I'm sure I miss things, and others probably do too: Special:Permalink/1030562622#User:Ulises142 - When a user receives three final warnings, and yet continues vandalizing. It would be good if this caught section heads that were later changed. —valereee (talk) 18:31, 26 June 2021 (UTC)

FUR

I want a script that adds FURs of the user's choice, similar to WP:FURME. --Kailash29792 (talk) 17:44, 13 February 2021 (UTC)

+1 this would be amazingly useful. Just a simple script to fill in the parameters of {{logo fur}} would even be useful. — Berrely • TalkContribs 18:54, 1 July 2021 (UTC)

Mass-patrolling at Special:NewPages

I'd like a script that allows a user to select multiple unpatrolled pages at Special:NewPages and mark them as patrolled, without leaving the page. This would be useful in patrolling, for example, talk namespaces, where the vast majority of creations are good and can be quickly patrolled without going to the page itself. Elli (talk | contribs) 20:01, 6 July 2021 (UTC)

Script requests

Copied from User talk:DannyS712#Script requests
Please can you make these scripts (ordered by prority):

  1. A copy-vio check for AfC (similar to User:DannyS712/copyvio-check)
  2. A one-click undo button(User:BrandonXLF/AJAXUndo)
  3. (If possible) A script which replaces alert notifications and input boxes with text boxes (because alert notifications don't appear for me)

Thanks! ―Qwerfjkltalk 18:45, 11 July 2021 (UTC)

Is there, or could there be, a script that puts thanks links on talk pages? Evad37's excellent TimestampDiffs already puts the diff link on each comment date; I'd imagine picking the oldid from that to put on a (thanks) link would be a breeze, no? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 06:03, 12 May 2021 (UTC)

@Guarapiranga Aren't there a couple of tools around that do this already? One I know is c:User:Jack who built the house/Convenient Discussions. – SD0001 (talk) 12:55, 28 May 2021 (UTC)
Just now I've disabled Discussion Tools to try this, @SD0001. So far: Wow! — Guarapiranga  06:24, 21 July 2021 (UTC)

GAN User script

Hi! I'll preface this and say my coding knowledge is very basic. I did make an effort to complete this myself, but I'm better at forking existing scripts than writing a new one. Some of this is quite personal to me, but easy enough to make this more useful to more editors. This would only be of help to serial nominators of GANs though! Here's what I've been looking to get:

When attempting to nominate an article for WP:GAN, you need to {{subst:GAN|subtopic=X}} on talk page. I'd like to add this, plus some additional actions in one go.

  1. {{subst:GAN|subtopic=X}} onto talk page of article being edited. Maybe a pop-up box for |subtopic, and |note.
  2. Adds page to User:Lee Vilenski/GANs or, substitute the user's page. Create if not already exists. I think this is [[{{{USERPAGE}}}/GANs]] - you'd know better than I.
  3. Potentially the most difficult, it watchlists /GA# page, such as Talk:2020 World Snooker Championship/GA1 or Talk:League of Legends/GA2 for example.

For future enhancement, most Wikiprojects have a nominations pane, it'd be nice for this to automatically add to these if possible (probably needs some sort of case-by-case addition.

In addition, something that closes GANs might also be good. To do:

  1. Close the discussion on the GAN page.
  2. Change {{GAN|subtopic=X|nominator=Y|page=Z|etc.}} to {{GA|subtopic=X|page=Z|~~~~~}} or {{failed GA|subtopic=X|page=Z|~~~~~}} on talk page of article dependent if GAN passes or fails.
  3. Change ratings on all WikiProjects to GA (or leave alone if failed).
  4. List article at WP:GA - this may need a drop down as to where it needs to go within the lists.

I think this is quite an ask, but if anyone wants to help me work on this, let me know. I'm happy to give some more specific steps if wanted :). Best Wishes, Lee Vilenski (talkcontribs) 09:56, 23 November 2020 (UTC)

@Lee Vilenski: Interesting. For creating nominations, I already have a DYK-helper.js and GAR-helper.js. Would love to complete the collection by bundling in GAN, FAC, FAR, etc. A GAN nomination script is pretty straightforward but the unusual thing is actually #2 since every person may have their personal GAN log formatted in a different way and we wouldn't know. One way to go about it is to make it an opt-in function which blindly appends * [[Article name]] to the page, leaving it upon the user to ensure that such an addition would fit into the formatting of the page.
As for a closure script, I think it also needs to handle options like WP:GAN/I#HOLD and WP:GAN/I#2O?
Also, since you say did make an effort to complete this myself is that code available so that i can take parts from it? – SD0001 (talk) 18:15, 23 November 2020 (UTC)
I didn't get it far enough into doing so. I spent a little bit of time, and panicked at the scripting that is far above my head! I suppose the thing about #2 is that it wouldn't be too difficult to change the place, and I would likely just set my nominations page to transcribe.Best Wishes, Lee Vilenski (talkcontribs) 18:38, 23 November 2020 (UTC)
@Lee Vilenski:  Done for first part. See User:SD0001/GAN-helper.js. For logging, you can specify page name and the log entry in the interface. – SD0001 (talk) 21:09, 23 November 2020 (UTC)
That is some quick fantastic work! I've asked some friends to also test this out as I don't have anything written to nominate now. The interface looks fantastic. Best Wishes, Lee Vilenski (talkcontribs) 21:17, 23 November 2020 (UTC)
Ha, I mostly just copied stuff from GAR-helper and changed things here and there ... – SD0001 (talk) 21:24, 23 November 2020 (UTC)

Hi SD0001 - I've been using your script a lot, it's been super helpful. I wonder if you'd be interested in something for closing GANs. Here's the list that I would want it to do:

  1. Close the discussion on the GAN page, either pass or fail.
  2. Change {{GAN|subtopic=X|nominator=Y|page=Z|etc.}} to {{GA|subtopic=X|page=Z|~~~~~}} or {{failed GA|subtopic=X|page=Z|~~~~~}} on talk page of article dependent if GAN passes or fails.
  3. Change ratings on all WikiProjects to GA (or leave alone if failed).
  4. List article at WP:GA - this may need a drop down as to where it needs to go within the lists. I think this is the hardest bit, but let me know what you think.

Currently, I think this is the most strenuous part of the review process, as you generally have to edit at least three pages at the bare minimum just to close the GAN. When I close, I currently use discussion closer and rater to do the work, but I think this could be a lot more convenient. Is this something we could automate? There's a lot of people who do hundreds of reviews, and this might just make it a little bit more streamlined. Best Wishes, Lee Vilenski (talkcontribs) 19:39, 23 July 2021 (UTC)

Vector/Timeless background color customizer script

So i want to change my background colors from the basic grey and white and due to my limited knowledge of javascript, i cannot figure out any of that stuff. I want a script that adds a button to the menu (pop-down on Timeless) and allows you to change 4 of the colors, 1 for The top bar. 1 for the secondary background (the grey portion), 1 for the main background (the thing where the text stands) and 1 for the text itself. MoonlightVectorTalk page 17:47, 6 October 2021 (UTC)

Contraction fixer

I'd like a user script that turns contractions into proper phrasing per MOS:CONTRACTION. Should be easy to code. WIKINIGHTS talk 16:11, 9 August 2021 (UTC)

Taking up the mantle of an almost completed peer review javascript bot

Hi all. Hope that you're well during these crazy times. I know this is technically a bot request but owing to the use of Javascript User:GreenC pointed me here. I was wondering if someone could take over a JavaScript bot request from a user who's now retired? (Wikipedia:Bots/Requests for approval/AWMBot 2)

Short summary of the problem is - old peer reviews are linked using CURRENTPAGENAME/ArchiveX. That means though when a page gets renamed, the link is lost. We have now about 680 broken reviews in this manner and a user created an almost complete javascript bot to fix it (code available via the bot request). There was only one slight problem which was that sometimes duplicate parameters got inserted into the fixed up peer review template. If you had time I'd be very very grateful to have this fixed up. Once this is done I plan to insert the peer review links into all the outstanding old peer reviews but can't do this until the broken ones are fixed up.

Fingers crossed! Tom (LT) (talk) 07:16, 19 August 2021 (UTC)

Rotating through lists

I just create the Go portal. In it, I created a box showing the top international title holders. The code for that is: {{#lst:List of top title holders in Go|titleholders}}. To make this work I added a section "titleholders" to part of the article List of top title holders in Go. This seems to work fine. Now, what I'd like to do, and I can't seem to figure out how to make it work, is to rotate through the various lists of title holders in the article List of top title holders in Go. For example, the next list in the article is for "Continental" title holders. I know how to display that list with appropriate code, i.e., {{#lst:List of top title holders in Go|Continental titleholders}} with an appropriate section label for that list. The problem is how to make a template or other script in the portal that will allow switching form one list to the next. It would be a bit like a slide show, as with {{Transclude linked excerpts as random slideshow}} except I need it to be clear when you select one list or another. Ideally, I would create a horizontal list of links for "International", "Continental", "China", etc., and the reader could click on the type and the list would automatically update. Alternatively, there could be a left/right arrow above the list and the reader could simply click to advance through each list with an appropriate label appearing above the list. I would appreciate any help understanding how this can be done. Coastside (talk) 06:39, 9 October 2021 (UTC)

Autohighlighting specific characters. (Greek)

I'd like to know if there is a tool (js, I guess) that if turned on, will highlight specific characters in an article. At this point I'm looking at articles that my search has said have a latin alphabet character next to a greek one, and I'd like to easily see in the article where that is. So for example, if both ΦΒΚ and ΦBK are in an article, I'd like to have all of the first one highlighted and only the Phi highlighted in the second (the first has Beta and Kappa, the second has B and K). I'd like it to be a little flexible, since I'd like to be able to add the accented greek letters as well as the Lunate Sigma (the version of Sigma that looks like a C. Naraht (talk) 15:10, 10 October 2021 (UTC)

Add WikiProject templates to subcategories

I would like to add {{WikiProject Go}} to the talk pages of all subcategories of category Go (game). Needless to say, I would only want to add it to the talk page if it isn't already added. Is there a bot or script that can do this? Coastside (talk) 06:25, 11 October 2021 (UTC)

I think EarwigBot Task 14 may be what you are looking for. – Rummskartoffel 11:32, 11 October 2021 (UTC)

Help request

Hey there! I'm pretty sure this is not the best place for this request so I do apologize beforehand. In SqWiki we have this extra CS1 error tracking category for citations missing the language parameter. (I'm an admin there.) It has around 11.500 entries. It would be good if we could decrease that number (solve that error) in any way possible. We don't have an active technical community in SqWiki, me being the only user that deals with that aspect. In this situations, I thought asking for help here. Is there any kind of bot that could help me with this? Or maybe even user scripts that could semi-automatize the process of finding the language of the citation and inserting it in the templates. Of course, I'm mostly talking about citations coming from webpages because I don't believe bots and scripts could be much of help in book citations and other of the sort. Any idea that helps decrease that number even partially is much appreciated. - Klein Muçi (talk) 21:24, 4 September 2021 (UTC)

Idea:: action=languagesearch API, which returns language codes based on the characters used in the input string, can be used to detect the language, but i have no idea how can we get a string from those citations and pass it to search parameter. Jeeputer (talk) 13:14, 25 September 2021 (UTC)
@Jeeputer, sorry for not replying for so long. Only now I'm seeing this. Unfortunately I can't progress your idea any further either. But thank you for trying to help! :) - Klein Muçi (talk) 20:40, 11 October 2021 (UTC)

GUI for voting

Hello! I was trying to find a way to make participation in voting easier for my homewiki (SqWiki) by introducing some kind of graphical user interface for adding templates like pro/against/neutral (preferably with a text box that asks for a rationale behind that vote) in "elections"/discussions. I asked around and found this script and my intention was to localize it into a gadget but unfortunately the script makes use of hard-coded EnWiki pages which made it hard for me to modify it. I tried contacting the creator for help but he wasn't available so... Is there any other script/gadget which is "more malleable" that I can use for my case? Maybe someone with extra free time can help me create one from scratch? - Klein Muçi (talk) 20:47, 11 October 2021 (UTC)

PS: Please ping in case of answers. - Klein Muçi (talk) 20:53, 11 October 2021 (UTC)

Some ideas

Some ideas copied from User:Enterprisey/Dashboard. If you make one of these scripts, strike the entry and add a link to your script.

Still not done?
  • A user script to display the same info as PleaseStand's script, but in a very compact way so it doesn't cause reflow when the info shows up - also incrementally showing the data as API responses get back would be cool
  • A user script to expand a diff until it covers all contiguous edits made by that user (if a user made three consecutive edits and you view the diff of the middle, pressing a button should expand it to cover all three) (L235 suggestion)
  • A user script to give you a browser push notification when you get a Wikipedia notification
  • A user script so that whenever you go directly to a section, the section gets floated so that the header gets locked to the top of the screen. This will theoretically prevent the text from jumping around as the rest of the pages load. Now, the hard part is making sure that this script runs before the rest of the stuff making it jump around.
  • A user script to quickly switch between tabs, on pages that have tabs at the top (WikiProjects, village pumps, etc)
  • A user script to make stuff clickable in diffs. (Section headers, line numbers, etc.)
  • A user script to highlight which content (in the HTML) comes from which template (suggested by MusikAnimal over IRC 23:18, 7 January 2019 (UTC))
  • A user script to say where a given template is being used. How to do it: call the Extension:TemplateSandbox endpoint (the one that gets hit when you do the "Preview page with this template" text field on a template edit page) with the wikitext of that template (but with a yellow border), and previewing the current page.
  • A user script that provides a button to mark all reverts (i.e. pages displayed with an edit summary that includes the word "reverted") as "visited" in the watchlist (suggested by Natureium)
  • A user script to automatically add unsigned/undated templates
  • A user script to show a pop-up section preview when you hover over its TOC link
  • A user script to put the current AIV count in your toolbar, Stack Overflow mod style.
  • A user script to move discussions
  • A user script to hyperlink "per X" to the last comment X made
  • Edit just one section w/ "true" (no server-roundtrip) live preview
  • Minimap for big diffs
  • A user script that removes newsletters and other recurring messages while viewing a talk page
  • There should be a way to jump directly to a user's comment from the history page (or, more broadly, if a diff consists of just a few lines being added in one place, to jump directly to those new lines instead of just to the top of the section). Implementation notes: Parallel fetch diff (mw:Api:Compare) and current wikitext, then split the wikitext by lines, go from the line number (from the diff HTML) to a string index into the wikitext, add a sentinel marker at that point, run it through Parsoid, find the sentinel, go up in the MediaWiki DOM to highest "paragraph" (or list element, for discussions), obtain the start and end string indices of the added region in the paragraph, pack up the (section header, paragraph index, start idx, end idx), reload the page with that 4-tuple in window.location.hash, and do the jump.
  • Replace page titles in watchlist & user contribs pages w/ their shortcuts for readability


Done

GUYWAN ( t · c ) 19:33, 5 December 2019 (UTC)

Cross wiki POTD

Hey, Hope you are doing well. Since small wiki's don't have enough contributors to help in Featured picture section, I was wondering if someone can come up with an idea to get En.wikis POTD featured on these wiki's. Actually this was a suggestion from another user at Ks.wiki. Thankyou signed, Iflaq (talk) 17:21, 26 October 2021 (UTC)

@Iflaq: This might be better implemented as a bot that automatically pulls in the {{POTD}} subpage of the current day and saves it to a page on ks.wiki. This could be implemented in the wiki's MediaWiki:Common.js but I advise against it due to performance issues (besides the fact that it won't show up for any user who doesn't use JavaScript). Chlod (say hi!) 09:39, 9 November 2021 (UTC)

Script for reporting people on WP:AIV?

Often while reverting people's vandalism I see accounts that have done enough to be reported to WP:AIV, which I do often. The process currently involves copying their username, opening WP:AIV, editing the "User reported" section, pasting their username at the bottom, then copying the template, then pasting it at the bottom, then cutting the username from where I put it, then putting it where the default name was. This is very annoying. I find it hard to believe that no one else has had this problem and made this script, I just cannot find one in the list with a name or description that says it might fix this. I'm looking for a script with a button on the page or something where I can just put their username / ip and a reason without fussing with copying the template to the bottom as well. Thanks, ― Levi_OPTalk 14:15, 10 January 2022 (UTC)

WP:TWINKLE has this. The menu item is TW -> ARV -> AIV. –Novem Linguae (talk) 15:03, 10 January 2022 (UTC)
I knew that twinkle could do something like this; the edit summaries on aiv said they were twinkle. The issue is that now I have twinkle installed. I don't really want twinkle. I've experimented with both and I prefer redwarn over it, and now having it installed just adds more load time to other stuff, and, well, now I have lots of other twinkle stuff on my page. Does redwarn have anything like this? Is there any way to turn off all of twinkle besides just the menu? Thanks, ― Levi_OPTalk 16:13, 10 January 2022 (UTC)
You can turn of all modules apart from ARV at the Twinkle preferences page. ― Qwerfjkltalk 16:20, 10 January 2022 (UTC)
Ah. I didn't realize that you could just disable all modules besides the one. Thanks! ― Levi_OPTalk 16:23, 10 January 2022 (UTC)
@Levi OP: I'm fairly sure RedWarn can also do this, if you click on the 3 horizontal dots, then Report [user] to AIV. ― Qwerfjkltalk 18:13, 10 January 2022 (UTC)
Ah, thanks so much. Forgot that this menu existed. ― Levi_OPTalk 18:16, 10 January 2022 (UTC)

Opening pages in new tab with modifier key

I would usually write my own scripts, but this one is a little more not straightforward so I thought I'd ask for help with it and it can be a learning experience :)

Anyway, let me describe my issue. When I'm editing wikipedia, I often want to open other pages to read them, get info from them, clarify a rule, etc. The easiest way to do this is to go to the search in the top right and type the page I want. For example, if I wanted to grab a quick deletion template, I would type wp:csd, and then down arrow, then the enter key. The issue with this is that the link will open on the current page, and there is no way to open it in a new tab. I currently take my hand off of the keyboard off of the keyboard and onto the mouse and then press the command key, which when clicking on pages opens them in a new tab. This is annoying for me as I use computers mainly with key combos and mostly using the keyboard.

With this in mind, I would like to make a script to fix this. My thoughts were modifying the search bar to open in a new tab when I have the command key held down (on mac; dunno what it is on windows). My first thoughts would be to just have a listener for onkeydown and onkeyup in the script and then setting target="_blank" when that's the case. I'm not familiar with the mediawiki javascript api in wikipedia so I don't know if this is the best way to to do things, or if using keydown listeners are something you can do in wikipedia scripts or if there is some more official api that you can use. Thanks a lot, ― Levi_OPTalk 17:08, 7 January 2022 (UTC)

Sounds like a good plan to me. .mw-searchSuggest-link appears to be the class you need to add target="_blank" to. Maybe do a DOMNodeInserted listener at first, just to get everything working. (This listener would add _blank all the time, even without a keypress.) Then once you confirm that it works, you can add the complexity of a keypress listener, whether to only add _blank while pressing, whether to remove _blank once keypress is done, etc. –Novem Linguae (talk) 18:27, 7 January 2022 (UTC)
Not only is DOMNodeInserted deprecated (and event delegation is your friend), that solution won't work because when you select an autocomplete with arrow keys and hit Enter, you're not opening the link but changing the textbox and submitting the form. Each autocomplete item is already a link, so Ctrl+click or middle click already works. Nardog (talk) 15:04, 8 January 2022 (UTC)
I have this issue as well. This sounds like a useful script. If you can't make it work, my workaround is to Cmd-click on something near the search box, like "View history" or "Sandbox", then go to that new tab and do my search. When I remember to do it, it works well. – Jonesey95 (talk) 14:08, 8 January 2022 (UTC)
Hacky but works:
$(document.body).on('keydown', '#searchInput', function (e) {
	if ((e.ctrlKey || e.metaKey) && e.which === 13) {
		$('#searchform').attr('target', '_blank');
	}
}).on('blur', '#searchform', function () {
	this.removeAttribute('target');
});
Nardog (talk) 14:48, 8 January 2022 (UTC)
Thanks for the help. This is kind of what I was looking for, and led me in the right direction. I wanted it more like the way that clicking works, where as long as cmd is held down it opens in a new tab, and it doesn't if it isn't, not if the input no longer focused. The issue is that when you have command held down, which is supposed to make it open in a new tab, pressing enter no longer does anything, because cmd+enter isn't supposed to work. To get around that I just added a listener for command enter and then made it click the search button, which will open it. Here's the code I ended up using:
$(document.body).on('keydown', '#searchInput', function (e) {
	if (e.metaKey) {
		$('#searchform').attr('target', '_blank');
        if (e.which === 13) {
            $("#searchButton").click()
        }
	}
}).on('keyup', '#searchform', function (e) {
    if (!e.metaKey) {
        this.removeAttribute('target');
    }
});
Thanks! ― Levi_OPTalk 13:55, 10 January 2022 (UTC)
I don't really know what you mean, but I used the blur event only because I had to figure out a way to remove the target attribute after a new tab was opened. keyup of course works too and is perhaps more obvious, but I figured that would get fired too often. Nardog (talk) 21:06, 10 January 2022 (UTC)