mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-20 20:12:43 +00:00
1.4.0
1. 增加分享率颜色显示; Close #14 2. 增加 `trackers` 栏,用于显示当前服务器列表; Close #86 3. 增加 `保存目录` 栏; 4. 恢复检测更新代码; 5. 增加 Changelog.md;
This commit is contained in:
parent
9b0604e301
commit
6028d412d7
25
CHANGELOG.md
Normal file
25
CHANGELOG.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# 更新日志
|
||||||
|
|
||||||
|
### 2017.11.08
|
||||||
|
- [+] 增加分享率颜色显示; #14
|
||||||
|
- [+] 增加 `trackers` 栏,用于显示当前服务器列表; #86
|
||||||
|
- [+] 增加 `保存目录` 栏;
|
||||||
|
- [+] 恢复检测更新代码;
|
||||||
|
- [+] 增加 Changelog.md;
|
||||||
|
|
||||||
|
### 2017.10.14
|
||||||
|
- [!] 修复 #94 中移动UI文字内容显示问题;
|
||||||
|
- [!] 修复因Cookie引起的界面无法正常显示的问题; #83
|
||||||
|
- [-] 删除Cookie依赖;
|
||||||
|
- [+] 增加新的安装脚本及更新方式。
|
||||||
|
|
||||||
|
### 2016-2017
|
||||||
|
- 更新了源程序的tar文件
|
||||||
|
- 修复英文界面的一些笔误
|
||||||
|
- 添加了http的安装方法
|
||||||
|
- 更新了install.sh的英文注释
|
||||||
|
- 更新了easyui到1.5.1和jquery到1.12.4 By -- @balonik
|
||||||
|
- 修复问题 #20, #21, #23, #39, #40, #43, #44, #53 By -- @balonik
|
||||||
|
- 替换了一些中文注释为英文注释.
|
||||||
|
- 修复问题 #77, #81 (如果载入错误,请清空cookies。) By -- @balonik
|
||||||
|
- 种子列表数修改为最多300,同时也可修改config.js中的"pagination:true" 为"pagination:false"来显示所有种子。 By -- @balonik
|
15
README.md
15
README.md
|
@ -7,21 +7,14 @@
|
||||||
|
|
||||||
#### [English Introduction](#introduction)
|
#### [English Introduction](#introduction)
|
||||||
|
|
||||||
|
### 界面预览
|
||||||
|

|
||||||
|
|
||||||
### 支持的Transmission版本(Support Transmission Version)
|
### 支持的Transmission版本(Support Transmission Version)
|
||||||
- Transmission 2.40 及以上版本(RPC版本:14及以上)
|
- Transmission 2.40 及以上版本(RPC版本:14及以上)
|
||||||
- Transmission 2.40 and above (RPC version: 14 and above)
|
- Transmission 2.40 and above (RPC version: 14 and above)
|
||||||
|
|
||||||
### 已修复问题
|
### [更新日志](https://github.com/ronggang/transmission-web-control/blob/master/CHANGELOG.md)
|
||||||
现在已经修改的问题如下:
|
|
||||||
- 更新了源程序的tar文件
|
|
||||||
- 修复英文界面的一些笔误
|
|
||||||
- 添加了http的安装方法
|
|
||||||
- 更新了install.sh的英文注释
|
|
||||||
- 更新了easyui到1.5.1和jquery到1.12.4 By -- @balonik
|
|
||||||
- 修复问题#20,#21,#23,#39,#40,#43,#44, #53 By -- @balonik
|
|
||||||
- 替换了一些中文注释为英文注释.
|
|
||||||
- 修复问题#77,#81 (如果载入错误,请清空cookies。) By -- @balonik
|
|
||||||
- 种子列表数修改为最多300,同时也可修改config.js中的"pagination:true" 为"pagination:false"来显示所有种子。 By -- @balonik
|
|
||||||
|
|
||||||
### 功能介绍
|
### 功能介绍
|
||||||
- 在线查看Transmission当前工作情况;
|
- 在线查看Transmission当前工作情况;
|
||||||
|
|
Binary file not shown.
|
@ -10,26 +10,26 @@
|
||||||
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ >
|
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ >
|
||||||
<title>Transmission Web Control</title>
|
<title>Transmission Web Control</title>
|
||||||
<!-- Style sheet -->
|
<!-- Style sheet -->
|
||||||
<link rel="stylesheet" type="text/css" href="tr-web-control/style/base.css?v=20171015.1" />
|
<link rel="stylesheet" type="text/css" href="tr-web-control/style/base.css?v=20171108" />
|
||||||
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/default/easyui.css?v=20171015.1"/>
|
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/default/easyui.css?v=20171108"/>
|
||||||
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/icon.css?v=20171015.1"/>
|
<link rel="stylesheet" type="text/css" href="tr-web-control/script/easyui/themes/icon.css?v=20171108"/>
|
||||||
<link rel="stylesheet" type="text/css" href="tr-web-control/style/icon.custom.css?v=20171015.1"/>
|
<link rel="stylesheet" type="text/css" href="tr-web-control/style/icon.custom.css?v=20171108"/>
|
||||||
<!-- Base class library -->
|
<!-- Base class library -->
|
||||||
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.12.4.min.js"></script>
|
<script type="text/javascript" src="tr-web-control/script/jquery/jquery-1.12.4.min.js"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/jquery/jquery.form.js"></script>
|
<script type="text/javascript" src="tr-web-control/script/jquery/jquery.form.js"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/jquery/json2.min.js"></script>
|
<script type="text/javascript" src="tr-web-control/script/jquery/json2.min.js"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/jquery/Base64.js"></script>
|
<script type="text/javascript" src="tr-web-control/script/jquery/Base64.js"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/easyui/jquery.easyui.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/easyui/jquery.easyui.min.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/easyui/plugins/jquery.datagrid.drophead.js"></script>
|
<script type="text/javascript" src="tr-web-control/script/easyui/plugins/jquery.datagrid.drophead.js"></script>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- System class library -->
|
<!-- System class library -->
|
||||||
<script type="text/javascript" src="tr-web-control/script/min/public.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/min/public.min.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/min/ua-parser.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/min/ua-parser.min.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/min/transmission.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/min/transmission.min.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/min/transmission.torrents.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/min/transmission.torrents.min.js?v=20171027"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/script/min/system.min.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/script/min/system.min.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/config.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/config.js?v=20171108"></script>
|
||||||
<script type="text/javascript" src="tr-web-control/plugin.js?v=20171015.1"></script>
|
<script type="text/javascript" src="tr-web-control/plugin.js?v=20171108"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var nonpc = [ "console", "mobile", "tablet", "smarttv", "wearable", "embedded" ]
|
var nonpc = [ "console", "mobile", "tablet", "smarttv", "wearable", "embedded" ]
|
||||||
if ((nonpc.indexOf($.ua.device.type) != -1 )&&location.search.getQueryString("devicetype")!="computer")
|
if ((nonpc.indexOf($.ua.device.type) != -1 )&&location.search.getQueryString("devicetype")!="computer")
|
||||||
|
@ -49,9 +49,9 @@
|
||||||
<div class="easyui-layout" data-options="fit:true">
|
<div class="easyui-layout" data-options="fit:true">
|
||||||
<div id="m_title_layout" data-options="region:'center'" border="0">
|
<div id="m_title_layout" data-options="region:'center'" border="0">
|
||||||
<img src="tr-web-control/logo.png"/><span id="m_title" style="padding:10px;display:none;"></span>
|
<img src="tr-web-control/logo.png"/><span id="m_title" style="padding:10px;display:none;"></span>
|
||||||
<span id="area-update-infos" style="display:none;">
|
<span id="area-update-infos" style="display:none;padding: 18px;position: absolute;background-color: #ffe48c;">
|
||||||
<span id="msg-updateInfos" style="color:red;"></span>
|
<span id="msg-updateInfos" style="color:#ff3232;"></span>
|
||||||
<a id="button-download-update" href="https://code.google.com/p/transmission-control/wiki/ChangeLog" system-lang="public['text-have-update']" target="_blank"></a>
|
<a id="button-download-update" href="https://github.com/ronggang/transmission-web-control/releases" system-lang="public['text-have-update']" target="_blank"></a>
|
||||||
</span>
|
</span>
|
||||||
<div style="float:right;padding:13px;">
|
<div style="float:right;padding:13px;">
|
||||||
<!-- 切换到移动版 -->
|
<!-- 切换到移动版 -->
|
||||||
|
|
52
src/tr-web-control/script/min/system.min.js
vendored
52
src/tr-web-control/script/min/system.min.js
vendored
|
@ -1,23 +1,23 @@
|
||||||
var system={version:"1.2 Beta",rootPath:"tr-web-control/",codeupdate:"20171015",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,pagination:true,pageList:[10,20,30,40,50,100,150,200,250,300],defaultSelectNode:null,autoExpandAttribute:false,defaultLang:"",foldersShow:false},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},
|
var system={version:"1.4.0",rootPath:"tr-web-control/",codeupdate:"20171108",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,pagination:true,pageList:[10,20,30,40,50,100,150,200,250,300],defaultSelectNode:null,autoExpandAttribute:false,defaultLang:"",foldersShow:false},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://raw.githubusercontent.com/ronggang/transmission-web-control/dev/release/update.json",
|
||||||
panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},userConfig:{torrentList:{fields:[],sortName:null,sortOrder:"asc"}},serverConfig:null,serverSessionStats:null,templates:{},setlang:function(lang,callback){if(!lang)if(this.config.defaultLang)lang=this.config.defaultLang;else lang=navigator.language||navigator.browserLanguage;if(!lang)lang="zh-CN";if(lang.indexOf("-")!=-1)lang=lang.split("-")[0].toLocaleLowerCase()+
|
contextMenus:{},panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},userConfig:{torrentList:{fields:[],sortName:null,sortOrder:"asc"}},serverConfig:null,serverSessionStats:null,templates:{},setlang:function(lang,callback){if(!lang)if(this.config.defaultLang)lang=this.config.defaultLang;else lang=navigator.language||navigator.browserLanguage;if(!lang)lang="zh-CN";if(lang.indexOf("-")!=-1)lang=
|
||||||
"-"+lang.split("-")[1].toLocaleUpperCase();if(!this.languages[lang])lang="en";$.getScript(system.rootPath+"lang/"+lang+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-"+lang.replace("-","_")+".js").done(function(script,textStatus){if(callback)callback()}).fail(function(jqxhr,settings,exception){$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-en.js",function(){if(callback)callback()})})})},
|
lang.split("-")[0].toLocaleLowerCase()+"-"+lang.split("-")[1].toLocaleUpperCase();if(!this.languages[lang])lang="en";$.getScript(system.rootPath+"lang/"+lang+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-"+lang.replace("-","_")+".js").done(function(script,textStatus){if(callback)callback()}).fail(function(jqxhr,settings,exception){$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-en.js",
|
||||||
init:function(lang,islocal,devicetype){this.readConfig();this.islocal=islocal==1?true:false;this.panel={main:$("#main"),top:$("#m_top"),toolbar:$("#m_toolbar"),left_layout:$("#m_left_layout"),left:$("#m_left"),body:$("#m_body"),layout_body:$("#layout_body"),list:$("#m_list"),attribute:$("#m_attribute"),bottom:$("#m_bottom"),title:$("#m_title"),status:$("#m_status"),statusbar:$("#m_statusbar"),status_text:$("#status_text"),droparea:$("#dropArea")};if(this.lang==null)this.setlang(lang,function(){system.initdata()});
|
function(){if(callback)callback()})})})},init:function(lang,islocal,devicetype){this.readConfig();this.islocal=islocal==1?true:false;this.panel={main:$("#main"),top:$("#m_top"),toolbar:$("#m_toolbar"),left_layout:$("#m_left_layout"),left:$("#m_left"),body:$("#m_body"),layout_body:$("#layout_body"),list:$("#m_list"),attribute:$("#m_attribute"),bottom:$("#m_bottom"),title:$("#m_title"),status:$("#m_status"),statusbar:$("#m_statusbar"),status_text:$("#status_text"),droparea:$("#dropArea")};if(this.lang==
|
||||||
else this.initdata()},resetLangText:function(parent){if(!parent)parent=$;var items=parent.find("*[system-lang]");$.each(items,function(key,item){var name=$(item).attr("system-lang");if(name.substr(0,1)=="[")$(item).html(eval("system.lang"+name));else $(item).html(eval("system.lang."+name))});items=parent.find("*[system-tip-lang]");$.each(items,function(key,item){var name=$(item).attr("system-tip-lang");if(name.substr(0,1)=="[")$(item).attr("title",eval("system.lang"+name));else $(item).attr("title",
|
null)this.setlang(lang,function(){system.initdata()});else this.initdata()},resetLangText:function(parent){if(!parent)parent=$;var items=parent.find("*[system-lang]");$.each(items,function(key,item){var name=$(item).attr("system-lang");if(name.substr(0,1)=="[")$(item).html(eval("system.lang"+name));else $(item).html(eval("system.lang."+name))});items=parent.find("*[system-tip-lang]");$.each(items,function(key,item){var name=$(item).attr("system-tip-lang");if(name.substr(0,1)=="[")$(item).attr("title",
|
||||||
eval("system.lang."+name))})},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version);var buttons=new Array;var title="\x3cspan\x3e"+this.lang.title.left+"\x3c/span\x3e";buttons.push("\x3cspan class\x3d'tree-title-toolbar'\x3e");for(var key in this.lang.tree.toolbar.nav){var value=this.lang.tree.toolbar.nav[key];buttons.push('\x3ca href\x3d"javascript:void(0);" id\x3d"tree-toolbar-nav-'+key+'" class\x3d"easyui-linkbutton" data-options\x3d"plain:true,iconCls:\'icon-disabled\'" onclick\x3d"javascript:system.navToolbarClick(this);"\x3e'+
|
eval("system.lang"+name));else $(item).attr("title",eval("system.lang."+name))})},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version);var buttons=new Array;var title="\x3cspan\x3e"+this.lang.title.left+"\x3c/span\x3e";buttons.push("\x3cspan class\x3d'tree-title-toolbar'\x3e");for(var key in this.lang.tree.toolbar.nav){var value=this.lang.tree.toolbar.nav[key];buttons.push('\x3ca href\x3d"javascript:void(0);" id\x3d"tree-toolbar-nav-'+key+'" class\x3d"easyui-linkbutton" data-options\x3d"plain:true,iconCls:\'icon-disabled\'" onclick\x3d"javascript:system.navToolbarClick(this);"\x3e'+
|
||||||
value+"\x3c/a\x3e")}buttons.push("\x3c/span\x3e");if(buttons.length>1){title+=buttons.join("");this.panel.left_layout.panel("setTitle",title);for(var key in this.lang.tree.toolbar.nav){$("#tree-toolbar-nav-"+key).linkbutton();switch(key){case "folders":if(system.config.foldersShow)$("tree-toolbar-nav-"+key).linkbutton({iconCls:"icon-enabled"}).data("status",1);else $("tree-toolbar-nav-"+key).linkbutton({iconCls:"icon-disabled"}).data("status",0);break;default:break}}}else this.panel.left_layout.panel("setTitle",
|
value+"\x3c/a\x3e")}buttons.push("\x3c/span\x3e");if(buttons.length>1){title+=buttons.join("");this.panel.left_layout.panel("setTitle",title);for(var key in this.lang.tree.toolbar.nav){$("#tree-toolbar-nav-"+key).linkbutton();switch(key){case "folders":if(system.config.foldersShow)$("tree-toolbar-nav-"+key).linkbutton({iconCls:"icon-enabled"}).data("status",1);else $("tree-toolbar-nav-"+key).linkbutton({iconCls:"icon-disabled"}).data("status",0);break;default:break}}}else this.panel.left_layout.panel("setTitle",
|
||||||
title);title="\x3cspan\x3e"+this.lang.title.list+"\x3c/span\x3e";buttons.length=0;buttons.push("\x3cspan class\x3d'tree-title-toolbar'\x3e");for(var key in this.lang["torrent-head"].buttons){var value=this.lang["torrent-head"].buttons[key];buttons.push('\x3ca href\x3d"javascript:void(0);" id\x3d"torrent-head-buttons-'+key+'" class\x3d"easyui-linkbutton" data-options\x3d"plain:true,iconCls:\'icon-disabled\'" onclick\x3d"javascript:system.navToolbarClick(this);"\x3e'+value+"\x3c/a\x3e")}buttons.push("\x3c/span\x3e");
|
title);title="\x3cspan\x3e"+this.lang.title.list+"\x3c/span\x3e";buttons.length=0;buttons.push("\x3cspan class\x3d'tree-title-toolbar'\x3e");for(var key in this.lang["torrent-head"].buttons){var value=this.lang["torrent-head"].buttons[key];buttons.push('\x3ca href\x3d"javascript:void(0);" id\x3d"torrent-head-buttons-'+key+'" class\x3d"easyui-linkbutton" data-options\x3d"plain:true,iconCls:\'icon-disabled\'" onclick\x3d"javascript:system.navToolbarClick(this);"\x3e'+value+"\x3c/a\x3e")}buttons.push("\x3c/span\x3e");
|
||||||
if(buttons.length>1){title+=buttons.join("");this.panel.body.panel("setTitle",title);for(var key in this.lang["torrent-head"].buttons){$("#torrent-head-buttons-"+key).linkbutton();switch(key){case "autoExpandAttribute":if(system.config.autoExpandAttribute)$("#torrent-head-buttons-"+key).linkbutton({iconCls:"icon-enabled"}).data("status",1);else $("#torrent-head-buttons-"+key).linkbutton({iconCls:"icon-disabled"}).data("status",0);break;default:break}}}else this.panel.body.panel("setTitle",title);
|
if(buttons.length>1){title+=buttons.join("");this.panel.body.panel("setTitle",title);for(var key in this.lang["torrent-head"].buttons){$("#torrent-head-buttons-"+key).linkbutton();switch(key){case "autoExpandAttribute":if(system.config.autoExpandAttribute)$("#torrent-head-buttons-"+key).linkbutton({iconCls:"icon-enabled"}).data("status",1);else $("#torrent-head-buttons-"+key).linkbutton({iconCls:"icon-disabled"}).data("status",0);break;default:break}}}else this.panel.body.panel("setTitle",title);
|
||||||
this.panel.status.panel("setTitle",this.lang.title.status);this.panel.attribute.panel({title:this.lang.title.attribute,onExpand:function(){if(system.currentTorrentId!=0&&$(this).data("isload"))system.getTorrentInfos(system.currentTorrentId);else system.clearTorrentAttribute()},onLoad:function(){if(!$(this).data("isload")){$(this).data("isload",true);if(system.currentTorrentId!=0)setTimeout(function(){system.getTorrentInfos(system.currentTorrentId)},500)}}});$.each(this.languages,function(key,value){$("\x3coption/\x3e").text(value).val(key).attr("selected",
|
this.panel.status.panel("setTitle",this.lang.title.status);this.panel.attribute.panel({title:this.lang.title.attribute,onExpand:function(){if(system.currentTorrentId!=0&&$(this).data("isload"))system.getTorrentInfos(system.currentTorrentId);else system.clearTorrentAttribute()},onLoad:function(){if(!$(this).data("isload")){$(this).data("isload",true);if(system.currentTorrentId!=0)setTimeout(function(){system.getTorrentInfos(system.currentTorrentId)},500)}}});$.each(this.languages,function(key,value){$("\x3coption/\x3e").text(value).val(key).attr("selected",
|
||||||
key==system.lang.name?true:false).appendTo(system.panel.top.find("#lang"))});this.panel.top.find("#lang").change(function(){location.href="?lang\x3d"+this.value});this.panel.toolbar.attr("class","panel-header");this.initTree();this.initToolbar();this.initStatusBar();this.initTorrentTable();this.connect();this.initEvent()},initEvent:function(){$(window).resize(function(){$("#main").layout("resize")});this.panel.droparea[0].addEventListener("dragover",function(e){e.stopPropagation();e.preventDefault();
|
key==system.lang.name?true:false).appendTo(system.panel.top.find("#lang"))});this.panel.top.find("#lang").change(function(){location.href="?lang\x3d"+this.value});this.panel.toolbar.attr("class","panel-header");this.initTree();this.initToolbar();this.initStatusBar();this.initTorrentTable();this.connect();this.initEvent();this.checkUpdate()},initEvent:function(){$(window).resize(function(){$("#main").layout("resize")});this.panel.droparea[0].addEventListener("dragover",function(e){e.stopPropagation();
|
||||||
system.debug("#dropArea.dragover")},false);this.panel.list[0].addEventListener("dragover",function(e){e.stopPropagation();e.preventDefault();system.panel.droparea.show();system.debug("dragover")},false);this.panel.droparea[0].addEventListener("drop",function(e){e.stopPropagation();e.preventDefault();system.panel.droparea.hide();system.debug("drop.e.dataTransfer:",e.dataTransfer);system.checkDropFiles(e.dataTransfer.files)},false);this.panel.droparea[0].addEventListener("dragleave",function(e){e.stopPropagation();
|
e.preventDefault();system.debug("#dropArea.dragover")},false);this.panel.list[0].addEventListener("dragover",function(e){e.stopPropagation();e.preventDefault();system.panel.droparea.show();system.debug("dragover")},false);this.panel.droparea[0].addEventListener("drop",function(e){e.stopPropagation();e.preventDefault();system.panel.droparea.hide();system.debug("drop.e.dataTransfer:",e.dataTransfer);system.checkDropFiles(e.dataTransfer.files)},false);this.panel.droparea[0].addEventListener("dragleave",
|
||||||
e.preventDefault();system.panel.droparea.hide();system.debug("dragleave")},false);$("#text-drop-title").html(this.lang["public"]["text-drop-title"])},navToolbarClick:function(source){var key=source.id;var status=$(source).data("status");var treenode=null;switch(key){case "tree-toolbar-nav-folders":treenode=this.panel.left.tree("find","folders");if(status==1)this.config.foldersShow=false;else this.config.foldersShow=true;break;case "tree-toolbar-nav-statistics":treenode=this.panel.left.tree("find",
|
function(e){e.stopPropagation();e.preventDefault();system.panel.droparea.hide();system.debug("dragleave")},false);$("#text-drop-title").html(this.lang["public"]["text-drop-title"])},navToolbarClick:function(source){var key=source.id;var status=$(source).data("status");var treenode=null;switch(key){case "tree-toolbar-nav-folders":treenode=this.panel.left.tree("find","folders");if(status==1)this.config.foldersShow=false;else this.config.foldersShow=true;break;case "tree-toolbar-nav-statistics":treenode=
|
||||||
"statistics");break;case "torrent-head-buttons-autoExpandAttribute":treenode={};treenode.target=null;if(status==1)this.config.autoExpandAttribute=false;else this.config.autoExpandAttribute=true;break}if(!treenode)return;if(status==1){$(source).linkbutton({iconCls:"icon-disabled"});$(treenode.target).parent().hide();status=0}else{$(source).linkbutton({iconCls:"icon-enabled"});$(treenode.target).parent().show();status=1}$(source).data("status",status);this.saveConfig()},checkDropFiles:function(sources){if(!sources||
|
this.panel.left.tree("find","statistics");break;case "torrent-head-buttons-autoExpandAttribute":treenode={};treenode.target=null;if(status==1)this.config.autoExpandAttribute=false;else this.config.autoExpandAttribute=true;break}if(!treenode)return;if(status==1){$(source).linkbutton({iconCls:"icon-disabled"});$(treenode.target).parent().hide();status=0}else{$(source).linkbutton({iconCls:"icon-enabled"});$(treenode.target).parent().show();status=1}$(source).data("status",status);this.saveConfig()},
|
||||||
!sources.length)return;var files=new Array;for(var i=0;i<sources.length;i++){var file=sources[i];if(file.name.split(".").pop().toLowerCase()=="torrent")files.push(file)}if(files.length>0)system.openDialogFromTemplate({id:"dialog-torrent-addfile",options:{title:system.lang.toolbar["add-torrent"],width:620,height:300,resizable:true},datas:{"files":files}})},initTree:function(){this.panel.left.tree({data:[{id:"torrent-all",iconCls:"icon-home",text:this.lang.tree.all+" ("+this.lang.tree.status.loading+
|
checkDropFiles:function(sources){if(!sources||!sources.length)return;var files=new Array;for(var i=0;i<sources.length;i++){var file=sources[i];if(file.name.split(".").pop().toLowerCase()=="torrent")files.push(file)}if(files.length>0)system.openDialogFromTemplate({id:"dialog-torrent-addfile",options:{title:system.lang.toolbar["add-torrent"],width:620,height:300,resizable:true},datas:{"files":files}})},initTree:function(){this.panel.left.tree({data:[{id:"torrent-all",iconCls:"icon-home",text:this.lang.tree.all+
|
||||||
")",children:[{id:"downloading",text:this.lang.tree.downloading,iconCls:"icon-download"},{id:"paused",text:this.lang.tree.paused,iconCls:"icon-pause"},{id:"sending",text:this.lang.tree.sending,iconCls:"icon-seed"},{id:"check",text:this.lang.tree.check,iconCls:"icon-check"},{id:"actively",text:this.lang.tree.actively,iconCls:"icon-actively"},{id:"error",text:this.lang.tree.error,iconCls:"icon-error"},{id:"warning",text:this.lang.tree.warning,iconCls:"icon-warning"}]},{id:"servers",text:this.lang.tree.servers,
|
" ("+this.lang.tree.status.loading+")",children:[{id:"downloading",text:this.lang.tree.downloading,iconCls:"icon-download"},{id:"paused",text:this.lang.tree.paused,iconCls:"icon-pause"},{id:"sending",text:this.lang.tree.sending,iconCls:"icon-seed"},{id:"check",text:this.lang.tree.check,iconCls:"icon-check"},{id:"actively",text:this.lang.tree.actively,iconCls:"icon-actively"},{id:"error",text:this.lang.tree.error,iconCls:"icon-error"},{id:"warning",text:this.lang.tree.warning,iconCls:"icon-warning"}]},
|
||||||
state:"closed",iconCls:"icon-servers",children:[{id:"servers-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"folders",text:this.lang.tree.folders,children:[{id:"folders-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"statistics",text:this.lang.tree.statistics.title,state:"closed",iconCls:"icon-chart",children:[{id:"cumulative-stats",text:this.lang.tree.statistics.cumulative,children:[{id:"uploadedBytes",text:this.lang.tree.statistics.uploadedBytes},
|
{id:"servers",text:this.lang.tree.servers,state:"closed",iconCls:"icon-servers",children:[{id:"servers-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"folders",text:this.lang.tree.folders,children:[{id:"folders-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"statistics",text:this.lang.tree.statistics.title,state:"closed",iconCls:"icon-chart",children:[{id:"cumulative-stats",text:this.lang.tree.statistics.cumulative,children:[{id:"uploadedBytes",
|
||||||
{id:"downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},{id:"filesAdded",text:this.lang.tree.statistics.filesAdded},{id:"sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"secondsActive",text:this.lang.tree.statistics.secondsActive}]},{id:"current-stats",text:this.lang.tree.statistics.current,children:[{id:"current-uploadedBytes",text:this.lang.tree.statistics.uploadedBytes},{id:"current-downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},{id:"current-filesAdded",
|
text:this.lang.tree.statistics.uploadedBytes},{id:"downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},{id:"filesAdded",text:this.lang.tree.statistics.filesAdded},{id:"sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"secondsActive",text:this.lang.tree.statistics.secondsActive}]},{id:"current-stats",text:this.lang.tree.statistics.current,children:[{id:"current-uploadedBytes",text:this.lang.tree.statistics.uploadedBytes},{id:"current-downloadedBytes",text:this.lang.tree.statistics.downloadedBytes},
|
||||||
text:this.lang.tree.statistics.filesAdded},{id:"current-sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"current-secondsActive",text:this.lang.tree.statistics.secondsActive}]}]}],onSelect:function(node){system.loadTorrentToList({node:node})},lines:true});for(var key in this.lang.tree.toolbar.nav){var treenode=this.panel.left.tree("find",key);switch(key){case "folders":if(system.config.foldersShow){$("#tree-toolbar-nav-"+key).click();$(treenode.target).parent().show()}else $(treenode.target).parent().hide()}}if(this.config.defaultSelectNode){var node=
|
{id:"current-filesAdded",text:this.lang.tree.statistics.filesAdded},{id:"current-sessionCount",text:this.lang.tree.statistics.sessionCount},{id:"current-secondsActive",text:this.lang.tree.statistics.secondsActive}]}]}],onSelect:function(node){system.loadTorrentToList({node:node})},lines:true});for(var key in this.lang.tree.toolbar.nav){var treenode=this.panel.left.tree("find",key);switch(key){case "folders":if(system.config.foldersShow){$("#tree-toolbar-nav-"+key).click();$(treenode.target).parent().show()}else $(treenode.target).parent().hide()}}if(this.config.defaultSelectNode){var node=
|
||||||
this.panel.left.tree("find",this.config.defaultSelectNode);if(node)this.panel.left.tree("select",node.target)}},initTorrentTable:function(){this.control.torrentlist=$("\x3ctable/\x3e").attr("class","torrent-list").appendTo(this.panel.list);var headContextMenu=null;var selectedIndex=-1;var flag_onselect=false;$.get(system.rootPath+"template/torrent-fields.json?time\x3d"+new Date,function(data){var fields=data.fields;if(system.userConfig.torrentList.fields.length!=0)fields=system.userConfig.torrentList.fields;
|
this.panel.left.tree("find",this.config.defaultSelectNode);if(node)this.panel.left.tree("select",node.target)}},initTorrentTable:function(){this.control.torrentlist=$("\x3ctable/\x3e").attr("class","torrent-list").appendTo(this.panel.list);var headContextMenu=null;var selectedIndex=-1;var flag_onselect=false;$.get(system.rootPath+"template/torrent-fields.json?time\x3d"+new Date,function(data){var fields=data.fields;if(system.userConfig.torrentList.fields.length!=0)fields=$.extend(fields,system.userConfig.torrentList.fields);
|
||||||
var _fields=JSON.stringify(fields);system.userConfig.torrentList.fields=JSON.parse(_fields);for(var key in fields){fields[key].title=system.lang.torrent.fields[fields[key].field]||fields[key].field;system.setFieldFormat(fields[key])}system.control.torrentlist.datagrid({autoRowHeight:false,pagination:system.config.pagination,rownumbers:true,remoteSort:false,checkOnSelect:false,pageSize:system.config.pageSize,pageList:system.config.pageList,idField:"id",fit:true,striped:true,sortName:system.userConfig.torrentList.sortName,
|
var _fields=JSON.stringify(fields);system.userConfig.torrentList.fields=JSON.parse(_fields);for(var key in fields){fields[key].title=system.lang.torrent.fields[fields[key].field]||fields[key].field;system.setFieldFormat(fields[key])}system.control.torrentlist.datagrid({autoRowHeight:false,pagination:system.config.pagination,rownumbers:true,remoteSort:false,checkOnSelect:false,pageSize:system.config.pageSize,pageList:system.config.pageList,idField:"id",fit:true,striped:true,sortName:system.userConfig.torrentList.sortName,
|
||||||
sortOrder:system.userConfig.torrentList.sortOrder,drophead:true,columns:[fields],onCheck:function(rowIndex,rowData){system.checkTorrentRow(rowIndex,rowData)},onUncheck:function(rowIndex,rowData){system.checkTorrentRow(rowIndex,rowData)},onCheckAll:function(rows){system.checkTorrentRow("all",false)},onUncheckAll:function(rows){system.checkTorrentRow("all",true)},onSelect:function(rowIndex,rowData){if(selectedIndex!=-1){flag_onselect=true;system.control.torrentlist.datagrid("unselectRow",selectedIndex);
|
sortOrder:system.userConfig.torrentList.sortOrder,drophead:true,columns:[fields],onCheck:function(rowIndex,rowData){system.checkTorrentRow(rowIndex,rowData)},onUncheck:function(rowIndex,rowData){system.checkTorrentRow(rowIndex,rowData)},onCheckAll:function(rows){system.checkTorrentRow("all",false)},onUncheckAll:function(rows){system.checkTorrentRow("all",true)},onSelect:function(rowIndex,rowData){if(selectedIndex!=-1){flag_onselect=true;system.control.torrentlist.datagrid("unselectRow",selectedIndex);
|
||||||
flag_onselect=false}if(system.config.autoExpandAttribute)if(system.panel.attribute.panel("options").collapsed)system.panel.layout_body.layout("expand","south");system.getTorrentInfos(rowData.id);selectedIndex=rowIndex},onUnselect:function(rowIndex,rowData){if(system.config.autoExpandAttribute)if(flag_onselect==false)if(!system.panel.attribute.panel("options").collapsed)system.panel.layout_body.layout("collapse","south");system.currentTorrentId=0;selectedIndex=-1},onBeforeLoad:function(param){system.currentTorrentId=
|
flag_onselect=false}if(system.config.autoExpandAttribute)if(system.panel.attribute.panel("options").collapsed)system.panel.layout_body.layout("expand","south");system.getTorrentInfos(rowData.id);selectedIndex=rowIndex},onUnselect:function(rowIndex,rowData){if(system.config.autoExpandAttribute)if(flag_onselect==false)if(!system.panel.attribute.panel("options").collapsed)system.panel.layout_body.layout("collapse","south");system.currentTorrentId=0;selectedIndex=-1},onBeforeLoad:function(param){system.currentTorrentId=
|
||||||
|
@ -89,15 +89,15 @@ formatLongTime(stats[key]);break;case "lastAnnounceSucceeded":case "lastAnnounce
|
||||||
item[key];var percentDone=parseFloat(item.progress*100).toFixed(2);rowdata.progress=system.getTorrentProgressBar(percentDone,transmission._status.download);datas.push(rowdata)}this.updateCurrentPageDatas("address",datas,system.panel.attribute.find("#torrent-peers-table"))},fillTorrentConfig:function(torrent){if(system.panel.attribute.find("#torrent-attribute-tabs").data("selectedIndex")!=4)return;transmission.torrents.getConfig(torrent.id,function(result){if(result==null)return;var torrent=transmission.torrents.all[system.currentTorrentId];
|
item[key];var percentDone=parseFloat(item.progress*100).toFixed(2);rowdata.progress=system.getTorrentProgressBar(percentDone,transmission._status.download);datas.push(rowdata)}this.updateCurrentPageDatas("address",datas,system.panel.attribute.find("#torrent-peers-table"))},fillTorrentConfig:function(torrent){if(system.panel.attribute.find("#torrent-attribute-tabs").data("selectedIndex")!=4)return;transmission.torrents.getConfig(torrent.id,function(result){if(result==null)return;var torrent=transmission.torrents.all[system.currentTorrentId];
|
||||||
jQuery.extend(torrent,result[0]);if(system.currentTorrentId==0)return;$.each(result[0],function(key,value){var indeterminate=false;var checked=false;var useTag=false;switch(key){case "seedIdleMode":case "seedRatioMode":if(value==0){checked=false;indeterminate=true}useTag=true;case "downloadLimited":case "uploadLimited":if(value==true||value==1)checked=true;system.panel.attribute.find("input[enabledof\x3d'"+key+"']").prop("disabled",!checked);if(useTag)system.panel.attribute.find("#"+key).prop("indeterminate",
|
jQuery.extend(torrent,result[0]);if(system.currentTorrentId==0)return;$.each(result[0],function(key,value){var indeterminate=false;var checked=false;var useTag=false;switch(key){case "seedIdleMode":case "seedRatioMode":if(value==0){checked=false;indeterminate=true}useTag=true;case "downloadLimited":case "uploadLimited":if(value==true||value==1)checked=true;system.panel.attribute.find("input[enabledof\x3d'"+key+"']").prop("disabled",!checked);if(useTag)system.panel.attribute.find("#"+key).prop("indeterminate",
|
||||||
indeterminate).data("_tag",value);system.panel.attribute.find("#"+key).prop("checked",checked);break;default:system.panel.attribute.find("#"+key).val(value);system.panel.attribute.find("#"+key).numberspinner("setValue",value);break}})})},setFieldFormat:function(field){if(field.formatter)switch(field.formatter){case "size":field.formatter=function(value,row,index){return formatSize(value)};break;case "speed":field.formatter=function(value,row,index){return formatSize(value,true,"speed")};break;case "longtime":field.formatter=
|
indeterminate).data("_tag",value);system.panel.attribute.find("#"+key).prop("checked",checked);break;default:system.panel.attribute.find("#"+key).val(value);system.panel.attribute.find("#"+key).numberspinner("setValue",value);break}})})},setFieldFormat:function(field){if(field.formatter)switch(field.formatter){case "size":field.formatter=function(value,row,index){return formatSize(value)};break;case "speed":field.formatter=function(value,row,index){return formatSize(value,true,"speed")};break;case "longtime":field.formatter=
|
||||||
function(value,row,index){return formatLongTime(value)};break;case "progress":field.formatter=function(value,row,index){var percentDone=parseFloat(value*100).toFixed(2);return system.getTorrentProgressBar(percentDone,transmission.torrents.all[row["id"]])};break;case "_usename_":switch(field.field){case "name":field.formatter=function(value,row,index){return system.getTorrentNameBar(transmission.torrents.all[row["id"]])};break}break}},reloadData:function(){this.reloadSession();this.reloading=false;
|
function(value,row,index){return formatLongTime(value)};break;case "progress":field.formatter=function(value,row,index){var percentDone=parseFloat(value*100).toFixed(2);return system.getTorrentProgressBar(percentDone,transmission.torrents.all[row["id"]])};break;case "_usename_":switch(field.field){case "name":field.formatter=function(value,row,index){return system.getTorrentNameBar(transmission.torrents.all[row["id"]])};break}break;case "ratio":field.formatter=function(value,row,index){var className=
|
||||||
this.getServerStatus();this.reloading=false;this.reloadTorrentBaseInfos();this.checkTorrentRow("all",false)},loadFolderList:function(oldFolders){this.removeTreeNode("folders-loading");for(var index in oldFolders){var item=oldFolders[index];if(item)system.removeTreeNode(item.nodeid)}if(transmission.downloadDirs.length==0)return;timedChunk(transmission.downloadDirs,this.appendFolder,this,10,function(){if(navigator.userAgent.indexOf("Firefox")>0)system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})})},
|
"";if(parseFloat(value)<1)className="text-status-warning";return'\x3cspan class\x3d"'+className+'"\x3e'+value+"\x3c/span\x3e"};break}},reloadData:function(){this.reloadSession();this.reloading=false;this.getServerStatus();this.reloading=false;this.reloadTorrentBaseInfos();this.checkTorrentRow("all",false)},loadFolderList:function(oldFolders){this.removeTreeNode("folders-loading");for(var index in oldFolders){var item=oldFolders[index];if(item)system.removeTreeNode(item.nodeid)}if(transmission.downloadDirs.length==
|
||||||
appendFolder:function(fullkey){if(!fullkey)return;var rootkey="folders";var parentkey=rootkey;var folder=fullkey.split("/");var key=rootkey+"-";for(var i in folder){var name=folder[i];if(name=="")continue;key+=this.B64.encode(name);var node=this.panel.left.tree("find",key);var folderinfos=transmission.torrents.folders[key];var text=name+this.showNodeMoreInfos(folderinfos.count,folderinfos.size);if(!node){this.appendTreeNode(parentkey,[{id:key,text:text}]);if(parentkey!=rootkey){node=this.panel.left.tree("find",
|
0)return;timedChunk(transmission.downloadDirs,this.appendFolder,this,10,function(){if(navigator.userAgent.indexOf("Firefox")>0)system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})})},appendFolder:function(fullkey){if(!fullkey)return;var rootkey="folders";var parentkey=rootkey;var folder=fullkey.split("/");var key=rootkey+"-";for(var i in folder){var name=folder[i];if(name=="")continue;key+=this.B64.encode(name);var node=this.panel.left.tree("find",key);var folderinfos=transmission.torrents.folders[key];
|
||||||
parentkey);this.panel.left.tree("collapse",node.target)}}else this.updateTreeNodeText(key,text);parentkey=key}},replaceURI:function(text){var reg=/(http|https|ftp):\/\/([^/:]+)(:\d*)?([^# ]*)/ig;return text.replace(reg,function(url){return'\x3ca href\x3d"'+url+'" target\x3d"_blank"\x3e'+url+"\x3c/a\x3e"})},readConfig:function(){this.readUserConfig();var config=this.getStorageData(this.configHead+".system");if(config)this.config=$.extend(this.config,JSON.parse(config));for(var key in this.storageKeys.dictionary)this.dictionary[key]=
|
var text=name+this.showNodeMoreInfos(folderinfos.count,folderinfos.size);if(!node){this.appendTreeNode(parentkey,[{id:key,text:text}]);if(parentkey!=rootkey){node=this.panel.left.tree("find",parentkey);this.panel.left.tree("collapse",node.target)}}else this.updateTreeNodeText(key,text);parentkey=key}},replaceURI:function(text){var reg=/(http|https|ftp):\/\/([^/:]+)(:\d*)?([^# ]*)/ig;return text.replace(reg,function(url){return'\x3ca href\x3d"'+url+'" target\x3d"_blank"\x3e'+url+"\x3c/a\x3e"})},readConfig:function(){this.readUserConfig();
|
||||||
this.getStorageData(this.storageKeys.dictionary[key])},saveConfig:function(){this.setStorageData(this.configHead+".system",JSON.stringify(this.config));for(var key in this.storageKeys.dictionary)this.setStorageData(this.storageKeys.dictionary[key],this.dictionary[key]);this.saveUserConfig()},readUserConfig:function(){var local=window.localStorage[this.configHead];if(local){var localOptions=JSON.parse(local);this.userConfig=$.extend(true,this.userConfig,localOptions)}},saveUserConfig:function(){window.localStorage[this.configHead]=
|
var config=this.getStorageData(this.configHead+".system");if(config)this.config=$.extend(this.config,JSON.parse(config));for(var key in this.storageKeys.dictionary)this.dictionary[key]=this.getStorageData(this.storageKeys.dictionary[key])},saveConfig:function(){this.setStorageData(this.configHead+".system",JSON.stringify(this.config));for(var key in this.storageKeys.dictionary)this.setStorageData(this.storageKeys.dictionary[key],this.dictionary[key]);this.saveUserConfig()},readUserConfig:function(){var local=
|
||||||
JSON.stringify(this.userConfig)},uploadTorrentFile:function(fileInputId,savePath,paused,callback){if(window.FileReader){var files=$("input[id\x3d'"+fileInputId+"']")[0].files;$.each(files,function(index,file){transmission.addTorrentFromFile(file,savePath,paused,callback,files.length)})}else alert(system.lang["publit"]["text-browsers-not-support-features"])},checkUpdate:function(){$.getScript(this.checkUpdateScript,function(){if(system.codeupdate<system.lastUpdateInfos.update){$("#area-update-infos").show();
|
window.localStorage[this.configHead];if(local){var localOptions=JSON.parse(local);this.userConfig=$.extend(true,this.userConfig,localOptions)}},saveUserConfig:function(){window.localStorage[this.configHead]=JSON.stringify(this.userConfig)},uploadTorrentFile:function(fileInputId,savePath,paused,callback){if(window.FileReader){var files=$("input[id\x3d'"+fileInputId+"']")[0].files;$.each(files,function(index,file){transmission.addTorrentFromFile(file,savePath,paused,callback,files.length)})}else alert(system.lang["publit"]["text-browsers-not-support-features"])},
|
||||||
$("#msg-updateInfos").html(system.lastUpdateInfos.update+" -\x3e "+system.lastUpdateInfos.infos)}else $("#area-update-infos").hide()})},changeLanguages:function(lang){if(lang==this.lang.name||!lang)return;this.config.defaultLang=lang;this.saveConfig();location.href="?lang\x3d"+lang},getStorageData:function(key,defaultValue){return window.localStorage[key]==null?defaultValue:window.localStorage[key]},setStorageData:function(key,value){window.localStorage[key]=value},openDialogFromTemplate:function(config){var defaultConfig=
|
checkUpdate:function(){$.ajax({url:this.checkUpdateScript,dataType:"json",success:function(result){if(result&&result.update)if(system.codeupdate<result.update){$("#area-update-infos").show();$("#msg-updateInfos").html(result.update+" -\x3e "+result.infos)}else $("#area-update-infos").hide()}})},changeLanguages:function(lang){if(lang==this.lang.name||!lang)return;this.config.defaultLang=lang;this.saveConfig();location.href="?lang\x3d"+lang},getStorageData:function(key,defaultValue){return window.localStorage[key]==
|
||||||
{id:null,options:null,datas:null};config=$.extend(true,defaultConfig,config);if(config.id==null)return;var dialogId=config.id;var options=config.options;var datas=config.datas;var dialog=$("#"+dialogId);if(dialog.length){dialog.dialog("open");if(datas)$.each(datas,function(key,value){dialog.data(key,value)});dialog.dialog({content:system.templates[dialogId]});return}var defaultOptions={title:"",width:100,height:100,resizable:false,cache:true,content:"loading...",modal:true};options=$.extend(true,
|
null?defaultValue:window.localStorage[key]},setStorageData:function(key,value){window.localStorage[key]=value},openDialogFromTemplate:function(config){var defaultConfig={id:null,options:null,datas:null};config=$.extend(true,defaultConfig,config);if(config.id==null)return;var dialogId=config.id;var options=config.options;var datas=config.datas;var dialog=$("#"+dialogId);if(dialog.length){dialog.dialog("open");if(datas)$.each(datas,function(key,value){dialog.data(key,value)});dialog.dialog({content:system.templates[dialogId]});
|
||||||
defaultOptions,options);$("\x3cdiv/\x3e").attr("id",dialogId).appendTo(document.body).dialog(options);$.get(system.rootPath+"template/"+dialogId+".html?time\x3d"+new Date,function(data){system.templates[dialogId]=data;if(datas)$.each(datas,function(key,value){$("#"+dialogId).data(key,value)});$("#"+dialogId).dialog({content:data})})},debug:function(label,text){if(window.console)if(window.console.log)window.console.log(label,text)}};
|
return}var defaultOptions={title:"",width:100,height:100,resizable:false,cache:true,content:"loading...",modal:true};options=$.extend(true,defaultOptions,options);$("\x3cdiv/\x3e").attr("id",dialogId).appendTo(document.body).dialog(options);$.get(system.rootPath+"template/"+dialogId+".html?time\x3d"+new Date,function(data){system.templates[dialogId]=data;if(datas)$.each(datas,function(key,value){$("#"+dialogId).data(key,value)});$("#"+dialogId).dialog({content:data})})},debug:function(label,text){if(window.console)if(window.console.log)window.console.log(label,
|
||||||
$(document).ready(function(){$.getScript(system.rootPath+"lang/default.js");$.getScript(system.rootPath+"lang/_languages.js",function(){system.init(location.search.getQueryString("lang"),location.search.getQueryString("local"))})});
|
text)}};$(document).ready(function(){$.getScript(system.rootPath+"lang/default.js");$.getScript(system.rootPath+"lang/_languages.js",function(){system.init(location.search.getQueryString("lang"),location.search.getQueryString("local"))})});
|
||||||
function pagerFilter(data){if(typeof data.length=="number"&&typeof data.splice=="function")data={total:data.length,rows:data};var dg=$(this);var opts=dg.datagrid("options");var pager=dg.datagrid("getPager");var buttons=dg.data("buttons");pager.pagination({onSelectPage:function(pageNum,pageSize){opts.pageNumber=pageNum;opts.pageSize=pageSize;pager.pagination("refresh",{pageNumber:pageNum,pageSize:pageSize});dg.datagrid("loadData",data)},buttons:buttons});if(!data.originalRows)data.originalRows=data.rows;
|
function pagerFilter(data){if(typeof data.length=="number"&&typeof data.splice=="function")data={total:data.length,rows:data};var dg=$(this);var opts=dg.datagrid("options");var pager=dg.datagrid("getPager");var buttons=dg.data("buttons");pager.pagination({onSelectPage:function(pageNum,pageSize){opts.pageNumber=pageNum;opts.pageSize=pageSize;pager.pagination("refresh",{pageNumber:pageNum,pageSize:pageSize});dg.datagrid("loadData",data)},buttons:buttons});if(!data.originalRows)data.originalRows=data.rows;
|
||||||
var start=(opts.pageNumber-1)*parseInt(opts.pageSize);var end=start+parseInt(opts.pageSize);data.rows=data.originalRows.slice(start,end);return data};
|
var start=(opts.pageNumber-1)*parseInt(opts.pageSize);var end=start+parseInt(opts.pageSize);data.rows=data.originalRows.slice(start,end);return data};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var system={version:"1.2 Beta",rootPath:"tr-web-control/",codeupdate:"20171015",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null},lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,currentContentPage:"home",currentContentConfig:null,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,torrentListChecked:false,debug:function(label,text){if(window.console)if(window.console.log)window.console.log(label,
|
var system={version:"1.4.0",rootPath:"tr-web-control/",codeupdate:"20171108",configHead:"transmission-web-control",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null},lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,currentContentPage:"home",currentContentConfig:null,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,torrentListChecked:false,debug:function(label,text){if(window.console)if(window.console.log)window.console.log(label,
|
||||||
text)},setlang:function(lang,callback){if(!lang)if(this.config.defaultLang)lang=this.config.defaultLang;else lang=navigator.language||navigator.browserLanguage;if(!lang)lang="zh-CN";if(lang.indexOf("-")!=-1)lang=lang.split("-")[0].toLocaleLowerCase()+"-"+lang.split("-")[1].toLocaleUpperCase();if(!this.languages[lang])lang="en";$.getScript(system.rootPath+"lang/"+lang+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();if(callback)callback()})},resetLangText:function(){var items=
|
text)},setlang:function(lang,callback){if(!lang)if(this.config.defaultLang)lang=this.config.defaultLang;else lang=navigator.language||navigator.browserLanguage;if(!lang)lang="zh-CN";if(lang.indexOf("-")!=-1)lang=lang.split("-")[0].toLocaleLowerCase()+"-"+lang.split("-")[1].toLocaleUpperCase();if(!this.languages[lang])lang="en";$.getScript(system.rootPath+"lang/"+lang+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();if(callback)callback()})},resetLangText:function(){var items=
|
||||||
$("*[system-lang]");$.each(items,function(key,item){var name=$(item).attr("system-lang");$(item).html(eval("system.lang."+name))})},init:function(lang,islocal){this.readConfig();transmission.options.getFolders=false;if(this.lang==null)this.setlang(lang,function(){system.initdata()});else this.initdata()},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version);this.control.torrentlist=$("#torrent-list");this.connect()},readConfig:function(){var config=this.getStorageData(this.configHead+
|
$("*[system-lang]");$.each(items,function(key,item){var name=$(item).attr("system-lang");$(item).html(eval("system.lang."+name))})},init:function(lang,islocal){this.readConfig();transmission.options.getFolders=false;if(this.lang==null)this.setlang(lang,function(){system.initdata()});else this.initdata()},initdata:function(){$(document).attr("title",this.lang.system.title+" "+this.version);this.control.torrentlist=$("#torrent-list");this.connect()},readConfig:function(){var config=this.getStorageData(this.configHead+
|
||||||
".system");if(config)this.config=$.extend(this.config,JSON.parse(config))},saveConfig:function(){this.setStorageData(this.configHead+".system",JSON.stringify(this.config))},getStorageData:function(key,defaultValue){return window.localStorage[key]==null?defaultValue:window.localStorage[key]},setStorageData:function(key,value){window.localStorage[key]=value},connect:function(){transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()};transmission.on.postError=function(){};transmission.init({islocal:true},
|
".system");if(config)this.config=$.extend(this.config,JSON.parse(config))},saveConfig:function(){this.setStorageData(this.configHead+".system",JSON.stringify(this.config))},getStorageData:function(key,defaultValue){return window.localStorage[key]==null?defaultValue:window.localStorage[key]},setStorageData:function(key,value){window.localStorage[key]=value},connect:function(){transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()};transmission.on.postError=function(){};transmission.init({islocal:true},
|
||||||
|
|
|
@ -6,11 +6,12 @@ true;transmission.torrents.recently=data.arguments.torrents;transmission.torrent
|
||||||
!this.all[item.id])this.newIds.push(item.id);item=$.extend(this.all[item.id],item);if(item.uploadedEver==0&&item.downloadedEver==0)item.uploadRatio="\u221e";item.infoIsLoading=false;var type=this.status[item.status];this.addTracker(item);if(!type){this.status[item.status]=new Array;type=this.status[item.status]}this.totalSize+=item.totalSize;if(item.rateDownload>0&&item.leftUntilDone>0){item["remainingTime"]=getTotalTime(item.leftUntilDone/item.rateDownload*1E3);item["remainingTimeRaw"]=Math.floor(item.leftUntilDone/
|
!this.all[item.id])this.newIds.push(item.id);item=$.extend(this.all[item.id],item);if(item.uploadedEver==0&&item.downloadedEver==0)item.uploadRatio="\u221e";item.infoIsLoading=false;var type=this.status[item.status];this.addTracker(item);if(!type){this.status[item.status]=new Array;type=this.status[item.status]}this.totalSize+=item.totalSize;if(item.rateDownload>0&&item.leftUntilDone>0){item["remainingTime"]=getTotalTime(item.leftUntilDone/item.rateDownload*1E3);item["remainingTimeRaw"]=Math.floor(item.leftUntilDone/
|
||||||
item.rateDownload*1E3)}else if(item.rateDownload==0&&item.leftUntilDone==0&&item.totalSize!=0){item["remainingTime"]=0;item["remainingTimeRaw"]=0}else{item["remainingTime"]="\u221e";item["remainingTimeRaw"]=31536E8}type.push(item);if(item.error!=0)this.error.push(item);if(item.rateUpload>0||item.rateDownload>0)this.actively.push(item);switch(item.status){case _Status.stopped:this.puased.push(item);break;case _Status.download:this.downloading.push(item);break}this.all[item.id]=item;if($.inArray(item.downloadDir,
|
item.rateDownload*1E3)}else if(item.rateDownload==0&&item.leftUntilDone==0&&item.totalSize!=0){item["remainingTime"]=0;item["remainingTimeRaw"]=0}else{item["remainingTime"]="\u221e";item["remainingTimeRaw"]=31536E8}type.push(item);if(item.error!=0)this.error.push(item);if(item.rateUpload>0||item.rateDownload>0)this.actively.push(item);switch(item.status){case _Status.stopped:this.puased.push(item);break;case _Status.download:this.downloading.push(item);break}this.all[item.id]=item;if($.inArray(item.downloadDir,
|
||||||
transmission.downloadDirs)==-1)transmission.downloadDirs.push(item.downloadDir);if(transmission.options.getFolders)if(item.downloadDir){var folder=item.downloadDir.split("/");var folderkey="folders-";for(var i in folder){var text=folder[i];if(text=="")continue;folderkey+=B64.encode(text);var node=this.folders[folderkey];if(!node)node={count:0,torrents:new Array,size:0,nodeid:folderkey};node.torrents.push(item);node.count++;node.size+=item.totalSize;this.folders[folderkey]=node}}this.count++}transmission.downloadDirs=
|
transmission.downloadDirs)==-1)transmission.downloadDirs.push(item.downloadDir);if(transmission.options.getFolders)if(item.downloadDir){var folder=item.downloadDir.split("/");var folderkey="folders-";for(var i in folder){var text=folder[i];if(text=="")continue;folderkey+=B64.encode(text);var node=this.folders[folderkey];if(!node)node={count:0,torrents:new Array,size:0,nodeid:folderkey};node.torrents.push(item);node.count++;node.size+=item.totalSize;this.folders[folderkey]=node}}this.count++}transmission.downloadDirs=
|
||||||
transmission.downloadDirs.sort();if(this.newIds.length>0)this.getallids(null,this.newIds)},addTracker:function(item){var trackerStats=item.trackerStats;var haveWarning=false;item.leecherCount=0;item.seederCount=0;if(trackerStats.length>0){for(var index in trackerStats){var trackerInfo=trackerStats[index];var lastResult=trackerInfo.lastAnnounceResult.toLowerCase();var trackerUrl=trackerInfo.host.replace("http://","").replace("https://","").split(":")[0].split(".");if($.inArray(trackerUrl[0],"www,tracker".split(","))!=
|
transmission.downloadDirs.sort();if(this.newIds.length>0)this.getallids(null,this.newIds)},addTracker:function(item){var trackerStats=item.trackerStats;var haveWarning=false;var trackers=[];item.leecherCount=0;item.seederCount=0;if(trackerStats.length>0){for(var index in trackerStats){var trackerInfo=trackerStats[index];var lastResult=trackerInfo.lastAnnounceResult.toLowerCase();var trackerUrl=trackerInfo.host.replace("http://","").replace("https://","").split(":")[0].split(".");if($.inArray(trackerUrl[0],
|
||||||
-1)trackerUrl.shift();var name=trackerUrl.join(".");var id="tracker-"+name.replace(/\./g,"-");var tracker=transmission.trackers[id];if(!tracker){transmission.trackers[id]={count:0,torrents:new Array,size:0,connected:true};tracker=transmission.trackers[id]}tracker["name"]=name;tracker["nodeid"]=id;tracker["host"]=trackerInfo.host;if(!trackerInfo.lastAnnounceSucceeded&&trackerInfo.announceState!=transmission._trackerStatus.inactive){haveWarning=true;item["warning"]=trackerInfo.lastAnnounceResult;if(lastResult==
|
"www,tracker".split(","))!=-1)trackerUrl.shift();var name=trackerUrl.join(".");var id="tracker-"+name.replace(/\./g,"-");var tracker=transmission.trackers[id];if(!tracker){transmission.trackers[id]={count:0,torrents:new Array,size:0,connected:true};tracker=transmission.trackers[id]}tracker["name"]=name;tracker["nodeid"]=id;tracker["host"]=trackerInfo.host;if(!trackerInfo.lastAnnounceSucceeded&&trackerInfo.announceState!=transmission._trackerStatus.inactive){haveWarning=true;item["warning"]=trackerInfo.lastAnnounceResult;
|
||||||
"could not connect to tracker")tracker.connected=false}tracker.torrents.push(item);tracker.count++;tracker.size+=item.totalSize;item.leecherCount+=trackerInfo.leecherCount;item.seederCount+=trackerInfo.seederCount}if(haveWarning){if(!item["nextAnnounceTime"])item["nextAnnounceTime"]=trackerInfo.nextAnnounceTime;else if(item["nextAnnounceTime"]>trackerInfo.nextAnnounceTime)item["nextAnnounceTime"]=trackerInfo.nextAnnounceTime;this.warning.push(item)}if(item.leecherCount<0)item.leecherCount=0;if(item.seederCount<
|
if(lastResult=="could not connect to tracker")tracker.connected=false}tracker.torrents.push(item);tracker.count++;tracker.size+=item.totalSize;item.leecherCount+=trackerInfo.leecherCount;item.seederCount+=trackerInfo.seederCount;trackers.push(name)}if(haveWarning){if(!item["nextAnnounceTime"])item["nextAnnounceTime"]=trackerInfo.nextAnnounceTime;else if(item["nextAnnounceTime"]>trackerInfo.nextAnnounceTime)item["nextAnnounceTime"]=trackerInfo.nextAnnounceTime;this.warning.push(item)}if(item.leecherCount<
|
||||||
0)item.seederCount=0;item.leecher=item.leecherCount+" ("+item.peersGettingFromUs+")";item.seeder=item.seederCount+" ("+item.peersSendingToUs+")"}},getPeers:function(ids){transmission.exec({method:"torrent-get",arguments:{fields:"peers,peersFrom".split(","),ids:ids}},function(data){console.log("data:",data)})},getMoreInfos:function(fields,ids,callback){transmission.exec({method:"torrent-get",arguments:{fields:fields.split(","),ids:ids}},function(data){if(data.result=="success"){if(callback)callback(data.arguments.torrents)}else if(callback)callback(null)})},
|
0)item.leecherCount=0;if(item.seederCount<0)item.seederCount=0;item.leecher=item.leecherCount+" ("+item.peersGettingFromUs+")";item.seeder=item.seederCount+" ("+item.peersSendingToUs+")";item.trackers=trackers.join(";")}},getPeers:function(ids){transmission.exec({method:"torrent-get",arguments:{fields:"peers,peersFrom".split(","),ids:ids}},function(data){console.log("data:",data)})},getMoreInfos:function(fields,ids,callback){transmission.exec({method:"torrent-get",arguments:{fields:fields.split(","),
|
||||||
search:function(key,source){if(!key)return null;if(!source)source=this.all;var arrReturn=new Array;$.each(source,function(item,i){if(source[item].name.toLowerCase().indexOf(key.toLowerCase())!=-1)arrReturn.push(source[item])});this.searchResult=arrReturn;return arrReturn},getFiles:function(id,callback){transmission.exec({method:"torrent-get",arguments:{fields:"files,fileStats".split(","),ids:id}},function(data){if(data.result=="success"){if(callback)callback(data.arguments.torrents)}else if(callback)callback(null)})},
|
ids:ids}},function(data){if(data.result=="success"){if(callback)callback(data.arguments.torrents)}else if(callback)callback(null)})},search:function(key,source){if(!key)return null;if(!source)source=this.all;var arrReturn=new Array;$.each(source,function(item,i){if(source[item].name.toLowerCase().indexOf(key.toLowerCase())!=-1)arrReturn.push(source[item])});this.searchResult=arrReturn;return arrReturn},getFiles:function(id,callback){transmission.exec({method:"torrent-get",arguments:{fields:"files,fileStats".split(","),
|
||||||
getConfig:function(id,callback){this.getMoreInfos(this.fields.config,id,callback)},getErrorIds:function(ignore,needUpdateOnly){var result=new Array;var now=new Date;if(needUpdateOnly==true)now=now.getTime()/1E3;for(var index in this.error){var item=this.error[index];if($.inArray(item.id,ignore)!=-1&&ignore.length>0)continue;if(needUpdateOnly==true)if(now<item.nextAnnounceTime)continue;if(item.status==transmission._status.stopped)continue;result.push(item.id)}for(var index in this.warning){var item=
|
ids:id}},function(data){if(data.result=="success"){if(callback)callback(data.arguments.torrents)}else if(callback)callback(null)})},getConfig:function(id,callback){this.getMoreInfos(this.fields.config,id,callback)},getErrorIds:function(ignore,needUpdateOnly){var result=new Array;var now=new Date;if(needUpdateOnly==true)now=now.getTime()/1E3;for(var index in this.error){var item=this.error[index];if($.inArray(item.id,ignore)!=-1&&ignore.length>0)continue;if(needUpdateOnly==true)if(now<item.nextAnnounceTime)continue;
|
||||||
this.warning[index];if($.inArray(item.id,ignore)!=-1&&ignore.length>0)continue;if(needUpdateOnly==true)if(now<item.nextAnnounceTime)continue;result.push(item.id)}return result},searchAndReplaceTrackers:function(oldTracker,newTracker,callback){if(!oldTracker||!newTracker)return;var result={};var count=0;for(var index in this.all){var item=this.all[index];if(!item)return;var trackerStats=item.trackerStats;for(var n in trackerStats){var tracker=trackerStats[n];if(tracker.announce==oldTracker){if(!result[n])result[n]=
|
if(item.status==transmission._status.stopped)continue;result.push(item.id)}for(var index in this.warning){var item=this.warning[index];if($.inArray(item.id,ignore)!=-1&&ignore.length>0)continue;if(needUpdateOnly==true)if(now<item.nextAnnounceTime)continue;result.push(item.id)}return result},searchAndReplaceTrackers:function(oldTracker,newTracker,callback){if(!oldTracker||!newTracker)return;var result={};var count=0;for(var index in this.all){var item=this.all[index];if(!item)return;var trackerStats=
|
||||||
{ids:new Array,tracker:newTracker};result[n].ids.push(item.id);count++}}}if(count==0)if(callback)callback(null,0);for(var index in result)transmission.exec({method:"torrent-set",arguments:{ids:result[index].ids,trackerReplace:[parseInt(index),result[index].tracker]}},function(data,tags){if(data.result=="success"){if(callback)callback(tags,count)}else if(callback)callback(null)},result[index].ids)}};
|
item.trackerStats;for(var n in trackerStats){var tracker=trackerStats[n];if(tracker.announce==oldTracker){if(!result[n])result[n]={ids:new Array,tracker:newTracker};result[n].ids.push(item.id);count++}}}if(count==0)if(callback)callback(null,0);for(var index in result)transmission.exec({method:"torrent-set",arguments:{ids:result[index].ids,trackerReplace:[parseInt(index),result[index].tracker]}},function(data,tags){if(data.result=="success"){if(callback)callback(tags,count)}else if(callback)callback(null)},
|
||||||
|
result[index].ids)}};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// Current system global object
|
// Current system global object
|
||||||
var system = {
|
var system = {
|
||||||
version:"1.2 Beta"
|
version:"1.4.0"
|
||||||
,rootPath: "tr-web-control/"
|
,rootPath: "tr-web-control/"
|
||||||
,codeupdate:"20171015"
|
,codeupdate:"20171108"
|
||||||
,configHead: "transmission-web-control"
|
,configHead: "transmission-web-control"
|
||||||
// default config, can be customized in config.js
|
// default config, can be customized in config.js
|
||||||
,config:{
|
,config:{
|
||||||
|
@ -25,7 +25,7 @@ var system = {
|
||||||
,dictionary:{
|
,dictionary:{
|
||||||
folders: null
|
folders: null
|
||||||
}
|
}
|
||||||
,checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js"
|
,checkUpdateScript:"https://raw.githubusercontent.com/ronggang/transmission-web-control/dev/release/update.json"
|
||||||
,contextMenus:{
|
,contextMenus:{
|
||||||
}
|
}
|
||||||
,panel:null
|
,panel:null
|
||||||
|
@ -297,7 +297,7 @@ var system = {
|
||||||
this.connect();
|
this.connect();
|
||||||
this.initEvent();
|
this.initEvent();
|
||||||
// Check for updates
|
// Check for updates
|
||||||
//this.checkUpdate();
|
this.checkUpdate();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
,initEvent:function()
|
,initEvent:function()
|
||||||
|
@ -598,7 +598,7 @@ var system = {
|
||||||
var fields = data.fields;
|
var fields = data.fields;
|
||||||
if (system.userConfig.torrentList.fields.length!=0)
|
if (system.userConfig.torrentList.fields.length!=0)
|
||||||
{
|
{
|
||||||
fields = system.userConfig.torrentList.fields;
|
fields = $.extend(fields,system.userConfig.torrentList.fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
var _fields = JSON.stringify(fields);
|
var _fields = JSON.stringify(fields);
|
||||||
|
@ -2496,6 +2496,15 @@ var system = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "ratio":
|
||||||
|
field.formatter = function(value,row,index){
|
||||||
|
var className = '';
|
||||||
|
if (parseFloat(value)<1) {
|
||||||
|
className = 'text-status-warning';
|
||||||
|
}
|
||||||
|
return '<span class="'+className+'">'+value+'</span>';
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2645,14 +2654,19 @@ var system = {
|
||||||
}
|
}
|
||||||
,checkUpdate: function()
|
,checkUpdate: function()
|
||||||
{
|
{
|
||||||
$.getScript(this.checkUpdateScript,function(){
|
$.ajax({
|
||||||
if (system.codeupdate<system.lastUpdateInfos.update)
|
url: this.checkUpdateScript,
|
||||||
{
|
dataType: "json",
|
||||||
|
success: function(result) {
|
||||||
|
if (result && result.update) {
|
||||||
|
if (system.codeupdate<result.update) {
|
||||||
$("#area-update-infos").show();
|
$("#area-update-infos").show();
|
||||||
$("#msg-updateInfos").html(system.lastUpdateInfos.update+" -> "+system.lastUpdateInfos.infos);
|
$("#msg-updateInfos").html(result.update+" -> "+result.infos);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
$("#area-update-infos").hide();
|
$("#area-update-infos").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Set the language to reload the page
|
// Set the language to reload the page
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
移动版
|
移动版
|
||||||
*/
|
*/
|
||||||
var system = {
|
var system = {
|
||||||
version:"1.2 Beta"
|
version:"1.4.0"
|
||||||
,rootPath: "tr-web-control/"
|
,rootPath: "tr-web-control/"
|
||||||
,codeupdate:"20171015"
|
,codeupdate:"20171108"
|
||||||
,configHead: "transmission-web-control"
|
,configHead: "transmission-web-control"
|
||||||
,config:{
|
,config:{
|
||||||
autoReload: true
|
autoReload: true
|
||||||
|
|
|
@ -231,9 +231,11 @@ transmission.torrents = {
|
||||||
addTracker: function(item) {
|
addTracker: function(item) {
|
||||||
var trackerStats = item.trackerStats;
|
var trackerStats = item.trackerStats;
|
||||||
var haveWarning = false;
|
var haveWarning = false;
|
||||||
|
var trackers = [];
|
||||||
|
|
||||||
item.leecherCount = 0;
|
item.leecherCount = 0;
|
||||||
item.seederCount = 0;
|
item.seederCount = 0;
|
||||||
|
|
||||||
if (trackerStats.length > 0) {
|
if (trackerStats.length > 0) {
|
||||||
for (var index in trackerStats) {
|
for (var index in trackerStats) {
|
||||||
var trackerInfo = trackerStats[index];
|
var trackerInfo = trackerStats[index];
|
||||||
|
@ -275,6 +277,7 @@ transmission.torrents = {
|
||||||
tracker.size += item.totalSize;
|
tracker.size += item.totalSize;
|
||||||
item.leecherCount += trackerInfo.leecherCount;
|
item.leecherCount += trackerInfo.leecherCount;
|
||||||
item.seederCount += trackerInfo.seederCount;
|
item.seederCount += trackerInfo.seederCount;
|
||||||
|
trackers.push(name);
|
||||||
}
|
}
|
||||||
if (haveWarning) {
|
if (haveWarning) {
|
||||||
// 设置下次更新时间
|
// 设置下次更新时间
|
||||||
|
@ -293,6 +296,7 @@ transmission.torrents = {
|
||||||
//item.seeder = item.seederCount+" | "+item.peersSendingToUs;
|
//item.seeder = item.seederCount+" | "+item.peersSendingToUs;
|
||||||
item.leecher = item.leecherCount + " (" + item.peersGettingFromUs + ")";
|
item.leecher = item.leecherCount + " (" + item.peersGettingFromUs + ")";
|
||||||
item.seeder = item.seederCount + " (" + item.peersSendingToUs + ")";
|
item.seeder = item.seederCount + " (" + item.peersSendingToUs + ")";
|
||||||
|
item.trackers = trackers.join(";");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 获取下载者和做种者数量测试
|
// 获取下载者和做种者数量测试
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
,{"field":"totalSize","width":"80","align":"right","sortable":"true","formatter":"size"}
|
,{"field":"totalSize","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||||
,{"field":"percentDone","width":"70","align":"center","sortable":"true","formatter":"progress"}
|
,{"field":"percentDone","width":"70","align":"center","sortable":"true","formatter":"progress"}
|
||||||
,{"field":"remainingTime","width":"100","align":"right","sortable":"true"}
|
,{"field":"remainingTime","width":"100","align":"right","sortable":"true"}
|
||||||
,{"field":"uploadRatio","width":"60","align":"right","sortable":"true"}
|
,{"field":"uploadRatio","width":"60","align":"right","sortable":"true","formatter":"ratio"}
|
||||||
,{"field":"status","width":"60","align":"center","sortable":"true"}
|
,{"field":"status","width":"60","align":"center","sortable":"true"}
|
||||||
,{"field":"statusCode","hidden":"true","allowCustom":"false"}
|
,{"field":"statusCode","hidden":"true","allowCustom":"false"}
|
||||||
,{"field":"seederCount","width":"60","align":"left"}
|
,{"field":"seederCount","width":"60","align":"left"}
|
||||||
|
@ -17,5 +17,7 @@
|
||||||
,{"field":"addedDate","width":"130","align":"center","sortable":"true","formatter":"longtime"}
|
,{"field":"addedDate","width":"130","align":"center","sortable":"true","formatter":"longtime"}
|
||||||
,{"field":"id","width":"30","align":"center","sortable":"true"}
|
,{"field":"id","width":"30","align":"center","sortable":"true"}
|
||||||
,{"field":"queuePosition","width":"30","align":"center"}
|
,{"field":"queuePosition","width":"30","align":"center"}
|
||||||
|
,{"field":"trackers","width":"100","align":"left","sortable":true}
|
||||||
|
,{"field":"downloadDir","width":200,"align":"left","sortable":true}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user