unencode all slashes and colons in importScript(), not just the first one of each
authorIlmari Karonen <vyznev@users.mediawiki.org>
Tue, 12 May 2009 23:56:28 +0000 (23:56 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Tue, 12 May 2009 23:56:28 +0000 (23:56 +0000)
skins/common/wikibits.js

index 30686fb..5e8e6ad 100644 (file)
@@ -49,8 +49,9 @@ function hookEvent(hookName, hookFunct) {
 }
 
 function importScript(page) {
+       // TODO: might want to introduce a utility function to match wfUrlencode() in PHP
        var uri = wgScript + '?title=' +
-               encodeURIComponent(page.replace(/ /g,'_')).replace('%2F','/').replace('%3A',':') +
+               encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') +
                '&action=raw&ctype=text/javascript';
        return importScriptURI(uri);
 }