summaryrefslogtreecommitdiff
path: root/extensions/ConfirmEdit/FancyCaptcha/resources
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/ConfirmEdit/FancyCaptcha/resources')
-rw-r--r--extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css41
-rw-r--r--extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js37
-rw-r--r--extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gifbin0 -> 6147 bytes
-rw-r--r--extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.pngbin0 -> 307 bytes
4 files changed, 78 insertions, 0 deletions
diff --git a/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css b/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css
new file mode 100644
index 00000000..96e4dd6a
--- /dev/null
+++ b/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.css
@@ -0,0 +1,41 @@
+.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;
+}
+
+.client-nojs .fancycaptcha-reload {
+ display: none;
+}
+
+.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;
+}
+
+.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/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js b/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
new file mode 100644
index 00000000..a8db7218
--- /dev/null
+++ b/extensions/ConfirmEdit/FancyCaptcha/resources/ext.confirmEdit.fancyCaptcha.js
@@ -0,0 +1,37 @@
+( function ( $, mw ) {
+ var api = new mw.Api();
+ $( document ).on( 'click', '.fancycaptcha-reload', function () {
+ var $this = $( this ), $captchaImage;
+
+ $this.addClass( 'fancycaptcha-reload-loading' );
+
+ $captchaImage = $( '.fancycaptcha-image' );
+
+ // AJAX request to get captcha index key
+ api.post( {
+ action: 'fancycaptchareload',
+ format: 'xml'
+ }, {
+ dataType: 'xml'
+ } )
+ .done( function ( xmldata ) {
+ var imgSrc, captchaIndex;
+ captchaIndex = $( xmldata ).find( 'fancycaptchareload' ).attr( 'index' );
+ 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
+ $( '#wpCaptchaId' ).val( captchaIndex );
+ $( '#wpCaptchaWord' ).val( '' ).focus();
+ }
+ } )
+ .always( function () {
+ $this.removeClass( 'fancycaptcha-reload-loading' );
+ } );
+
+ return false;
+ } );
+} )( jQuery, mediaWiki );
diff --git a/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif b/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif
new file mode 100644
index 00000000..772e9a55
--- /dev/null
+++ b/extensions/ConfirmEdit/FancyCaptcha/resources/images/ajax-loader-10x10.gif
Binary files differ
diff --git a/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png b/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png
new file mode 100644
index 00000000..6cbde303
--- /dev/null
+++ b/extensions/ConfirmEdit/FancyCaptcha/resources/images/fancycaptcha-reload-icon.png
Binary files differ