Skip to content

Commit

Permalink
Merge pull request #1 from pt1602/feature/add-mobile-support
Browse files Browse the repository at this point in the history
add mobile support
  • Loading branch information
pt1602 authored Jun 13, 2022
2 parents 22ee05a + 9f01fc8 commit bef24cd
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions script.js
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);
});
}

0 comments on commit bef24cd

Please sign in to comment.