Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -41,9 +41,12 @@ |
42 | 42 | 'moodbar-form-title' => 'Because...', |
43 | 43 | 'moodbar-form-note' => '140 character maximum', |
44 | 44 | 'moodbar-form-note-dynamic' => '$1 characters remaining', |
45 | | - 'moodbar-form-submit' => 'Send Feedback', |
| 45 | + 'moodbar-form-submit' => 'Share Feedback', |
46 | 46 | 'moodbar-form-policy-text' => 'By submitting, $1', |
47 | 47 | 'moodbar-form-policy-label' => 'our policy', |
| 48 | + 'moodbar-loading-title' => 'Sharing...', |
| 49 | + 'moodbar-success-title' => 'Thanks!', |
| 50 | + 'moodbar-error-title' => 'Sharing...', |
48 | 51 | // Special:MoodBar |
49 | 52 | 'right-moodbar-view' => 'View and export MoodBar feedback', |
50 | 53 | 'moodbar-admin-title' => 'MoodBar feedback', |
Index: trunk/extensions/MoodBar/modules/jquery.moodBar/jquery.moodBar.js |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | * - type: A string. |
19 | 19 | * @return jqXHR |
20 | 20 | */ |
21 | | - 'submit' : function( fbProps ) { |
| 21 | + 'submit': function( fbProps ) { |
22 | 22 | var clientData = $.client.profile(), |
23 | 23 | fbProps = $.extend( { |
24 | 24 | 'page': mw.config.get( 'wgPageName' ), |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.init.js |
— | — | @@ -9,6 +9,14 @@ |
10 | 10 | |
11 | 11 | conf: mw.config.get( 'mbConfig' ), |
12 | 12 | |
| 13 | + cookiePrefix: function() { |
| 14 | + return 'ext.moodBar@' + mb.conf.bucketConfig.version + '-'; |
| 15 | + }, |
| 16 | + |
| 17 | + isDisabled: function() { |
| 18 | + return $.cookie( mb.cookiePrefix() + 'disabled' ) == '1'; |
| 19 | + }, |
| 20 | + |
13 | 21 | ui: { |
14 | 22 | // jQuery objects |
15 | 23 | pMoodbar: null, |
— | — | @@ -49,6 +57,8 @@ |
50 | 58 | |
51 | 59 | }; |
52 | 60 | |
53 | | - mb.init(); |
| 61 | + if ( !mb.isDisabled() ) { |
| 62 | + mb.init(); |
| 63 | + } |
54 | 64 | |
55 | 65 | } )( jQuery ); |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css |
— | — | @@ -40,6 +40,10 @@ |
41 | 41 | text-align: center; |
42 | 42 | } |
43 | 43 | |
| 44 | +.mw-moodBar-type { |
| 45 | + cursor: pointer; |
| 46 | +} |
| 47 | + |
44 | 48 | .mw-moodBar-typeTitle, |
45 | 49 | .mw-moodBar-privacy, |
46 | 50 | .mw-moodBar-overlayWhat { |
— | — | @@ -67,6 +71,11 @@ |
68 | 72 | outline: none; |
69 | 73 | } |
70 | 74 | |
| 75 | +.mw-moodBar-privacy, |
| 76 | +.mw-moodBar-overlayWhatContent { |
| 77 | + font-size: 10px; |
| 78 | +} |
| 79 | + |
71 | 80 | .mw-moodBar-formSubmit { |
72 | 81 | float: right; |
73 | 82 | } |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js |
— | — | @@ -9,9 +9,12 @@ |
10 | 10 | $.extend( mb, { |
11 | 11 | |
12 | 12 | tpl: { |
13 | | - overlay: '\ |
| 13 | + overlayBase: '\ |
14 | 14 | <div id="mw-moodBar-overlayWrap"><div id="mw-moodBar-overlay">\ |
15 | 15 | <span class="mw-moodBar-overlayClose"><a href="#"><html:msg key="moodbar-close" /></a></span>\ |
| 16 | + <div class="mw-moodBar-overlayContent"></div>\ |
| 17 | + </div></div>', |
| 18 | + userinput: '\ |
16 | 19 | <div class="mw-moodBar-overlayTitle"><html:msg key="moodbar-intro-using" /></div>\ |
17 | 20 | <div class="mw-moodBar-types"></div>\ |
18 | 21 | <div class="mw-moodBar-form">\ |
— | — | @@ -26,17 +29,22 @@ |
27 | 30 | </div>\ |
28 | 31 | </div>\ |
29 | 32 | <span class="mw-moodBar-overlayWhat">\ |
30 | | - <a title-msg="tooltip-moodbar-what">\ |
| 33 | + <a href="#" title-msg="tooltip-moodbar-what">\ |
31 | 34 | <span class="mw-moodBar-overlayWhatTrigger"></span>\ |
32 | 35 | <span class="mw-moodBar-overlayWhatLabel"><html:msg key="moodbar-what-label" /></span>\ |
33 | 36 | </a>\ |
34 | 37 | <div class="mw-moodBar-overlayWhatContent"></div>\ |
35 | | - </span>\ |
36 | | - </div></div>', |
| 38 | + </span>', |
37 | 39 | type: '\ |
38 | 40 | <div class="mw-moodBar-type mw-moodBar-type-$1" rel="$1">\ |
39 | 41 | <span class="mw-moodBar-typeTitle"><html:msg key="moodbar-type-$1-title" /></span>\ |
40 | | - </div>' |
| 42 | + </div>', |
| 43 | + loading: '\ |
| 44 | + <div><img src="' + mw.config.get( 'wgExtensionAssetsPath' ) + '/MoodBar/modules/ext.moodBar/images/ajax-spinner.gif" />Sharing...</div>', |
| 45 | + success: '\ |
| 46 | + <div>Thanks!</div>', |
| 47 | + error: '\ |
| 48 | + <div>Oops!</div>' |
41 | 49 | }, |
42 | 50 | |
43 | 51 | event: { |
— | — | @@ -51,7 +59,13 @@ |
52 | 60 | |
53 | 61 | disable: function( e ) { |
54 | 62 | e.preventDefault(); |
55 | | - // TODO write |
| 63 | + $.cookie( |
| 64 | + mb.cookiePrefix() + 'disabled', |
| 65 | + '1', |
| 66 | + { 'path': '/', 'expires': Number( mb.conf.disableExpiration ) } |
| 67 | + ); |
| 68 | + mb.ui.overlay.fadeOut( 'fast' ); |
| 69 | + mb.ui.trigger.fadeOut( 'fast' ); |
56 | 70 | } |
57 | 71 | }, |
58 | 72 | |
— | — | @@ -61,9 +75,9 @@ |
62 | 76 | type: 'unknown', |
63 | 77 | callback: function( data ) { |
64 | 78 | if ( data && data.moodbar && data.moodbar.result === 'success' ) { |
65 | | - alert(1); |
| 79 | + mb.swapContent( mb.tpl.success ); |
66 | 80 | } else { |
67 | | - alert(0); |
| 81 | + mb.swapContent( '.mw-moodBar-overlayContent' ); |
68 | 82 | } |
69 | 83 | } |
70 | 84 | }, |
— | — | @@ -73,7 +87,11 @@ |
74 | 88 | msgOptions.params['moodbar-intro-using'] = [mw.config.get( 'wgSiteName' )]; |
75 | 89 | |
76 | 90 | // Create overlay |
77 | | - mb.ui.overlay = $( mb.tpl.overlay ) |
| 91 | + mb.ui.overlay = $( mb.tpl.overlayBase ) |
| 92 | + // Fill content with user input screen |
| 93 | + .find( '.mw-moodBar-overlayContent' ) |
| 94 | + .html( mb.tpl.userinput ) |
| 95 | + .end() |
78 | 96 | // Handle all html:msgs |
79 | 97 | .localize( msgOptions ) |
80 | 98 | // Bind close-toggle |
— | — | @@ -83,7 +101,7 @@ |
84 | 102 | // Populate type selector |
85 | 103 | .find( '.mw-moodBar-types' ) |
86 | 104 | .append( function() { |
87 | | - var $mwMoodBarTypes = $(this), |
| 105 | + var $mwMoodBarTypes = $( this ), |
88 | 106 | elems = []; |
89 | 107 | $.each( mb.conf.validTypes, function( id, type ) { |
90 | 108 | elems.push( |
— | — | @@ -116,7 +134,8 @@ |
117 | 135 | .text( mw.msg( 'moodbar-what-collapsed' ) ) |
118 | 136 | .end() |
119 | 137 | .find( '.mw-moodBar-overlayWhat > a' ) |
120 | | - .click( function() { |
| 138 | + .click( function( e ) { |
| 139 | + e.preventDefault(); |
121 | 140 | mb.ui.overlay |
122 | 141 | .find( '.mw-moodBar-overlayWhatContent' ) |
123 | 142 | .each( function() { |
— | — | @@ -187,7 +206,9 @@ |
188 | 207 | .find( '.mw-moodBar-formSubmit' ) |
189 | 208 | .val( mw.msg( 'moodbar-form-submit' ) ) |
190 | 209 | .click( function() { |
191 | | - mb.feedbackItem.comment = mb.ui.overlay.find( 'mw-moodBar-formInput' ).val(); |
| 210 | + mb.feedbackItem.comment = mb.ui.overlay.find( '.mw-moodBar-formInput' ).val(); |
| 211 | + mb.swapContent( mb.tpl.loading ); |
| 212 | + //$.moodBar.submit( mb.feedbackItem ); |
192 | 213 | } ) |
193 | 214 | .end(); |
194 | 215 | |
— | — | @@ -201,9 +222,18 @@ |
202 | 223 | |
203 | 224 | // Bind triger |
204 | 225 | mb.ui.trigger.click( mb.event.trigger ); |
| 226 | + }, |
| 227 | + swapContent: function( tpl ) { |
| 228 | + mb.ui.overlay |
| 229 | + .find( '.mw-moodBar-overlayContent' ) |
| 230 | + .html( tpl ) |
| 231 | + .localize(); |
| 232 | + return true; |
205 | 233 | } |
206 | 234 | } ); |
207 | 235 | |
208 | | - mb.core(); |
| 236 | + if ( !mb.isDisabled() ) { |
| 237 | + mb.core(); |
| 238 | + } |
209 | 239 | |
210 | 240 | } )( jQuery ); |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/ajax-spinner.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/ajax-spinner.gif |
___________________________________________________________________ |
Added: svn:mime-type |
211 | 241 | + application/octet-stream |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -121,9 +121,10 @@ |
122 | 122 | 'using' => 10, |
123 | 123 | 'share' => 10, |
124 | 124 | ), |
125 | | - 'version' => 1, |
| 125 | + 'version' => 2, |
126 | 126 | 'expires' => 30, |
127 | 127 | ), |
128 | 128 | 'infoUrl' => 'http://www.mediawiki.org/wiki/MoodBar', |
129 | 129 | 'privacyUrl' => 'about:blank', |
| 130 | + 'disableExpiration' => 365, |
130 | 131 | ); |