Index: trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php |
— | — | @@ -152,9 +152,19 @@ |
153 | 153 | wfMsgWikiHtml( $question['question'] ) ); |
154 | 154 | $retval .= Xml::openElement( 'td', |
155 | 155 | array( 'valign' => 'top' ) ); |
156 | | - $retval .= Xml::input( "survey-$id-x", 5 ); |
| 156 | + $retval .= Xml::input( "survey-$id-x", |
| 157 | + 5, false, array( |
| 158 | + 'class' => 'optin-resolution-x', |
| 159 | + 'id' => "survey-$id-x", |
| 160 | + ) |
| 161 | + ); |
157 | 162 | $retval .= ' x '; |
158 | | - $retval .= Xml::input( "survey-$id-y", 5 ); |
| 163 | + $retval .= Xml::input( "survey-$id-y", |
| 164 | + 5, false, array( |
| 165 | + 'class' => 'optin-resolution-y', |
| 166 | + 'id' => "survey-$id-y", |
| 167 | + ) |
| 168 | + ); |
159 | 169 | $retval .= Xml::closeElement( 'td' ); |
160 | 170 | $retval .= Xml::closeElement( 'tr' ); |
161 | 171 | break; |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.js |
— | — | @@ -1,3 +1,85 @@ |
| 2 | +/*
|
| 3 | +
|
| 4 | +jQuery Browser Plugin
|
| 5 | + * Version 2.3
|
| 6 | + * 2008-09-17 19:27:05
|
| 7 | + * URL: http://jquery.thewikies.com/browser
|
| 8 | + * Description: jQuery Browser Plugin extends browser detection capabilities and can assign browser selectors to CSS classes.
|
| 9 | + * Author: Nate Cavanaugh, Minhchau Dang, & Jonathan Neal
|
| 10 | + * Copyright: Copyright (c) 2008 Jonathan Neal under dual MIT/GPL license.
|
| 11 | + * JSLint: This javascript file passes JSLint verification.
|
| 12 | +*//*jslint
|
| 13 | + bitwise: true,
|
| 14 | + browser: true,
|
| 15 | + eqeqeq: true,
|
| 16 | + forin: true,
|
| 17 | + nomen: true,
|
| 18 | + plusplus: true,
|
| 19 | + undef: true,
|
| 20 | + white: true
|
| 21 | +*//*global
|
| 22 | + jQuery
|
| 23 | +*/
|
| 24 | +
|
| 25 | +(function ($) {
|
| 26 | + $.browserTest = function (a, z) {
|
| 27 | + var u = 'unknown', x = 'X', m = function (r, h) {
|
| 28 | + for (var i = 0; i < h.length; i = i + 1) {
|
| 29 | + r = r.replace(h[i][0], h[i][1]);
|
| 30 | + }
|
| 31 | +
|
| 32 | + return r;
|
| 33 | + }, c = function (i, a, b, c) {
|
| 34 | + var r = {
|
| 35 | + name: m((a.exec(i) || [u, u])[1], b)
|
| 36 | + };
|
| 37 | +
|
| 38 | + r[r.name] = true;
|
| 39 | +
|
| 40 | + r.version = (c.exec(i) || [x, x, x, x])[3];
|
| 41 | +
|
| 42 | + if (r.name.match(/safari/) && r.version > 400) {
|
| 43 | + r.version = '2.0';
|
| 44 | + }
|
| 45 | +
|
| 46 | + if (r.name === 'presto') {
|
| 47 | + r.version = ($.browser.version > 9.27) ? 'futhark' : 'linear_b';
|
| 48 | + }
|
| 49 | + r.versionNumber = parseFloat(r.version, 10) || 0;
|
| 50 | + r.versionX = (r.version !== x) ? (r.version + '').substr(0, 1) : x;
|
| 51 | + r.className = r.name + r.versionX;
|
| 52 | +
|
| 53 | + return r;
|
| 54 | + };
|
| 55 | +
|
| 56 | + a = (a.match(/Opera|Navigator|Minefield|KHTML|Chrome/) ? m(a, [
|
| 57 | + [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''],
|
| 58 | + ['Chrome Safari', 'Chrome'],
|
| 59 | + ['KHTML', 'Konqueror'],
|
| 60 | + ['Minefield', 'Firefox'],
|
| 61 | + ['Navigator', 'Netscape']
|
| 62 | + ]) : a).toLowerCase();
|
| 63 | +
|
| 64 | + $.browser = $.extend((!z) ? $.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));
|
| 65 | +
|
| 66 | + $.layout = c(a, /(gecko|konqueror|msie|opera|webkit)/, [
|
| 67 | + ['konqueror', 'khtml'],
|
| 68 | + ['msie', 'trident'],
|
| 69 | + ['opera', 'presto']
|
| 70 | + ], /(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);
|
| 71 | +
|
| 72 | + $.os = {
|
| 73 | + name: (/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase()) || [u])[0].replace('sunos', 'solaris')
|
| 74 | + };
|
| 75 | +
|
| 76 | + if (!z) {
|
| 77 | + $('html').addClass([$.os.name, $.browser.name, $.browser.className, $.layout.name, $.layout.className].join(' '));
|
| 78 | + }
|
| 79 | + };
|
| 80 | +
|
| 81 | + $.browserTest(navigator.userAgent);
|
| 82 | +})(jQuery);
|
| 83 | +
|
2 | 84 | /* JavaScript for OptIn extension */
|
3 | 85 |
|
4 | 86 | $( document ).ready( function() {
|
— | — | @@ -11,4 +93,17 @@ |
12 | 94 | $( '.optin-other-radios' ).click( function() {
|
13 | 95 | $(this).prev().prev().click();
|
14 | 96 | });
|
| 97 | + // Detect screen resolution
|
| 98 | + if ( screen.width && screen.height ) {
|
| 99 | + $( '.optin-resolution-x' ).val( screen.width );
|
| 100 | + $( '.optin-resolution-y' ).val( screen.height );
|
| 101 | + // Hide the fields?
|
| 102 | + }
|
| 103 | + /*
|
| 104 | + * We should probably refactor the code above and make it a jquery plugin
|
| 105 | + $.browser.name // String like "firefox"
|
| 106 | + $.browser.versionNumber // Floating point number like 3.5
|
| 107 | + $.os.name // String like "mac"
|
| 108 | + // More info about usage: http://jquery.thewikies.com/browser
|
| 109 | + */
|
15 | 110 | }); |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.i18n.php |
— | — | @@ -50,6 +50,6 @@ |
51 | 51 | 'optin-survey-answer-os-macos' => 'Mac OS', |
52 | 52 | 'optin-survey-answer-os-linux' => 'Linux', |
53 | 53 | 'optin-survey-answer-os-other' => 'Other:', |
54 | | - 'optin-survey-question-res' => 'What is the resolution of your screen?<br />If you don\'t know, [http://www.whatismyscreenresolution.com/ click here].', |
| 54 | + 'optin-survey-question-res' => 'What is the resolution of your screen?', |
55 | 55 | 'optin-survey-question-feedback' => 'Please let us know your feedback:', |
56 | 56 | ); |