Files
freeCodeCamp/client/commonFramework/ask-for-help.js

35 lines
967 B
JavaScript
Raw Normal View History

2017-08-05 23:53:05 +05:30
window.common = (function({ common = { init: [] } }) {
common.init.push(function($) {
$('#ask-for-help-button').on('click', function() {
var helpTitle = common.challengeName;
var helpMessage = [
2017-08-09 10:44:29 -05:00
'**Tell us what\'s happening:**\n\n\n\n',
'**Your code so far**\n',
2017-08-05 23:53:05 +05:30
'```' + common.editor.getValue() + '```\n',
2017-08-09 10:44:29 -05:00
'**Your browser information:**\n\n',
'Your Browser User Agent is: ```',
2017-08-05 23:53:05 +05:30
navigator.userAgent,
'```.\n\n',
2017-08-09 10:44:29 -05:00
'**Link to the challenge:**\n',
2017-08-05 23:53:05 +05:30
window.location.href + '\n'
].join('');
helpTitle = encodeURIComponent(helpTitle);
helpMessage = encodeURIComponent(helpMessage);
$('#ask-for-help-modal').modal('hide');
window.open(
2017-08-09 21:14:14 +01:00
'https://forum.freecodecamp.org/new-topic?title='
2017-08-05 23:53:05 +05:30
+ helpTitle
+ '&body='
+ helpMessage
+ '&category=help',
'_blank'
);
});
});
return common;
}(window));