mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00:00
Copy Git repository URL on click
The Git repository URLs are not meant to be visited using a web browser. Copy the link to the clipboard instead. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
f7f5152be5
commit
58aa0a9e45
2 changed files with 30 additions and 4 deletions
|
@ -100,9 +100,9 @@ $base_uri = get_pkgbase_uri($row['BaseName']);
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= __('Git Clone URL') . ': ' ?></th>
|
<th><?= __('Git Clone URL') . ': ' ?></th>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>)
|
<a class="copy" href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>, <?= __('click to copy') ?>)
|
||||||
<?php if (in_array($uid, $maintainers)): ?>
|
<?php if (in_array($uid, $maintainers)): ?>
|
||||||
<br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a>
|
<br /> <a class="copy" href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a> (<?= __('click to copy') ?>)
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -306,3 +306,16 @@ endif;
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.copy').click(function(e) {
|
||||||
|
var tmp = $("<input>");
|
||||||
|
$("body").append(tmp);
|
||||||
|
tmp.val($(this).text()).select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
tmp.remove();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -49,9 +49,9 @@ $base_uri = get_pkgbase_uri($row['Name']);
|
||||||
<tr>
|
<tr>
|
||||||
<th><?= __('Git Clone URL') . ': ' ?></th>
|
<th><?= __('Git Clone URL') . ': ' ?></th>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>)
|
<a class="copy" href="<?= $git_clone_uri_anon ?>"><?= $git_clone_uri_anon ?></a> (<?= __('read-only') ?>, <?= __('click to copy') ?>)
|
||||||
<?php if (in_array($uid, $maintainers)): ?>
|
<?php if (in_array($uid, $maintainers)): ?>
|
||||||
<br /> <a href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a>
|
<br /> <a class="copy" href="<?= $git_clone_uri_priv ?>"><?= $git_clone_uri_priv ?></a> (<?= __('click to copy') ?>)
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -135,3 +135,16 @@ endif;
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.copy').click(function(e) {
|
||||||
|
var tmp = $("<input>");
|
||||||
|
$("body").append(tmp);
|
||||||
|
tmp.val($(this).text()).select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
tmp.remove();
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue