Last modified: 2014-09-24 01:26:07 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14509, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12509 - Add a CSS class to target IP user pages
Add a CSS class to target IP user pages
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: css 22771
  Show dependency treegraph
 
Reported: 2008-01-05 02:09 UTC by rememberthedot
Modified: 2014-09-24 01:26 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
SkinTemplate patch (693 bytes, patch)
2008-01-05 02:10 UTC, rememberthedot
Details
MonoBook.php patch (890 bytes, patch)
2008-01-05 02:10 UTC, rememberthedot
Details
SkinTemplate.php patch (788 bytes, patch)
2008-01-05 02:38 UTC, rememberthedot
Details

Description rememberthedot 2008-01-05 02:09:16 UTC
Please add a CSS class that targets IP user pages. This would be useful for applying custom CSS rules to IP user pages. For example, a user could choose to set "visibility:hidden" on all IP user page links, because IP addresses generally do not use user pages. The CSS to do that could be:

.ns-3.ip-userpage #ca-nstab-user a {
    visibility: hidden;
}

Or the following could be used to make gray, but not remove, links to nonexistant user pages:
.ns-3.ip-userpage #ca-nstab-user.new a {
    color: #7D7D7D;
}

I've created a patch, based on MediaWiki 1.11.0, that provides this behavior. It adds "ip-userpage" to <body>'s class attribute.

Since this isn't a major change, hopefully you developers will be more willing to implement it ;-)
Comment 1 rememberthedot 2008-01-05 02:10:02 UTC
Created attachment 4507 [details]
SkinTemplate patch
Comment 2 rememberthedot 2008-01-05 02:10:22 UTC
Created attachment 4508 [details]
MonoBook.php patch
Comment 3 rememberthedot 2008-01-05 02:38:45 UTC
Created attachment 4509 [details]
SkinTemplate.php patch

Fixed patch to prevent ip-userpage class from appearing outside the User and User_talk namespaces
Comment 4 Brion Vibber 2008-01-07 18:53:39 UTC
That would hide or gray out links that are *on* an IP user page, not links *to an IP user page.
Comment 5 rememberthedot 2008-01-09 04:40:08 UTC
Look again. It does nothing of the kind.
Comment 6 rememberthedot 2008-01-10 02:01:07 UTC
It could be used to gray out all links on an IP user page, but I doubt anyone will want to do that, and that's not what I intended this code to be used for. I intend to use it to gray out the "user page" tab for IP editors, rather than having it appear in glaring red.
Comment 7 p858snake 2011-04-30 00:09:37 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 8 Sumana Harihareswara 2011-11-06 14:25:34 UTC
Adding the "design" keyword since this is partly a visual design change.
Comment 9 Roan Kattouw 2011-11-20 18:01:54 UTC
These patches don't apply at all, marking them as obsolete.

pageclass et al seem to have disappeared in one of the recent skin system refactorings, so I don't really know how to apply this to trunk.

Removing design keyword, it's not really needed IMO because the default design isn't changed at all, this'll just enable people to do certain things in their own CSS more conveniently.
Comment 10 Sumana Harihareswara 2011-11-20 20:52:05 UTC
rememberthedot, are you interested in revising this patch to work with current trunk?  Thanks!
Comment 11 Daniel Friesen 2011-11-21 09:45:08 UTC
The proper way to do this now in current code:
- Use userpage-anon and userpage-user for classes, they fit in better with the ns-* page-* pattern that we already have going with classes. ip-userpage is an odd break from that. (note don't use something like page-anonuser since that would conflict with a page titled [[Anonuser]])
- Code would go in OutputPage::headElement, likely right after the `$bodyAttrs['class'] .= ' ' . $sk->getPageClasses( $this->getTitle() );` line.
- You'd probably move the $this->getTitle() from that to a $title variable and use it in getPageClasses as well.

if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) {
  // Don't show the class on subpages
  if ( !$title->isSubpage() ) {
    $bodyAttrs['class'] .= ' ' . ( User::isIP( $this->getTitle() ) ? 'userpage-anon' : 'userpage-user' );
  }
}

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links