Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -127,8 +127,10 @@ |
128 | 128 | 'articlefeedbackv5-transparency-terms-linktext' => 'terms', |
129 | 129 | 'articlefeedbackv5-transparency-terms-url' => 'Project:Privacy_policy', // TODO: Confirm correct link |
130 | 130 | 'articlefeedbackv5-section-linktext' => 'feedback', |
131 | | - 'articlefeedbackv5-toolbox-linktext' => 'Feedback', |
| 131 | + 'articlefeedbackv5-titlebar-linktext' => 'Feedback', |
| 132 | + 'articlefeedbackv5-toolbox-linktext' => 'Rate this page', |
132 | 133 | |
| 134 | + |
133 | 135 | /* --- copied from AFTv4 and possibly not used --- */ |
134 | 136 | /* ArticleFeedback survey */ |
135 | 137 | 'articlefeedbackv5-survey-question-origin' => 'What page were you on when you started this survey?', |
— | — | @@ -285,6 +287,7 @@ |
286 | 288 | 'articlefeedbackv5-transparency-terms-url' => 'The URL for the terms (can be translated; defaults to Project:Privacy_policy; Do not translate "Project:")', |
287 | 289 | 'articlefeedbackv5-section-linktext' => 'When a link to pop up the feedback tool appears on the article section headers, next to [edit], this will be the text inside the brackets immediately following (e.g. "[edit] [feedback]").', |
288 | 290 | 'articlefeedbackv5-toolbox-linktext' => 'When a link to pop up the feedback tool appears at the bottom of the toolbox area in the sidebar, this will be the link text.', |
| 291 | + 'articlefeedbackv5-toolbox-linktext' => 'When a link to pop up the feedback tool appears just below the title bar to the far right, this will be the link text.', |
289 | 292 | |
290 | 293 | /* --- copied from AFTv4 and possibly not used --- */ |
291 | 294 | /* ArticleFeedback survey */ |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -1906,10 +1906,12 @@ |
1907 | 1907 | } else if ( cookieval in knownBuckets ) { |
1908 | 1908 | $.articleFeedbackv5.bucketId = cookieval; |
1909 | 1909 | } else { |
1910 | | - $.articleFeedbackv5.bucketId = mw.user.bucket( |
| 1910 | + var bucketName = mw.user.bucket( |
1911 | 1911 | 'ext.articleFeedbackv5-display', |
1912 | 1912 | mw.config.get( 'wgArticleFeedbackv5DisplayBuckets' ) |
1913 | 1913 | ); |
| 1914 | + var nameMap = { zero: '0', one: '1', two: '2', three: '3', four: '4', five: '5' }; |
| 1915 | + $.articleFeedbackv5.bucketId = nameMap[bucketName]; |
1914 | 1916 | } |
1915 | 1917 | // Drop in a cookie to keep track of their display bucket; |
1916 | 1918 | // use the config to determine how long to hold onto it. |
— | — | @@ -2329,6 +2331,30 @@ |
2330 | 2332 | }; |
2331 | 2333 | |
2332 | 2334 | // }}} |
| 2335 | + // {{{ inDebug |
| 2336 | + |
| 2337 | + /** |
| 2338 | + * Returns whether the plugin is in debug mode |
| 2339 | + * |
| 2340 | + * @return int whether the plugin is in debug mode |
| 2341 | + */ |
| 2342 | + $.articleFeedbackv5.inDebug = function () { |
| 2343 | + return $.articleFeedbackv5.debug; |
| 2344 | + }; |
| 2345 | + |
| 2346 | + // }}} |
| 2347 | + // {{{ getBucketId |
| 2348 | + |
| 2349 | + /** |
| 2350 | + * Gets the bucket ID |
| 2351 | + * |
| 2352 | + * @return int the bucket ID |
| 2353 | + */ |
| 2354 | + $.articleFeedbackv5.getBucketId = function () { |
| 2355 | + return $.articleFeedbackv5.bucketId; |
| 2356 | + }; |
| 2357 | + |
| 2358 | + // }}} |
2333 | 2359 | // {{{ openAsModal |
2334 | 2360 | |
2335 | 2361 | /** |
— | — | @@ -2396,6 +2422,12 @@ |
2397 | 2423 | $.articleFeedbackv5.init( $( this ), opts ); |
2398 | 2424 | } else if ( 'setLinkId' === opts ) { |
2399 | 2425 | $.articleFeedbackv5.setLinkId( arg ); |
| 2426 | + } else if ( 'getBucketId' === opts ) { |
| 2427 | + return $.articleFeedbackv5.getBucketId(); |
| 2428 | + } else if ( 'inDebug' === opts ) { |
| 2429 | + return $.articleFeedbackv5.inDebug(); |
| 2430 | + } else if ( 'prefix' === opts ) { |
| 2431 | + return $.articleFeedbackv5.prefix( arg ); |
2400 | 2432 | } else if ( 'openAsModal' === opts ) { |
2401 | 2433 | $.articleFeedbackv5.openAsModal( arg ); |
2402 | 2434 | } else if ( 'closeAsModal' === opts ) { |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.css |
— | — | @@ -1,16 +1,18 @@ |
2 | | -/* |
3 | | - * Styles for Article Feedback Extension |
4 | | - */ |
5 | | -#articleFeedback-dialog { |
6 | | - padding: 2em; |
7 | | - padding-top: 1em; |
8 | | -} |
| 2 | +/** Styles for feedback links **/ |
9 | 3 | |
10 | | -.articleFeedback-survey-disclaimer { |
11 | | - font-weight: normal; /* Override bold */ |
12 | | - font-style: italic; |
| 4 | +#articleFeedbackv5-titlebarlink { |
| 5 | + float: right; |
| 6 | + font-size: 85%; |
| 7 | + font-weight: bold; |
| 8 | + line-height: 1.5em; |
| 9 | + margin: 5px 0; |
| 10 | + padding: 0; |
| 11 | + position: absolute; |
| 12 | + right: 0; |
| 13 | + text-align: right; |
| 14 | + text-indent: 0; |
| 15 | + text-transform: none; |
| 16 | + top: 0; |
| 17 | + white-space: nowrap; |
13 | 18 | } |
14 | 19 | |
15 | | -.articleFeedback-survey-disclaimer a { |
16 | | - color: #0645AD; /* Override blackish color set by JUI */ |
17 | | -} |
Index: trunk/extensions/ArticleFeedbackv5/modules/ext.articleFeedbackv5/ext.articleFeedbackv5.js |
— | — | @@ -3,6 +3,19 @@ |
4 | 4 | */ |
5 | 5 | ( function( $ ) { |
6 | 6 | |
| 7 | +/* Load at the bottom of the article */ |
| 8 | +var $aftDiv = $( '<div id="mw-articlefeedbackv5"></div>' ).articleFeedbackv5(); |
| 9 | + |
| 10 | +// Put on bottom of article before #catlinks (if it exists) |
| 11 | +// Except in legacy skins, which have #catlinks above the article but inside content-div. |
| 12 | +var legacyskins = [ 'standard', 'cologneblue', 'nostalgia' ]; |
| 13 | +if ( $( '#catlinks' ).length && $.inArray( mw.config.get( 'skin' ), legacyskins ) < 0 ) { |
| 14 | + $aftDiv.insertBefore( '#catlinks' ); |
| 15 | +} else { |
| 16 | + // CologneBlue, Nostalgia, ... |
| 17 | + mw.util.$content.append( $aftDiv ); |
| 18 | +} |
| 19 | + |
7 | 20 | /* Setup for feedback links */ |
8 | 21 | |
9 | 22 | // Only track users who have been assigned to the tracking group |
— | — | @@ -13,10 +26,13 @@ |
14 | 27 | // Info about each of the links |
15 | 28 | var linkInfo = { |
16 | 29 | '1': { |
17 | | - clickTracking: $.articleFeedbackv5.prefix( 'section-link' ) |
| 30 | + clickTracking: $aftDiv.articleFeedbackv5( 'prefix', 'section-link' ) |
18 | 31 | }, |
| 32 | + '2': { |
| 33 | + clickTracking: $aftDiv.articleFeedbackv5( 'prefix', 'titlebar-link' ) |
| 34 | + }, |
19 | 35 | '4': { |
20 | | - clickTracking: $.articleFeedbackv5.prefix( 'toolbox-link' ) |
| 36 | + clickTracking: $aftDiv.articleFeedbackv5( 'prefix', 'toolbox-link' ) |
21 | 37 | } |
22 | 38 | }; |
23 | 39 | |
— | — | @@ -26,47 +42,81 @@ |
27 | 43 | if ( useClickTracking && $.isFunction( $.trackActionWithInfo ) ) { |
28 | 44 | $.trackActionWithInfo( linkInfo[ $link.data( 'linkId' ) ].clickTracking, mw.config.get( 'wgTitle' ) ); |
29 | 45 | } |
30 | | - // Set the link id |
31 | | - $( '#mw-articlefeedbackv5' ).articleFeedbackv5( 'openAsModal', $link ); |
32 | | -} |
| 46 | + // Open as modal |
| 47 | + $aftDiv.articleFeedbackv5( 'openAsModal', $link ); |
| 48 | +}; |
33 | 49 | |
34 | | -/* Load at the bottom of the article */ |
35 | | -var $aftDiv = $( '<div id="mw-articlefeedbackv5"></div>' ).articleFeedbackv5(); |
| 50 | +// Bucketing |
| 51 | +var linkBucket = function () { |
| 52 | + // Find out which link bucket they go in: |
| 53 | + // 1. Display buckets 0 or 5? Always zero. |
| 54 | + // 2. Requested in query string (debug only) |
| 55 | + // 3. Random bucketing |
| 56 | + var displayBucket = $aftDiv.articleFeedbackv5( 'getBucketId' ); |
| 57 | + if ( '5' == displayBucket || '0' == displayBucket ) { |
| 58 | + console.log( '5 or 0'); |
| 59 | + return '0'; |
| 60 | + } |
| 61 | + var knownBuckets = { '0': true, '1': true, '2': true }; |
| 62 | + var requested = mw.util.getParamValue( 'aft_link' ); |
| 63 | + if ( $aftDiv.articleFeedbackv5( 'inDebug' ) && requested in knownBuckets ) { |
| 64 | + console.log( 'requested ' + requested ); |
| 65 | + return requested; |
| 66 | + } else { |
| 67 | + console.log( 'bucketing' ); |
| 68 | + console.log( mw.config.get( 'wgArticleFeedbackv5LinkBuckets' ) ); |
| 69 | + console.log( mw.config.get( 'wgArticleFeedbackv5DisplayBuckets' ) ); |
| 70 | + var bucketName = mw.user.bucket( 'ext.articleFeedbackv5-links', |
| 71 | + mw.config.get( 'wgArticleFeedbackv5LinkBuckets' ) |
| 72 | + ); |
| 73 | + var nameMap = { '-': 0, 'A': 1, 'B': 2 }; |
| 74 | + return nameMap[bucketName]; |
36 | 75 | |
37 | | -// Put on bottom of article before #catlinks (if it exists) |
38 | | -// Except in legacy skins, which have #catlinks above the article but inside content-div. |
39 | | -var legacyskins = [ 'standard', 'cologneblue', 'nostalgia' ]; |
40 | | -if ( $( '#catlinks' ).length && $.inArray( mw.config.get( 'skin' ), legacyskins ) < 0 ) { |
41 | | - $aftDiv.insertBefore( '#catlinks' ); |
42 | | -} else { |
43 | | - // CologneBlue, Nostalgia, ... |
44 | | - mw.util.$content.append( $aftDiv ); |
| 76 | + } |
| 77 | +}(); |
| 78 | +if ( $aftDiv.articleFeedbackv5( 'inDebug' ) ) { |
| 79 | + console.log( 'Using link option #' + linkBucket ); |
45 | 80 | } |
46 | 81 | |
47 | 82 | /* Add section links */ |
48 | | -$( 'span.editsection' ).append( |
49 | | - ' [' + |
50 | | - '<a href="#mw-articlefeedbackv5" class="articleFeedbackv5-sectionlink">' + |
51 | | - mw.msg( 'articlefeedbackv5-section-linktext' ) + '</a>' + |
52 | | - ']' |
53 | | -); |
54 | | -$( 'span.editsection a.articleFeedbackv5-sectionlink' ) |
55 | | - .data( 'linkId', 1 ) |
56 | | - .click( function ( e ) { |
57 | | - e.preventDefault(); |
58 | | - clickFeedbackLink( $( e.target ) ); |
59 | | - } ); |
| 83 | +if ( '1' == linkBucket ) { |
| 84 | + $( 'span.editsection' ).append( |
| 85 | + ' [' + |
| 86 | + '<a href="#mw-articlefeedbackv5" class="articleFeedbackv5-sectionlink">' + |
| 87 | + mw.msg( 'articlefeedbackv5-section-linktext' ) + '</a>' + |
| 88 | + ']' |
| 89 | + ); |
| 90 | + $( 'span.editsection a.articleFeedbackv5-sectionlink' ) |
| 91 | + .data( 'linkId', 1 ) |
| 92 | + .click( function ( e ) { |
| 93 | + e.preventDefault(); |
| 94 | + clickFeedbackLink( $( e.target ) ); |
| 95 | + } ); |
| 96 | +} |
60 | 97 | |
61 | | -/* Add toolbox link */ |
62 | | -var $aftLink4 = $( '<li id="t-articlefeedbackv5"><a href="#mw-articlefeedbackv5"></a></li>' ) |
63 | | - .find( 'a' ) |
64 | | - .data( 'linkId', 4 ) |
65 | | - .text( mw.msg( 'articlefeedbackv5-toolbox-linktext' ) ) |
| 98 | +/* Add titlebar link */ |
| 99 | +if ( '2' == linkBucket ) { |
| 100 | + $( '<a href="#mw-articleFeedbackv5" id="articleFeedbackv5-titlebarlink" />' ) |
| 101 | + .data( 'linkId', 2 ) |
| 102 | + .text( mw.msg( 'articlefeedbackv5-titlebar-linktext' ) ) |
66 | 103 | .click( function ( e ) { |
67 | 104 | e.preventDefault(); |
68 | 105 | clickFeedbackLink( $( e.target ) ); |
69 | 106 | } ) |
70 | | - .end(); |
71 | | -$( '#p-tb' ).find( 'ul' ).append( $aftLink4 ); |
| 107 | + .insertBefore( $aftDiv ); |
| 108 | +} |
72 | 109 | |
| 110 | +/* Add toolbox link */ |
| 111 | +if ( '5' == $aftDiv.articleFeedbackv5( 'getBucketId' ) ) { |
| 112 | + var $aftLink4 = $( '<li id="t-articlefeedbackv5"><a href="#mw-articlefeedbackv5"></a></li>' ) |
| 113 | + .find( 'a' ) |
| 114 | + .text( mw.msg( 'articlefeedbackv5-toolbox-linktext' ) ) |
| 115 | + .click( function ( e ) { |
| 116 | + // Just set the link ID -- this should act just like AFTv4 |
| 117 | + $aftDiv.articleFeedbackv5( 'setLinkId', 4 ); |
| 118 | + } ) |
| 119 | + .end(); |
| 120 | + $( '#p-tb' ).find( 'ul' ).append( $aftLink4 ); |
| 121 | +} |
| 122 | + |
73 | 123 | } )( jQuery ); |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.php |
— | — | @@ -63,12 +63,12 @@ |
64 | 64 | // the new odds are applied to everyone, not just people who have yet to be |
65 | 65 | // placed in a bucket. |
66 | 66 | 'buckets' => array( |
67 | | - '0' => 17, |
68 | | - '1' => 17, |
69 | | - '2' => 17, |
70 | | - '3' => 17, |
71 | | - '4' => 16, |
72 | | - '5' => 16, |
| 67 | + 'zero' => 17, |
| 68 | + 'one' => 17, |
| 69 | + 'two' => 17, |
| 70 | + 'three' => 17, |
| 71 | + 'four' => 16, |
| 72 | + 'five' => 16, |
73 | 73 | ), |
74 | 74 | // This version number is added to all tracking event names, so that |
75 | 75 | // changes in the software don't corrupt the data being collected. Bump |
— | — | @@ -82,7 +82,7 @@ |
83 | 83 | 'tracked' => true |
84 | 84 | ); |
85 | 85 | |
86 | | -// Bucket settings for tracking users |
| 86 | +// Bucket settings for click tracking on feedback links |
87 | 87 | $wgArticleFeedbackv5Tracking = array( |
88 | 88 | // Not all users need to be tracked, but we do want to track some users over time - these |
89 | 89 | // buckets are used when deciding to track someone or not, placing them in one of two buckets: |
— | — | @@ -97,13 +97,13 @@ |
98 | 98 | // This version number is added to all tracking event names, so that changes in the software |
99 | 99 | // don't corrupt the data being collected. Bump this when you want to start a new "experiment". |
100 | 100 | 'version' => 0, |
101 | | - // Let user's be tracked for a month, and then rebucket them, allowing some churn |
| 101 | + // Let users be tracked for a month, and then rebucket them, allowing some churn |
102 | 102 | 'expires' => 30, |
103 | 103 | // Track the event of users being bucketed - so we can be sure the odds worked out right |
104 | 104 | 'tracked' => true |
105 | 105 | ); |
106 | 106 | |
107 | | -// Bucket settings for extra options in the UI |
| 107 | +// Bucket settings for extra expertise checkboxes in the Option 5 feedback form |
108 | 108 | $wgArticleFeedbackv5Options = array( |
109 | 109 | 'buckets' => array( |
110 | 110 | 'show' => 100, |
— | — | @@ -114,6 +114,31 @@ |
115 | 115 | 'tracked' => true |
116 | 116 | ); |
117 | 117 | |
| 118 | +// Bucket settings for links to the feedback form |
| 119 | +$wgArticleFeedbackv5LinkBuckets = array( |
| 120 | + // Users can fall into one of several buckets for links. These are: |
| 121 | + // 0: No link; user must scroll to the bottom of the page |
| 122 | + // 1: Section bars |
| 123 | + // 2: Title bar |
| 124 | + // 3: Vertical button |
| 125 | + 'buckets' => array( |
| 126 | + '-' => 0, |
| 127 | + 'A' => 0, |
| 128 | + 'B' => 100, |
| 129 | + 'C' => 0, |
| 130 | + ), |
| 131 | + // This version number is added to all tracking event names, so that |
| 132 | + // changes in the software don't corrupt the data being collected. Bump |
| 133 | + // this when you want to start a new "experiment". |
| 134 | + 'version' => 0, |
| 135 | + // Let users be tracked for a month, and then rebucket them, allowing some |
| 136 | + // churn. |
| 137 | + 'expires' => 30, |
| 138 | + // Track the event of users being bucketed - so we can be sure the odds |
| 139 | + // worked out right. |
| 140 | + 'tracked' => true |
| 141 | +); |
| 142 | + |
118 | 143 | /** |
119 | 144 | * The full URL for a discussion page about the Article Feedback Dashboard |
120 | 145 | * |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -20,6 +20,7 @@ |
21 | 21 | 'styles' => 'ext.articleFeedbackv5/ext.articleFeedbackv5.css', |
22 | 22 | 'messages' => array( |
23 | 23 | 'articlefeedbackv5-section-linktext', |
| 24 | + 'articlefeedbackv5-titlebar-linktext', |
24 | 25 | 'articlefeedbackv5-toolbox-linktext', |
25 | 26 | ), |
26 | 27 | 'dependencies' => array( |
— | — | @@ -216,6 +217,7 @@ |
217 | 218 | $wgArticleFeedbackv5DisplayBuckets, |
218 | 219 | $wgArticleFeedbackv5Tracking, |
219 | 220 | $wgArticleFeedbackv5Options, |
| 221 | + $wgArticleFeedbackv5LinkBuckets, |
220 | 222 | $wgArticleFeedbackv5Namespaces, |
221 | 223 | $wgArticleFeedbackv5LearnToEdit; |
222 | 224 | $vars['wgArticleFeedbackv5SMaxage'] = $wgArticleFeedbackv5SMaxage; |
— | — | @@ -228,6 +230,7 @@ |
229 | 231 | $vars['wgArticleFeedbackv5DisplayBuckets'] = $wgArticleFeedbackv5DisplayBuckets; |
230 | 232 | $vars['wgArticleFeedbackv5Tracking'] = $wgArticleFeedbackv5Tracking; |
231 | 233 | $vars['wgArticleFeedbackv5Options'] = $wgArticleFeedbackv5Options; |
| 234 | + $vars['wgArticleFeedbackv5LinkBuckets'] = $wgArticleFeedbackv5LinkBuckets; |
232 | 235 | $vars['wgArticleFeedbackv5Namespaces'] = $wgArticleFeedbackv5Namespaces; |
233 | 236 | $vars['wgArticleFeedbackv5LearnToEdit'] = $wgArticleFeedbackv5LearnToEdit; |
234 | 237 | $vars['wgArticleFeedbackv5WhatsThisPage'] = wfMsgForContent( 'articlefeedbackv5-bucket5-form-panel-explanation-link' ); |