Fix url encoding

This commit is contained in:
Abhisek Pattnaik
2016-01-16 11:12:57 +05:30
committed by Arsen Melikyan
parent db57fd405f
commit e1aec710aa

View File

@ -46,27 +46,27 @@ window.common = (function(global) {
break;
case common.challengeTypes.JS:
case common.challengeTypes.BONFIRE:
type = 'javascript';
type = 'js';
break;
default:
type = '';
}
var returnValue = '';
if (trigger.id === 'markdown') {
switch (trigger.id) {
case 'markdown':
returnValue = '```' + type + '\n' + editor.getSelection() + '\n```';
editor.replaceSelection(editor.getSelection());
return returnValue;
} else if (trigger.id === 'plain') {
case 'plain':
returnValue = editor.getSelection();
editor.replaceSelection(editor.getSelection());
return returnValue;
} else if (trigger.id === 'link') {
case 'link':
editor.replaceSelection(editor.getSelection());
return ('[Challenge - ' + common.challengeName +
return '[Challenge - ' + common.challengeName +
(common.username ? ' (' + common.username + '\'s solution)' : '')
+ '](' + window.location + ')')
.replace(/\)/g, '%29').replace(/%29\]/g, ')]') + ')';
+ '](' + String(window.location).replace(/\)/g, '%29') + ')';
}
}
});