Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

User:Anomie/linkclassifier

    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 inCategory:All disambiguation pages.
      • intentional-disambiguation – The target page's name ends in "(disambiguation)".
    • set-index – The target page is inCategory:All set index articles.
    • needs-review – The target page haspending changes in need of review.
    • featured-content – The target page is in one of the Featured Content categories.
    • good-content – The target page is inCategory:Good articles.
    • soft-redirect-cats – The target page (most likely a category link) is inCategory:Wikipedia soft redirected categories.
    • spoken-articles – The target page is inCategory:Spoken articles.
    • stubcls – The target page is in any category ending in "stubs".
    • nonfree-media – The target page is inCategory:All non-free media.
    • nonimage – The link does not have theimage 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 inCategory:Redirects from misspellings orCategory:Redirects from incorrect names.
    • unprintworthy – The target page is anunprintworthy redirect.
    • unprintworthy-shortcut – The target page is inCategory: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", andlevel 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 inUser:Anomie/linkclassifier.css.

    Usage

    [edit]

    To use the script, add the following to yourskin-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(){varel=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 yourskin-specific CSS file.

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

    Legend

    [edit]

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

    TypeNormalVisited
    Normal linkslike thislike this
    External linkslike thislike this
    Red linkslike thislike this
    stubclslike thislike this
    redirectlike thislike this
    self-redirectlike thislike this
    broken-redirectlike thislike this
    disambiguationlike thislike this
    intentional-disambiguationlike thislike this
    soft-redirect-catslike thislike this
    deletionlike thislike this
    unprintworthylike thislike this
    Red link,protection-create-sysop-indeflike thislike this
    imagenonfree-mediaExampleExample
    imagedeletionExampleExample

    Styling

    [edit]

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

    NormalVisited
    bf0000bf3e3e
    cc6700cc8843
    bfbf00bfbf3e
    00bf003ebf3e
    00bfbf3ebfbf
    0033cc4365cc
    6000bf7f3ebf
    bf00bfbf3ebf
    bf0066bf3e83

    References

    [edit]
    1. ^Due to technical limitations it is currently infeasible to check whether a page waspreviously speedy deleted.
    Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Anomie/linkclassifier&oldid=1135882956"
    Categories:

    [8]ページ先頭

    ©2009-2025 Movatter.jp