This could probably have gone in reports, but it is also a suggestion, so not sure where to put it. Seemed more like a suggestion than a bug because it "technically" still works but requires enabling of flash.
Since flash has been deprecated on a lot of browsers, server list kinda just does this when hovering over the "copy" button:
This should substitute ZeroClipboard.js:
The clipboard function then be changed to:
Will need to change "onmouseOver" to "onclick" on the <td> elements. The navigator api will complain if this isn't called from something like onclick.
Also probably wouldn't hurt to add "cursor:pointer;" to the .blue class to give a bit more feedback because the flash element wouldn't be there.
Since flash has been deprecated on a lot of browsers, server list kinda just does this when hovering over the "copy" button:
This should substitute ZeroClipboard.js:
Code:
function copyToClipboard(text, success, forceOld){
if(!forceOld && navigator.clipboard){ //Newer browsers are more elegant. Also requires secure(https) context.
navigator.clipboard.writeText(text).then(success, function(){
//Try to fallback to older methods if we failed for some reason.
copyToClipboard(text, success, true);
});
}else{ //For older browsers. It either is new enough for the above or old enough for the below.
var tmp = document.createElement("input");
//Probably not needed to style it since page isn't repainted until the function finishes
tmp.style.position="fixed";
tmp.style.top="0";
tmp.style.left="0";
document.body.appendChild(tmp)
tmp.value = text;
tmp.select();
document.execCommand("copy");
document.body.removeChild(tmp);
(success||function(){})();
}
}
Code:
function clipboard(me, msg, name) {
copyToClipboard(msg, function() {
noty({
text: name+' address copied. Press CTRL+V in the console to connect.',
theme: 'noty_theme_facebook',
layout: 'topRight',
speed: 200,
timeout: 4000,
});
});
}
Also probably wouldn't hurt to add "cursor:pointer;" to the .blue class to give a bit more feedback because the flash element wouldn't be there.