diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js')
-rw-r--r-- | extensions/ConfirmEdit/resources/ext.confirmEdit.asirra.js | 55 |
1 files changed, 55 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(); + +} ); |