Jump to content

User talk:Anomie/linkclassifier

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Note: from WP:VP/PR -- John Broughton (♫♫) 23:12, 16 November 2007 (UTC)[reply]

[edit]

Two-part proposal:

1. Color links by status & add links:

  • Active = Blue (like now)
  • Listed as X for Deletion = Purple + small superscript "AfD" (or whatever) linking to current XfD (Maybe green?)
  • Listed for Deletion Review = Dark red + small superscript "DRV" linking to current DRV (Maybe better purple? Something else?)
  • Deleted = Dark red + small superscript "AfD" (or whatever) linking to last XfD
  • Never existed = Red (like now)

If you don't like the idea of adding superscript links, then consider:

  1. allowing people to opt in to seeing superscript links through WP preferences (with default seeing new colors)
  2. allowing people to opt in to BOTH links and coloration (with default seeing same as now)


2. Add subst template in the form: {{subst:deletionlinks|articlename}}

to output (perhaps dynamically rather than subst??): [[article]] [[link to afd #1|AfD]] [[link to DRV|DRV]] [[link to AfD #2|AfD 2]] (etc in chronological order. and including obsolete but not quite completely redirected things like VfD)

See bottom of WikiProject Constructed languages/Edit wars and deletions for example of what I mean.


Purpose being:

  1. to make it much easier to notice articles that are up for deletion when you might not have them on your watchlist, and easily participate in deletion/undeletion discussions
  2. to make it obvious when articles have been deleted, so you don't think it's just a broken link and more likely check the deletion reasoning before recreating
  3. to make participating in and listing deletions easier & more automatic
  4. to make deletion sort pages like the one above easier to maintain

Thanks. Sai Emrys ¿? 09:18, 14 November 2007 (UTC)[reply]

Interesting idea, but I have no idea how it could be implemented. --ais523 18:13, 14 November 2007 (UTC)
Although it sounds really useful for an editor, I don't think it's a really great idea for everyone and in article space. Instead, perhaps a user script that used a bot-updated list of AfD's to highlight links to particular pages might be in order, so that people who do not want and/or need the functionality do not receive it. I imagine that such a script would be similar to the script that highlights admin names in cyan. Nihiltres{t.l} 22:58, 14 November 2007 (UTC)[reply]
I also thought it was interesting, interesting enough to write a script. The script just adds CSS classes (currently "redirect" and "deletion") to appropriate links, you can edit your monobook.css to do something with it.[1] Anomie 06:03, 15 November 2007 (UTC)[reply]
Could you make the CSS includeable as well? IIRC there's an easy way to do that on a monobook.js page.
Any chance you can make the 'has been deleted and is now blank' and 'under DRV' parts? My guess is that these two are the harder ones to code, but if done, making a subst template to dump all relevant links should (?) be a relatively easy extension. Thanks! Sai Emrys ¿? 23:28, 15 November 2007 (UTC)[reply]

Script not working properly any longer

[edit]

Lately, the script stopped working properly for me. AFAIK, it used to color all links to disambiguation pages. This seems not to be the case any longer. Usually, I'd notice at least two or three dab-links in long articles - this stopped a few weeks ago, and finding dab-links became rare. And if you have a look at my screenshot above from Wikipedia:Disambiguation pages with links, you'll notice that only a few of those articles on the list turn up as a dab-page - which is strange, because that's what they all are! Do you know what's changed? I've noticed that you haven't updated the script or stylesheet for several months, so perhaps the problem is some change in the Wikimedia stuff that has rendered your script largely obsolete? Feel free to ask if you need me to clarify something. -Lilac Soul (talk contribs count) I'm watching this page so just reply to me right here! 17:25, 15 July 2008 (UTC)[reply]

Thanks for the bug report! The devs seem to have added yet another set of limiting and continuation parameters to the API. It still sort-of worked in that it would get the "first" 10 categories for each group of 50 linked pages, and I never really look at such disambiguation-heavy pages as Wikipedia:Disambiguation pages with links, so I didn't notice it being broken. I've bumped the limit up to get the "first" 500 cats for each group of 50 for now (bypass your cache), and when I have time later today I'll add code to use the continuation to make sure it pulls in all the categories.
BTW, don't worry too much about the no-updates; if there are no bugs found and no new features to implement, what's there to change? Anomie 19:03, 15 July 2008 (UTC)[reply]
Ok, it should be completely fixed now, even if you run into a page with links to pages with more than 10 cats each. Anomie 22:38, 15 July 2008 (UTC)[reply]
Seems to be working perfectly, thanks! As for the no-updates, I wasn't suggesting that it was a problem, merely that it made me speculate that it probably wasn't you who had broken anything, rather the Wiki-devs who'd done something that had rendered your script obsolete. Thanks for the quick fix by the way! -Lilac Soul (talk contribs count) 06:12, 16 July 2008 (UTC)[reply]
Edit: I'll remove the screenshot from this talkpage and nominate the image file for deletion as it is now no longer needed. -Lilac Soul (talk contribs count) 06:13, 16 July 2008 (UTC)[reply]

This problem appears to be back

[edit]

Once again, I am no longer seeing more than very very few disambiguation pages. And checking Wikipedia:Disambiguation pages with links, it is evident that only very few of those listed articles turn up in the proper colour. I'm guessing the devs added something similar to what broke your script the last time? Let me know if you need more info. Cheers! -Lilac Soul (talk contribs count) I'm watching this page so just reply to me right here! 18:35, 8 September 2008 (UTC)[reply]

Actually, it seems to be completely different this time: someone moved all the disambiguation pages out of Category:Disambiguation and into a new category Category:Disambiguation pages. Hopefully I've fixed it now. Anomie 22:40, 8 September 2008 (UTC)[reply]
Thank you very much for the fix, it appears to be working perfectly again! And thank you for the script, I find it to be extremely useful! -Lilac Soul (talk contribs count) I'm watching this page so just reply to me right here! 07:08, 9 September 2008 (UTC)[reply]

More use out of data

[edit]

Some thoughts on getting more out of those queries. FA star next to feature article links, stub color for stubs (instead of by size), and locks for various types of protection. — Dispenser 13:18, 7 June 2009 (UTC)[reply]

Stub is easy to do without changing much, and is already done: the CSS class added is "stubcls", both so MW's default CSS for the "stub" CSS class isn't used and so people can effectively use both this and MW's size-based stubbing. But the other two would need to query additional data (FA star more so than protection); I'll have to consider whether to bother with those or not. Anomie 15:05, 7 June 2009 (UTC)[reply]
I thought you were using the category method of detection, which would match Category:Featured articles and the protection icon put their pages into hidden categories too. Another is one to consideration is Category:Spoken articles. — Dispenser 16:32, 7 June 2009 (UTC)[reply]
You're right about the FAs, for some reason I looked at {{FA-star}} instead of {{featured article}} when I was looking to see if the pages were put into a category. I'm a little wary of relying on the protection templates, however, as it seems not every admin bothers to add them and if the page is fully-protected we cannot have a bot or non-admin add it after the fact. Anomie 17:26, 7 June 2009 (UTC)[reply]
Ok, I've added in the rest now, although I didn't provide any CSS rules for most of them in User:Anomie/linkclassifier.css. FAs and FLs get a class "featured-content", Spoken articles get "spoken-articles", and protected articles get "protected-X-Y" (where X is "edit", "move", etc and Y is "autoconfirmed" or "sysop"), and "protected-X-Y-indef" if the expiry is set to infinity. Anomie 19:29, 7 June 2009 (UTC)[reply]

Good articles

[edit]

Could GA links have their own class so that I could add the GA icon after them? Category:Wikipedia good articles and Category:Wikipedia valued pictures should do the trick. Thanks! –Drilnoth (T • C • L) 03:56, 28 October 2009 (UTC)[reply]

The difficulty with GA is that the category is not on the page itself, just the talk page. Anomie 11:11, 28 October 2009 (UTC)[reply]
Ah, right. Could the script strip "Talk:" from the page name in any way? –Drilnoth (T • C • L) 19:56, 29 October 2009 (UTC)[reply]
The problem is that the script would have to make twice as many queries, as for each subject page the talk page would also have to be queried. I'm not sure it's worth doubling the load just to detect GAs. Too bad {{Good article}} was deleted instead of just having no output besides an appropriate category. Anomie 20:54, 29 October 2009 (UTC)[reply]
Ah; gotcha. I guess that it would double how long the query takes which, I agree, isn't the most efficient thing to do. As an alternative, would it be possible to add the GA-detection functionality to the script, but only activate it if say, linkClassifierGAs is set to true? Then people who would like the function, like me, could use it even if it causes the script to be slower, but it wouldn't decrease the speed for other users. I'm not sure if that is feasible for the small number of people who would probably use it, but I thought I'd throw it out there. –Drilnoth (T • C • L) 00:34, 30 October 2009 (UTC)[reply]
[edit]
  • Could you, when you get a chance chece my User:Peteypaws/monobook.js and User:Peteypaws/vector.js. I loaded Link Classifier on both skins and cleared my cache but sill doesn't work, Thanks in advance Peteypaws (talk) 21:53, 4 May 2010 (UTC)[reply]
    • Your monobook.js looks to be non-functional because of the "lang=javascript>" at the beginning. Your vector.js looks fine. But in both cases you don't have any CSS rules for the classes the script adds to the links, so while the script will run without issue it will not result in any visible change to the page contents. The easy fix is to copy the following line to your monobook.js and vector.js:
      importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]
      
      Alternatively, you could copy the rules from User:Anomie/linkclassifier.css to your own monobook.css and/or vector.css and modify them to suit yourself. Anomie 23:25, 4 May 2010 (UTC)[reply]

map: Method error

[edit]

I've been using linkclassifier for a while, but since switching to Chrome as my primary browser, I usually have to manually initiate the script. In the JS console, I show an "Uncaught TypeError: Object function Array() { [native code] } has no method 'map'" at line 184. I'm unsure if this is the cause of the loading problem, but it's the only symptom that I have found. Thanks, Ost (talk) 18:46, 25 May 2010 (UTC)[reply]

That would probably cause it to not load, but that error should have been fixed with this edit over a year ago... Anomie 05:11, 26 May 2010 (UTC)[reply]
That is weird; I'm not sure why it's erring that way when you have the function defined. It may be some quirk with Chrome, though it seems like it should be pretty straightforward. —Ost (talk) 16:16, 26 May 2010 (UTC)[reply]
If you feel like trying something, see if entering "javascript:alert(Array.map)" into your address bar after loading a Wikipedia page will give you a popup with helpful information (it may not, IIRC Safari ignores javascript entered in that way and Chrome is also based on WebKit). Alternatively, you could temporarily add something to your skin.js to give you a button that does the same javascript call. Anomie 17:13, 26 May 2010 (UTC)[reply]
Thanks for the help. After the debugging I tried this morning, I can easily try this step. It gives what I can I'm guessing is the expected result:
function (obj, callback, thisObject){
return Array.prototype.map.call(obj, callback, thisObject);
}
Even without this message, it seemed likely that util.js is loading since your other scripts that I'm using work. For what it's worth, I tried looking through other scripts that I have installed and didn't find a confounding declaration of util.js or Array.map, though I didn't scour the gadgets or follow the import trail of the scripts. It may also be notable that wikEd also gives me problems in Chrome, but refreshing the page tends to get that to load. I have added an item in the drop-down tab to manually classify the links—and I thank you for adding that feature; this function seems to work every time and is a good workaround, though slightly less convenient. —Ost (talk) 19:19, 26 May 2010 (UTC)[reply]
Second test: "javascript:alert([].map)". Also, I just noticed that when Happy-melon changed it to use importScriptURI, he used text/js instead of text/javascript for the content type. I suppose it's worth a shot changing that to the correct value. Anomie 21:19, 26 May 2010 (UTC)[reply]
That command gives me "function map() { [native code] }". —Ost (talkcontribs) 21:54, 26 May 2010 (UTC)[reply]
Interesting. How about "javascript:alert(Array.prototype.map)"? Anomie 01:35, 27 May 2010 (UTC)[reply]
The same as the last: "function map() { [native code] }". —Ost (talk) 12:24, 27 May 2010 (UTC)[reply]
Three more to try:
  • javascript:alert([1,2,3].map(function(x){ return x+10; }))
  • javascript:alert(Array.map([1,2,3],function(x){ return x+20; }))
  • javascript:alert(Array.map(document.getElementsByTagName("BODY"),function(x){ return x; }))
Anomie 16:31, 27 May 2010 (UTC)[reply]
  • 11,12,13
  • 21,22,23
  • [object HTMLBodyElement]
Ost (talk) 18:57, 27 May 2010 (UTC)[reply]
Ok, I think I may have figured this out. Try adding importScript('User:Anomie/util.js'); to your skin.js somewhere above the line for linkclassifier.js. Anomie 20:14, 27 May 2010 (UTC)[reply]
Thanks, that seemed to work! I'm a little mad at myself for forgetting to try adding that to my .js when I was changing stuff around yesterday. You've certainly helped enough, but do you have any idea why that needs to be imported first (especially since your other scripts import it and I had them before linkclassifier)? —Ost (talk) 20:37, 27 May 2010 (UTC)[reply]
My best guess is that having the importScript call outside of linkclassifier.js causes the browser to wait on parsing linkclassifier.js until util.js is loaded, while doing it from inside linkclassifier.js doesn't (and thus the function is undefined when run onload but is defined later); the other scripts may have faced the same issue and just didn't trigger an error for some reason. Possibly also Chrome doesn't delay the load event for added script tags where other browsers do. Anomie 20:52, 27 May 2010 (UTC)[reply]
Those sound like logical explanations. It makes me wonder if it's a bug in Chrome that should be reported. Thanks again for the help and for developing this script in the first place. —Ost (talk) 21:39, 27 May 2010 (UTC)[reply]
I can tell you for a fact that Chrome doesn't delay the onload event when importing more scripts. You can see it with the Timeline feature in Developer tools dialog. Also, as far as I can tell Internet Explorer 8 doesn't do this either. — Dispenser 01:20, 28 May 2010 (UTC)[reply]

Pending changes

[edit]

Would it be helpful to have a color for pages with unaccepted WP:Pending changes? I realize that it's just in trial and that the sample pages are likely to be highly watched, but it may become useful if rolled out to more obscure BLPs in the future—when I forget that I had this idea. —Ost (talk) 20:11, 17 June 2010 (UTC)[reply]

Good idea; I looked earlier at coloring for pages with pending protection (not possible at the moment, BTW, as the API for that is lacking), but didn't think to do that too. You may also be interested in my new script at User:Anomie/needsReview. If you want to test it, it is available on http://flaggedrevs.labs.wikimedia.org/wiki/ as well. Anomie 01:59, 18 June 2010 (UTC)[reply]
Thanks. I'll give that a try. —Ost (talk) 12:26, 18 June 2010 (UTC)[reply]
I see my instructions were less than clear: the importStylesheet line goes in your js file, not in your css. I should probably also test if that works with Vector. Anomie 15:40, 18 June 2010 (UTC)[reply]
Thanks. I should have realized that when I noticed that the rules for linkclassifier weren't there. —Ost (talk) 16:03, 18 June 2010 (UTC)[reply]

Signpost and Set Index articles

[edit]

I'm having trouble making a decent demo "link" for the next Signpost, Wikipedia:Wikipedia Signpost/2010-09-20/Dispatches. Would it be possible to add some functionality to make it work?

Also, the script does not detect set index articles, which are basically another type of disambiguation page. Could detection for Category:All set index articles be added? — Dispenser 00:19, 16 September 2010 (UTC)[reply]

Nifty! Category:All set index articles added. What sort of demo "link" did you have in mind? Anomie 01:49, 16 September 2010 (UTC)[reply]
See the "Demo:" links or instructions for some of the other projects covered, eg WikiEd. Some have a live link, and some require copy&pasting a line of javascript into the address field (like a bookmarklet, and would presummably work well as such).
(See also Tools, part 1 from last week, for many more). -- Quiddity (talk) 02:13, 16 September 2010 (UTC)[reply]
Ah, I see. javascript:importScript('User:Anomie/util.js');importScript('User:Anomie/linkclassifier.js');importStylesheet('User:Anomie/linkclassifier.css');void(0); seems to work for me. Anomie 02:42, 16 September 2010 (UTC)[reply]
I was actually looking for something shorter that didn't involve a workaround for the race condition. — Dispenser 04:20, 16 September 2010 (UTC)[reply]
Will javascript:void(importScript('User:Anomie/linkclassifier-demo.js')); satisfy you? Anomie 10:34, 16 September 2010 (UTC)[reply]
Yes and it is now in the current Signpost. I was considering javascript:var s='User:Anomie/linkclassifier';importScript('User:Anomie/util.js');importScript(s+'.js');importStylesheet(s+'.css');void(0); before you posted. — Dispenser 15:41, 22 September 2010 (UTC)[reply]
Set index articles should not be marked with the 'disambiguation' class. Although skinning them the same is fine. — Dispenser 21:59, 22 September 2010 (UTC)[reply]

image border in Chrome

[edit]

I've found recently that when viewing Wikipedia pages in Google Chrome, some images have a narrow double border of red around them (inside the larger box that surrounds image+caption in Thumb mode). This doesn't happen for images from Commons, and it doesn't happen in Firefox (I can't bring myself to test in Internet Exploder). The problem disappears when logged out, and also when removing the linkclassifier script from my JS page. Is this a feature or a bug? If you want an example, the top image (Chavez at Turiamo) at 2002 Venezuelan coup d'état attempt is affected. Rd232 talk 14:04, 17 October 2010 (UTC)[reply]

I use Firefox and with some images I to get the red border. Not sure it has anything to do with Link Classifier. Mlpearc powwow 15:33, 17 October 2010 (UTC)[reply]
It's a feature, those images are marked as non-free and the "default" CSS rules in User:Anomie/linkclassifier.css apply a double red border to make their use easy to spot. I don't know why you're not seeing it in Firefox, Rd232, as it should be showing up in that browser too. Not sure if it would show in IE.
If you want to turn it off, override (or don't copy) this CSS rule:
A.image.nonfree-media    > IMG { outline:3px double #ff0000; }
Anomie 16:05, 17 October 2010 (UTC)[reply]
BTW, linkclassifier will also put a single purple border around images nominated for deletion. The rules responsible for that are:
A.image.deletion         > IMG { outline:2px solid #ff0088; }
A.image.deletion:visited > IMG { outline-color:#cc2277; }
Anomie 16:08, 17 October 2010 (UTC)[reply]

aha, it's a feature :) thanks. Rd232 talk 18:46, 17 October 2010 (UTC)[reply]

Thanx for clearing that up. Mlpearc powwow 19:08, 17 October 2010 (UTC)[reply]

… and FYI, it does show here in IE8 and Firefox (3.6.10). -- Michael Bednarek (talk) 04:55, 18 October 2010 (UTC)[reply]

Files nominated for WP:PUF

[edit]

Should we also mark files that were nominated as a possibly unfree file at WP:PUF pink, as the same way with anything else for deletion? At least that would help out for me, and it makes sense. –MuZemike 23:22, 13 January 2011 (UTC)[reply]

 Done Anomie 03:17, 14 January 2011 (UTC)[reply]
[edit]

I added the linkclassifier to User:Dthomsen8/monobook.js and User:Dthomsen8/monobook.css, cleared the cache, and restarted Firefox, but I do not see any results. Could you indicate a page with link classifier results? What would I see? --DThomsen8 (talk) 13:40, 4 February 2011 (UTC)[reply]

The line
importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]
goes in your monobook.js, not in your monobook.css. Or you could copy the contents of User:Anomie/linkclassifier.css to your monobook.css and modify them however you like. Anomie 16:50, 4 February 2011 (UTC)[reply]
Fixed that, still don't see results. --DThomsen8 (talk) 00:03, 5 February 2011 (UTC)[reply]

Problems with Mediawiki 1.17?

[edit]

Since the upgrade to Mediawiki 1.17, your linkclassifier scripts have stopped working for me. Are you aware of any problems? Is there something I need to do on my side? I've tried bypassing my browser's cache with Ctrl-Shift-R, and logging off and on again, but without success. I'm using the vector skin on Firefox 3.6.13. —Bruce1eetalk 06:04, 17 February 2011 (UTC)[reply]

Oops, not a problem with your scripts at all. I had another script in my vector.js file, and as soon as I commented that out, linkclassifier worked fine. Sorry about that. —Bruce1eetalk 08:40, 17 February 2011 (UTC)[reply]
No problem. At some point now that 1.17 is out I'll need to rewrite the script to use jQuery, if you want to watchlist User:Anomie/linkclassifier.js to know when I do that and report any bugs that would be great. Anomie 12:19, 17 February 2011 (UTC)[reply]
I'll do that, thanks. —Bruce1eetalk 12:29, 17 February 2011 (UTC)[reply]

Problems with Mediawiki 1.18?

[edit]

Well, "problems" is probably exaggerating it—the script seems to be working fine for the most part—but where it most certainly no longer works is in Special:Contributions. Could you please look into that when you have a moment? Thanks!—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); October 5, 2011; 16:06 (UTC)

It is working there for me. –Drilnoth (T/C) 17:47, 5 October 2011 (UTC)[reply]
Are you using Vector? I'm on monobook myself. No idea if that affects anything, but worth checking.—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); October 5, 2011; 18:38 (UTC)
Yes, Vector. Sorry I didn't specify. Firefox 7.01, Ubuntu Linux 11.04, 64-bit. –Drilnoth (T/C) 19:21, 5 October 2011 (UTC)[reply]
Seems to work fine for me on Vector. Note that if any of your other scripts or gadgets are broken, that could prevent the linkclassifier from running. Are you getting any Javascript errors? Anomie 19:33, 5 October 2011 (UTC)[reply]
No, I'm not getting any. Interesting that only the Special:Contributions pages are affected; everything else is working as usual. Can you think of any reason for that?—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); October 5, 2011; 19:52 (UTC)
Best guess is some other script is breaking just on that page, for whatever reason. Anomie 20:30, 5 October 2011 (UTC)[reply]
There were some specific changes made to that page (removing the ability to filter by namespace), so some other tool may have broken because of that. –Drilnoth (T/C) 21:48, 5 October 2011 (UTC)[reply]
Works here using Monobook with Internet Explorer, Firefox, Chrome. -- Michael Bednarek (talk) 02:39, 6 October 2011 (UTC)[reply]
Today it is working for me as well, even though I didn't do anything (was going to turn my other scripts for a while). Perhaps it is due to something the upgrade team has changed, perhaps not, but the problem has been resolved. Sorry for taking everyone's time with this. Cheers,—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); October 6, 2011; 14:26 (UTC)
I wonder if one of your other scripts was breaking because the "namespace" dropdown was missing from Special:Contributions; it was restored earlier today. Anomie 16:57, 6 October 2011 (UTC)[reply]

Protocol-relative URL

[edit]

Could this line:

importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Anomie/util.js&action=raw&ctype=text/javascript');  // for backwards compat

please be changed to this:

importScriptURI('//en.wikipedia.org/w/index.php?title=User:Anomie/util.js&action=raw&ctype=text/javascript');  // for backwards compat

? --Yair rand (talk) 12:15, 31 October 2011 (UTC)[reply]

I did better and got rid of the need for that line completely. Anomie 15:19, 31 October 2011 (UTC)[reply]

Not working?

[edit]

The script seems to have stopped working for me and I don't know enough to figure out why. Seems to have been sometime in the last couple of days (perhaps even within the last day). I use Chrome and the vector skin.

Checking in IE, this error is reported:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB7.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Mon, 7 Nov 2011 17:41:27 UTC


Message: Object doesn't support this property or method Line: 241 Char: 9 Code: 0

URI: http://en.wikipedia.org/w/index.php?title=User:Anomie/linkclassifier.js&action=raw&ctype=text/javascript

olderwiser 17:45, 7 November 2011 (UTC)[reply]

Try enabling the "JavaScript Standard Library" gadget in your preferences. I recently removed my own compatibility library from this script in favor of jquery, and apparently IE still doesn't support basic functions like Array.map in IE 8. I'd have thought Chrome would work fine, though; apparently not. Anomie 21:39, 7 November 2011 (UTC)[reply]
Thanks for the reply. But I did already have that selected in preferences. Just to be sure, I deselected and reselected it, but to no avail. olderwiser 23:25, 7 November 2011 (UTC)[reply]
Linkclassifier works fine here using Monobook skin with Chrome (14.0.835.202) (and Firefox 7.0.1 for that matter), but as Bkonrad reports above, it stopped working some time ago with IE8. Following your suggestion to enable the "JavaScript Standard Library" gadget, IE8 now works again. -- Michael Bednarek (talk)
Bypass your cache and try it now. Anomie 03:00, 8 November 2011 (UTC)[reply]
Your recent changes at User:Anomie/linkclassifier.js didn't make any difference here: IE8 only works with the "JavaScript Standard Library" gadget selected, Chrome and Firefox continue to work with or without it. In short: I have no problem. -- Michael Bednarek (talk) 11:47, 8 November 2011 (UTC)[reply]
I didn't expect any change for you, Michael; the query was to Bkonrad. When I looked into it, I found that the JSL was providing Array.prototype.map but not Array.map. Anomie 14:56, 8 November 2011 (UTC)[reply]
It appears to be working just fine now. Thanks. olderwiser 16:08, 8 November 2011 (UTC)[reply]

Class style key

[edit]

Thank you for this very useful tool which I've just discovered. I've compiled a colour key for my own use and thought it may be handy for other editors. Obviously the styles will change when anyone copies and amends the .css and .js files rather than linking to your originals.

Classes which don't have a style but which users could add to their own .css files:

  • needs-review – The target page has pending changes in need of review.
  • featured-content – The target page is in one of the Featured Content categories.
  • good-content – The target page is in Category:Good articles.
  • spoken-articles – The target page is in Category:Spoken articles.
  • nonimage – The link is does not have the image class, which is added by MediaWiki to image links.
  • protection-type-level – The target page is protected. type is the type of protection, for example "move", "edit", "create", and level specifies the level, for example "sysop" or "autoconfirmed".
    • protection-type-level-indef – The target page is indefinitely protected.

Please feel free to edit this comment where I've made mistakes. Certes (talk) 16:46, 18 December 2011 (UTC)[reply]

Not a bad idea. I added something similar in tabular form to the documentation. Anomie 03:40, 19 December 2011 (UTC)[reply]

Coloring of "set index" pages

[edit]

I can see in User:Anomie/linkclassifier.js that Category:All set index articles are dealt with; however, I don't see any coloring for "set-index" in User:Anomie/linkclassifier.css. I've attempted to add something in my User:Michael Bednarek/monobook.css, but it has no effect. What is the correct way to do this? -- Michael Bednarek (talk) 10:29, 19 December 2011 (UTC)[reply]

That should work fine, unless you're actually using Vector instead of Monobook. Anomie 12:07, 19 December 2011 (UTC)[reply]
On second glance, try removing the "//"-style comments from the file. IIRC CSS only supports "/* */"-style comments. Anomie 12:11, 19 December 2011 (UTC)[reply]
I'm using Monobook, and changing the comment syntax and taking the A.set-index statement to the top doesn't make a difference. I'm using Category:All set index articles as a test case where I expect all members to be colored. It's not a major deal; thanks for looking at it. -- Michael Bednarek (talk) 13:11, 19 December 2011 (UTC)[reply]
Sorry for butting in. I can't really help with why it isn't working for you, but I copied the same line to my css, and it works as expected. Perhaps a cache purge is all you need?—Ëzhiki (Igels Hérissonovich Ïzhakoff-Amursky) • (yo?); December 19, 2011; 14:25 (UTC)

Problem with mw 1.19

[edit]

Since the upgrade I'm getting

Uncaught Error: Unknown dependency: mw.util

The full stack seems to be

Uncaught Error: Unknown dependency: mw.util
recurse load.php:144
resolve load.php:145
resolve load.php:145
loader.using load.php:154
LinkClassifier.classifyChildren index.php:243
LinkClassifier.onDemand index.php:292
LinkClassifier.onLoad index.php:286
jQuery.Callbacks.fire load.php:14
jQuery.Callbacks.self.add load.php:14
jQuery.fn.jQuery.ready load.php:4
(anonymous function)

JohnBlackburnewordsdeeds 02:48, 1 March 2012 (UTC)[reply]

I haven't noticed any error message in Chrome and I don't know when 1.19 went live, but linkclassifier has not been working for me today. olderwiser 03:32, 1 March 2012 (UTC)[reply]
I saw it too. Should have been "mediawiki.util". Fixed now. Anomie 03:35, 1 March 2012 (UTC)[reply]
Thanks, working again. olderwiser 03:40, 1 March 2012 (UTC)[reply]
Yes, working here thanks (though I had to empty Chrome's cache for it to pick up the change, grr).--JohnBlackburnewordsdeeds 13:20, 1 March 2012 (UTC)[reply]

Per Wikipedia:Village pump (technical)#Visited external links are not changing to purple we now need to add .mw-body. ---— Gadget850 (Ed) talk 12:45, 2 March 2012 (UTC)[reply]

The styles in User:Anomie/linkclassifier.css use #bodyContent a.extiw and the like, which has a higher specificity than .mw-body a.extiw and the like. Looks like they reduced the specificity in Monobook at the same time they raised it for Vector. Anomie 16:50, 2 March 2012 (UTC)[reply]

Request: highlight blocked users

[edit]

I don't know whether this is possible, but it would be nice if the color of blocked user name/ip links could be changed. This would be useful on pages like Special:RecentChanges. You could use the user's block log, but the trick would be to check for expired blocks. If this is going to be a lot of work, don't bother, it's just a nice-to-have request. Thanks. —Bruce1eetalk 07:55, 30 March 2012 (UTC)[reply]

I suppose that already exists as User:NuclearWarfare/Mark-blocked script.js. (For the actual source code, see ru:MediaWiki:Gadget-markblocked.js.) Are you having any problems using both scripts together? SoledadKabocha (talk) 04:15, 24 May 2012 (UTC)[reply]
I didn't know about NW's script. I've tried it in my vector.js‎ and it works, and it doesn't appear to clash with anything else. Thank you for your help! —Bruce1eetalk 05:31, 24 May 2012 (UTC)[reply]

Linkclassifier and Pending Changes Protection

[edit]

I think that your script should be able to support Pending Changes protection. Even though it is being commented on right now, there are test pages using PC right now.

protection-review-autoconfirmed should work for Level 1 protection, level two should get protection-review-sysop. James1011R (talk, contribs) 01:34, 13 April 2012 (UTC)[reply]

The problem is that there is no straightforward way to query the pending changes protection level for a page. See T26068. Anomie 10:56, 13 April 2012 (UTC)[reply]

Redirects to sections

[edit]

Could we consider adding a class for redirects to sections?

(By the way, why does the script add a "redirect" class when the MediaWiki software already does mw-redirect? Is there any reason other than convenience?) SoledadKabocha (talk) 17:24, 14 June 2012 (UTC)[reply]

The only way to determine if a redirect is a redirect to a section is to load the wikitext of the redirect and parse it; doing this for all the redirects in the page seems too much load for such a minor gain. This script is already rather heavy on larger pages.
As for mw-redirect, when the script was written mw-redirect wasn't there yet and I never felt like breaking backwards compatibility. Anomie 20:27, 14 June 2012 (UTC)[reply]
I've JS code for reverse, a WhatLinksHere with section grouping. It uses prop=revisions with gblfilterredir=redirects to get 50 redirect pages for each API request. This probably still too expensive for every page loaded. — Dispenser 19:20, 15 June 2012 (UTC)[reply]
Why can't we just check whether the page is in Category:Redirects to sections, as (the wikicode of) my original post was meant to suggest? I realize this may not be 100% accurate though — and really, people do too poor a job of categorizing such redirects for the category to be of much help. (Sorry, I suppose I answered my own question...) SoledadKabocha (talk) 01:36, 16 June 2012 (UTC)[reply]

Protection status of redirects

[edit]

For redirect pages, the script seems to obtain the protection status from the redirect target. Is this intentional? I would have wanted to use it to check the protection status of the redirects itself.

I had a quick glance at the source code but didn't figure out the reason for this behavior.

Test cases as of now, where the relevant protection is edit-sysop: UCR mascot Highlander (protected redirect to unprotected page); User talk:JuJube (unprotected redirect to protected page) SoledadKabocha (talk) 00:34, 13 August 2012 (UTC)[reply]

The reason is that the API query used specifies redirects=1 (currently at line 264 of the script). If it didn't do this, it would need to make additional queries to get the information about the redirect targets, which is generally more useful. Anomie 20:32, 13 August 2012 (UTC)[reply]
For what it's worth, I managed to implement this in a way that allows checking for the protection status of both the redirect targets and the redirects themselves. (Ignore the line numbers; my copy of the script has other added features, which I may talk about later if I think any are worthwhile feature requests.) --SoledadKabocha (talk) 17:02, 29 October 2012 (UTC)[reply]
I realized a few months ago that I was already making queries about the redirects, so I could just add to the existing query as you seem to have done there. But I've been so busy with other stuff I never had a chance to come back to it. So I did it now. Anomie 01:24, 30 October 2012 (UTC)[reply]
Ok, thank you very much for showing me a more efficient way to do what I intended (which I have merged in my copy). I had no real JS experience before hacking around with scripts on Wikipedia, so I didn't realize exactly what object "this" represented in that part of the code... --SoledadKabocha (talk) 04:42, 30 October 2012 (UTC)[reply]
If you haven't found them already, you might find these links useful:
Google tends to be helpful too, but watch out for outdated information. Also watch out if you intend to support older browsers, particularly Internet Explorer. Anomie 12:27, 30 October 2012 (UTC)[reply]

Featured article reviews and former featured articles

[edit]

Is there any easy way to detect articles that are under featured article review, or former featured articles? I'm guessing not, since there are no categories for these things; I may have answered my own question again, but I'm posting this here just in case I'm missing something. SoledadKabocha (talk) 05:29, 21 August 2012 (UTC)[reply]

Run on Preview and post Save

[edit]

It would be useful to run this script immediately a user has added a link to avoid adding disambiguation links. The best opportunity is after the user saves or previews their text for correctness by matching window.location.href or document.referer to something like /[&?]action=edit\b/. This avoids wasting resources on simply browsing. — Dispenser 15:40, 16 October 2012 (UTC)[reply]

Such a thing could be done easily enough by calling LinkClassifier.onDemand() based on whatever conditions you wanted. As long as it doesn't get too huge, feel free to add an example to the documentation. BTW, the best way to do it would be to check if mw.config.get('wgAction') returns 'edit' or 'submit'. Anomie 16:25, 16 October 2012 (UTC)[reply]

Hooks for scripts

[edit]

I'd like to change the disambiguation links to button to my Dab solver tool. I don't see anyway to hook it in. — Dispenser 15:43, 16 October 2012 (UTC)[reply]

What sort of hook are you wanting, exactly? Anomie 16:29, 16 October 2012 (UTC)[reply]
Whenever LinkClassifier.onDemand() finishes, but I guess I could hijack the function. — Dispenser 21:19, 19 May 2014 (UTC)[reply]

Thanks!

[edit]

Just wanted to say thanks for linkclassifier! I'm glad there are generous computer-savvy people like you that provide this sort of thing for non-computer-savvy people like me :) --Fishicus (talk) 02:03, 8 February 2013 (UTC)[reply]

LinkClassifierOnDemand=true; //Not working

[edit]

Hello. I'm trying to use your script (which I'll likely modify a little later to better suit me) and the " LinkClassifierOnDemand=true;" doesn't seem to be working. The script is loading and running all of the time even without clicking the link to turn it on. I'm assuming it is suppose to be off when pages load until you turn it on. If I am incorrect about this and it is a toggle feature, do you think the link could be reworded to indicate its current status "Turn Link Classifier ON" or "Turn Link Classifier OFF"? Thank you. Technical 13 (talk) 16:10, 12 April 2013 (UTC)[reply]

Seems to work fine when I try it. Anomie 21:22, 12 April 2013 (UTC)[reply]

span class="plainlinks" around an entire page

[edit]

It looks like WP:Lamest edit wars does that, thus interfering with the ability of linkclassifier to apply background colors, such as for disambiguations. What CSS workaround do you suggest? (Is this a specificity issue?) --SoledadKabocha (talk) 05:42, 27 July 2013 (UTC)[reply]

plainlinks uses !important, which means the linkclassifier rules would have to use !important too. Better, IMO, would be for plainlinks to be targeted to avoid internal links. Anomie 21:19, 27 July 2013 (UTC)[reply]
The use of <div class="plainlinks"> in that article seems just lazy to me. The article should use templates of the family {{Diff}}, {{Oldid}}, {{Querylink}}, etc, or the English Wikipedia should treat all links to …//en.wikipedia.org/ automatically as internal links, as the German Wikipedia seems to do. -- Michael Bednarek (talk) 12:02, 28 July 2013 (UTC)[reply]
[edit]

I think the instructions at User:Anomie/linkclassifier#Usage should be updated, to replace the "addOnloadHook(function() {addPortletLink" with "mw.util.addPortletLink" - but I'm not exactly sure....

(I think this is right? There seem to be 51 other instances, which might benefit from the fix too.) HTH. –Quiddity (talk) 03:15, 29 June 2014 (UTC)[reply]

That should be ok; the user js is loaded at the end of the page, so waiting for onReady is probably not necessary. Feel free to update the instructions. Anomie 11:03, 29 June 2014 (UTC)[reply]

Suggestion

[edit]

I think when you hover over a coloured link it says what the colour means as it is hard to remember everyone one of the colour codes. Cheers NickGibson3900 - Talk - Sign my Guestbook 07:03, 21 July 2014 (UTC)[reply]

(talk page stalker) @NickGibson3900: Have you tried Wikipedia:Tools/Navigation popups ? hover over the link and it will show you a snapshot of the page. Mlpearc (open channel) 07:12, 21 July 2014 (UTC)[reply]
Mlpearc I specifically meant hovering over the link just saying what that colour means (e.g. redirect, stub etc.)

Disambig lnks

[edit]

Is there a way to exclude the template namspace when dealing with disambiguation links ? Mlpearc (open channel) 03:47, 22 July 2014 (UTC)[reply]

[edit]

I added this "to be run on demand" and noticed that, even when disabled, the red and blue link colors for visited links became closer to those for unvisited links. --NE2 15:04, 23 July 2014 (UTC)[reply]

I suspect that is not an effect of linkclassifier but a local browser function. -- Michael Bednarek (talk) 05:29, 24 July 2014 (UTC)[reply]
I don't see how it could be. It started when I added it to my skin.js and ended when I removed it. --NE2 08:13, 24 July 2014 (UTC)[reply]
Assuming the problem is the "even when disabled" part, rather than the overall choice of colors: This is probably due to linkclassifier.css being loaded unconditionally even when the portlet link hasn't been clicked on yet. This could probably be solved by creating a wrapper function that has importStylesheet('User:Anomie/linkclassifier.css'); LinkClassifier.onDemand(); in it and changing the portlet link to call that. --SoledadKabocha (talk) 02:10, 16 April 2015 (UTC)[reply]

Anchor (un)encoding

[edit]

The line that deals with reversing MediaWiki's anchor encoding has a regex /\.([0-9A-F][0-9A-F])/gi.

I think it should be /\.([2-7A-F][0-9A-F])/g, but that still needs a special case of some kind to avoid or re-encode 7F.

The code points at 0x, 1x, 7F, 8x, and 9x are control characters, which should never really be present in an anchor. If an anchor contains .00, it's probably because someone actually typed .00.

As for case sensitivity, the MediaWiki software always seems to capitalize A-F when encoding anchors, so allowing insensitivity just adds a risk of false positives.

For test cases, see User:SoledadKabocha/sandbox#.7F and the two headings above it (point to the corresponding links in the TOC). --SoledadKabocha (talk) 02:27, 16 April 2015 (UTC)[reply]

To clarify: There also appears generally to be some mishandling (i.e. mojibake) of various accented letters. I don't know how to fix that, nor do I have a specific test case handy, so this discussion is only about the control-character code points which should not be parsed at all. --SoledadKabocha (talk) 20:55, 3 May 2015 (UTC) (ED: may revisit this later 20:38, 5 May 2015 (UTC))[reply]

Question about "run on demand" mode (vector skin)

[edit]

Hello, I had installed linkclassifier in my vector.js copying the 4 lines for "run on demand" exactly 1:1. This added a new list item to my "More" tab in article namespace and worked great. However, trying to use the script in my own user pages, I don't see the same function. Since then I have switched to automatic handling with only 2 lines of installation code (per documentation), which works fine in article and user namespace. Is the "run on demand" mode supposed to work in user namespace? If not, could you activate the "run on demand" function for user namespace as well please? GermanJoe (talk) 17:38, 10 June 2015 (UTC)[reply]

Never mind. I am obviously blind (or the script loaded slowly the first time). Tested again - now the "run on demand" function is visible in user pages as well (in the "More" tab). Sorry for bothering :). GermanJoe (talk) 17:48, 10 June 2015 (UTC)[reply]
[edit]

Check out this link: Template:Welcome. By default, it'll appear pink; for me, it appears in a red box. It's not nominated for deletion, though, a template that's transcluded on the documentation page is. Is there a way to fix that? Eman235/talk 20:38, 8 September 2015 (UTC)[reply]

All the script knows is that the linked page is in Category:Templates for deletion. A template being transcluded shouldn't be applying that category, but I suppose the TFD template is only checking "apply category if I'm being transcluded in the Template namespace". Anomie 21:07, 8 September 2015 (UTC)[reply]
I've brought this over to the technical village pump. Eman235/talk 03:56, 9 September 2015 (UTC)[reply]

Categories in talk page of the target page

[edit]

Hello, Anomie. Some links are worth to be colored, but the category is in target's talk page. (For example Category:Requested moves) Colour for assessment class (Category:X-Class *** articles) is also interesting. How to edit the script so that it can check categories both in one page and its talk page? --Swords in the Wind (talk) 10:36, 28 December 2015 (UTC)[reply]

[edit]

As the title says, the script is beautiful, gorgeous in fact, but I cannot use the link function with it. Iazyges Consermonor Opus meum 04:31, 29 September 2016 (UTC)[reply]

Deletion highlighting needs a tweak

[edit]

Category:Wikipedia files for deletion was renamed to Category:Wikipedia files for discussion last November. The script needs to be updated to reflect this. -- John of Reading (talk) 10:10, 6 October 2016 (UTC)[reply]

 Done Thanks Anomie 18:44, 6 October 2016 (UTC)[reply]
[edit]

I love this tool, but my one major complaint is that it doesn't seem to work at all in visual editor, which is what I use most of the time to edit. If you could somehow make it work even in visual editor the same as it works normally when reading an article, that would be fantastic!--Chicowales (talk) 00:53, 19 November 2016 (UTC)[reply]

Linked misspellings

[edit]

Would it be possible to highlight links to redirects that are tagged with {{R from misspelling}}? wbm1058 (talk) 16:57, 19 November 2016 (UTC)[reply]

Since the template puts the redirects into Category:Redirects from misspellings, you'd just have to add an entry to LinkClassifier.cats. Anomie 20:45, 20 November 2016 (UTC)[reply]
Thanks, I've got the highlighter part working. Hopefully I didn't break anything. But then I was disappointed to find Wikipedia talk:Tools/Navigation popups/About fixing redirects#Is this still a feature? Any chance that Navpops' redirect fixer could be enabled for me? wbm1058 (talk) 00:52, 21 November 2016 (UTC)[reply]
I don't know anything about Navpops, sorry. Anomie 16:52, 21 November 2016 (UTC)[reply]
I posted a question a week ago at Wikipedia talk:Tools/Navigation popups#Fixing redirects - does it work? If you can read Javascript, I'd appreciate it if you could figure out whether the code I cited works, and if so, how to successfully use it, and if not, what it would take to fix it to work. Haven't gotten any responses yet. Thanks, wbm1058 (talk) 16:19, 28 November 2016 (UTC)[reply]

Yet another deletion category

[edit]

Please add the new Category:All files proposed for deletion to the list of deletion categories. -- John of Reading (talk) 11:07, 23 April 2017 (UTC)[reply]

Done. Anomie 13:17, 23 April 2017 (UTC)[reply]

My Userpage + talk is shown as a disambig

[edit]

Hey. Problem is the above title, and I've no idea why this is so.

I've tried to following to no avail

  • commented out my entire userpage
  • check the .css file and other pages with same coloring, found three but I'm still not sure.

Looks like it just affects me and I bet it's due to some quirky thing I did before, though this used to never happen and only noticed it now (I've been inactive here since several months). Ugog Nizdast (talk) 06:25, 8 November 2017 (UTC)[reply]

@Ugog Nizdast: (talk page stalker) That yellow colouring isn't from the link classifier; it's from User:PleaseStand/highlight-comments.js -- John of Reading (talk) 07:25, 8 November 2017 (UTC)[reply]
*bangs head against wall* you're right, so obvious. It did come across my mind, but I didn't realise they both use an almost identical looking coloring. Will customise that.
Been away for too long. Thanks a lot and have a good day, Ugog Nizdast (talk) 11:12, 8 November 2017 (UTC)[reply]

Possible issue

[edit]

I currently have this script active but it seems like it doesn't show links anymore on Ubinas, although on Pong the non-free image border does show up. Jo-Jo Eumerus (talk, contributions) 10:42, 2 June 2018 (UTC)[reply]

Seems to be working fine for me, I see several dab links highlighted for example. Why do you think it's not working? Are you seeing any errors in your browser's error console? Anomie 11:39, 2 June 2018 (UTC)[reply]
On Firefox, for JS that only shows a bunch of "Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist." errors. Jo-Jo Eumerus (talk, contributions) 11:56, 2 June 2018 (UTC)[reply]

Use on :sr:

[edit]

Do you know why I don't get my link "Обоји везе" in drop-down menu. I get it only on this page itself, sr:Корисник:Obsuser/common.js; on pages other than this one nothing shows up. Thanks.

My navbox script is not being loaded either... --Obsuser (talk) 04:14, 26 January 2019 (UTC)[reply]

Linkclassifier not indicating redirects on some pages

[edit]

Greetings,

I've noticed on Honolulu Volcanics that some redirects - such as Koolau which redirects to Koʻolau Range aren't being marked as such. Is there a reason for this? Jo-Jo Eumerus (talk, contributions) 08:29, 22 April 2019 (UTC)[reply]

I see five (green) marked redirects in the first paragraph there (and here) with Firefox, Chrome: Rejuvenated stage volcanism, Koolau, Lava flow, Tuff cone, Volcanic island. They take a fraction of a second to get colored, but they do. -- Michael Bednarek (talk) 12:07, 22 April 2019 (UTC)[reply]
Well, it's taking a lot more than a fraction of a second here, in fact they don't appear even after a minute. Jo-Jo Eumerus (talk, contributions) 14:18, 22 April 2019 (UTC)[reply]
I assume @Jo-Jo Eumerus either figured this out or gave up in the past 2.5 years, but to close loop for anyone else having trouble (as I initially was just now), note that this script should be installed at your skin-specific Javascript file instead of your typical common.js file--which is the default location that script-installer will try to install to. The documentation page says this, but it's easy to miss if trying to use an installer script straight from the User:Anomie/linkclassifier.js page. -2pou (talk) 20:06, 7 September 2022 (UTC)[reply]
I have the script and its CSS files installed at my User:Michael Bednarek/common.js, and it works. My skin is MonoBook, but I don't have anything in User:Michael Bednarek/monobook.js. -- Michael Bednarek (talk) 01:42, 8 September 2022 (UTC)[reply]
I didn't figure it out (it's still on User:Jo-Jo Eumerus/common.js) but I did now change it. Let's see if it works. Jo-Jo Eumerus (talk) 08:09, 8 September 2022 (UTC)[reply]
Hmm, how did I not see this in 2019? It shouldn't matter which of the pages you install it on. The instructions here were probably written before user common.js existed.
As for the problem described, all I can say is it works for me currently on Honolulu Volcanics. You might check your browser's console for errors, perhaps one of the API calls is failing somehow? Anomie 12:03, 8 September 2022 (UTC)[reply]
It seems to work today, anyhow. Jo-Jo Eumerus (talk) 12:59, 8 September 2022 (UTC)[reply]

Some suggestions

[edit]

I've forked the LinkClassified a while back. The current differences are here (.js) and here (.css).

While some of those shouldn't be merged here (specifically, the abbreviation classifications / diacritic classifications I'm using to help with WP:JCW), the others should probably be backported to the original link classifier. Specifically, adding

to the 'deletion/discussion' category, and the addition of a typo/mispelling class that uses orange for

Headbomb {t · c · p · b} 17:10, 20 August 2019 (UTC)[reply]

No objection as long as it doesn't significantly increase processing time and doesn't break anything. -- Michael Bednarek (talk) 04:10, 21 August 2019 (UTC)[reply]
AFCIAT, it's just going from 47 → 53 categories. If there's a performance cost, it's unnoticeable. Been using this for over a year now without issue. Headbomb {t · c · p · b} 04:17, 21 August 2019 (UTC)[reply]
Hmm, User:Wbm1058 had already added individual classes for Category:Redirects from misspellings and Category:Redirects from miscapitalisations. I think I'll merge those with the other two as suggested here.

Note that the script is designed such that you should be able to adjust the list without forking the whole script. I added instructions on doing that to User:Anomie/linkclassifier#Usage.

BTW, that Usage section currently says the script has only been extensively tested on Monobook. If any of you have been using it on Vector, feel free to remove that line. Anomie 11:20, 21 August 2019 (UTC)[reply]
That works to add new categories, but won't work to add new classes. Headbomb {t · c · p · b} 15:39, 21 August 2019 (UTC)[reply]
Yes it does. I've used it to add a new class since 2015. Anomie 21:57, 21 August 2019 (UTC)[reply]
What's the trick then, you need to have a custom .css on top of the hook? Headbomb {t · c · p · b} 00:29, 22 August 2019 (UTC)[reply]
You need CSS that applies styles based on your new class, yes. You can easily put that in your common.css. Anomie 00:50, 22 August 2019 (UTC)[reply]
User:Wbm1058/vector.css sets up different background colors for linked-misspellings and linked-miscapitalisations. I've worked the lists at Wikipedia:Database reports/Linked misspellings and Wikipedia:Database reports/Linked miscapitalizations, and personally place a higher priority on clearing the outright misspellings. The purpose of highlighting these is to make them easier to find after they appear on the database reports. I fix them using using popups – see User:Wbm1058/vector.js. Category:Redirects from incorrect disambiguation appears to be a pile of junk, which I just briefly waded into, and am now quickly leaving, lest I get stuck in that quagmire. I'm not sure I see the point of highlighting them. Category:Redirects from incorrect names probably needs some love, but with out a database report for that, which I asked for here, it's not likely to get any soon. So I guess I need to either replace linked-misspellings { background-color:#ffcccc; } and linked-miscapitalisations { background-color:#ffebeb; } with a single color for incorrect-title, or take some unscheduled time to figure out how to set up my own custom User:Anomie/linkclassifier#Usage. Sigh. wbm1058 (talk) 14:37, 21 August 2019 (UTC)[reply]
@Wbm1058: I'm not a technical user, but I have been using this script for years, custom setup in vector, I'm just courious will any of this concern my setup? Thanx, - FlightTime (open channel) 14:50, 21 August 2019 (UTC)[reply]
@FlightTime: I am not a CSS and Javascript expert, either. On my personal to-do list is taking the freeCodeCamp Javascript course (when I manage to pull myself away from working on Wikipedia tasks). My User:Wbm1058/common.css doesn't have anything relating to the linkclassifier. Rather, my User:Wbm1058/vector.js imports this with:
importScript('User:Anomie/linkclassifier.js'); // Linkback: User:Anomie/linkclassifier.js
It doesn't appear to me that you are actually importing this (User:FlightTime/vector.js), so changes here should have no effect on your current setup. Buit don't quote me on that ;) – wbm1058 (talk) 15:36, 21 August 2019 (UTC)[reply]

Customization

[edit]

How can I customize it according to my wish. For example, I want redirect to be shown as cyan-coloured and many other colour changes according to my need. Thank you. Empire AS Talk! 06:00, 10 September 2020 (UTC)[reply]

As mentioned several times above, e.g. at #Link Clasifier, you could copy User:Anomie/linkclassifier.css to Special:Mypage/common.js and then modify its values. Make sure that you don't import that file into Special:Mypage/common.js. -- Michael Bednarek (talk) 06:41, 10 September 2020 (UTC)[reply]
Michael Bednarek Where to paste this css, in js or in css? I didn't understand what 'that file' mean in your above reply? Did you mean to say this script's css? But your reply appears to be contradicted as it says that import it to js and then don't import to js. Thank you. Empire AS Talk! 08:59, 10 September 2020 (UTC)[reply]
My mistake; sorry for the confusion. Copy, with cut & paste, the content of User:Anomie/linkclassifier.css to Special:Mypage/common.css, and then modify its values. By "import", I meant the instruction importStylesheet('User:Anomie/linkclassifier.css');, which should not be in that .css, nor in Special:Mypage/common.js. -- Michael Bednarek (talk) 10:27, 10 September 2020 (UTC)[reply]
I've done. But to customize it, can you give me a list of all colours to customize it. Thank you. Empire AS Talk! 12:09, 10 September 2020 (UTC)[reply]
I have no aptitude for picking colours. Many web sites provide an interactive service for HTML color conversion. The one at https://www.rapidtables.com/convert/color/rgb-to-hex.html looks very easy to use. -- Michael Bednarek (talk) 12:17, 10 September 2020 (UTC)[reply]
Thank you for helping me out in customization. Thank you. Empire AS Talk! 12:32, 10 September 2020 (UTC)[reply]

Examples

[edit]

@Anomie: Can you add some examples to test whether or not the script is working/is installed correctly? Thanks! ― Qwerfjkl | 𝕋𝔸𝕃𝕂  (please use {{reply to|Qwerfjkl}} on reply) 22:02, 26 May 2021 (UTC)[reply]

I agree this would also be useful.
I've made a test page, User:Jim Grisham/Scripts/Test pages/LinkClassifier; feel free to edit it to add new styles if I missed any (or if the script is updated in the future).
- Jim Grisham (talk) 22:15, 19 June 2024 (UTC)[reply]

Use on MediaWiki

[edit]

This is probably far outside the intended use, but just FYI in case I missed something simple.
I load the same common.js on all of the wikis and this can pull in the same set of user scripts via my main common.js, but I had to disable the linkclassifier on MediaWiki.
There seems to be a CSS explosion when the disambiguation class is added to the mw-pt-languages-list. The rule .mw-parser-output .disambiguation adds display: flex; which causes all sorts of chaos.
For example — see the "Other languages" bar in mw:Editor when the linkclassifier is in use. — GhostInTheMachine talk to me 14:10, 11 February 2022 (UTC)[reply]

@GhostInTheMachine: That's from mw:Template:Disambiguation/styles.css, apparently mw:Template:Disambiguation is also using the class "disambiguation". You could make use of the hook described at User:Anomie/linkclassifier#Usage to delete "disambiguation" from the .cats and .props. Anomie 21:37, 11 February 2022 (UTC)[reply]
Thanks. A long term fix might also be to rename any classes specifically added by the script to linkclassifier-disambiguation etc. That would also reduce the chance of other clashes in the future — GhostInTheMachine talk to me 14:34, 12 February 2022 (UTC)[reply]
The drawback to that it that it would break any custom CSS anyone using the script has added to adjust the highlighting. Anomie 20:36, 12 February 2022 (UTC)[reply]

Javascript error

[edit]

Hello. I've been getting a Javascript Error with your link sequencer. Specifically, "URIError: malformed URI sequence" for line 248. This has come up multiple times recently while looking around English Wikipedia. Thought I'd let you know. Thanks :) MrLinkinPark333 (talk) 01:04, 6 December 2022 (UTC)[reply]

Same here, intermittently. -- Michael Bednarek (talk) 03:27, 6 December 2022 (UTC)[reply]
Added some error handling. Anomie 12:37, 6 December 2022 (UTC)[reply]

Does this work in other projects?

[edit]

Hope so: I tried to link from pt:Usuário:Tuvalkin/monobook.js. Eitherway, thanks for this! Tuvalkin (talk) 21:59, 3 February 2023 (UTC)[reply]

You'll probably have to follow the instructions for adjusting the list of categories to replace the list entirely with the correct categories (and also adjust the value of linkClassifier.intentionaldab) for the target wiki. Also the "has-draft" thing probably won't work since, if there's a Draft namespace at all, it's probably not named "Draft" and the script does not make that configurable. Other than that, there's a good chance it will work. Anomie 13:39, 4 February 2023 (UTC)[reply]

Pages marked as historical

[edit]

Would it be feasible to add a setting for pages marked with {{Historical}}? I have pages in a WikiProject I've marked as such, and it would be nice to have those files display with a different color, like when I as the project maintainer look at pages in the Subpages list. Stefen Towers among the rest! GabGruntwerk 20:12, 3 January 2024 (UTC)[reply]

You could follow the instructions at User:Anomie/linkclassifier#Usage to add a class for Category:Inactive project pages to .cats in your vector.js. The script doesn't currently allow for looking for a template directly, since templates of interest normally add categories. Anomie 23:30, 3 January 2024 (UTC)[reply]
Wow, that's pretty darn powerful! Thank you for your assistance and your work! Stefen Towers among the rest! GabGruntwerk 00:36, 4 January 2024 (UTC)[reply]