summaryrefslogtreecommitdiff
path: root/extensions/ConfirmEdit/resources
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/ConfirmEdit/resources')
-rw-r--r--extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js55
-rw-r--r--extensions/ConfirmEdit/resources/ext.confirmEdit.fancyCaptcha.css41
-rw-r--r--extensions/ConfirmEdit/resources/ext.confirmEdit.fancyCaptcha.js37
-rw-r--r--extensions/ConfirmEdit/resources/images/ajax-loader-10x10.gifbin0 -> 6147 bytes
-rw-r--r--extensions/ConfirmEdit/resources/images/fancycaptcha-reload-icon.pngbin0 -> 307 bytes
5 files changed, 133 insertions, 0 deletions
diff --git a/extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js b/extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js
new file mode 100644
index 00000000..52dc532c
--- /dev/null
+++ b/extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js
@@ -0,0 +1,55 @@
+/*======================================================================*\
+|| #################################################################### ||
+|| # Asirra module for ConfirmEdit by Bachsau # ||
+|| # ---------------------------------------------------------------- # ||
+|| # This code is released into public domain, in the hope that it # ||
+|| # will be useful, but without any warranty. # ||
+|| # ------------ YOU CAN DO WITH IT WHATEVER YOU LIKE! ------------- # ||
+|| #################################################################### ||
+\*======================================================================*/
+
+jQuery( function( $ ) {
+ var asirraform = $( "form#userlogin2" );
+ var submitButtonClicked = document.createElement("input");
+ var passThroughFormSubmit = false;
+
+ function PrepareSubmit() {
+ console.log( 'daa' );
+ submitButtonClicked.type = "hidden";
+ var inputFields = asirraform.find( "input" );
+ for (var i=0; i<inputFields.length; i++) {
+ if (inputFields[i].type === "submit") {
+ inputFields[i].onclick = function(event) {
+ console.log( this );
+ submitButtonClicked.name = this.name;
+ submitButtonClicked.value = this.value;
+ }
+ }
+ }
+
+ asirraform.submit( function() {
+ return MySubmitForm();
+ } );
+ }
+
+ function MySubmitForm() {
+ if (passThroughFormSubmit) {
+ return true;
+ }
+ Asirra_CheckIfHuman(HumanCheckComplete);
+ return false;
+ }
+
+ function HumanCheckComplete(isHuman) {
+ if (!isHuman) {
+ alert( mw.msg( 'asirra-failed' ) );
+ } else {
+ asirraform.append(submitButtonClicked);
+ passThroughFormSubmit = true;
+ asirraform.submit();
+ }
+ }
+
+ PrepareSubmit();
+
+} );
diff --git a/extensions/ConfirmEdit/resources/ext.confirmEdit.fancyCaptcha.css b/extensions/ConfirmEdit/resources/ext.confirmEdit.fancyCaptcha.css
new file mode 100644
index 00000000..96e4dd6a
--- /dev/null
+++ b/extensions/ConfirmEdit/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/resources/ext.confirmEdit.fancyCaptcha.js b/extensions/ConfirmEdit/resources/ext.confirmEdit.fancyCaptcha.js
new file mode 100644
index 00000000..a8db7218
--- /dev/null
+++ b/extensions/ConfirmEdit/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/resources/images/ajax-loader-10x10.gif b/extensions/ConfirmEdit/resources/images/ajax-loader-10x10.gif
new file mode 100644
index 00000000..772e9a55
--- /dev/null
+++ b/extensions/ConfirmEdit/resources/images/ajax-loader-10x10.gif
Binary files differ
diff --git a/extensions/ConfirmEdit/resources/images/fancycaptcha-reload-icon.png b/extensions/ConfirmEdit/resources/images/fancycaptcha-reload-icon.png
new file mode 100644
index 00000000..6cbde303
--- /dev/null
+++ b/extensions/ConfirmEdit/resources/images/fancycaptcha-reload-icon.png
Binary files differ