MediaWiki:Resources/landingpage.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
creating page with JS from Template:Lp-layout-default |
adding getQuerystring function from Template:2012FR/Form-template-whereyourdonation |
||
Line 8: | Line 8: | ||
} ); |
} ); |
||
} ); |
} ); |
||
function getQuerystring( key ) { |
|||
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' ); |
|||
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' ); |
|||
var qs = regex.exec( window.location.search ); |
|||
return qs == null ? '' : qs[1]; |
|||
} |
|||
</script> |
</script> |
||
</html> |
</html> |
Revision as of 18:43, 22 March 2012
<html>
<script type="text/javascript">
$( document ).ready( function () {
// Disable submitting form with return key
$( 'form' ).bind( 'keypress', function(e) {
var code = ( e.keyCode ? e.keyCode : e.which );
if ( code == 13 ) return false;
} );
} );
function getQuerystring( key ) {
key = key.replace( /[\[]/, '\\\[' ).replace( /[\]]/, '\\\]' );
var regex = new RegExp( '[\\?&]' + key + '=([a-zA-Z0-9\_\-]*)' );
var qs = regex.exec( window.location.search );
return qs == null ? '' : qs[1];
}
</script>
</html>