MediaWiki talk:Common.js/Archive 17: Difference between revisions

Content deleted Content added
MiszaBot II (talk | contribs)
m Archiving 2 thread(s) from MediaWiki talk:Common.js.
MiszaBot II (talk | contribs)
m Archiving 2 thread(s) from MediaWiki talk:Common.js.
Line 577:
:I have done some more testing and noticed something I had forgotten: Wikipedia can only rescale PNGs and JPGs (and indirectly SVGs). It doesn't rescale GIFs. So we will have to live without this feature for the GIF images.
:--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 03:23, 27 November 2009 (UTC)
== Spellcheck in edit summary ==
 
Per [[Wikipedia:Village pump (technical)#Turn on spellcheck in summary field|a discussion]] at the Village pump, we (I and Dispenser) would like to turn on spellchecking in the edit summary field. At the moment this works for Firefox 2 and 3. At least for me it doesn't work in Opera, but it is likely more browsers will sooner or later support this. I would like to add the code below to [[MediaWiki:Common.js/edit.js]]:
 
<source lang="javascript">
// Turn on spellchecking in the edit summary field, for Firefox.
// Temporary until [[bugzilla:21604]] is deployed
addOnloadHook( function() {
var wpSummary = document.getElementById( "wpSummary" );
if ( wpSummary && typeof wpSummary.spellcheck != undefined )
wpSummary.spellcheck = true;
} );
</source>
 
The code has been checked (and fixed) by TheDJ.
 
--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 16:40, 24 November 2009 (UTC)
 
:I would support adding this to edit.js But it needs a comment with r59360 or the bugzilla number. Easier on maintenance in the future. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 18:32, 24 November 2009 (UTC)
 
::Agreed, it should have such a comment. By the way, it should be r59361, not r59360, but yeah [[bugzilla:21604]] is better. How about this: "''Remove this when MediaWiki adds "spellcheck = true" to the rendered pages. See <nowiki>[[bugzilla:21604]]</nowiki>.''" Since that gives a hint how to easily check if it has been deployed. I added it to the code above, feel free to modify the comment in the code.
::--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 01:38, 25 November 2009 (UTC)
:::A bit too verbose I think. I shortened it. —[[User:TheDJ|Th<span style="color: green">e</span>DJ]] ([[User talk:TheDJ|talk]] • [[Special:Contributions/TheDJ|contribs]]) 14:13, 25 November 2009 (UTC)
 
::::Your shorter version is okay too. So I have now added this to [[MediaWiki:Common.js/edit.js]].
::::--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 16:56, 25 November 2009 (UTC)
 
I'm not a techie, so forgive me if this is a daft comment. Spell checking in the edit summary may cause more problems than it solves. Lots of users deliberately use odd abbreviations in their edit summaries - will the spell checker automatically correct them, prompt (with a need for an extra click) the user, or just graphically highlight the error? IMHO only the last of these is good, and I hope you're going to tell me that's what it is... --[[User:Dweller|Dweller]] ([[User talk:Dweller|talk]]) 12:55, 26 November 2009 (UTC)
 
:No worries, it only highlights. I use Firefox 2, and for me it just puts light red underlining on words with bad spelling, that's all. And I can right-click those words to get a list of suggestions to insert in its place. And with another click I can add the word to the dictionary, if I deem the word correct. So my spellchecker by now understands lots of WP abbreviations and the names of the templates I use. :)) With two clicks I can change what language the spellchecker in Firefox uses. Very convenient for me who is not a native English speaker and uses three languages. I assume it works the same in Firefox 3.
:--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 13:09, 26 November 2009 (UTC)
::Splendid. That ends the irritating intervention of the person who doesn't understand these things. Thanks for bearing with me. --[[User:Dweller|Dweller]] ([[User talk:Dweller|talk]]) 13:46, 26 November 2009 (UTC)
 
There's a Firefox setting to turn on spellcheck for all text boxes. Go to about:config, search for <code>layout.spellcheckDefault</code> and set it to <code>2</code>.[http://kb.mozillazine.org/Layout.spellcheckDefault] [[User:Rocket000|Rocket000]] ([[User talk:Rocket000|talk]]) 01:28, 3 December 2009 (UTC)
 
:Rocket000: Thanks for the tip. It worked in my Firefox 2, now I have spellchecking everywhere. :)) But we should of course keep the javascript fix for the edit summary field, since most users won't know how to do that setting themselves.
:--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 03:58, 3 December 2009 (UTC)
 
== Accountcreator CSS ==
 
I intend to add code in Common.js that loads the new [[MediaWiki:Accountcreator.css]], similar to how Common.js loads [[MediaWiki:Sysop.js]] which in turn loads [[MediaWiki:Sysop.css]]. I will also make it so [[MediaWiki:Sysop.css]] is loaded before the page is rendered.
 
The reason is that we are currently updating the editnotice system. We need to show some links that are normally hidden, but admins and accountcreators should see them. See discussion at [[Wikipedia talk:Editnotice#Navbar]]. I have added an explanation how the hiding and showing code should be used at [[MediaWiki talk:Common.css#Hidden items]].
 
I want to load [[MediaWiki:Accountcreator.css]] and [[MediaWiki:Sysop.css]] before the page is rendered, otherwise the page and scrollbar will "jump" when the hidden links get visible after the page has been rendered. It works fine when I test it in my personal /monobook.js, but there is one detail that I can only test here (how the <code>!window.disableSysopJS</code> variable is affected by the load order). So first I will only add code for loading [[MediaWiki:Accountcreator.css]] and see what happens. Then I will know what changes I can do in the loading of [[MediaWiki:Sysop.js]] and [[MediaWiki:Sysop.css]]. I'll report here when I know more.
 
--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 11:26, 6 January 2010 (UTC)
 
:I have added the code for the accountcreators, and it works fine.
:But as I thought, we can't check variables set by users, unless inside addOnloadHook(). We need to load [[MediaWiki:Sysop.css]] before page rendering, so that means we can't check <code>!window.disableSysopJS</code> for it. But as far as I know the reason for that variable is that Sysop.js interferes with some user scripts, but the Sysop.css should not be a problem for those users. And as far as I can see from searching for "disableSysopJS" only three admins use that setting. The most noticeable difference for those three admins will be that from now on they will see pink background in the edit window when editing protected pages, just like all other admins see. If they don't like that, then they can instead do like some of us and add one line of CSS to their /monobook.css to change that pink background to something else.
:Since the code for loading the sysop and accountcreator files is so similar, I want to merge it, like this:
<source lang="javascript">
/** For sysops and accountcreators *****************************************
*
* Description: Allows for sysop-specific Javascript at [[MediaWiki:Sysop.js]],
* and accountcreator-specific CSS at [[MediaWiki:Accountcreator.css]].
*/
if ( wgUserGroups ) {
for ( var g = 0; g < wgUserGroups.length; ++g ) {
if ( wgUserGroups[g] == "sysop" ) {
importStylesheet("MediaWiki:Sysop.css");
addOnloadHook( function() {
if ( !window.disableSysopJS ) {
importScript("MediaWiki:Sysop.js");
}
} );
}
else if ( wgUserGroups[g] == "accountcreator" ) {
importStylesheet("MediaWiki:Accountcreator.css");
}
}
}
</source>
:This also makes it easy and efficient if we want to add loading of special CSS or javascript for other user groups.
:--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 12:03, 6 January 2010 (UTC)
 
::{{tick|18}} '''{{ucfirst:Done}}''' - I have updated Common.js with the code above. Sysop.css is now loaded before page rendering.
::--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 13:25, 7 January 2010 (UTC)
 
:The editnotice system now also needs to unhide a link when a user edits his own user or user talk page. That is, no one else than the user himself (and admins) should see it. See discussion at [[Wikipedia talk:Editnotice#User page links]]. To do that I intend to add this code to [[MediaWiki:Common.js/edit.js]]:
<source lang="javascript">
// Loads [[MediaWiki:Ownuserspace.css]] when the
// user is on his own user or user talk basepage.
if ( (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) && wgTitle == wgUserName ) {
importStylesheet("MediaWiki:Ownuserspace.css");
}
</source>
:The above code only loads [[MediaWiki:Ownuserspace.css]] when on the user's rootpage or root talk page, not on the user's subpages. Currently we don't need it to load on the subpages, so no reason to make the code more complicated. Later we might load it for the entire userspace, so I named the CSS file "userspace" instead of "userpage". And currently we only need it when editing the page, so loading it from /edit.js is more efficient than loading it from Common.js.
:--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 22:41, 12 January 2010 (UTC)
 
::{{tick|18}} '''{{ucfirst:Done}}''' – --[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 01:33, 13 January 2010 (UTC)
 
::[[Image:Kde crystalsvg eraser.png|18px]] '''Undone''' - I have removed the loading of "MediaWiki:Ownuserspace.css" since not needed anymore. Amalthea pointed out that {{tlc|REVISIONUSER}} returns the name of the current user when it is used in system messages, which is a better solution for the editnotice system. See [[Wikipedia talk:Editnotice#User page links]].
::But we still use the javascript for sysops and accountcreators shown in the first code box above.
::--[[User:Davidgothberg|David Göthberg]] ([[User talk:Davidgothberg|talk]]) 12:11, 14 January 2010 (UTC)