X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki%2Fmediawiki.util.js;h=887885ea50c5475ab63a85fdc3531d058a75801b;hb=27f8aa732e55f0655255152fa22655fa07424c2d;hp=221ac745f67357cb273d133ff5ab66877d203123;hpb=dbc16057d91d73428bf161f57565f67173eda473;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki/mediawiki.util.js b/resources/src/mediawiki/mediawiki.util.js index 221ac745f6..887885ea50 100644 --- a/resources/src/mediawiki/mediawiki.util.js +++ b/resources/src/mediawiki/mediawiki.util.js @@ -60,14 +60,29 @@ /** * Encode page titles for use in a URL + * * We want / and : to be included as literal characters in our title URLs - * as they otherwise fatally break the title + * as they otherwise fatally break the title. + * + * The others are decoded because we can, it's prettier and matches behaviour + * of `wfUrlencode` in PHP. * * @param {string} str String to be encoded. */ wikiUrlencode: function ( str ) { return util.rawurlencode( str ) - .replace( /%20/g, '_' ).replace( /%3A/g, ':' ).replace( /%2F/g, '/' ); + .replace( /%20/g, '_' ) + // wfUrlencode replacements + .replace( /%3B/g, ';' ) + .replace( /%40/g, '@' ) + .replace( /%24/g, '$' ) + .replace( /%21/g, '!' ) + .replace( /%2A/g, '*' ) + .replace( /%28/g, '(' ) + .replace( /%29/g, ')' ) + .replace( /%2C/g, ',' ) + .replace( /%2F/g, '/' ) + .replace( /%3A/g, ':' ); }, /** @@ -399,7 +414,7 @@ // RegExp is case insensitive 'i' ); - return ( null !== mailtxt.match( html5EmailRegexp ) ); + return ( mailtxt.match( html5EmailRegexp ) !== null ); }, /** @@ -474,10 +489,10 @@ * * Should match: * - * - "ctrl-option-" - * - "alt-shift-" - * - "ctrl-alt-" - * - "ctrl-" + * - "[ctrl-option-x]" + * - "[alt-shift-x]" + * - "[ctrl-alt-x]" + * - "[ctrl-x]" * * The accesskey is matched in group $6. *