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

Content deleted Content added
Alex Smotrov (talk | contribs)
archiving «Please set NavigationBarShowDefault = 0» from talk page
 
(7 intermediate revisions by 6 users not shown)
Line 1:
<span id="63308533199" ></span>
==Global JS/CSS "safe" now==
{{tl|editprotected}}
Looks like developers did the same thing for global JS/CSS files as they already did before for personal js/css files: now the whole page is shown inside &lt;pre class="mw-code mw-js"> tag, which means nothing is going to work inside and we can remove all templates (e.g. {{tl|Interwiki-all}} in [[MediaWiki:Monobook.css]] and [[MediaWiki:Common.css]]), <nowiki>[[User:]]</nowiki> links, headings, &lt;pre> tags and so on. However, there is still one little reason to keep &lt;source> tag: you can trasclude the file on another page and then still enjoy it with syntax highlighting ∴ [[User:Alex Smotrov|Alex Smotrov]] 22:29, 27 June 2007 (UTC)
: For highlighting add both <nowiki></pre></nowiki> before <nowiki><sourcesyntaxhighlight ...></nowiki> and <nowiki><pre></nowiki> after <nowiki></sourcesyntaxhighlight></nowiki> tags.--[[User:AlefZet|AlefZet]] 21:57, 28 June 2007 (UTC)
::Well, that was my first idea as well, but it doesn't work since Mediawiki simply replaces all &lt; into &amp;lt;. Note that this doesn't happen immediately after saving (I have no idea why), so if markup on js/css pages seems to work for you, just wait a little and it won't ;) ∴ [[User:Alex Smotrov|Alex Smotrov]] 22:13, 28 June 2007 (UTC)
 
Line 11:
If you still want to see it with all the bells and whistles (parsed wikicode), try a diff, like: [http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&oldid=141424535&diff= &oldid=141424535&diff=]. --[[User:Splarka|Splarka]] ([[User_talk:Splarka|rant]]) 07:05, 30 June 2007 (UTC)
:There is ongoing discussion about this on bugzilla (bugs [[bugzilla:10196|10196]], [[bugzilla:10314|10314]], [[bugzilla:10410|10410]], [[bugzilla:10422|10422]]), so don't be surprised if it changes again soon. --[[User:ais523|ais523]] 15:39, 2 July 2007 ([[User:ais523|U]][[User talk:ais523|T]][[Special:Contributions/Ais523|C]])
<span id="63308889130" ></span>
== Make "Upload file" more like on commons ==
 
Line 23:
:::I already posted it at the village pump, what more do you need? --[[User:Steinninn|Steinn]][[User talk:Steinninn|inn]] 13:55, 6 July 2007 (UTC)
::::Unfortunately, I am unwilling to make such changes without agreement of the community. The only thing I would say is trying re-listing, possibly at [[WP:VPT]] too. [[User:GDonato|GDonato]] ('''[[User talk:GDonato|talk]]''') 18:32, 6 July 2007 (UTC)
<span id="63309176658" ></span>
== Search images ==
 
I have just reverted Martinp23's addition of the search engine images. Adding images like these violates our [[WP:FU|fair use policy]] and may be interpreted as ads. [[User:Sean William|Sean William]] 22:46, 19 May 2007 (UTC)
 
:Agreed. <small><sup><font color="#000">[[User:H|(]]</font><fontspan colorstyle="color:#c20000000;">(</span>]][[User talk:H|H]]</font><fontspan colorstyle="color:#000cc2200;">H</span>]][[User:H|<span style="color:#000000;">)]]</fontspan>]]</sup></small><!-- Was HighInBC --> 22:50, 19 May 2007 (UTC)
::Likewise. I factored the images out, but apparantely I'm not allowed to do that, so putting this reversion up for discussion - to be clear, the ideal way to give the external searches would be server-side, in the mediawiki text, but as no params are available in the relevant text, something client side is required. This has been requested in various places, including [[WP:AN]] (which, incidentally, is where I decided to add the images code, from fr.wiki, as a favour - still somewhat sick at the hostility of some to an easily reversible mistake...). The removal of the code which I changes is reverted [http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&curid=763577&diff=132109299&oldid=132106859 here]. [[User:Martinp23|Mart]]'''[[User_talk:Martinp23|inp23]]''' 00:21, 20 May 2007 (UTC)
::: Unfortunately any code pasted here is not easily reverted as it can stayed cached in visitors' browser cache for weeks. Any mistakes in the code can cause anything from annoying popups to appear to all pages on Wikipedia showing up blank during that time. From the simple cut 'n paste job you did I assumed you are not familiar with Javascript yourself, while adding executable code to one of the most visited websites is something that should not be doen without a little care. There are usually enough people hanging around on this page who van evaluate (and perhaps improve the code) on it's correctness, performance impact, maintainability etc. This was not meant as a hostile action, but as necessary caution. A reaction you can sometimes expect when being bold. —''[[User:Ruud Koot|Ruud]]'' 13:27, 20 May 2007 (UTC)
Line 35:
::::::Not at all! Thank you for your diligence in taking that care. Feel free to re-enter the js when/if you feel it has been suitably reviewed. [[User:Martinp23|Mart]]'''[[User_talk:Martinp23|inp23]]''' 19:25, 20 May 2007 (UTC)
 
::I support the image free version. Good idea. <small><sup><font color="#000">[[User:H|(]]</font><fontspan colorstyle="color:#c20000000;">(</span>]][[User talk:H|H]]</font><fontspan colorstyle="color:#000cc2200;">H</span>]][[User:H|<span style="color:#000000;">)]]</fontspan>]]</sup></small><!-- Was HighInBC --> 19:28, 20 May 2007 (UTC)
 
:See my note below. I'm not a fan, but at least I can do <code>onloadFuncts.splice(onloadFuncts.indexOf(SpecialSearchEnhanced3), 1)</code>. [[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> § 19:41, 20 May 2007 (UTC)
Line 187:
 
:It would require a bit of tweaking to the script since it assumes that there is only one additional parameter besides the free text field used for the search term. For Yahoo!, this is currently being used for <code>vs=en.wikipedia.org</code>. The code would have to be changed to add a hidden element to the form for the <code>ei</code> parameter on submit, which would significantly alter the structure of the code. [[User talk:Mike Dillon|Mike Dillon]] 02:24, 10 July 2007 (UTC)
<span id="63309291258" ></span>
== small replace() bug ==
{{tl|editprotected}}
Line 197:
::{{tick}} '''Done''' (after testing the relevant expressions). (There are certainly a lot of ways to express the intended concept; I went for / /g in the actual change, but when writing my own code I often use /\ /g (which is correct in both JavaScript and Perl, even when using Perl's /x modifier) or even split(" ").join("_") (which has the advantages of accepting non-literal strings). --[[User:ais523|ais523]] 17:22, 6 July 2007 ([[User:ais523|U]][[User talk:ais523|T]][[Special:Contributions/Ais523|C]])
:: Right, my copy&paste mistake. --[[User:Piet Delport|Piet Delport]] 10:14, 11 July 2007 (UTC)
<span id="63309567253" ></span>
== JavaScript framework ==
 
Line 203:
 
:While that may be true, it would also add another 20k of overhead to the site JavaScript. I'm not sure if the readability benefit is enough, since 99.9% of the people for whom this code executes will never even know about it, let alone read it. [[User talk:Mike Dillon|Mike Dillon]] 14:54, 14 July 2007 (UTC)
<span id="63309762904" ></span>
== Please discuss first ==
 
Line 244:
::Just to be clear, what I said about user scripts not loading was overstated and not entirely correct. I think the only side effect of waiting for the call to tools.wikimedia.de to time out will be that any scripts or stylesheets added in an onload hook will not be loaded until the tools.wikimedia.de call times out. This is a pretty marginal case since most onload hooks just have code to execute and new scripts/styles are usually imported outside of the onload hook itself which means the associated resource will have been loaded before the onload hooks execute. [[User talk:Mike Dillon|Mike Dillon]] 15:10, 15 July 2007 (UTC)
 
:The ''no reason to revert'' stance doesn't appear to be much differant from the ''why was this ever added'' stance. If for nothing else, users accessing the english wikipedia may wonder why they have a script loading from a german ___domain. Additionally the only documentation delivered with it is "Allows for geographic targeting of watchlist notices", which doesn't explain much to even experienced editors what is really going on here. If new off-site scripts are going to be included, can they include onsite documentation (or a link to meta, or somewhere else on-wiki)? — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 01:25, 15 July 2007 (UTC)
 
::Could you please ask an actual question? I'm not sure exactly what you want to know. --[[User:Gmaxwell|Gmaxwell]] 01:49, 15 July 2007 (UTC)
Line 255:
:::::Please read my comments above. I addressed this earlier. Further, I've yet to see any actual problem with the software being held externally to mediawiki proper. Can you please articulate your concerns on this front?
:::#How can this be better documented so that everyone knows what is going on here and in the future for off-loaded scripts?
:::#:I'd suggest a project page documenting this new code-set referenced from a comment code if loading scripts from other servers is required. — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 03:42, 15 July 2007 (UTC)
:::Thank you, — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 03:42, 15 July 2007 (UTC)
:::::Understand that it is currently a test to determine the usefulness. At this point you may now be asking me to expend more work to justify my code to ''you personally'' than was required for the entire implementation. The operation is fairly simple, and nearly self-explanatory. The addition to common.js loads a script from a cgi which depends on the ___location of the browser loading it. That script displays a notice. I have a mediawiki implementation, but without experience using the feature I don't know how ___location ranges can be most usefully specified. I was hoping to gain experience with DC and NYC, but it appears that you have decided to not permit me to do so.
:::::Frankly I am disinclined to spend several more hours justifying a rather simple feature which has already been removed for no particular reason. If you don't want it fine, but please adjust the pages to make it clear that the English Wikipedia is not open to contributions because you have personally decided that it shouldn't be.--[[User:Gmaxwell|Gmaxwell]] 06:32, 15 July 2007 (UTC)
Line 264:
 
::Greg can correct me if I'm wrong, but I believe it uses the user's IP address to determine whether they are in a region with an upcoming [[Wikipedia:Meetup|Meetup]] and alerts them with a dismissable message. It may be limited only to the Washington DC meetup at the moment. [[User talk:Mike Dillon|Mike Dillon]] 04:49, 15 July 2007 (UTC)
:::So it's passing IP information about active editors to another server? How does providing this type of information to the toolserver play with the privacy policy? — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 05:59, 15 July 2007 (UTC)
::::It's loading a page from another Wikimedia system. The same way many of other things do here, for example the mediaplayer, which has been in service for a very long time. Furthermore, no information which connects a specific editor to an IP is transfered, which is far more than many of our other internal features. Why do you have the access required to revert this change if you can't see for yourself exactly what it is doing in that regard? --[[User:Gmaxwell|Gmaxwell]] 06:32, 15 July 2007 (UTC)
:::::When using media players, etc our users are making a specific request to leave en: and connect to the other server. When loading their watchlist, they are not generally not even going to be aware of this connection. As this is also executing off-site, what it is doing there is beyond review here, thus my request for documentation to be published. This certainly doesn’t mean that I’m assuming something bad is happening either. To answer your “why”, while I, and >1000 others here, have access to change this page, it is not a page I normally update (and I did not revert it), we have administrator accounts for many more reasons that updating javascript and that should be blatantly obvious. Site administrators have a variety of skills, and while javascript coding is not one of my strong points, networking and privacy are. — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 06:56, 15 July 2007 (UTC)
::::::"while javascript coding is not one of my strong points, networking and privacy are", can you please provide some evidence of these skills? My experience with your trackrecord indicates otherwise... In numerous occasions you have objected to actions taken by users on technical grounds, such as "system load", which had no baring in reality.--[[User:Gmaxwell|Gmaxwell]] 17:31, 15 July 2007 (UTC)
 
So, we've now had hours of discussion... and no one has brought up any concrete examples of problems. Would some third party be interested in restoring my faith in English Wikipedia by restoring the code so that I can continue to learn useful things about its performance? Thanks. --[[User:Gmaxwell|Gmaxwell]] 06:38, 15 July 2007 (UTC)
:There appear to be a few things outstanding: How it will benefit our editors?, How will this content (new messages) be managed?; What is the expected amounts of false positives and false negatives expected from a geo-coded rsult? Is the geo-___location being performed on the tool server itself, or being farmed out to another server? All of these leadto: Where have we shown a consensus that we want to run this? Making interface changes simply to run an experiment to "learn useful things" seems to be pushing it. — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 06:56, 15 July 2007 (UTC)
::FWIW, I'm never going to personally add this, but will also not remove it if another admin does add it. — [[User:Xaosflux|<b><fontspan colorstyle="color:#FF9933"; face="font-weight:bold; font-family:monotype;">xaosflux</font></bspan>]] <sup>[[User_talk:Xaosflux|<fontsup colorstyle="color:#00FF00;">Talk</fontsup>]]</sup> 06:58, 15 July 2007 (UTC)
 
:::"How it will benefit our editors?" I think this point has been sufficiently explained, already. Are you just asking in order to make sure I've filled out Form #XBR1952 in triplicate, or are some useful applications of this notice not already obvious to you? I'd be less skeptical about your question were it not for the fact that the notice was already in use in a way which was clearly beneficial.
Line 317:
::::::I did not say "you're requred to provide documentation", but that would be a nice thing to do; and be realistic - someone else would have asked anyway; and I don't see why this page is less suited to ask questions than your talk page ∴ [[User:Alex Smotrov|Alex Smotrov]] 20:04, 16 July 2007 (UTC)
 
<sourcesyntaxhighlight lang=javascript enclose=div>
if (!document.cookie.match('hidedcn=1')){
insertsub=document.getElementById("contentSub")
Line 323:
'<div class="plainlinks" id="WN_DCN" style="width:98%; margin:5px auto 0; background:transparent; text-align:right;"><font size="+1" color="#000000">The next <a href="http://en.wikipedia.org/wiki/Wikipedia:Meetup/DC_2">Washington DC meetup</a> is Saturday the 21st.<br/></font><i>You\'re invited! [<a href="#" onClick="var date = new Date(); date.setTime(date.getTime()+86400000);document.cookie = \'hidedcn=1; expires=\' + date.toGMTString() + \'; path=/\';document.getElementById(\'WN_DCN\').style.visibility = \'hidden\';return false">hide</a>]</i></div>'
}
</syntaxhighlight>
</source>
 
:I notice this is accessing some python script, which generates that JavaScript code for some people. I don't see any documentation or code for the python script makes use of our IP address information. Gmaxwell is a trusted and experienced user, who I'm sure wouldn't misuse any of that information. Nonetheless, I think people would be reassured if the python source code was provided. --[[User:Aude|Aude]] <small>([[User talk:Aude|talk]])</small> 17:02, 16 July 2007 (UTC)
Line 331:
::::One possible improvement would be introducing an additional user preference where you could specific one or more alternative locations, but then thats collecting additional private data that we would have to worry about protecting, and it is not clear how many things we'll use ___location data for. Notices are an obvious thing, and we could do a "Recently changed subjects near me" feature as well, but beyond that the applications are fairly slim. Nothing that I can come up with absolutely requires accurate ___location data.--[[User:Gmaxwell|Gmaxwell]] 21:06, 16 July 2007 (UTC)
:::::Possibly, user categories might be useful. Though, I know there are userboxes that say "User:X lives or hails from Maryland". Then you get people who were born in Maryland, but no longer live there. Nothing private about these, though we would want to distinguish "lives in" from "hails from". --[[User:Aude|Aude]] <small>([[User talk:Aude|talk]])</small> 21:15, 16 July 2007 (UTC)
<span id="63309918016" ></span>
== "Technical restrictions" title fix ==
 
The "Technical restrictions" title fix can be removed due to the new magicword <code><nowiki>{{DISPLAYTITLE:correct page name}}</nowiki></code>. It functions exactly the same as the "Technical restrictions" title fix does (it only displays as long as the displayed title is a valid link to that page). We need a bot to update all the pages to use this instead of the js class and then we can remove it from here. [[User:81.34.54.162|81.34.54.162]] 18:24, 17 July 2007 (UTC)
 
:Since most if not all of the additions of the RealTitle id are done by templates, it should be possible to change this without a bot by just putting <code><nowiki>{{DISPLAYTITLE:{{{1}}}}}</nowiki></code> into the relevant templates. [[User talk:Mike Dillon|Mike Dillon]] 20:21, 17 July 2007 (UTC)
Line 341:
 
:::It's not as simple for {{tl|wrongtitle}}, for example see [[P*U*L*S*E (film)]]: the javascript code is smart enough not to replace the heading but it does replace the page title, also the template shows "The correct title is …" message. P.S. [http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=23393 This seems to be a revision] which enabled <code><nowiki>{{DISPLAYTITLE:}}</nowiki></code> ∴ [[User:Alex Smotrov|Alex Smotrov]] 16:20, 18 July 2007 (UTC)
<span id="63310490192" ></span>
== Administrator.js ==
 
Line 366:
:::: Are you completely sure about that? Objects in javascript can be treated a associative arrays, so one would expect that the reverse would also hold. —''[[User:Ruud Koot|Ruud]]'' 20:30, 24 July 2007 (UTC)
:::::Array in Javascript is not "Associative" by itself, I think [http://www.andrewdupont.net/2006/05/18/javascript-associative-arrays-considered-harmful/ this article] should explain it better than me. In any case, <code>javascript:alert("user" in wgUserGroups)</code> (in browser address field) shows false in all browsers I tried.
:::::By the way, everybody seems to have their own version of "call Sysop.js" code, here's mine: <code> if (wgUserGroups && (wgUserGroups[0] == "sysop" ) && !window.disableSysopJS)</code>. Advantages: most simple and efficient; works right now; if it stops working, people who notice will be able to fix it :) ∴ [[User:Alex Smotrov|Alex Smotrov]] 03:49, 25 July 2007 (UTC)
 
::::::Personally I just use something like <code>wgUserGroups.join(' ').indexOf('sysop')</code>. --[[User:Splarka|Splarka]] ([[User_talk:Splarka|rant]]) 07:16, 25 July 2007 (UTC)