diff --git a/script.js b/script.js index dd9c327..3d45de8 100644 --- a/script.js +++ b/script.js @@ -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); }); } \ No newline at end of file