-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathsox.github.js
More file actions
25 lines (22 loc) · 915 Bytes
/
sox.github.js
File metadata and controls
25 lines (22 loc) · 915 Bytes
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
(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') || sox.location.on('feature_request')) return;
const issue = document.querySelector('#issue_body');
if (!issue) return;
const environmentText = `**Environment**
SOX version: ${version}
Platform: ${handler}`;
let issueText = issue.value;
issueText = issueText.replace(/..Environment..\n.*?Tampermonkey\)/, environmentText); // inject environment details
issueText += '\n---\n\n### Features Enabled \n\n ' + JSON.stringify(sox.settings.load());
issue.value = issueText;
}
$(document).on('pjax:complete', inject);
inject();
},
};
})(window.sox = window.sox || {}, jQuery);