提交 b4a884e5 编写于 作者: N Nicolae Pascu 提交者: Oleg Nenashev

[JENKINS-54933] Replace ZeroClipboard (Flash) with native JavaScript implementation (#3780)

* [CORE-626] remove ZeroClipboard and replace with pure js replacement

* remove css rule used for testing

* Poke the build
上级 f0dadba4
.copy-button {
display: inline-block;
}
.copy-button BUTTON {
background: url('clipboard.png') center center no-repeat;
.copy-button button {
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBmaWxsPSJyZ2IoMCwwLDApIiBkPSJNMTcsOUg3VjdIMTdNMTcsMTNIN1YxMUgxN00xNCwxN0g3VjE1SDE0TTEyLDNBMSwxIDAgMCwxIDEzLDRBMSwxIDAgMCwxIDEyLDVBMSwxIDAgMCwxIDExLDRBMSwxIDAgMCwxIDEyLDNNMTksM0gxNC44MkMxNC40LDEuODQgMTMuMywxIDEyLDFDMTAuNywxIDkuNiwxLjg0IDkuMTgsM0g1QTIsMiAwIDAsMCAzLDVWMTlBMiwyIDAgMCwwIDUsMjFIMTlBMiwyIDAgMCwwIDIxLDE5VjVBMiwyIDAgMCwwIDE5LDNaIiAvPjwvc3ZnPg==');
background-size: 18px;
background-position: center center;
background-repeat: no-repeat;
width: 20px;
height: 20px;
}
// @include org.kohsuke.stapler.zeroclipboard
Behaviour.specify("span.copy-button", 'copyButton', 0, function(e) {
var btn = e.firstChild;
var id = "copy-button"+(iota++);
btn.id = id;
var btn = e.firstChild;
var id = "copy-button"+(iota++);
btn.id = id;
makeButton(btn, function() {
//make an invisible textarea element containing the text
var el = document.createElement('textarea');
el.value = e.getAttribute("text");
el.style.width = "1px";
el.style.height = "1px";
el.style.border = "none";
el.style.padding = "0px";
document.body.appendChild(el);
var clip = new ZeroClipboard(e);
makeButton(btn);
clip.setHandCursor(true);
//select the text and copy it to the clipboard
el.select();
document.execCommand('copy');
var container = e.getAttribute("container");
if (container) {
container = $(e).up(container);
container.style.position = "relative";
}
//remove the textarea element
document.body.removeChild(el);
clip.on('datarequested',function() {
clip.setText(e.getAttribute("text"));
});
clip.on('complete',function() {
notificationBar.show(e.getAttribute("message"));
});
clip.on('mouseOver',function() {
$(id).addClassName('yui-button-hover')
});
clip.on('mouseOut',function() {
$(id).removeClassName('yui-button-hover')
});
clip.on('mouseDown',function() {
$(id).addClassName('yui-button-active')
});
clip.on('mouseUp',function() {
$(id).removeClassName('yui-button-active')
});
//show the notification
notificationBar.show(e.getAttribute("message"));
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册