diff options
author | Don Bowman <don.waterloo@gmail.com> | 2015-08-12 21:10:00 +0000 |
---|---|---|
committer | Don Bowman <don.waterloo@gmail.com> | 2015-08-12 21:10:00 +0000 |
commit | 1cb46ede1acf4f8527e64fcae7e92672cad764b2 (patch) | |
tree | fabb54ee5f040be2a4ee5c95f87cb3e9fbf7bdea /public/ng/js/gogs.js | |
parent | 9e6bd31d76aa6d6495a2144466af78773f34d07c (diff) | |
parent | aede5cdb04fdbf74d9c602062fdece9f408e90f4 (diff) |
Merge branch 'master' of https://github.com/gogits/gogs
Conflicts:
routers/repo/download.go
Diffstat (limited to 'public/ng/js/gogs.js')
-rw-r--r-- | public/ng/js/gogs.js | 75 |
1 files changed, 55 insertions, 20 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js index c5fd719c..38b34c61 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); @@ -753,10 +781,17 @@ function initAdmin() { if (v == 2) { $('.ldap').toggleShow(); $('.smtp').toggleHide(); + $('.pam').toggleHide(); } if (v == 3) { $('.smtp').toggleShow(); $('.ldap').toggleHide(); + $('.pam').toggleHide(); + } + if (v == 4) { + $('.pam').toggleShow(); + $('.smtp').toggleHide(); + $('.ldap').toggleHide(); } }); |