mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-20 16:18:11 +00:00
fix 第一次复制碰链失败
fix 复制多行文本
This commit is contained in:
parent
b223afce7f
commit
6b6663f91b
114
src/tr-web-control/script/min/system.min.js
vendored
114
src/tr-web-control/script/min/system.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -967,7 +967,7 @@ var system = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
menu = this.getContentMenuWithKey(key);
|
menu = this.getContentMenuWithKey(key, parent);
|
||||||
if (menu) {
|
if (menu) {
|
||||||
parent.menu("appendItem", menu);
|
parent.menu("appendItem", menu);
|
||||||
}
|
}
|
||||||
|
@ -996,9 +996,10 @@ var system = {
|
||||||
/**
|
/**
|
||||||
* 根据指定的key获取右键菜单
|
* 根据指定的key获取右键菜单
|
||||||
* @param key
|
* @param key
|
||||||
|
* @param parent 父节点
|
||||||
* @return 菜单对象
|
* @return 菜单对象
|
||||||
*/
|
*/
|
||||||
getContentMenuWithKey: function(key) {
|
getContentMenuWithKey: function(key, parent) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "setLabels":
|
case "setLabels":
|
||||||
return {
|
return {
|
||||||
|
@ -1036,6 +1037,7 @@ var system = {
|
||||||
onclick: function() {
|
onclick: function() {
|
||||||
system.getTorrentMagnetLink(function(data){
|
system.getTorrentMagnetLink(function(data){
|
||||||
system.copyToClipboard(data);
|
system.copyToClipboard(data);
|
||||||
|
parent.css("display","block"); // 防止第一次复制碰链失败
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1214,9 +1216,13 @@ var system = {
|
||||||
// by https://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
|
// by https://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
|
||||||
copyToClipboard: function (text) {
|
copyToClipboard: function (text) {
|
||||||
// Create a "hidden" input
|
// Create a "hidden" input
|
||||||
var aux = document.createElement("input");
|
var id = "copy_to_clipboard_textarea";
|
||||||
|
var aux = document.getElementById(id);
|
||||||
|
if(!aux) aux = document.createElement("textarea"); // <input/> 不接受换行
|
||||||
|
aux.id = id;
|
||||||
|
aux.style.display = "block";
|
||||||
// Assign it the value of the specified element
|
// Assign it the value of the specified element
|
||||||
aux.setAttribute("value", text);
|
aux.value = text; // <textarea/> 不能使用 setAttribute
|
||||||
// Append it to the body
|
// Append it to the body
|
||||||
document.body.appendChild(aux);
|
document.body.appendChild(aux);
|
||||||
// Highlight its content
|
// Highlight its content
|
||||||
|
@ -1224,7 +1230,7 @@ var system = {
|
||||||
// Copy the highlighted text
|
// Copy the highlighted text
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
// Remove it from the body
|
// Remove it from the body
|
||||||
document.body.removeChild(aux);
|
aux.style.display = "none";
|
||||||
},
|
},
|
||||||
// Initialize the System Toolbar
|
// Initialize the System Toolbar
|
||||||
initToolbar: function () {
|
initToolbar: function () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user