Merge branch 'support-firefox-via-extensions-api' into 'master'
Remove chrome specific code and make compatible with the cross-browser extensions API for Firefox support See merge request conventionalcomments/conventional-comments-button!3
This commit is contained in:
commit
97424b07cb
22
README.md
22
README.md
@ -1,6 +1,6 @@
|
|||||||
# Conventional Comments button
|
# Conventional Comments button
|
||||||
|
|
||||||
This is a tiny Chrome extension that adds a conventional comment button to GitLab file explorer comments, allowing to quickly leave a structured semantic comment during your MR reviews!
|
This is a tiny extension that adds a conventional comment button to GitLab file explorer comments, allowing to quickly leave a structured semantic comment during your MR reviews!
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
@ -8,18 +8,34 @@ This is a tiny Chrome extension that adds a conventional comment button to GitLa
|
|||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
|
|
||||||
This is a chrome extension, recently chrome disallowed to install packed `crx` extension that are not listed on the Chrome Store, so to install this
|
First, clone this repo `git clone git@gitlab.com:conventionalcomments/conventional-comment-button.git` and then see below for browser specific instructions.
|
||||||
|
|
||||||
|
### Chrome
|
||||||
|
|
||||||
|
Recently chrome disallowed to install packed `crx` extension that are not listed on the Chrome Store, so to install this
|
||||||
|
|
||||||
- `git clone git@gitlab.com:conventionalcomments/conventional-comment-button.git`
|
|
||||||
- On Chrome: Menu
|
- On Chrome: Menu
|
||||||
- More Tools
|
- More Tools
|
||||||
- Extensions
|
- Extensions
|
||||||
- In the Extension page: `Load unpacked` and select the cloned repository
|
- In the Extension page: `Load unpacked` and select the cloned repository
|
||||||
|
|
||||||
|
### Firefox
|
||||||
|
|
||||||
|
- On Firefox: enter `about:debugging#/runtime/this-firefox` into the address bar
|
||||||
|
- In the Extension page: `Load Temporary Add-on...` and select any file within the cloned repository
|
||||||
|
|
||||||
## How to update
|
## How to update
|
||||||
|
|
||||||
- `git pull`
|
- `git pull`
|
||||||
|
|
||||||
|
### Chrome
|
||||||
|
|
||||||
- On Chrome: Menu
|
- On Chrome: Menu
|
||||||
- More Tools
|
- More Tools
|
||||||
- Extensions
|
- Extensions
|
||||||
- In the Extension page find `conventional comments button` and hit the refresh button
|
- In the Extension page find `conventional comments button` and hit the refresh button
|
||||||
|
|
||||||
|
### Firefox
|
||||||
|
|
||||||
|
- On Firefox: enter `about:debugging#/runtime/this-firefox` into the address bar
|
||||||
|
- In the Extension page find `conventional comments button` and hit the reload button
|
||||||
|
@ -10,16 +10,13 @@
|
|||||||
"128": "icons/icon128.png"
|
"128": "icons/icon128.png"
|
||||||
},
|
},
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"background": {
|
|
||||||
"scripts": ["src/bg/background.js"],
|
|
||||||
"persistent": true
|
|
||||||
},
|
|
||||||
"permissions": ["https://gitlab.com/*"],
|
"permissions": ["https://gitlab.com/*"],
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["https://gitlab.com/*"],
|
"matches": ["https://gitlab.com/*"],
|
||||||
"js": ["src/inject/inject.js"],
|
"js": ["src/inject/inject.js"],
|
||||||
"css": ["src/inject/inject.css"]
|
"css": ["src/inject/inject.css"],
|
||||||
|
"run_at": "document_idle"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
// if you checked "fancy-settings" in extensionizr.com, uncomment this lines
|
|
||||||
|
|
||||||
// var settings = new Store("settings", {
|
|
||||||
// "sample_setting": "This is how you use Store.js to remember values"
|
|
||||||
// });
|
|
||||||
|
|
||||||
//example of using a message handler from the inject scripts
|
|
||||||
chrome.extension.onMessage.addListener(function (
|
|
||||||
request,
|
|
||||||
sender,
|
|
||||||
sendResponse
|
|
||||||
) {
|
|
||||||
sendResponse();
|
|
||||||
});
|
|
@ -89,23 +89,12 @@ const addSemanticButton = (element) => {
|
|||||||
parent.appendChild(container);
|
parent.appendChild(container);
|
||||||
};
|
};
|
||||||
|
|
||||||
const main = () => {
|
document.addEventListener("click", (e) => {
|
||||||
document.addEventListener("click", (e) => {
|
if (
|
||||||
if (
|
|
||||||
e.target.id === "note_note" &&
|
e.target.id === "note_note" &&
|
||||||
!e.target.dataset.semanticButtonInitialized
|
!e.target.dataset.semanticButtonInitialized
|
||||||
) {
|
) {
|
||||||
e.target.dataset.semanticButtonInitialized = true;
|
e.target.dataset.semanticButtonInitialized = true;
|
||||||
addSemanticButton(e.target);
|
addSemanticButton(e.target);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
chrome.extension.sendMessage({}, (response) => {
|
|
||||||
const readyStateCheckInterval = setInterval(() => {
|
|
||||||
if (document.readyState === "complete") {
|
|
||||||
clearInterval(readyStateCheckInterval);
|
|
||||||
main();
|
|
||||||
}
|
|
||||||
}, 10);
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user