diff --git a/README.md b/README.md index 538c8e5..afb4ce8 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,21 @@ # Gitlab "git clone …" -Simple chrome extension, that adds "git clone" before the source. +Simple Google Chrome extension, which adds some minor tweaks to make working with Gitlab a little better. -![Screenshot Gitlab](assets/readme-ressources/gitlab-git-clone.png "Screenshot Gitlab") +--- + +## Current Features + +It adds "git clone" before the repository source. + +![Screenshot Git Clone](assets/readme-ressources/gitlab-git-clone.png "Screenshot Git Clone") + +and also a _Checkout_ button on the Merge-Request page to copy the branch name plus a _git checkout_ before it. + +![Screenshot Merge Request](assets/readme-ressources/gitlab-merge-request.png "Screenshot Merge Request") + +--- ## How to install? diff --git a/assets/readme-ressources/gitlab-merge-request.png b/assets/readme-ressources/gitlab-merge-request.png new file mode 100644 index 0000000..60895b9 Binary files /dev/null and b/assets/readme-ressources/gitlab-merge-request.png differ diff --git a/js/frontend.js b/js/frontend.js index f3f47ce..c357ccb 100644 --- a/js/frontend.js +++ b/js/frontend.js @@ -4,7 +4,7 @@ let cloneOptionsDropdown = document.querySelectorAll('.clone-options-dropdown > let mobileCloneButtons = document.querySelector('.mobile-git-clone .clone-dropdown-btn'); const currentPath = window.location.pathname; const beforeVal = 'git clone '; -const copyNameBtnVal = 'Copy branch name'; +const copyNameBtnVal = 'Checkout'; const copyNameBtnClasses = 'gl-display-none gl-md-display-block btn gl-button btn-default btn-grouped'; let branchNameEl; function modifyMobileCloneButtons() { @@ -18,10 +18,10 @@ function createCopyBranchNameButton(branchNameEl) { cloneBranchNameBtn.innerText = copyNameBtnVal; if (branchName) { cloneBranchNameBtn.addEventListener('click', () => { - navigator.clipboard.writeText(branchName).then(() => { - /* success */ + navigator.clipboard.writeText('git checkout ' + branchName).then(() => { + /* success - do nothing */ }, () => { - /* failure */ + /* failure - do nothing */ }); }); } diff --git a/manifest.json b/manifest.json index 021b5e1..96966a3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Gitlab Git Clone", "description": "Adds 'git clone' to the ssh/https clone url, so you simply can copy and paste it into your terminal.", - "version": "1.2", + "version": "1.3", "manifest_version": 3, "content_scripts": [ { diff --git a/package-lock.json b/package-lock.json index 2d64f5d..57e1c06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gitlab-gitclone", - "version": "1.2.0", + "version": "1.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gitlab-gitclone", - "version": "1.2.0", + "version": "1.3.0", "license": "MIT", "devDependencies": { "typescript": "^4.8.2" diff --git a/package.json b/package.json index d0305f2..802120c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gitlab-gitclone", - "version": "1.2.0", + "version": "1.3.0", "description": "Adds 'git clone' to the ssh/https clone url, so you simply can copy and paste it into your terminal.", "main": "./js/frontend.js", "scripts": { diff --git a/ts/frontend.ts b/ts/frontend.ts index 7e91347..8d0c6fc 100644 --- a/ts/frontend.ts +++ b/ts/frontend.ts @@ -3,7 +3,7 @@ let cloneOptionsDropdown: NodeList | null = document.querySelectorAll('.clone-op let mobileCloneButtons: HTMLElement | null = document.querySelector('.mobile-git-clone .clone-dropdown-btn'); const currentPath: string = window.location.pathname; const beforeVal: string = 'git clone '; -const copyNameBtnVal: string = 'Copy Branch Name'; +const copyNameBtnVal: string = 'Checkout'; const copyNameBtnClasses: string = 'gl-display-none gl-md-display-block btn gl-button btn-default btn-grouped'; let branchNameEl: HTMLElement | null; @@ -20,7 +20,7 @@ function createCopyBranchNameButton(branchNameEl: HTMLElement) { if (branchName) { cloneBranchNameBtn.addEventListener('click', () => { - navigator.clipboard.writeText(branchName).then( + navigator.clipboard.writeText('git checkout ' + branchName).then( () => { /* success - do nothing */ },