Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Usage  





2 Legend  





3 Styling  





4 References  














User:Anomie/linkclassifier

















User page
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
User contributions
User logs
View user groups
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 

< User:Anomie

This script adds various classes to the link elements based on various characteristics:

  • deletion – The target page is in one of the many "X for deletion/discussion" categories, or certain speedy deletion categories.[1]
  • disambiguation – The target page is in Category:All disambiguation pages.
    • intentional-disambiguation – The target page's name ends in "(disambiguation)".
  • set-index – The target page is in Category:All set index articles.
  • 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.
  • soft-redirect-cats – The target page (most likely a category link) is in Category:Wikipedia soft redirected categories.
  • spoken-articles – The target page is in Category:Spoken articles.
  • stubcls – The target page is in any category ending in "stubs".
  • nonfree-media – The target page is in Category:All non-free media.
  • nonimage – The link does not have the image class, which is added by MediaWiki to image links.
  • has-draft – The target page is a mainspace page, and the corresponding Draft-namespace page exists.
  • redirect – The target page is a redirect.
    • self-redirect – The target page is a redirect to the current page.
    • broken-redirect – The target page is a redirect to a page that does not exist.
  • incorrect-title – The target page is a redirect from an incorrect title, such as those in Category:Redirects from misspellingsorCategory:Redirects from incorrect names.
  • unprintworthy – The target page is an unprintworthy redirect.
  • unprintworthy-shortcut – The target page is in Category:Redirects from shortcuts.
  • protection-type-level – The target page is protected. If the page is a redirect, the protection status will be obtained from the redirect target. 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.
  • redir-protection-type-level – The redirect to the target page is protected, as above.
  • You can then add CSS rules to apply various visible changes to the different types of links. A number of default rules are available in User:Anomie/linkclassifier.css.

    Usage

    [edit]

    To use the script, add the following to your skin-specific Javascript file.

    importScript('User:Anomie/linkclassifier.js'); // Linkback: [[User:Anomie/linkclassifier.js]]
    importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]
    

    Note that this script has only been extensively tested on Monobook.

    If you want to adjust the list of categories, a hook is provided for that purpose:

    mw.hook( 'LinkClassifier' ).add( function ( linkClassifier ) {
        linkClassifier.cats['my-code'] = [ 'Category:Foo', 'Category:Bar' ].sort();
    } );
    importScript('User:Anomie/linkclassifier.js'); // Linkback: [[User:Anomie/linkclassifier.js]]
    importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]
    

    If you want it to be run on demand (i.e. by clicking a button next to "unwatch"), include it something like this:

    LinkClassifierOnDemand=true;
    importScript('User:Anomie/linkclassifier.js'); // Linkback: [[User:Anomie/linkclassifier.js]]
    importStylesheet('User:Anomie/linkclassifier.css'); // Linkback: [[User:Anomie/linkclassifier.css]]
    
    $.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function() {
        var el = mw.util.addPortletLink('p-cactions', '', 'Link Classifier');
        $(el).on('click', function(e) {
            LinkClassifier.onDemand();
            e.preventDefault();
        } );
    } );
    

    In either case, the line for linkclassifier.css may be omitted, if you would rather add custom CSS rules to your skin-specific CSS file.

    Please note that the line for linkclassifier.css does not go in your skin.css, it goes in your skin.js along with the other lines. Alternatively, you can copy the contentsofUser:Anomie/linkclassifier.css into your skin.css and customize the rules however you would like.

    Legend

    [edit]

    With the default rules, you should see the following types of links:

    Type Normal Visited
    Normal links like this like this
    External links like this like this
    Red links like this like this
    stubcls like this like this
    redirect like this like this
    self-redirect like this like this
    broken-redirect like this like this
    disambiguation like this like this
    intentional-disambiguation like this like this
    soft-redirect-cats like this like this
    deletion like this like this
    unprintworthy like this like this
    Red link, protection-create-sysop-indef like this like this
    image nonfree-media Example Example
    image deletion Example Example

    Styling

    [edit]

    If you want to create your own styles, the following list of colors may or may not be helpful:

    Normal Visited
    bf0000 bf3e3e
    cc6700 cc8843
    bfbf00 bfbf3e
    00bf00 3ebf3e
    00bfbf 3ebfbf
    0033cc 4365cc
    6000bf 7f3ebf
    bf00bf bf3ebf
    bf0066 bf3e83

    References

    [edit]
    1. ^ Due to technical limitations it is currently infeasible to check whether a page was previously speedy deleted.

    Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Anomie/linkclassifier&oldid=1135882956"

    Categories: 
    Wikipedia tools
    Wikipedia links
     



    This page was last edited on 27 January 2023, at 12:58 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki