aboutsummaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-05 20:26:00 +0800
committerUnknwon <u@gogs.io>2015-08-05 20:26:00 +0800
commit2c507667bfd17f88dc4bfabc426c74cd5f8e4461 (patch)
tree31b267331f84d45a92f6a0bfe7eaafa124f4578f /public
parent0705f55ce097b9892a7c4c11faa5396c4e557232 (diff)
parentb9527cd1bfabcce3be62b43f0c199b1418519549 (diff)
downloadgitea-2c507667bfd17f88dc4bfabc426c74cd5f8e4461.tar.gz
gitea-2c507667bfd17f88dc4bfabc426c74cd5f8e4461.zip
Merge branch 'develop' of github.com:gogits/gogs into feature/milestone
# Conflicts: # gogs.go # models/issue.go # templates/.VERSION
Diffstat (limited to 'public')
-rw-r--r--public/js/app.js78
-rw-r--r--public/ng/js/gogs.js68
2 files changed, 100 insertions, 46 deletions
diff --git a/public/js/app.js b/public/js/app.js
index 6208dbedc8..8eb19a0aa5 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -269,36 +269,62 @@ var Gogits = {};
if ($(selector).hasClass('js-copy-bind')) {
return;
}
- $(selector).zclip({
- path: "/js/ZeroClipboard.swf",
- copy: function () {
- var t = $(this).data("copy-val");
- var to = $($(this).data("copy-from"));
- var str = "";
- if (t == "txt") {
- str = to.text();
- }
- if (t == 'val') {
- str = to.val();
- }
- if (t == 'html') {
- str = to.html();
- }
- return str;
- },
- afterCopy: function () {
+
+ if ( document.documentElement.classList.contains("is-copy-enabled") ) {
+
+ $(selector).click(function(event) {
var $this = $(this);
- $this.tooltip('hide')
- .attr('data-original-title', 'Copied OK');
+
+ var cfrom = $this.attr('data-copy-from');
+ $(cfrom).select();
+ document.execCommand('copy');
+ getSelection().removeAllRanges();
+
+ $this.tipsy("hide").attr('original-title', $this.data('after-title'));
setTimeout(function () {
- $this.tooltip("show");
+ $this.tipsy("show");
}, 200);
setTimeout(function () {
- $this.tooltip('hide')
- .attr('data-original-title', 'Copy to Clipboard');
- }, 3000);
- }
- }).addClass("js-copy-bind");
+ $this.tipsy('hide').attr('original-title', $this.data('original-title'));
+ }, 2000);
+
+ this.blur();
+ return;
+ });
+
+ $(selector).addClass("js-copy-bind");
+
+ } else {
+
+ $(selector).zclip({
+ path: Gogits.AppSubUrl + "/js/ZeroClipboard.swf",
+ copy: function () {
+ var t = $(this).data("copy-val");
+ var to = $($(this).data("copy-from"));
+ var str = "";
+ if (t == "txt") {
+ str = to.text();
+ }
+ if (t == 'val') {
+ str = to.val();
+ }
+ if (t == 'html') {
+ str = to.html();
+ }
+ return str;
+ },
+ afterCopy: function () {
+ var $this = $(this);
+ $this.tipsy("hide").attr('original-title', $this.data('after-title'));
+ setTimeout(function () {
+ $this.tipsy("show");
+ }, 200);
+ setTimeout(function () {
+ $this.tipsy('hide').attr('original-title', $this.data('original-title'));
+ }, 2000);
+ }
+ }).addClass("js-copy-bind");
+ }
}
// api working
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index 7ffef8af8b..38b34c6152 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -333,25 +333,17 @@ var Gogs = {};
if ($(selector).hasClass('js-copy-bind')) {
return;
}
- $(selector).zclip({
- path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf",
- copy: function () {
- var t = $(this).data("copy-val");
- var to = $($(this).data("copy-from"));
- var str = "";
- if (t == "txt") {
- str = to.text();
- }
- if (t == 'val') {
- str = to.val();
- }
- if (t == 'html') {
- str = to.html();
- }
- return str;
- },
- afterCopy: function () {
+
+ if ( document.documentElement.classList.contains("is-copy-enabled") ) {
+
+ $(selector).click(function(event) {
var $this = $(this);
+
+ var cfrom = $this.attr('data-copy-from');
+ $(cfrom).select();
+ document.execCommand('copy');
+ getSelection().removeAllRanges();
+
$this.tipsy("hide").attr('original-title', $this.data('after-title'));
setTimeout(function () {
$this.tipsy("show");
@@ -359,8 +351,44 @@ var Gogs = {};
setTimeout(function () {
$this.tipsy('hide').attr('original-title', $this.data('original-title'));
}, 2000);
- }
- }).addClass("js-copy-bind");
+
+ this.blur();
+ return;
+ });
+
+ $(selector).addClass("js-copy-bind");
+
+ } else {
+
+ $(selector).zclip({
+ path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf",
+ copy: function () {
+ var t = $(this).data("copy-val");
+ var to = $($(this).data("copy-from"));
+ var str = "";
+ if (t == "txt") {
+ str = to.text();
+ }
+ if (t == 'val') {
+ str = to.val();
+ }
+ if (t == 'html') {
+ str = to.html();
+ }
+ return str;
+ },
+ afterCopy: function () {
+ var $this = $(this);
+ $this.tipsy("hide").attr('original-title', $this.data('after-title'));
+ setTimeout(function () {
+ $this.tipsy("show");
+ }, 200);
+ setTimeout(function () {
+ $this.tipsy('hide').attr('original-title', $this.data('original-title'));
+ }, 2000);
+ }
+ }).addClass("js-copy-bind");
+ }
}
})(jQuery);