Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.test.js |
— | — | @@ -78,14 +78,6 @@ |
79 | 79 | '\\.st\\{e\\}\\$st (string)'); |
80 | 80 | mw.test.addTest('typeof $.fn.checkboxShiftClick', |
81 | 81 | 'function (string)'); |
82 | | - mw.test.addTest('typeof mw.util.isBrowser( \'safari\' )', |
83 | | - 'boolean (string)'); |
84 | | - mw.test.addTest('typeof mw.util.isLayout( \'webKit\' )', |
85 | | - 'boolean (string)'); |
86 | | - mw.test.addTest('typeof mw.util.isPlatform( \'MAC\' )', |
87 | | - 'boolean (string)'); |
88 | | - mw.test.addTest('typeof mw.util.isBrowserVersion( \'5\' )', |
89 | | - 'boolean (string)'); |
90 | 82 | mw.test.addTest('typeof mw.util.rawurlencode', |
91 | 83 | 'function (string)'); |
92 | 84 | mw.test.addTest('mw.util.rawurlencode( \'Test: A&B/Here\' )', |
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js |
— | — | @@ -15,33 +15,33 @@ |
16 | 16 | // Any initialisation after the DOM is ready |
17 | 17 | $(function () { |
18 | 18 | |
19 | | - // Populate clientProfile var |
20 | | - mw.util.clientProfile = $.client.profile(); |
| 19 | + // Initiate jQuery.client.profile |
| 20 | + $.client.profile(); |
21 | 21 | |
22 | 22 | // Set tooltipAccessKeyPrefix |
23 | 23 | |
24 | 24 | // Opera on any platform |
25 | | - if ( mw.util.isBrowser('opera') ) { |
| 25 | + if ( $.client.profile.name == 'opera' ) { |
26 | 26 | this.tooltipAccessKeyPrefix = 'shift-esc-'; |
27 | 27 | |
28 | 28 | // Chrome on any platform |
29 | | - } else if ( mw.util.isBrowser('chrome') ) { |
| 29 | + } else if ( $.client.profile.name == 'chrome' ) { |
30 | 30 | // Chrome on Mac or Chrome on other platform ? |
31 | | - this.tooltipAccessKeyPrefix = mw.util.isPlatform('mac') ? 'ctrl-option-' : 'alt-'; |
| 31 | + this.tooltipAccessKeyPrefix = $.client.profile.platform == 'mac' ? 'ctrl-option-' : 'alt-'; |
32 | 32 | |
33 | 33 | // Non-Windows Safari with webkit_version > 526 |
34 | | - } else if ( !mw.util.isPlatform('win') && mw.util.isBrowser('safari') && webkit_version > 526 ) { |
| 34 | + } else if ( $.client.profile.platform !== 'win' && $.client.profile.name == 'safari' && $.client.profile.layoutVersion > 526 ) { |
35 | 35 | this.tooltipAccessKeyPrefix = 'ctrl-alt-'; |
36 | 36 | |
37 | 37 | // Safari/Konqueror on any platform, or any browser on Mac (but not Safari on Windows) |
38 | | - } else if ( !( mw.util.isPlatform('win') && mw.util.isBrowser('safari') ) |
39 | | - && ( mw.util.isBrowser('safari') |
40 | | - || mw.util.isPlatform('mac') |
41 | | - || mw.util.isBrowser('konqueror') ) ) { |
| 38 | + } else if ( !( $.client.profile.platform == 'win' && $.client.profile.name == 'safari' ) |
| 39 | + && ( $.client.profile.name == 'safari' |
| 40 | + || $.client.profile.platform == 'mac' |
| 41 | + || $.client.profile.name == 'konqueror' ) ) { |
42 | 42 | this.tooltipAccessKeyPrefix = 'ctrl-'; |
43 | 43 | |
44 | 44 | // Firefox 2.x |
45 | | - } else if ( mw.util.isBrowser('firefox') && mw.util.isBrowserVersion('2') ) { |
| 45 | + } else if ( $.client.profile.name == 'firefox' && $.client.profile.versionBase == '2' ) { |
46 | 46 | this.tooltipAccessKeyPrefix = 'alt-shift-'; |
47 | 47 | } |
48 | 48 | |
— | — | @@ -66,69 +66,7 @@ |
67 | 67 | |
68 | 68 | /* Main body */ |
69 | 69 | |
70 | | - // Holds result of $.client.profile() |
71 | | - // Populated by init() |
72 | | - 'clientProfile' : {}, |
73 | | - |
74 | 70 | /** |
75 | | - * Checks if the current browser matches |
76 | | - * |
77 | | - * @example mw.util.isBrowser( 'safari' ); |
78 | | - * @param String str name of a browser (case insensitive). Check jquery.client.js for possible values |
79 | | - * @return Boolean true if the browsername matches the clients browser |
80 | | - */ |
81 | | - 'isBrowser' : function( str ) { |
82 | | - str = (str + '').toLowerCase(); |
83 | | - return this.clientProfile.name == str; |
84 | | - }, |
85 | | - |
86 | | - /** |
87 | | - * Checks if the current layout matches |
88 | | - * |
89 | | - * @example mw.util.isLayout( 'webkit' ); |
90 | | - * @param String str name of a layout engine (case insensitive). Check jquery.client.js for possible values |
91 | | - * @return Boolean true if the layout engine matches the clients browser |
92 | | - */ |
93 | | - 'isLayout' : function( str ) { |
94 | | - str = (str + '').toLowerCase(); |
95 | | - return this.clientProfile.layout == str; |
96 | | - }, |
97 | | - |
98 | | - /** |
99 | | - * Checks if the current layout engine version matches |
100 | | - * |
101 | | - * @example mw.util.isLayoutVersion( 533 ); |
102 | | - * @param Number num version number of a layout engine. |
103 | | - * @return Boolean true if the layout engine matches the clients browser |
104 | | - */ |
105 | | - 'isLayoutVersion' : function( num ) { |
106 | | - return this.clientProfile.layoutVersion == num; |
107 | | - }, |
108 | | - |
109 | | - /** |
110 | | - * Checks if the current layout matches |
111 | | - * |
112 | | - * @example mw.util.isPlatform( 'mac' ); |
113 | | - * @param String str name of a platform (case insensitive). Check jquery.client.js for possible values |
114 | | - * @return Boolean true if the platform matches the clients platform |
115 | | - */ |
116 | | - 'isPlatform' : function( str ) { |
117 | | - str = (str + '').toLowerCase(); |
118 | | - return this.clientProfile.platform == str; |
119 | | - }, |
120 | | - |
121 | | - /** |
122 | | - * Checks if the current browser version matches |
123 | | - * |
124 | | - * @example mw.util.isBrowserVersion( '5' ); |
125 | | - * @param String str version number without decimals |
126 | | - * @return Boolean true if the version number matches the clients browser |
127 | | - */ |
128 | | - 'isBrowserVersion' : function( str ) { |
129 | | - return this.clientProfile.versionBase === str; |
130 | | - }, |
131 | | - |
132 | | - /** |
133 | 71 | * Encodes the string like PHP's rawurlencode |
134 | 72 | * |
135 | 73 | * @param String str string to be encoded |