Index: trunk/extensions/WikiLove/wikiLove.css |
— | — | @@ -266,6 +266,10 @@ |
267 | 267 | } |
268 | 268 | |
269 | 269 | /* add details gallery */ |
| 270 | +#wikiLoveDialog #wlGallery { |
| 271 | + min-height: 40px; |
| 272 | +} |
| 273 | + |
270 | 274 | #wikiLoveDialog #wlGallery img { |
271 | 275 | margin-right: 5px; |
272 | 276 | margin-bottom: 5px; |
— | — | @@ -281,6 +285,16 @@ |
282 | 286 | background-color: #f56427; |
283 | 287 | } |
284 | 288 | |
| 289 | +#wikiLoveDialog #wlGallerySpinner { |
| 290 | + position: relative; |
| 291 | +} |
| 292 | + |
| 293 | +#wikiLoveDialog #wlGallerySpinner .wlSpinner { |
| 294 | + float: none; |
| 295 | + position: absolute; |
| 296 | + z-index: -1; |
| 297 | +} |
| 298 | + |
285 | 299 | /* dialog preview */ |
286 | 300 | #wikiLoveDialog #wlPreview { |
287 | 301 | float: right; |
Index: trunk/extensions/WikiLove/wikiLove.js |
— | — | @@ -33,10 +33,10 @@ |
34 | 34 | template: '', |
35 | 35 | gallery: { |
36 | 36 | // right now we can only query the local wiki (not e.g. commons) |
37 | | - category: 'Category:Cat', |
| 37 | + category: 'Category:Cats', |
38 | 38 | total: 100, // total number of pictures to retrieve, and to randomise |
39 | 39 | num: 3, // number of pictures to show from the randomised set |
40 | | - width: 150 // width of each picture in pixels in the interface (not in the template) |
| 40 | + width: 145 // width of each picture in pixels in the interface (not in the template) |
41 | 41 | } |
42 | 42 | }, |
43 | 43 | // default type, nice to leave this one in place when adding other types |
— | — | @@ -69,11 +69,11 @@ |
70 | 70 | // Find out if we can email the user |
71 | 71 | $.wikiLove.getEmailable(); |
72 | 72 | |
| 73 | + // Reusable spinner string |
| 74 | + var spinner = '<img class="wlSpinner" src="' + mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) |
| 75 | + + '/extensions/WikiLove/images/spinner.gif"/>'; |
| 76 | + |
73 | 77 | // Build a type list like this: |
74 | | - // <ul id="wlTypes"> |
75 | | - // <li tabindex="0"><span>Barnstar</span></li> |
76 | | - // <li tabindex="0"><span>Make your own</span></li> |
77 | | - // </ul> |
78 | 78 | var $typeList = $( '<ul id="wlTypes"></ul>' ); |
79 | 79 | for( var typeId in $.wikiLove.types ) { |
80 | 80 | $button = $( '<a href="#"></a>' ); |
— | — | @@ -97,10 +97,6 @@ |
98 | 98 | } |
99 | 99 | |
100 | 100 | // Build the left menu for selecting a type: |
101 | | - // <div id="wlSelectType"> |
102 | | - // <h3>Select Type:</h3> |
103 | | - // <ul id="wlTypes">...</ul> |
104 | | - // </div> |
105 | 101 | var $selectType = $( '<div id="wlSelectType"></div>' ) |
106 | 102 | .append( '<span class="wlNumber">1</span>' ) |
107 | 103 | .append( '<h3>' + mw.msg( 'wikilove-select-type' ) + '</h3>' ) |
— | — | @@ -115,22 +111,6 @@ |
116 | 112 | ); |
117 | 113 | |
118 | 114 | // Build the right top section for selecting a subtype and entering a title (optional) and message |
119 | | - // <div id="wlAddDetails"> |
120 | | - // <h3>Add Details:</h3> |
121 | | - // |
122 | | - // <label for="wlSubtype" id="wlSubtypeLabel">...</label> (label depends on type) |
123 | | - // <select id="wlSubtype">...</select> (also depends on type) |
124 | | - // |
125 | | - // <label for="wlTitle" id="wlTitleLabel">Title:</label> (hidden for some (sub)types) |
126 | | - // <input type="text" class="text" id="wlTitle"/> |
127 | | - // |
128 | | - // <label for="wlMessage" id="wlMessageLabel">Enter a message:</label> |
129 | | - // <span class="wlOmitSig">(without a signature)</span> (this span floats right) |
130 | | - // <textarea id="wlMessage"></textarea> (textarea grows automatically with content) |
131 | | - // |
132 | | - // <input id="wlButtonPreview" class="submit" type="submit" value="Preview"/> |
133 | | - // <img class="wlSpinner" src="..."/> (spinner for the preview button) |
134 | | - // </div> |
135 | 115 | var $addDetails = $( '<div id="wlAddDetails"></div>' ) |
136 | 116 | .append( '<span class="wlNumber">2</span>' ) |
137 | 117 | .append( '<h3>' + mw.msg( 'wikilove-add-details' ) + '</h3>' ) |
— | — | @@ -138,6 +118,7 @@ |
139 | 119 | .append( $( '<form id="wlPreviewForm"></form>' ) |
140 | 120 | .append( '<select id="wlSubtype"></select>' ) |
141 | 121 | .append( '<label id="wlGalleryLabel">' + mw.msg( 'wikilove-gallery' ) + '</label>' ) |
| 122 | + .append( '<div id="wlGallerySpinner">' + spinner + '</div>' ) |
142 | 123 | .append( '<div id="wlGallery"/>' ) |
143 | 124 | .append( '<label for="wlTitle" id="wlTitleLabel">' + mw.msg( 'wikilove-title' ) + '</label>' ) |
144 | 125 | .append( '<input type="text" class="text" id="wlTitle"/>' ) |
— | — | @@ -147,18 +128,11 @@ |
148 | 129 | .append( $('<div id="wlNotify"></div>').html('<input type="checkbox" id="wlNotifyCheckbox" name="notify"/> <label for="wlNotifyCheckbox">Notify user by email</label>') ) |
149 | 130 | .append( '<input id="wlButtonPreview" class="submit" type="submit" value="' |
150 | 131 | + mw.msg( 'wikilove-button-preview' ) + '"/>' ) |
151 | | - .append( '<img class="wlSpinner" src="' + mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) |
152 | | - + '/extensions/WikiLove/images/spinner.gif"/>' ) |
| 132 | + .append( spinner ) |
153 | 133 | ) |
154 | 134 | .hide(); |
155 | 135 | |
156 | 136 | // Build the right bottom preview section |
157 | | - // <div id="wlPreview"> |
158 | | - // <h3>Preview:</h3> |
159 | | - // <div id="wlPreviewArea">...</div> (preview gets loaded here) |
160 | | - // <input id="wlButtonSend" class="submit" type="submit" value="Send WikiLove"/> |
161 | | - // <img class="wlSpinner" src="..."/> (another spinner for the send button) |
162 | | - // </div> |
163 | 137 | var $preview = $( '<div id="wlPreview"></div>' ) |
164 | 138 | .append( '<span class="wlNumber">3</span>' ) |
165 | 139 | .append( '<h3>' + mw.msg( 'wikilove-preview' ) + '</h3>' ) |
— | — | @@ -166,8 +140,7 @@ |
167 | 141 | .append( $( '<form id="wlSendForm"></form>' ) |
168 | 142 | .append( '<input id="wlButtonSend" class="submit" type="submit" value="' |
169 | 143 | + mw.msg( 'wikilove-button-send' ) + '"/>' ) |
170 | | - .append( '<img class="wlSpinner" src="' + mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) |
171 | | - + '/extensions/WikiLove/images/spinner.gif"/>' ) |
| 144 | + .append( spinner ) |
172 | 145 | ) |
173 | 146 | .hide(); |
174 | 147 | |
— | — | @@ -488,6 +461,8 @@ |
489 | 462 | makeGallery: function() { |
490 | 463 | $( '#wlGallery' ).html( '' ); |
491 | 464 | $.wikiLove.gallery = {}; |
| 465 | + $( '#wlGallerySpinner .wlSpinner' ).fadeIn( 200 ); |
| 466 | + |
492 | 467 | $.ajax({ |
493 | 468 | url: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/api.php', |
494 | 469 | data: { |
— | — | @@ -529,10 +504,13 @@ |
530 | 505 | // only add the image if it's actually an image |
531 | 506 | if( page.imageinfo[0].mime.substr(0,5) == 'image' ) { |
532 | 507 | // build an image tag with the correct url and width |
533 | | - $img = $( '<img/>' ); |
534 | | - $img.attr( 'src', page.imageinfo[0].url ); |
535 | | - $img.attr( 'width', $.wikiLove.currentTypeOrSubtype.gallery.width ); |
| 508 | + $img = $( '<img/>' ) |
| 509 | + .attr( 'src', page.imageinfo[0].url ) |
| 510 | + .attr( 'width', $.wikiLove.currentTypeOrSubtype.gallery.width ) |
| 511 | + .hide() |
| 512 | + .load( function() { $( this ).fadeIn( 400 ); } ); |
536 | 513 | |
| 514 | + |
537 | 515 | // append the image to the gallery and also make sure it's selectable |
538 | 516 | $( '#wlGallery' ).append( |
539 | 517 | $( '<a href="#"></a>' ) |
— | — | @@ -558,6 +536,8 @@ |
559 | 537 | $( '#wlGallery' ).hide(); |
560 | 538 | $( '#wlGalleryTitle' ).hide(); |
561 | 539 | } |
| 540 | + |
| 541 | + $( '#wlGallerySpinner .wlSpinner' ).fadeOut( 200 ); |
562 | 542 | } |
563 | 543 | }); |
564 | 544 | }, |
Index: trunk/extensions/WikiLove/WikiLove.api.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); |
17 | 17 | } |
18 | 18 | |
19 | | - if ( stripos( $params['text'], $params['template'] ) === false ) { |
| 19 | + if ( strlen( $params['template'] ) > 0 && stripos( $params['text'], $params['template'] ) === false ) { |
20 | 20 | $this->dieUsage( 'Template could not be found in the message!', 'invalidtemplate' ); |
21 | 21 | } |
22 | 22 | |