- gitlist.git
- public
- js
- clone-buttons.js
This file ( 2kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
document.addEventListener("DOMContentLoaded", function(event) {
require('snackbarjs');
const cloneButtonSSH = $('#clone-button-ssh');
const cloneButtonHTTP = $('#clone-button-http');
const cloneInputSSH = $('#clone-input-ssh');
const cloneInputHTTP = $('#clone-input-http');
const debounce = require('lodash/debounce')
const copy = debounce(($input) => {
const input = $input[0];
input.select()
document.execCommand("Copy");
$.snackbar({
htmlAllowed: true,
content: `
<strong>This URL is in your clipboard:</strong><br/>
${input.value}`
});
}, 250);
const copyCloneInputSSH = () => {
copy(cloneInputSSH)
}
const copyCloneInputHTTP = () => {
copy(cloneInputHTTP)
}
cloneInputSSH.click(copyCloneInputSSH)
cloneInputHTTP.click(copyCloneInputHTTP)
let cloneButtonSSHInit = false;
cloneButtonSSH.click(function()
{
if(cloneButtonSSH.hasClass('active')) {
return;
}
if (cloneButtonSSHInit) {
copyCloneInputSSH();
}
cloneButtonSSHInit = true;
cloneButtonSSH.addClass('active');
cloneInputSSH.show();
cloneButtonHTTP.removeClass('active');
cloneInputHTTP.hide();
});
let cloneButtonHTTPInit = false;
cloneButtonHTTP.click(function()
{
if(cloneButtonHTTP.hasClass('active')) {
return;
}
if (cloneButtonHTTPInit) {
copyCloneInputHTTP()
}
cloneButtonHTTPInit = true;
cloneButtonHTTP.addClass('active');
cloneInputHTTP.show();
cloneButtonSSH.removeClass('active');
cloneInputSSH.hide();
});
cloneButtonSSH.click();
cloneButtonHTTP.click();
})