mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-18 18:14:32 +00:00
commit
b7c4202e4d
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Automatically matches data directory"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigation",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Elegir automáticamente directorio de datos"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navegación",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Correspondance auto des dossiers de données"
|
||||
},
|
||||
"setLabels": "Personnaliser les étiquettes"
|
||||
"setLabels": "Personnaliser les étiquettes",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigation",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Könyvtárak automatikus felismerése"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigáció",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Associa automaticamente cartella dati"
|
||||
},
|
||||
"setLabels": "Imposta Etichette Utente"
|
||||
"setLabels": "Imposta Etichette Utente",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigazione",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "자동으로 데이터 폴더 일치시키기"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "안내",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Automatically matches data directory"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigatie",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Automatyczne dopasowanie katalogu"
|
||||
},
|
||||
"setLabels": "Ustaw własne etykiety"
|
||||
"setLabels": "Ustaw własne etykiety",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Nawigacja",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Combinar automaticamente diretório de dados"
|
||||
},
|
||||
"setLabels": "Definir Rótulos do Usuário"
|
||||
"setLabels": "Definir Rótulos do Usuário",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navegação",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Combinar automaticamente o diretório de dados"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navegação",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Automatically matches data directory"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Navigare",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Автосопоставление путей"
|
||||
},
|
||||
"setLabels": "Присвоить метки"
|
||||
"setLabels": "Присвоить метки",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Навигация",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "Авто-зіставлення шляхів"
|
||||
},
|
||||
"setLabels": "Set User Labels"
|
||||
"setLabels": "Set User Labels",
|
||||
"copyMagnetLink": "Copy magnetLink to clipboard"
|
||||
},
|
||||
"title": {
|
||||
"left": "Навігація",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "自动匹配数据目录"
|
||||
},
|
||||
"setLabels": "设置用户标签"
|
||||
"setLabels": "设置用户标签",
|
||||
"copyMagnetLink": "复制磁力链接到剪切板"
|
||||
},
|
||||
"title": {
|
||||
"left": "导航",
|
||||
|
|
|
@ -85,7 +85,8 @@
|
|||
"plugin": {
|
||||
"auto-match-data-folder": "自動配對資料夾"
|
||||
},
|
||||
"setLabels": "設置使用者標籤"
|
||||
"setLabels": "設置使用者標籤",
|
||||
"copyMagnetLink": "复制磁力链接到剪切板"
|
||||
},
|
||||
"title": {
|
||||
"left": "分類資料夾",
|
||||
|
|
112
src/tr-web-control/script/min/system.min.js
vendored
112
src/tr-web-control/script/min/system.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -928,7 +928,8 @@ var system = {
|
|||
menus = new Array("start", "pause", "-",
|
||||
"rename", "remove", "recheck", "-",
|
||||
"morepeers", "changeDownloadDir", "copyPath", "-",
|
||||
"menu-queue-move-top", "menu-queue-move-up", "menu-queue-move-down", "menu-queue-move-bottom"
|
||||
"menu-queue-move-top", "menu-queue-move-up", "menu-queue-move-down", "menu-queue-move-bottom",
|
||||
"magnetLink"
|
||||
);
|
||||
|
||||
// 是否显示标签菜单
|
||||
|
@ -1026,6 +1027,18 @@ var system = {
|
|||
});
|
||||
}
|
||||
};
|
||||
case "magnetLink":
|
||||
return{
|
||||
id: "magnetLink",
|
||||
text: system.lang.menus.copyMagnetLink,
|
||||
iconCls: "iconfont tr-icon-labels",
|
||||
disabled: this.checkedRows.length==0,
|
||||
onclick: function() {
|
||||
system.getTorrentMagnetLink(function(data){
|
||||
system.copyToClipboard(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
@ -1198,6 +1211,21 @@ var system = {
|
|||
$("#clipboard-source").val("");
|
||||
}
|
||||
},
|
||||
// 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) {
|
||||
// Create a "hidden" input
|
||||
var aux = document.createElement("input");
|
||||
// Assign it the value of the specified element
|
||||
aux.setAttribute("value", text);
|
||||
// Append it to the body
|
||||
document.body.appendChild(aux);
|
||||
// Highlight its content
|
||||
aux.select();
|
||||
// Copy the highlighted text
|
||||
document.execCommand("copy");
|
||||
// Remove it from the body
|
||||
document.body.removeChild(aux);
|
||||
},
|
||||
// Initialize the System Toolbar
|
||||
initToolbar: function () {
|
||||
// refresh time
|
||||
|
@ -2452,6 +2480,15 @@ var system = {
|
|||
});
|
||||
}
|
||||
},
|
||||
// get the magnetlink of torrent
|
||||
getTorrentMagnetLink: function (callback) {
|
||||
var rows = this.control.torrentlist.datagrid("getChecked");
|
||||
var ids = new Array();
|
||||
for (var i in rows) {
|
||||
ids.push(rows[i].id);
|
||||
}
|
||||
transmission.torrents.getMagnetLink(ids, callback);
|
||||
},
|
||||
// Looks for the specified torrent from the torrent list
|
||||
searchTorrents: function (key) {
|
||||
if (key == "") {
|
||||
|
|
|
@ -483,5 +483,49 @@ transmission.torrents = {
|
|||
}
|
||||
}, result[index].ids);
|
||||
}
|
||||
},
|
||||
|
||||
// 获取磁力链接
|
||||
getMagnetLink: function(ids, callback){
|
||||
var result = "";
|
||||
// is single number
|
||||
if(ids.constructor.name != "Array")
|
||||
ids = [ids];
|
||||
if(ids.length == 0) {
|
||||
if(callback) callback(result);
|
||||
return;
|
||||
}
|
||||
// 跳过己获取的
|
||||
var req_list = [];
|
||||
for(var id in ids){
|
||||
id = ids[id];
|
||||
if (!this.all[id]) continue;
|
||||
if (!this.all[id].magnetLink)
|
||||
req_list.push(id)
|
||||
else
|
||||
result += this.all[id].magnetLink + "\n";
|
||||
}
|
||||
|
||||
if(req_list.length == 0){
|
||||
if(callback) callback(result.trim());
|
||||
return;
|
||||
}
|
||||
|
||||
transmission.exec({
|
||||
method: "torrent-get",
|
||||
arguments: {
|
||||
fields: [ "id", "magnetLink" ],
|
||||
ids: req_list
|
||||
}
|
||||
}, function(data) {
|
||||
if (data.result == "success") {
|
||||
for(var item in data.arguments.torrents){
|
||||
item = data.arguments.torrents[item];
|
||||
transmission.torrents.all[item.id].magnetLink = item.magnetLink;
|
||||
result += item.magnetLink + "\n";
|
||||
}
|
||||
if(callback) callback(result.trim());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user