-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pt1602/feature/add-mobile-support
add mobile support
- Loading branch information
Showing
1 changed file
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
let cloneButtons = document.querySelectorAll('#ssh_project_clone, #http_project_clone'); | ||
let cloneOptionsDropdown = document.querySelectorAll('.clone-options-dropdown > li > a'); | ||
let mobileCloneButtons = document.querySelector('.mobile-git-clone .clone-dropdown-btn'); | ||
const beforeVal = 'git clone '; | ||
|
||
if (cloneButtons) { | ||
cloneButtons.forEach(function(item){ | ||
item.value = 'git clone ' + item.value; | ||
cloneButtons.forEach(function (item) { | ||
item.value = beforeVal + item.value; | ||
}); | ||
} | ||
|
||
if (mobileCloneButtons) { | ||
function modifyMobileCloneButtons() { | ||
mobileCloneButtons.dataset.clipboardText = beforeVal + mobileCloneButtons.dataset.clipboardText; | ||
} | ||
|
||
modifyMobileCloneButtons(); | ||
|
||
cloneOptionsDropdown.forEach(item => { | ||
item.addEventListener('click', modifyMobileCloneButtons); | ||
}); | ||
} |