forked from soscripted/sox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsox.github.js
29 lines (26 loc) · 993 Bytes
/
sox.github.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(function(sox, $) {
'use strict';
sox.github = {
init: function(version, handler) {
// auto-inject version number and environment information into GitHub issues
function inject() {
if (!sox.location.on('github.com/soscripted/sox') || location.href.includes('feature_request')) return;
const $issue = $('#issue_body');
if ($issue.length) {
$issue.prop('disabled', 'true');
const environmentText = `
**Environment**
SOX version: ${version}
Platform: ${handler}
`;
let issueText = $issue.text();
issueText = issueText.replace('**Environment**', environmentText); //inject environment details
issueText += '\n---\n\n### Features Enabled \n\n ' + JSON.stringify(sox.settings.load());
$('#issue_body').delay(500).text(issueText).removeAttr('disabled');
}
}
$(document).on('pjax:complete', inject);
inject();
},
};
})(window.sox = window.sox || {}, jQuery);