mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-16 22:03:18 +00:00
Fixed #165
This commit is contained in:
parent
88f16d1f4e
commit
0268bf3eee
8
src/tr-web-control/script/min/system.min.js
vendored
8
src/tr-web-control/script/min/system.min.js
vendored
|
@ -1,4 +1,4 @@
|
|||
var system={version:"1.5.1",rootPath:"tr-web-control/",codeupdate:"20180328",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,theme:"default",showBTServers:false,ui:{status:{tree:{},layout:{main:{},body:{},left:{}},panel:{}}}},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://raw.githubusercontent.com/ronggang/transmission-web-control/dev/release/update.json",
|
||||
var system={version:"1.5.1",rootPath:"tr-web-control/",codeupdate:"20180328",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,theme:"default",showBTServers:false,ui:{status:{tree:{},layout:{main:{},body:{},left:{}},panel:{}}}},storageKeys:{dictionary:{folders:"dictionary.folders"}},dictionary:{folders:null},checkUpdateScript:"https://raw.githubusercontent.com/ronggang/twc-release/master/update.json",
|
||||
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:{},checkedRows:[],setlang:function(a,b){a||(a=this.config.defaultLang?this.config.defaultLang:navigator.language||navigator.browserLanguage);a||(a="zh-CN");if(a.indexOf("-")!=-1)a=a.split("-")[0].toLocaleLowerCase()+
|
||||
"-"+a.split("-")[1].toLocaleUpperCase();this.languages[a]||(a="en");$.getScript(system.rootPath+"lang/"+a+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-"+a.replace("-","_")+".js").done(function(){b&&b()}).fail(function(){$.getScript(system.rootPath+"script/easyui/locale/easyui-lang-en.js",function(){b&&b()})})})},init:function(a,b){this.readConfig();this.islocal=b==1?true:false;this.panel=
|
||||
{main:$("#main"),top:$("#m_top"),toolbar:$("#m_toolbar"),left_layout:$("#m_left_layout"),left:$("#m_left").hide(),body:$("#m_body"),layout_body:$("#layout_body"),layout_left:$("#layout_left"),list:$("#m_list"),attribute:$("#m_attribute"),bottom:$("#m_bottom"),title:$("#m_title"),status:$("#m_status"),statusbar:$("#m_statusbar"),status_text:$("#status_text"),droparea:$("#dropArea")};this.lang==null?this.setlang(a,function(){system.initdata()}):this.initdata();this.initThemes();this.clipboard=new ClipboardJS("#toolbar_copyPath")},
|
||||
|
@ -17,9 +17,9 @@ a.state;system.saveConfig()},onCollapse:function(a){system.config.ui.status.tree
|
|||
text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"folders",text:this.lang.tree.folders,iconCls:"iconfont tr-icon-folder",state:"closed",children:[{id:"folders-loading",text:this.lang.tree.status.loading,iconCls:"tree-loading"}]},{id:"statistics",text:this.lang.tree.statistics.title,state:"closed",iconCls:"iconfont tr-icon-shuju",children:[{id:"cumulative-stats",text:this.lang.tree.statistics.cumulative,iconCls:"iconfont tr-icon-folder",children:[{id:"uploadedBytes",text:this.lang.tree.statistics.uploadedBytes,
|
||||
iconCls:"iconfont tr-icon-empty"},{id:"downloadedBytes",text:this.lang.tree.statistics.downloadedBytes,iconCls:"iconfont tr-icon-empty"},{id:"filesAdded",text:this.lang.tree.statistics.filesAdded,iconCls:"iconfont tr-icon-empty"},{id:"sessionCount",text:this.lang.tree.statistics.sessionCount,iconCls:"iconfont tr-icon-empty"},{id:"secondsActive",text:this.lang.tree.statistics.secondsActive,iconCls:"iconfont tr-icon-empty"}]},{id:"current-stats",text:this.lang.tree.statistics.current,iconCls:"iconfont tr-icon-folder",
|
||||
children:[{id:"current-uploadedBytes",text:this.lang.tree.statistics.uploadedBytes,iconCls:"iconfont tr-icon-empty"},{id:"current-downloadedBytes",text:this.lang.tree.statistics.downloadedBytes,iconCls:"iconfont tr-icon-empty"},{id:"current-filesAdded",text:this.lang.tree.statistics.filesAdded,iconCls:"iconfont tr-icon-empty"},{id:"current-sessionCount",text:this.lang.tree.statistics.sessionCount,iconCls:"iconfont tr-icon-empty"},{id:"current-secondsActive",text:this.lang.tree.statistics.secondsActive,
|
||||
iconCls:"iconfont tr-icon-empty"}]}]}],onSelect:function(c){system.loadTorrentToList({node:c})},lines:true});for(var a in this.lang.tree.toolbar.nav){var b=this.panel.left.tree("find",a);switch(a){case "folders":if(system.config.foldersShow){$("#tree-toolbar-nav-"+a).click();$(b.target).parent().show()}else $(b.target).parent().hide()}}if(this.config.defaultSelectNode)(a=this.panel.left.tree("find",this.config.defaultSelectNode))&&this.panel.left.tree("select",a.target)},initUIStatus:function(){var a=
|
||||
this.config.ui.status.tree,b;for(b in a){var c=this.panel.left.tree("find",b);if(c&&c.target)a[b]=="open"?this.panel.left.tree("expand",c.target):this.panel.left.tree("collapse",c.target)}this.panel.left.show();a=this.config.ui.status.layout.body;for(b in a)a[b]=="open"?this.panel.layout_body.layout("expand",b):this.panel.layout_body.layout("collapse",b);a=this.config.ui.status.layout.left;for(b in a)a[b]=="open"?this.panel.layout_left.layout("expand",b):this.panel.layout_left.layout("collapse",b);
|
||||
a=this.config.ui.status.layout.main;for(b in a)a[b]=="open"?this.panel.main.layout("expand",b):this.panel.main.layout("collapse",b)},initTorrentTable:function(){function a(){b&&$(b).remove();b=$("<div/>").appendTo("body");b.menu({onClick:function(h){if(h.iconCls=="icon-ok"){system.control.torrentlist.datagrid("hideColumn",h.name);b.menu("setIcon",{target:h.target,iconCls:"icon-empty"})}else{system.control.torrentlist.datagrid("showColumn",h.name);b.menu("setIcon",{target:h.target,iconCls:"icon-ok"})}system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]);
|
||||
iconCls:"iconfont tr-icon-empty"}]}]}],onSelect:function(c){system.loadTorrentToList({node:c})},lines:true});for(var a in this.lang.tree.toolbar.nav){var b=this.panel.left.tree("find",a);switch(a){case "folders":if(system.config.foldersShow){$("#tree-toolbar-nav-"+a).click();$(b.target).parent().show()}else $(b.target).parent().hide()}}},initUIStatus:function(){var a=this.config.ui.status.tree,b;for(b in a){var c=this.panel.left.tree("find",b);if(c&&c.target)a[b]=="open"?this.panel.left.tree("expand",
|
||||
c.target):this.panel.left.tree("collapse",c.target)}this.panel.left.show();if(this.config.defaultSelectNode)(c=this.panel.left.tree("find",this.config.defaultSelectNode))&&this.panel.left.tree("select",c.target);a=this.config.ui.status.layout.body;for(b in a)a[b]=="open"?this.panel.layout_body.layout("expand",b):this.panel.layout_body.layout("collapse",b);a=this.config.ui.status.layout.left;for(b in a)a[b]=="open"?this.panel.layout_left.layout("expand",b):this.panel.layout_left.layout("collapse",
|
||||
b);a=this.config.ui.status.layout.main;for(b in a)a[b]=="open"?this.panel.main.layout("expand",b):this.panel.main.layout("collapse",b)},initTorrentTable:function(){function a(){b&&$(b).remove();b=$("<div/>").appendTo("body");b.menu({onClick:function(h){if(h.iconCls=="icon-ok"){system.control.torrentlist.datagrid("hideColumn",h.name);b.menu("setIcon",{target:h.target,iconCls:"icon-empty"})}else{system.control.torrentlist.datagrid("showColumn",h.name);b.menu("setIcon",{target:h.target,iconCls:"icon-ok"})}system.resetTorrentListFieldsUserConfig(system.control.torrentlist.datagrid("options").columns[0]);
|
||||
system.saveUserConfig()}});for(var d=system.control.torrentlist.datagrid("getColumnFields"),e=0;e<d.length;e++){var f=d[e],g=system.control.torrentlist.datagrid("getColumnOption",f);if(g.allowCustom!=false&&g.allowCustom!="false")b.menu("appendItem",{text:g.title,name:f,iconCls:g.hidden?"icon-empty":"icon-ok"})}}this.control.torrentlist=$("<table/>").attr("class","torrent-list").appendTo(this.panel.list);var b=null,c=-1;$.get(system.rootPath+"template/torrent-fields.json?time="+new Date,function(d){d=
|
||||
d.fields;if(system.userConfig.torrentList.fields.length!=0){system.userConfig.torrentList.fields.formatter=d.formatter;d=$.extend(d,system.userConfig.torrentList.fields)}var e=JSON.stringify(d);system.userConfig.torrentList.fields=JSON.parse(e);for(var f in d){d[f].title=system.lang.torrent.fields[d[f].field]||d[f].field;system.setFieldFormat(d[f])}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:[d],onCheck:function(g,h){system.checkTorrentRow(g,h)},onUncheck:function(g,h){system.checkTorrentRow(g,h)},onCheckAll:function(){system.checkTorrentRow("all",false)},onUncheckAll:function(){system.checkTorrentRow("all",true)},onSelect:function(g,h){c!=-1&&system.control.torrentlist.datagrid("unselectRow",c);system.getTorrentInfos(h.id);
|
||||
|
|
|
@ -605,14 +605,6 @@ var system = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// node that specifies the default selection
|
||||
if (this.config.defaultSelectNode) {
|
||||
var node = this.panel.left.tree("find", this.config.defaultSelectNode);
|
||||
if (node) {
|
||||
this.panel.left.tree("select", node.target);
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 初始化界面状态
|
||||
|
@ -632,6 +624,14 @@ var system = {
|
|||
|
||||
this.panel.left.show();
|
||||
|
||||
// node that specifies the default selection
|
||||
if (this.config.defaultSelectNode) {
|
||||
var node = this.panel.left.tree("find", this.config.defaultSelectNode);
|
||||
if (node) {
|
||||
this.panel.left.tree("select", node.target);
|
||||
}
|
||||
}
|
||||
|
||||
status = this.config.ui.status.layout.body;
|
||||
for (var key in status) {
|
||||
if (status[key]=="open") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user