summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources')
-rw-r--r--www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css42
-rw-r--r--www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js33
-rw-r--r--www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gifbin0 -> 6147 bytes
-rw-r--r--www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.pngbin0 -> 196 bytes
4 files changed, 75 insertions, 0 deletions
diff --git a/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css
new file mode 100644
index 00000000..3be89338
--- /dev/null
+++ b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css
@@ -0,0 +1,42 @@
+.fancycaptcha-wrapper {
+ display: table;
+ background-color: #fff;
+}
+
+/* Prevents the size of the container from changing, affecting page
+layout, for normal CAPTCHA sizes. */
+.fancycaptcha-image-container {
+ min-height: 95px;
+ position: relative; /* to position Reload link within this */
+ display: inline-block;
+}
+
+.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;
+ cursor: pointer;
+ cursor: hand;
+}
+
+.client-nojs .fancycaptcha-reload {
+ display: none;
+}
+
+.fancycaptcha-reload:hover {
+ text-decoration: underline;
+}
+
+.fancycaptcha-reload-loading {
+ /* @embed */
+ background: url( images/ajax-loader-10x10.gif ) no-repeat scroll left center transparent;
+}
+
+.fancycaptcha-image-container .fancycaptcha-reload {
+ position: absolute;
+ bottom: 0;
+ right: 4px;
+}
diff --git a/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
new file mode 100644
index 00000000..689c88ec
--- /dev/null
+++ b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
@@ -0,0 +1,33 @@
+( function ( $, mw ) {
+ $( document ).on( 'click', '.fancycaptcha-reload', function () {
+ var $this = $( this ),
+ $root = $this.closest( '.fancycaptcha-captcha-container' ),
+ $captchaImage = $root.find( '.fancycaptcha-image' );
+
+ $this.addClass( 'fancycaptcha-reload-loading' );
+
+ // AJAX request to get captcha index key
+ new mw.Api().post( { action: 'fancycaptchareload' } ).done( function ( data ) {
+ var captchaIndex = data.fancycaptchareload.index,
+ imgSrc;
+ if ( typeof captchaIndex === 'string' ) {
+ // replace index key with a new one for captcha image
+ imgSrc = $captchaImage.attr( 'src' ).replace( /(wpCaptchaId=)\w+/, '$1' + captchaIndex );
+ $captchaImage.attr( 'src', imgSrc );
+
+ // replace index key with a new one for hidden tag
+ $( '#mw-input-captchaId' ).val( captchaIndex );
+ $( '#mw-input-captchaWord' ).val( '' ).focus();
+
+ // now do the same with a selector that works for pre-1.27 login forms
+ $root.find( '[name="wpCaptchaId"]' ).val( captchaIndex );
+ $root.find( '[name="wpCaptchaWord"]' ).val( '' ).focus();
+ }
+ } )
+ .always( function () {
+ $this.removeClass( 'fancycaptcha-reload-loading' );
+ } );
+
+ return false;
+ } );
+}( jQuery, mediaWiki ) );
diff --git a/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif
new file mode 100644
index 00000000..772e9a55
--- /dev/null
+++ b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif
Binary files differ
diff --git a/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png
new file mode 100644
index 00000000..e894aa87
--- /dev/null
+++ b/www/wiki/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png
Binary files differ