|
|
@ -269,8 +269,35 @@ var Gogits = {}; |
|
|
|
if ($(selector).hasClass('js-copy-bind')) { |
|
|
|
if ($(selector).hasClass('js-copy-bind')) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"); |
|
|
|
|
|
|
|
}, 200); |
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
|
|
|
|
$this.tipsy('hide').attr('original-title', $this.data('original-title')); |
|
|
|
|
|
|
|
}, 2000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.blur(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(selector).addClass("js-copy-bind"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
$(selector).zclip({ |
|
|
|
$(selector).zclip({ |
|
|
|
path: "/js/ZeroClipboard.swf", |
|
|
|
path: Gogs.AppSubUrl + "/js/ZeroClipboard.swf", |
|
|
|
copy: function () { |
|
|
|
copy: function () { |
|
|
|
var t = $(this).data("copy-val"); |
|
|
|
var t = $(this).data("copy-val"); |
|
|
|
var to = $($(this).data("copy-from")); |
|
|
|
var to = $($(this).data("copy-from")); |
|
|
@ -288,18 +315,17 @@ var Gogits = {}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
afterCopy: function () { |
|
|
|
afterCopy: function () { |
|
|
|
var $this = $(this); |
|
|
|
var $this = $(this); |
|
|
|
$this.tooltip('hide') |
|
|
|
$this.tipsy("hide").attr('original-title', $this.data('after-title')); |
|
|
|
.attr('data-original-title', 'Copied OK'); |
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
|
setTimeout(function () { |
|
|
|
$this.tooltip("show"); |
|
|
|
$this.tipsy("show"); |
|
|
|
}, 200); |
|
|
|
}, 200); |
|
|
|
setTimeout(function () { |
|
|
|
setTimeout(function () { |
|
|
|
$this.tooltip('hide') |
|
|
|
$this.tipsy('hide').attr('original-title', $this.data('original-title')); |
|
|
|
.attr('data-original-title', 'Copy to Clipboard'); |
|
|
|
}, 2000); |
|
|
|
}, 3000); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).addClass("js-copy-bind"); |
|
|
|
}).addClass("js-copy-bind"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// api working
|
|
|
|
// api working
|
|
|
|
Gogits.getUsers = function (val, $target) { |
|
|
|
Gogits.getUsers = function (val, $target) { |
|
|
|