Jump to content

MediaWiki talk:Common.js/Archive 7

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shadowbot3 (talk | contribs) at 00:01, 1 July 2007 (Automated archival of 2 sections from MediaWiki talk:Common.js). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

/***** subPagesLink ********
* Adds a link to subpages of current page
*
*  Maintainers: [[:he:משתמש:ערן]], [[User:Dschwen]]
*
*  JSconfig items: bool JSconfig.subPagesLink
*                       (true=enabled (default), false=disabled)
****/
var JSconfig =
{
subPagesLink : true
}

var subPagesLink =
{ 
//
// Translations of the menu item
//
i18n :
{
  'de': 'Unterseiten',
  'en': 'Subpages',    // default
  'es': 'Subpáginas',
  'fr': 'Sous-pages',
  'he': 'דפי משנה',
  'it': 'Sottopagine',
  'ru': 'Подстраницы'
},

install: function()
{
  // honor user configuration
  if( !JSconfig.subPagesLink ) return;

  if ( document.getElementById("t-whatlinkshere") 
       &&  wgNamespaceNumber != -2   // Media: (upcoming)
       &&  wgNamespaceNumber != -1   // Special:
       && wgNamespaceNumber != 6     // Image:
       &&  wgNamespaceNumber != 14   // Category:
     )
  {
   var subpagesText = subPagesLink.i18n[wgUserLanguage] || subPagesLink.i18n['en'];
   var subpagesLink ='/wiki/Special:Prefixindex/' + wgPageName +'/';

   addPortletLink( 'p-tb', subpagesLink, subpagesText, 't-subpages' );
  }
}
}
addOnloadHook(subPagesLink.install);

I tried to ask for other people's opinion on WP:VPT but nobody responded. The code is definitely working as it's already been in the commons equivalent of this page for quite a while now. Yonatan talk 17:34, 27 May 2007 (UTC)[reply]

This is not very useful in article space, which doesn't have/support subpages. —Ruud 17:54, 27 May 2007 (UTC)[reply]
It can be turned off for that namespace as well. Yonatan talk 18:28, 27 May 2007 (UTC)[reply]
I also think its usefulness is quite limited if the link always shows up, instead of only when there actually are any subpages. —Ruud 18:33, 27 May 2007 (UTC)[reply]
It isn't really doable to add a query that checks whether there are any subpages for every page loaded. Its usefulness isn't limited at all, it's good for anyone wanting to see the subpages of a certain page but doesn't wanna go around looking for how to do it. Yonatan talk 06:39, 29 May 2007 (UTC)[reply]
It should be doable if it is coded into MediaWiki. With the current implementation you have to know beforehand that there are subpages and it adds even more clutter to the toolbox in the large majority of the cases where there are none, or you simply don't care. That makes me doubt whether this should be enabled by default. I think the Village Pump would be a better place to gauge support for this. —Ruud 18:29, 29 May 2007 (UTC)[reply]
This will have trouble on the secure server because of the hard-coded use of "/wiki". That part can be fixed by using wgArticlePath and a replace of "$1". There could also be issues if wgPageName contains special characters, which could be solved by using "?title=" + encodeURIComponent(wgPageName) instead of the path-based version of Special:Prefixindex.
The lack of response on WP:VPT could mean that there isn't any interest in adding this (and it wouldn't be the first time, as evidenced by my proposals page); I personally think this one makes more sense as a user script, since it isn't the sort of thing that the majority of readers (i.e. anons) care about, only people who are involved enough in the project that they probably wouldn't mind changing monobook.js. Mike Dillon 18:38, 27 May 2007 (UTC)[reply]
I agree subpages link is useful, but since I already have it, and the suggested code is a bit bloated (i18n and stuff), personally I'd vote for leaving it a personal script and simply adding a good how-to into Wikipedia:SubpagesAlex Smotrov 18:25, 29 May 2007 (UTC)[reply]

Could be useful here as well. —Ruud 22:03, 29 May 2007 (UTC)[reply]

I have added it now, I'm 99.99% sure it won't affect anything on the page. AzaToth 22:28, 29 May 2007 (UTC)[reply]
Hmm.. it breaks the wikilinks. —Ruud 22:37, 29 May 2007 (UTC)[reply]
Please discuss things here before implementing them, if you are 99.99% sure, and it is uploaded to 100,000 people then statistically you are messing up 10 people. Better that 10 or 20 people become 99.99% sure. (H) 22:48, 29 May 2007 (UTC)[reply]