Skip to content

Commit

Permalink
add clipboard support
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Aug 5, 2016
1 parent b6a2908 commit d89a841
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Upload size now limited to 1G
1. [x] Auto tag version
1. [x] Custom title support
1. [x] Support setting from conf file
1. [x] Quick copy download link

## Installation
```
Expand Down
3 changes: 3 additions & 0 deletions res/imgs/clippy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions res/index.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
<span class="hidden-xs">Download</span>
<span class="glyphicon glyphicon-download-alt"></span>
</a>
<button class="btn btn-default btn-xs bstooltip" data-trigger="manual" title="Copied!" data-clipboard-text="{{genDownloadURL(f)}}">
<img class="clippy" width="12" src="/-/res/imgs/clippy.svg" alt="Copy to clipboard">
</button>
<button class="btn btn-default btn-xs hidden-xs" v-on:click="genQrcode(f.name)">
<span v-if="shouldHaveQrcode(f.name)">QRCode</span>
<span class="glyphicon glyphicon-qrcode"></span>
Expand Down Expand Up @@ -198,6 +201,7 @@ <h4 class="modal-title">
<script src="/-/res/js/moment.min.js"></script>
<script src="/-/res/js/dropzone.js"></script>
<script src="/-/res/js/underscore-min.js"></script>
<script src="/-/res/js/clipboard-1.5.12.min.js"></script>
<script src="/-/res/bootstrap-3.3.5/js/bootstrap.min.js"></script>
<script src="/-/res/js/index.js"></script>
[[if .GoogleTrackerId ]]
Expand Down
7 changes: 7 additions & 0 deletions res/js/clipboard-1.5.12.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions res/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ var vm = new Vue({
});
$("#qrcode-modal").modal("show");
},
genDownloadURL: function(f) {
return location.origin + "/" + f.path;
},
shouldHaveQrcode: function(name) {
return ['apk', 'ipa'].indexOf(getExtention(name)) !== -1;
},
Expand Down Expand Up @@ -303,4 +306,18 @@ $(function() {
$.getJSON("/-/sysinfo", function(res) {
vm.version = res.version;
})

var clipboard = new Clipboard('.btn');
clipboard.on('success', function(e) {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
$(e.trigger)
.tooltip('show')
.mouseleave(function() {
$(this).tooltip('hide');
})

e.clearSelection();
});
});

0 comments on commit d89a841

Please sign in to comment.