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, 17 July 2007 (Automated archival of 1 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.

/***** 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]

Overriding automatic deletion summaries for attack pages

In response to the suggestions made on WP:AN#Deletion summaries for attack pages, I wrote User:Ilmari Karonen/cleandelsummary.js. What it does is check if the MediaWiki-prefilled deletion summary contains a template such as {{db-attack}} and, if so, replaces the summary with one that doesn't contain any of the content being deleted. Assuming this does not cause any unexpected problems, would anyone oppose including such code here? —Ilmari Karonen (talk) 21:50, 6 June 2007 (UTC)[reply]

See two threads up. —Ruud 22:38, 6 June 2007 (UTC)[reply]
Assuming you mean #Administrator.js, if we do set up such a system this should obviously be placed there. In the mean time, the code is only nine lines (which isn't that much more than what the code to pull in an extra .js page would take anyway), and does absolutely nothing except on pages having action=delete. —Ilmari Karonen (talk) 23:55, 6 June 2007 (UTC)[reply]

Exalead search engine

I added Exalead's search engine. The idea has been floated at Village Pump and was not opposed. My experience is that users complaining about our search engine on OTRS are pleased with Exalead's solution. David.Monniaux 11:43, 8 June 2007 (UTC) [reply]

It might enhance the convenience of the page if the following was done for each script:

  1. Preface each one with //<span id="Script name"/><source lang="JavaScript">. "Script name" is a simple description of the script.
  2. Added * Shortcut: [[MediaWiki:Common.js#Script name]] to each code description
  3. Ended each one with </source>

It should be mentioned, this does increase the byte count of the page a bit without enhancing the scripts' functionalities. This will make the page more navigable and allow the space between <source/> tags to make scripts more visibly separate. How does this idea sound? GracenotesT § 01:07, 15 June 2007 (UTC)[reply]

Sounds fine to me. If there are no objections, I'll go ahead an implement. AmiDaniel (talk) 02:19, 15 June 2007 (UTC)[reply]
This might be a good idea. But I wish somebody would also clean the code a little bit, removing unnecessary *************** lines, meaningless comments, etc. And there are so many places where the code could be shortened, making it easier to read at the same time ∴ Alex Smotrov 14:49, 15 June 2007 (UTC)[reply]