MediaWiki talk:Common.js/Archive 9: Difference between revisions
Content deleted Content added
Shadowbot3 (talk | contribs) m Automated archival of 2 sections from MediaWiki talk:Common.js |
m Andrybak moved page MediaWiki talk:Common.js/Archive Sep 2007 to MediaWiki talk:Common.js/Archive 9: Template talk:Automatic archive navigator#Later archives are not linked |
||
(8 intermediate revisions by 6 users not shown) | |||
Line 1:
<span id="63310950361" ></span>
==Disable overflow in printable version of page==
I thought after the deletion of [[template:scrollref]] that it was determined that it would be too difficult to block scrollboxes from rendering in the printable layout of pages, but it seems like it would be fairly simple now: [http://en.wikipedia.org/w/index.php?title=Wikipedia:Bot_requests&curid=912023&diff=145731448&oldid=145714756#Accessibility_and_printable_layout-breaking_div_markup]. Would someone mind implementing the change? Any time that a div tag has the overflow flag set and obscures content, print users will not be able to see any obscured content in the present form. Doing this via templates has been disabled in Main namespace on the en wiki, but is still in use in the it wiki, as I understand it. At present, a dozen or so user and talk pages are unprintable here, but several real pages are unprintable elsewhere do to [[Template:scrollbox]], but lord only knows how many are using subst'd equivalents or directly put in the div tag. Is there any reason not to make with the fix in the diff linked above? Thanks, [[User:MrZaius|<
:That change would not be made by a sysop on this page, it'd be made by a developer on /skins-1.5/common/commonPrint.css, which is not on-wiki. — [[User:Madman bum and angel|Madman bum and angel]] ([[User talk:Madman bum and angel|talk]] – [[User:Madman bum and angel/Desk|desk]]) 14:23, 20 July 2007 (UTC)
::Would <code>@media print</code> work? [[User:Gracenotes|<span style="color:#960;">Grace</span><span style="color:#000;">notes</span>]]<sup>[[User talk:Gracenotes|<span style="color:#960;">T</span>]]</sup> <span title="MediaWiki talk:Common.js">§</span> 22:59, 20 July 2007 (UTC)
:::I'm not sure if that last comment implies a fix is possible here w/o buggin' the devs, but I believe this change should be made to MediaWiki proper, if the same problem is applicable to all other installations. Reported here: http://bugzilla.wikimedia.org/show_bug.cgi?id=10654 If I borked the description, would someone mind responding and clarifying? Thanks for all your help, [[User:MrZaius|<
::::The devs seem unwilling or unable to fix the problem. Do we have a fix we can implement here? [[User:MrZaius|<
::::: I agree with the comments Simetrical makes at Bugzilla. If we specify a fixed height/scrollable overflow somewhere it should be done properly (e.g. use a CSS class from Common.css and specify an alterative for <code>@media print</code>). However, I doubt scrollboxes have any legitimate uses for the same reasons that {{tl|scrollref}} was deleted. Where are they still used? —''[[User:Ruud Koot|Ruud]]'' 22:32, 24 July 2007 (UTC)
:On the en wiki, primarily user pages and talk pages. On the Italian wiki, they at least ''were'' used for a handful of galleries. Furthermore, not a month goes by without editors on the en wiki popping up the raw code on articles, ignoring the {{tl|scrollref}} TfD. That said, I wouldn't have been surprised at all to see scrollref survive TfD if it hadn't broken printable layouts and raised accessibility concerns. {{tl|scrollbox}} is still in use, although it too has been flagged for TfD by a nom that is solely concerned about this very issue. If it is being used correctly, great - fix it so that it can be safely used without breaking accessibility. If not, block the raw code in main and other namespaces alike. Go halfway, and this will just keep coming up over and over again. [[User:MrZaius|<
Common.css and Common.js are not used on the Printable version. Even if they were, this would be for Common.css, not Common.js. — [[User:Madman bum and angel|Madman bum and angel]] ([[User talk:Madman bum and angel|talk]] – [[User:Madman bum and angel/Desk|desk]]) 02:01, 25 July 2007 (UTC)
:Does that mean there's no possible rendering fix without dev involvement and no way to completely block overflow from rendering sitewide? If that's the case, seems like we're back to the bot idea and I'd better switch my keep to a delete on {{tl|scrollbox}}'s TfD. [[User:MrZaius|<
: They are used on the printable version. —''[[User:Ruud Koot|Ruud]]'' 12:41, 25 July 2007 (UTC)
:: My apologies. You are, of course, correct; I hadn't read enough of the page source. — [[User:Madman bum and angel|Madman bum and angel]] ([[User talk:Madman bum and angel|talk]] – [[User:Madman bum and angel/Desk|desk]]) 15:06, 30 July 2007 (UTC)
<span id="63311912426" ></span>
== Readonly ==
Line 24:
</nowiki></pre>
This code should, of course, by put inside the main function for "The Main Page is unavailable" tweaks. <small>—</small>'''[[User:Animum Delivery Bot|<
:As another option, adding "newarticletext" as a triggering elementId would activate the script even if they click an edit link. An enterprising vandal might then disable JS, but as Main Page is transcluded onto ten cascade-protected pages, this would do them little good. – <span style="font-family: Garamond">[[User:Luna Santin|<
:Or we could use the last function that I've installed in my monobook, for extra precaution, etc. –'''''[[User:Magnus animum|<span style="font-family:Candara;color:#8A2BE2">Animum</span>]]''''' <em style="font-family:sans-serif;color:black;font-size:smaller">15:52 12 August 2007 (UTC)</em>
<span id="63312333087" ></span>
== WikiMiniAtlas ==
Line 44:
:::Moving the whole stuff, including the script (which is the same for all projects, and handles UI language and displayed data dynamically) to meta would be a good idea. The Wikiminiatlas page could then easily be translated to several languages (some translations alredy exist), and the JS popup could link to those translated pages (i.e. [[:meta:WikiMiniAtlas/en]]). We could get rid of the installation instructions and instead focus more on data-source citations and utilized software. --[[User:Dschwen|Dschwen]] 08:38, 14 August 2007 (UTC)
Sounds like an excellent alternative to Google Maps, which we should purge as soon as possible. --[[User:Cyde|<
* In-house software is preferable to other alternatives, so yeah, I support this as well. My only concern is about load issues. Can it handle the added visits? [[User:Titoxd|Tito<span style="color:#008000;">xd</span>]]<sup>([[User talk:Titoxd|?!?]] - [[WP:FAC|cool stuff]])</sup> 00:26, 15 August 2007 (UTC)
Line 57:
:::With temporary sysop-privileges I moved the script to [[:meta:MediaWiki:Wikiminiatlas.js]]. The doc pages are located at [[:meta:WikiMiniAtlas]]. I'll redesign the docs to reflect the fact that the Atlas is enabled by default. I'd say you can go ahead an enable it. --[[User:Dschwen|Dschwen]] 15:11, 16 August 2007 (UTC)
<span id="63312381475" ></span>
== Exporting table collapse code ==
Line 73:
:::: All right, I copied hasClass over and it seems to be working now. If I'm still missing something, please tell me, since I really don't have much experience with debuggers (and the one I use isn't reporting any errors now). Thanks for your help! --[[User:Dinoguy1000|Dinoguy1000]] <sup>[[User_talk:Dinoguy1000|Talk]]</sup> 04:37, 17 August 2007 (UTC)
<span id="63312619730" ></span>
== importScript() and Wikimediaplayer.js ==
Line 79:
<ol><li>
Adding an optional <code>maxage</code> parameter to <code>importScript()</code> and <code>importStylesheet()</code>, applied as:
<
if (typeof maxage != 'undefined') {
url += "&smaxage=" + encodeURIComponent(maxage);
}
</
Replacing the current code used to pull in [[Mediawiki:Wikimediaplayer.js]] with:
<
importScript('Mediawiki:Wikimediaplayer.js', 86400);
</
Any potential problems I may have overlooked? —[[User:Ilmari Karonen|Ilmari Karonen]] <small>([[User talk:Ilmari Karonen|talk]])</small> 14:37, 17 August 2007 (UTC)
Line 97:
::Next version of the mediaplayer will likely be meta hosted as well. It's become a pain to maintain it on so many sites. :) --[[User:Gmaxwell|Gmaxwell]] 22:48, 19 August 2007 (UTC)
<span id="63312778909" ></span>
== For the collapsible table, include the brackets in the show/hide link ==
Line 146:
: I ''could'' be copied over using some javascript, on the other hand I don't see any reason for people to override the default colours of navigational boxes in the first place (totally breaks when there are multiple navboxes in a single article / makes it nearly impossible to make the style skin-dependant). —''[[User:Ruud Koot|Ruud]]'' 19:01, 21 August 2007 (UTC)
<span id="63312789289" ></span>
== Wikiminiatlas bugged? ==
Line 152:
:It was the innocent looking application of a translation patch. Yep, I slipped, I try to add new translations quickly to enhance accessability for new users. Always worked before, but it is just that seemingly easy stuff that asks for trouble. Anywho, I created a staging copy now, better late than never. You are welcome to do more of the ''testing'' you asked for, but the WMA exists for 1.5 years now and it needs constant development as new features keep getting asked for. I am currently reworking the server-side part and the parts of the JS that are located on the toolserver (all on staging copies), that stuff gets a lot of testing but will eventually be put live. I need the feedback, so I have difficulties imagining a ''stable'' with, what, a release once a year? --[[User:Dschwen|Dschwen]] 21:54, 21 August 2007 (UTC)
<span id="63313271105" ></span>
== [[template:Scroll gallery]] ==
A system admin of the French wiki [[fr:Utilisateur:Pabix]] has created a template [[fr:Modèle:Images]] that allows to create slideshows on wikipedia: i.e. [[it:Seconda battaglia di El Alamein#La battaglia|slideshow of maps about the 2nd Battle of El Alamein]].<br />
The template uses some java extensions and has (so far) also been adapted for the Italian wiki [[it:Template:Galleria]]. Yesterday I tried to import it to the English [[Template:Scroll gallery]] and German wiki [[de:Vorlage:Scroll Gallery]], but it would not work. Today I was informed by Italian wiki user [[it:utente:Twice25]] that the follwoing java script needs to be added to either MediaWiki:Common.js or MediaWiki:Monobook.js for the template to work. Would this be possible to do? Thanks, --[[User:Noclador|noclador]] 00:54, 20 August 2007 (UTC) <br />
I copied the script that needs to be added below and it looks as it should, but it comes out all distored in the saved text- therefore here you can find the link as the script appears in the Italian [[it:MediaWiki:Monobook.js]] (it is the last at the bottom of the page) and here is a link to the change that was made in the Italian wiki to insert the script: [http://it.wikipedia.org/w/index.php?title=MediaWiki:Monobook.js&diff=prev&oldid=10174045 ]
<pre>
/*** CODE FOR TEMPLATE:Scroll gallery ***/
function toggleImage(group, remindex, shwindex) {
document.getElementById("ImageGroupsGr"+group+"Im"+remindex).style.display="none";
document.getElementById("ImageGroupsGr"+group+"Im"+shwindex).style.display="inline";
}
function ImageGroup(){
if (document.___URL.match(/printable/g)) return;
var bc=document.getElementById("bodyContent");
var divs=bc.getElementsByTagName("div");
var i = 0, j = 0;
var units, search;
var currentimage;
var UnitNode;
for (i = 0; i < divs.length ; i++) {
if (divs[i].className != "ImageGroup") continue;
UnitNode=undefined;
search=divs[i].getElementsByTagName("div");
for (j = 0; j < search.length ; j++) {
if (search[j].className != "ImageGroupUnits") continue;
UnitNode=search[j];
break;
}
if (UnitNode==undefined) continue;
units=Array();
for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
var temp = UnitNode.childNodes[j];
if (temp.className=="center") units.push(temp);
}
for (j = 0 ; j < units.length ; j++) {
currentimage=units[j];
currentimage.id="ImageGroupsGr"+i+"Im"+j;
var imghead = document.createElement("div");
var leftlink;
var rightlink;
if (j != 0) {
leftlink = document.createElement("a");
leftlink.href = "javascript:toggleImage("+i+","+j+","+(j-1)+");";
leftlink.innerHTML="◀";
} else {
leftlink = document.createElement("span");
leftlink.innerHTML=" ";
}
if (j != units.length - 1) {
rightlink = document.createElement("a");
rightlink.href = "javascript:toggleImage("+i+","+j+","+(j+1)+");";
rightlink.innerHTML="▶";
} else {
rightlink = document.createElement("span");
rightlink.innerHTML=" ";
}
var comment = document.createElement("tt");
comment.innerHTML = "("+ (j+1) + "/" + units.length + ")";
with(imghead) {
style.fontSize="110%";
style.fontweight="bold";
appendChild(leftlink);
appendChild(comment);
appendChild(rightlink);
}
currentimage.insertBefore(imghead,currentimage.childNodes[0]);
if (j != 0) currentimage.style.display="none";
}
}
}
addOnloadHook(ImageGroup);
</pre>
Looks great, but I think there's a problem when you scroll to the last image. Try going to image 16 of 16 on [[:it:Seconda battaglia di El Alamein#La battaglia]]. It doesn't display. —<span style="color: red;">[[User:Mets501|M<small>ETS</small>501]] ([[User talk:Mets501|talk]])</span> 00:59, 20 August 2007 (UTC)
: Strange... I tried to replace the 16th image with the 1st image and the 1st was displayed correctly... than i changed the resolution to 399px and now the 10th image does not work, but the 16th does... but all images have tge same size: 1153x1153px ???? with 404px they work now all :-) --[[User:Noclador|noclador]] 01:12, 20 August 2007 (UTC)
Aren't we not supposed to disrupt printing like that? I know there are specific instrtuctions against scrollbars on references, and this seems very similar. A nice idea, but ordinary gallery tags are better for our purposes. ←[[User talk:BenB4|Ben<sup>B4</sup>]] 01:47, 20 August 2007 (UTC)
:ordinary gallery tags are totally different. The above script produces a kind of animation that allows the reader to click through the a series of images and thus to comprehend easier the dynmaics of i.e. a battle or the workings of an engine. I think that a long series of images is much more disruptive to an article than this- i.e. [[Second battle of El Alamein#The battle]]. About printing: what about animated gifs? --[[User:Noclador|noclador]] 11:54, 20 August 2007 (UTC)
:: I would like to know if the above script will be included in the MediaWiki:Common.js or not, as without it I'm unable to include the [[it:Seconda battaglia di El Alamein#La battaglia|slideshow of maps about the 2nd Battle of El Alamein]] into the article [[Second battle of El Alamein#The battle]]. Any info about what the status is of the script would be appreciated. --[[User:Noclador|noclador]] 11:45, 27 August 2007 (UTC)
<span id="63313359104" ></span>
== Problem with nested collapsible tables ==
Nesting collapsible tables while using the autocollapse feature has been giving me some problems. Note that in the example below (which should start out in a collapsed state), when you press the Show button, the child tables start out in uncollapsed mode, but the buttons display "show" instead of "hide". I think that the child tables should start out in collapsed mode when the parent table is uncollapsed. This occurs on Firefox for XP/Vista (and I think on IE also). Can someone either show me the correct way to nest tables, or tell me if there is a problem in the collapsible code? Thanks, --[[User:CapitalR|CapitalR]] 14:00, 22 August 2007 (UTC)
<pre>
<table class="navbox collapsible autocollapse">
<tr><th>Title1</th></tr>
<tr><td><!--http://en.wikipedia.org/wiki/MediaWiki:Common.js
Message
--><table class="navbox collapsible collapsed">
<tr><th>Title1</th></tr>
<tr><td>Text1</td></tr></table><!--
--><table class="navbox collapsible collapsed">
<tr><th>Title1</th></tr>
<tr><td>Text1</td></tr></table><!--
--></td></tr></table>
</pre>
<table class="navbox collapsible autocollapse">
<tr><th>Title1</th></tr>
<tr><td><!--
--><table class="navbox collapsible collapsed">
<tr><th>Title1</th></tr>
<tr><td>Text1</td></tr></table><!--
--><table class="navbox collapsible collapsed">
<tr><th>Title1</th></tr>
<tr><td>Text1</td></tr></table><!--
--></td></tr></table>
: I never designed the code with nesting in mind, and as far as I am aware it doesn't work. I'm still planning to rewrite the code to allow multiple headers in a single table which can be hidden and shown separately. Could you give any concrete examples where nesting collapsible tables would be useful? —''[[User:Ruud Koot|Ruud]]'' 16:12, 22 August 2007 (UTC)
::Thanks for the reply. I think that making multiple collapsible headers in a table would fix the problem in most cases. I just converted about 5000 templates to use the collapsible table class, and noticed that about 30-40 of them now have nested collapsible tables, which don't quite work correctly. One major disaster is {{tl|Anatolian Seljuk Sultanate and Anatolian Turkish Beyliks}}. This relies heavily on the nesting to collapse a giant navbox into a small bar, but when the parent navbox is uncollapsed it would be nice to just see all of the child navboxes collapsed so only one at a time can be uncollapsed manually. --[[User:CapitalR|CapitalR]] 16:38, 22 August 2007 (UTC)
::: Oh my... that "navagation box" needs some rethinking. —''[[User:Ruud Koot|Ruud]]'' 17:05, 22 August 2007 (UTC)
::::Yup, I'll second that. --[[User:CapitalR|CapitalR]] 17:19, 22 August 2007 (UTC)
I had brought up this same issue at [[WP:VPT]] a while ago. (ATM it's still the first discussion on the page.) It took me a while to come up with something, since I've never worked with JS or the DOM before, but in the end it seemed to me that a one-line change to the code would enable nesting to work as expected (albeit not necessarily as documented). I put this proposal up at VPT too, and it just scrolled off having received no comment.
The only thing that keeps nesting from working is that the line in collapseTable
<syntaxhighlight lang="javascript">
var Rows = Table.getElementsByTagName( "tr" );
</syntaxhighlight>
grabs all rows below <code>Table</code> in all its descendants. However, if it was to grab only the rows that are direct children of <code>Table</code>, nesting works just fine. So instead:
<syntaxhighlight lang="javascript">
var Rows = Table.rows;
</syntaxhighlight>
I've tested this out in my monobook.js in both Firefox 2.0 and IE6 and it appears to work.
In my case, the impetus for wanting to nest tables came from the vociferous arguments that flare up from time to time at [[Template:Books of the Old Testament]], where issues of what version of what book is in whose canon, and which should be included in the template and which should not (inevitably, someone feels slighted) often take up the bulk of the talk page. Nesting the tables would enable a template that's all-inclusive, but which would not necessarily have to be so long in the display as to be unwieldy. It would also enable the elimination of every other Judaeo-Christian religion/denomination-specific template on the Biblical canon since in every case the main template can then be used with only the relevant portion expanded by default. (And also enable the inclusion of the Jewish canon as such, without POV language such as "Old Testament" in the title.) Ugly, but so are the arguments, so I'd hope this approach would render the arguments moot and encourage people to spend their energies more on, you know, writing an encyclopedia.
How generally useful this would be I can't say, but since it seems to be a relatively simple change is it doable anyway? ''[[User:Csernica|TCC]]'' <small>[[User_talk:Csernica|(talk)]] [[Special:Contributions/Csernica|(contribs)]]</small> 23:26, 24 August 2007 (UTC)
<nowiki>{{editprotected}}</nowiki> per the above. By the way, I didn't test this in the context of a navbox, but I don't see that there would be much difference. ''[[User:Csernica|TCC]]'' <small>[[User_talk:Csernica|(talk)]] [[Special:Contributions/Csernica|(contribs)]]</small> 00:46, 28 August 2007 (UTC)
:{{done}} '''[[User:Graham87|Graham]]'''[[User talk:Graham87|<span style="color:green;">87</span>]] 12:11, 28 August 2007 (UTC)
|