mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-05-18 08:36:52 +00:00
commit
6432b4ba3b
4
src/tr-web-control/script/min/system.min.js
vendored
4
src/tr-web-control/script/min/system.min.js
vendored
@ -54,7 +54,7 @@ this.panel.toolbar.find("#toolbar_search").searchbox({searcher:function(a){syste
|
||||
0);transmission.on.torrentCountChange=function(){system.reloadTorrentBaseInfos()};transmission.on.postError=function(){};transmission.init({islocal:true},function(){system.reloadSession(true);system.getServerStatus()})},reloadSession:function(a){transmission.getSession(function(b){system.serverConfig=b;$("#status_version").html("Transmission "+system.lang.statusbar.version+b.version+", RPC: "+b["rpc-version"]+", WEB Control: "+system.version+"("+system.codeupdate+")");if(b["alt-speed-enabled"]==true){system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"iconfont tr-icon-woniu"});
|
||||
$("#status_alt_speed").show()}else{system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"iconfont tr-icon-rocket"});$("#status_alt_speed").hide()}system.downloadDir=b["download-dir"];transmission.downloadDirs.length==0&&transmission.downloadDirs.push(system.downloadDir);parseInt(system.serverConfig["rpc-version"])>=15?transmission.getFreeSpace(system.downloadDir,function(c){system.serverConfig["download-dir-free-space"]=c.arguments["size-bytes"];system.showFreeSpace(c.arguments["size-bytes"])}):
|
||||
system.showFreeSpace(system.serverConfig["download-dir-free-space"]);a&&system.showStatus(system.lang.system.status.connected)})},showFreeSpace:function(a){a=a;a=a==-1?system.lang["public"]["text-unknown"]:formatSize(a);$("#status_freespace").text(system.lang.dialog["system-config"]["download-dir-free-space"]+" "+a)},reloadTorrentBaseInfos:function(a,b){if(!this.reloading){clearTimeout(this.autoReloadTimer);this.reloading=true;var c={trackers:transmission.trackers,folders:transmission.torrents.folders};
|
||||
transmission.torrents.getallids(function(d){var e=[],f;for(f in d)e.push(d[f].id);d=transmission.torrents.getErrorIds(e,true);d.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(c)},d):system.resetTorrentInfos(c)},a,b)}},resetTorrentInfos:function(a){this.resetNavTorrentStatus();this.resetNavServers(a);this.resetNavStatistics();this.resetNavFolders(a);this.resetNavLabels();navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})},
|
||||
transmission.torrents.getallids(function(d){var e=[],f;for(f in d)e.push(d[f].id);d=transmission.torrents.getErrorIds(e,true);d.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(c)},d):system.resetTorrentInfos(c)},a,b)}},resetTorrentInfos:function(a){this.resetNavTorrentStatus();this.resetNavServers(a);this.resetNavStatistics();this.resetNavFolders(a);this.resetNavLabels();navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size")},
|
||||
resetNavTorrentStatus:function(){var a=this.currentTorrentId;transmission.torrents.status[transmission._status.stopped]?system.updateTreeNodeText("paused",system.lang.tree.paused+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.stopped].length)):system.updateTreeNodeText("paused",system.lang.tree.paused);transmission.torrents.status[transmission._status.seed]?system.updateTreeNodeText("sending",system.lang.tree.sending+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seed].length)):
|
||||
system.updateTreeNodeText("sending",system.lang.tree.sending);if(transmission.torrents.status[transmission._status.seedwait]){var b=system.panel.left.tree("find","sending"),c=system.panel.left.tree("getChildren",b.target),d=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seedwait].length);c.length>0?system.updateTreeNodeText(c[0].id,d):system.appendTreeNode(b,[{id:"seedwait",text:d,iconCls:"iconfont tr-icon-wait"}])}else system.removeTreeNode("seedwait");
|
||||
transmission.torrents.status[transmission._status.check]?system.updateTreeNodeText("check",system.lang.tree.check+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.check].length)):system.updateTreeNodeText("check",system.lang.tree.check);if(transmission.torrents.status[transmission._status.checkwait]){b=system.panel.left.tree("find","check");c=system.panel.left.tree("getChildren",b.target);d=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.checkwait].length);
|
||||
@ -96,7 +96,7 @@ b.push(e)}this.updateCurrentPageDatas("address",b,system.panel.attribute.find("#
|
||||
true;case "downloadLimited":case "uploadLimited":if(d==true||d==1)f=true;system.panel.attribute.find("input[enabledof='"+c+"']").prop("disabled",!f);g&&system.panel.attribute.find("#"+c).prop("indeterminate",e).data("_tag",d);system.panel.attribute.find("#"+c).prop("checked",f);break;default:system.panel.attribute.find("#"+c).val(d);system.panel.attribute.find("#"+c).numberspinner("setValue",d)}})}})},setFieldFormat:function(a){if(a.formatter)switch(a.formatter){case "size":a.formatter=function(b){return formatSize(b)};
|
||||
break;case "speed":a.formatter=function(b){return formatSize(b,true,"speed")};break;case "longtime":a.formatter=function(b){return formatLongTime(b)};break;case "progress":a.formatter=function(b,c){var d=parseFloat(b*100).toFixed(2);return system.getTorrentProgressBar(d,transmission.torrents.all[c.id])};break;case "_usename_":switch(a.field){case "name":a.formatter=function(b,c){return system.getTorrentNameBar(transmission.torrents.all[c.id])}}break;case "ratio":a.formatter=function(b){var c="";if(parseFloat(b)<
|
||||
1&&b!=-1)c="text-status-warning";return'<span class="'+c+'">'+(b==-1?"∞":b)+"</span>"};break;case "remainingTime":a.formatter=function(b){if(b>=31536E8)return"∞";return getTotalTime(b)};break;case "labels":a.formatter=function(b,c){return system.formetTorrentLabels(b,c.hashString)};break;case "color":a.formatter=function(b){return $("<span class='user-label'/>").html(b).css({"background-color":b,color:getGrayLevel(b)>0.5?"#000":"#fff"}).get(0).outerHTML}}},reloadData:function(){if(this.popoverCount>
|
||||
0)setTimeout(function(){system.reloadData()},2E3);else{this.reloadSession();this.reloading=false;this.getServerStatus();this.reloading=false;this.reloadTorrentBaseInfos()}},loadFolderList:function(a){this.removeTreeNode("folders-loading");for(var b in a){var c=a[b];c&&system.removeTreeNode(c.nodeid)}transmission.downloadDirs.length!=0&&timedChunk(transmission.downloadDirs,this.appendFolder,this,10,function(){navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"});
|
||||
0)setTimeout(function(){system.reloadData()},2E3);else{this.reloadSession();this.reloading=false;this.getServerStatus();this.reloading=false;this.reloadTorrentBaseInfos()}},loadFolderList:function(a){this.removeTreeNode("folders-loading");for(var b in a){var c=a[b];c&&system.removeTreeNode(c.nodeid)}transmission.downloadDirs.length!=0&&timedChunk(transmission.downloadDirs,this.appendFolder,this,10,function(){navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size");
|
||||
system.initUIStatus()})},appendFolder:function(a){if(a){var b="folders";a=a.replace(/\\/g,"/").split("/");var c="folders-",d="",e;for(e in a){var f=a[e];if(f!=""){d+=f;var g=this.B64.encode(f);c+=g.replace(/[+|\/|=]/g,"0");g=this.panel.left.tree("find",c);var h=transmission.torrents.folders[c];if(h){f=f+this.showNodeMoreInfos(h.count,h.size);if(g)this.updateTreeNodeText(c,f);else{this.appendTreeNode(b,[{id:c,path:d,text:f,iconCls:"iconfont tr-icon-file"}]);if(b!="folders"){g=this.panel.left.tree("find",
|
||||
b);this.panel.left.tree("collapse",g.target)}}b=c}else{this.debug("appendFolder:key",c);this.debug("appendFolder:name",f);this.debug("appendFolder:node",g)}}}}},replaceURI:function(a){return a.replace(/(http|https|ftp):\/\/([^/:]+)(:\d*)?([^# ]*)/ig,function(b){return'<a href="'+b+'" target="_blank">'+b+"</a>"})},readConfig:function(){this.readUserConfig();var a=this.getStorageData(this.configHead+".system");if(a)this.config=$.extend(true,this.config,JSON.parse(a));for(var b in this.storageKeys.dictionary)this.dictionary[b]=
|
||||
this.getStorageData(this.storageKeys.dictionary[b])},saveConfig:function(){this.setStorageData(this.configHead+".system",JSON.stringify(this.config));for(var a in this.storageKeys.dictionary)this.setStorageData(this.storageKeys.dictionary[a],this.dictionary[a]);this.saveUserConfig()},readUserConfig:function(){var a=window.localStorage[this.configHead];if(a){a=JSON.parse(a);this.userConfig=$.extend(true,this.userConfig,a)}},saveUserConfig:function(){window.localStorage[this.configHead]=JSON.stringify(this.userConfig)},
|
||||
|
Loading…
x
Reference in New Issue
Block a user