Spage has uploaded a new change for review.
https://gerrit.wikimedia.org/r/61155
Change subject: Move reload image into the _Refresh_ background
......................................................................
Move reload image into the _Refresh_ background
This makes the icon and text a single item, so they don't split across
lines, and reduces code.
Bug: 47398
Change-Id: If81313b9fe03693dcdc06d5d682f0ef9a9994f76
---
M FancyCaptcha.class.php
M resources/ext.confirmEdit.fancyCaptcha.css
M resources/ext.confirmEdit.fancyCaptcha.js
R resources/images/ajax-loader-10x10.gif
R resources/images/fancycaptcha-reload-icon.png
5 files changed, 25 insertions(+), 43 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ConfirmEdit
refs/changes/55/61155/1
diff --git a/FancyCaptcha.class.php b/FancyCaptcha.class.php
index b04ceb9..d6609db 100644
--- a/FancyCaptcha.class.php
+++ b/FancyCaptcha.class.php
@@ -98,25 +98,16 @@
$index = $this->getCaptchaIndex();
if ( $wgEnableAPI ) {
- $reloadText = wfMessage( 'fancycaptcha-reload-text'
)->text();
-
// Loaded only if JS is enabled
$wgOut->addModules( 'ext.confirmEdit.fancyCaptcha' );
- $captchaReload = "<span
class='confirmedit-captcha-reload fancycaptcha-reload'>" .
- Html::element( 'img', array(
- 'class' =>
'fancycaptcha-reload-button',
- 'src' => $wgExtensionAssetsPath .
'/ConfirmEdit/images/fancycaptcha-reload-icon.png',
- 'alt' => wfMessage(
'fancycaptcha-reload-button' )->text(),
- 'title' => $reloadText
- )
- ) .
- Html::element( 'small', array(
- 'class' => 'fancycaptcha-reload-text'
+ $captchaReload = Html::element(
+ 'small',
+ array(
+ 'class' => 'confirmedit-captcha-reload
fancycaptcha-reload'
),
- $reloadText
- ) .
- "</span>\n";
+ wfMessage( 'fancycaptcha-reload-text' )->text()
+ );
} else {
$captchaReload = '';
}
diff --git a/resources/ext.confirmEdit.fancyCaptcha.css
b/resources/ext.confirmEdit.fancyCaptcha.css
index 5115957..78280f9 100644
--- a/resources/ext.confirmEdit.fancyCaptcha.css
+++ b/resources/ext.confirmEdit.fancyCaptcha.css
@@ -9,30 +9,24 @@
min-height: 95px;
}
-.fancycaptcha-reload {
- padding: 0 5px;
-}
-
.client-nojs .fancycaptcha-reload {
display: none;
}
-.fancycaptcha-reload-button {
- padding: 5px;
-}
-
-.fancycaptcha-reload-button:hover {
- cursor: pointer;
- cursor: hand;
-}
-
-.fancycaptcha-reload-text {
+.fancycaptcha-reload {
+ /* @embed */
+ background: url(images/fancycaptcha-reload-icon.png) no-repeat scroll
left center transparent;
+ margin: 0 0 0 3px;
+ padding: 1px 2px 1px 12px;
color: #0645AD;
- display: inline !important;
-}
-
-.fancycaptcha-reload-text:hover {
- text-decoration: underline;
cursor: pointer;
cursor: hand;
}
+
+.fancycaptcha-reload:hover {
+ text-decoration: underline;
+}
+.fancycaptcha-reload-loading {
+ /* @embed */
+ background: url(images/ajax-loader-10x10.gif) no-repeat scroll left
center transparent;
+}
diff --git a/resources/ext.confirmEdit.fancyCaptcha.js
b/resources/ext.confirmEdit.fancyCaptcha.js
index 7640df3..a8db721 100644
--- a/resources/ext.confirmEdit.fancyCaptcha.js
+++ b/resources/ext.confirmEdit.fancyCaptcha.js
@@ -1,14 +1,11 @@
( function ( $, mw ) {
var api = new mw.Api();
$( document ).on( 'click', '.fancycaptcha-reload', function () {
- var staticImageDirectory = mw.config.get(
'wgExtensionAssetsPath' ) + '/ConfirmEdit/images/',
- $this = $( this ), reloadButtonImage, captchaImage;
+ var $this = $( this ), $captchaImage;
- reloadButtonImage = $this
- .find( '.fancycaptcha-reload-button' )
- .attr( 'src', staticImageDirectory +
'ajax-loader-10x10.gif' );
+ $this.addClass( 'fancycaptcha-reload-loading' );
- captchaImage = $( '.fancycaptcha-image' );
+ $captchaImage = $( '.fancycaptcha-image' );
// AJAX request to get captcha index key
api.post( {
@@ -22,9 +19,9 @@
captchaIndex = $( xmldata ).find( 'fancycaptchareload'
).attr( 'index' );
if ( typeof captchaIndex === 'string' ) {
// replace index key with a new one for captcha
image
- imgSrc = captchaImage.attr( 'src' )
+ imgSrc = $captchaImage.attr( 'src' )
.replace( /(wpCaptchaId=)\w+/, '$1' +
captchaIndex );
- captchaImage.attr( 'src', imgSrc );
+ $captchaImage.attr( 'src', imgSrc );
// replace index key with a new one for hidden
tag
$( '#wpCaptchaId' ).val( captchaIndex );
@@ -32,7 +29,7 @@
}
} )
.always( function () {
- reloadButtonImage.attr( 'src', staticImageDirectory +
'fancycaptcha-reload-icon.png' );
+ $this.removeClass( 'fancycaptcha-reload-loading' );
} );
return false;
diff --git a/images/ajax-loader-10x10.gif
b/resources/images/ajax-loader-10x10.gif
similarity index 100%
rename from images/ajax-loader-10x10.gif
rename to resources/images/ajax-loader-10x10.gif
Binary files differ
diff --git a/images/fancycaptcha-reload-icon.png
b/resources/images/fancycaptcha-reload-icon.png
similarity index 100%
rename from images/fancycaptcha-reload-icon.png
rename to resources/images/fancycaptcha-reload-icon.png
Binary files differ
--
To view, visit https://gerrit.wikimedia.org/r/61155
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If81313b9fe03693dcdc06d5d682f0ef9a9994f76
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ConfirmEdit
Gerrit-Branch: master
Gerrit-Owner: Spage <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits