-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontent.js
21 lines (21 loc) · 1 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Note we use a content script instead of a background script because:
// > Background scripts can access all the WebExtension JavaScript APIs, but
// they can't directly access the content of web pages. So if your extension
// needs to do that, you need content scripts.
// See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts
chrome.storage.local.get({
name: '',
email: ''
}, function (items) {
if (items.name && items.email) {
var signoff = "Signed-off-by: " + items.name + " <" + items.email + ">"
// Standard commit message
cdt = document.getElementById('commit-description-textarea')
if (cdt) {
cdt.value = signoff;
}
// Suggested changes commit message
// ref: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request
document.getElementsByName('commit_message').forEach(function(v,i,o){o[i].value = this}, signoff);
}
});