r34228 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34227‎ | r34228 | r34229 >
Date:23:51, 4 May 2008
Author:simetrical
Status:old
Tags:
Comment:
* Show correct accesskey prefix for Firefox 3 beta (Alt-Shift-, not Alt-)
* Clean up some of the surrounding code: use regexes where appropriate, observe 80-char lines, remove superfluous parentheses.

Not tested on FF3, because it seems to freak out at JavaScript served from http://localhost and I haven't figured out yet how to make it accept it. But it looks regression-free from Opera 9 (included masked as IE/Fx), although I can't verify the fix.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -1,18 +1,22 @@
22 // MediaWiki JavaScript support functions
33
44 var clientPC = navigator.userAgent.toLowerCase(); // Get client info
5 -var is_gecko = ((clientPC.indexOf('gecko')!=-1) && (clientPC.indexOf('spoofer')==-1)
6 - && (clientPC.indexOf('khtml') == -1) && (clientPC.indexOf('netscape/7.0')==-1));
7 -var is_safari = ((clientPC.indexOf('applewebkit')!=-1) && (clientPC.indexOf('spoofer')==-1));
8 -var is_khtml = (navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ));
9 -// For accesskeys
10 -var is_ff2_win = (clientPC.indexOf('firefox/2')!=-1 || clientPC.indexOf('minefield/3')!=-1) && clientPC.indexOf('windows')!=-1;
11 -var is_ff2_x11 = (clientPC.indexOf('firefox/2')!=-1 || clientPC.indexOf('minefield/3')!=-1) && clientPC.indexOf('x11')!=-1;
 5+var is_gecko = /gecko/.test( clientPC ) &&
 6+ !/khtml|spoofer|netscape\/7\.0/.test(clientPC);
 7+var is_safari = clientPC.indexOf('applewebkit') != -1 &&
 8+ clientPC.indexOf('spoofer') == -1;
 9+var is_khtml = navigator.vendor == 'KDE' ||
 10+ ( document.childNodes && !document.all && !navigator.taintEnabled );
 11+// For accesskeys; note that FF3+ is included here!
 12+var is_ff2 = /firefox\/[2-9]|minefield\/3/.test( clientPC );
 13+// These aren't used here, but some custom scripts rely on them
 14+var is_ff2_win = is_ff2 && clientPC.indexOf('windows') != -1;
 15+var is_ff2_x11 = is_ff2 && clientPC.indexOf('x11') != -1;
1216 if (clientPC.indexOf('opera') != -1) {
1317 var is_opera = true;
14 - var is_opera_preseven = (window.opera && !document.childNodes);
15 - var is_opera_seven = (window.opera && document.childNodes);
16 - var is_opera_95 = (clientPC.search(/opera\/(9.[5-9]|[1-9][0-9])/)!=-1);
 18+ var is_opera_preseven = window.opera && !document.childNodes;
 19+ var is_opera_seven = window.opera && document.childNodes;
 20+ var is_opera_95 = /opera\/(9.[5-9]|[1-9][0-9])/.test( clientPC );
1721 }
1822
1923 // Global external objects used by this script.
@@ -498,7 +502,7 @@
499503 || navigator.userAgent.toLowerCase().indexOf('mac') != -1
500504 || navigator.userAgent.toLowerCase().indexOf('konqueror') != -1 ) {
501505 tooltipAccessKeyPrefix = 'ctrl-';
502 -} else if (is_ff2_x11 || is_ff2_win) {
 506+} else if (is_ff2) {
503507 tooltipAccessKeyPrefix = 'alt-shift-';
504508 }
505509 var tooltipAccessKeyRegexp = /\[(ctrl-)?(alt-)?(shift-)?(esc-)?.\]$/;
Index: trunk/phase3/RELEASE-NOTES
@@ -246,6 +246,7 @@
247247 * (bug 13820) Fix updater for rev_parent_id population
248248 * (bug 13925) Fix bad HTML on search results list
249249 * (bug 13934) Fixing the link to GNU General Public License Version 2
 250+* Show correct accesskey prefix for Firefox 3 beta (Alt-Shift-, not Alt-)
250251
251252
252253 === API changes in 1.13 ===

Status & tagging log