mirror of
https://github.com/ronggang/transmission-web-control.git
synced 2025-04-16 03:40:18 +00:00
* 修复上传种子文件完成时,没有自动关闭窗口的BUG (issue 49);
* 修改原来设置RPC路径的方式; * 删除种子提示对话框从每次从服务器读到改为只读取一次模板数据; * 添加 Brazilian Portuguese 葡萄牙语(巴西) 语言包,感谢 Dudu Maroja * 添加荷兰语语言包,感谢Alwin Hummels; * Fix some bug
This commit is contained in:
parent
67ecfc772e
commit
b879adb4b1
22
index.html
22
index.html
|
@ -8,24 +8,24 @@
|
|||
<meta http-equiv="Cache-Control" content="no-cache">
|
||||
<title>Transmission Web Control</title>
|
||||
<!-- 样式表 -->
|
||||
<link rel="stylesheet" type="text/css" href="style/base.css?v=20130731" />
|
||||
<link rel="stylesheet" type="text/css" href="script/easyui/themes/default/easyui.css?v=20130731"/>
|
||||
<link rel="stylesheet" type="text/css" href="script/easyui/themes/icon.css?v=20130731"/>
|
||||
<link rel="stylesheet" type="text/css" href="style/base.css?v=20130830" />
|
||||
<link rel="stylesheet" type="text/css" href="script/easyui/themes/default/easyui.css?v=20130830"/>
|
||||
<link rel="stylesheet" type="text/css" href="script/easyui/themes/icon.css?v=20130830"/>
|
||||
<!-- 基础类库 -->
|
||||
<script type="text/javascript" src="script/jquery/jquery-1.8.3.min.js"></script>
|
||||
<script type="text/javascript" src="script/jquery/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="script/jquery/json2.min.js"></script>
|
||||
<script type="text/javascript" src="script/jquery/Base64.js"></script>
|
||||
<script type="text/javascript" src="script/easyui/jquery.easyui.min.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/easyui/jquery.easyui.min.js?v=20130830"></script>
|
||||
<!-- -->
|
||||
<!-- 系统类库 -->
|
||||
<script type="text/javascript" src="script/min/public.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/cookies.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/clientDevice.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/transmission.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/transmission.torrents.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/system.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="config.js?v=20130731"></script>
|
||||
<script type="text/javascript" src="script/min/public.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="script/min/cookies.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="script/min/clientDevice.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="script/min/transmission.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="script/min/transmission.torrents.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="script/min/system.js?v=20130830"></script>
|
||||
<script type="text/javascript" src="config.js?v=20130830"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main" class="easyui-layout">
|
||||
|
|
|
@ -10,4 +10,5 @@ system.languages = {
|
|||
,"ro":"Română(Romanian)"
|
||||
,"it":"Italiano(Italian)"
|
||||
,"pt-BR":"Brazilian Portuguese"
|
||||
,"nl":"Dutch"
|
||||
};
|
336
lang/nl.js
Normal file
336
lang/nl.js
Normal file
|
@ -0,0 +1,336 @@
|
|||
// lang file
|
||||
system.lang = {
|
||||
"name":"nl"
|
||||
,"system":{
|
||||
"title":"Transmission WEB Control"
|
||||
,"status":{
|
||||
"connect":"Verbinden..."
|
||||
,"connected":"Verbonden"
|
||||
,"queue":"Wachtrij:"
|
||||
,"queuefinish":"De wachtrij(en) zijn gereed."
|
||||
,"notfinal":"Not final"
|
||||
}
|
||||
}
|
||||
,"error":{
|
||||
"data-error":"Data error."
|
||||
,"data-post-error":"Data post error."
|
||||
}
|
||||
,"config":{
|
||||
"save-path":"Download dir"
|
||||
}
|
||||
,"toolbar":{
|
||||
"start":"Start"
|
||||
,"pause":"Pauze"
|
||||
,"recheck":"Verifiëren"
|
||||
,"start-all":"Start alles"
|
||||
,"pause-all":"Pauzeer alles"
|
||||
,"remove":"Verwijder"
|
||||
,"remove-all":"Verwijder Alles"
|
||||
,"remove-data":"Verwijder data"
|
||||
,"add-torrent":"Toevoegen"
|
||||
,"attribute":"Attribute"
|
||||
,"alt-speed":"Alt-Snelheid"
|
||||
,"system-config":"Instellingen"
|
||||
,"system-reload":"Opnieuw laden"
|
||||
,"about":"Over"
|
||||
,"reload-time":"Automatisch verversen:"
|
||||
,"reload-time-unit":"s/tijd"
|
||||
,"autoreload-disabled":"Uitgeschakeld"
|
||||
,"autoreload-enabled":"Ingeschakeld"
|
||||
,"search-prompt":"Zoek Locale Torrents"
|
||||
,"tracker-replace":"Vervang trackers"
|
||||
,"tip":{
|
||||
"start":"Start de geselecteerde torrents"
|
||||
,"pause":"Pauzeer de geselecteerde torrents"
|
||||
,"recheck":"Verifiëren"
|
||||
,"recheck-confirm":"Weet u zeker dat u de geselecteerde torrents wilt Verifiëren? Dit kan enige tijd duren!"
|
||||
,"start-all":"Start alles"
|
||||
,"pause-all":"Pauzeer alles"
|
||||
,"remove":"Verwijderen"
|
||||
,"delete-all":"Torrent en data verwijderen"
|
||||
,"delete-data":"Delete-data"
|
||||
,"add-torrent":"Toevoegen torrent(s)"
|
||||
,"attribute":"Attribute"
|
||||
,"alt-speed":"Alt-snelheid"
|
||||
,"system-config":"Instellingen"
|
||||
,"system-reload":"Opnieuw laden"
|
||||
,"about":"Over deze app"
|
||||
,"autoreload-disabled":"Automatisch Verversen uit zetten"
|
||||
,"autoreload-enabled":"Automatisch verversen aan zetten"
|
||||
,"tracker-replace":"Vervang trackers"
|
||||
,"change-download-dir":"Locatie instellen"
|
||||
,"ui-mobile":"Mobiele UI"
|
||||
,"ui-original":"Originele UI"
|
||||
,"more-peers":"Tracker voor meer peers vragen"
|
||||
}
|
||||
}
|
||||
,"title":{
|
||||
"left":"Navigatie"
|
||||
,"list":"Torrents"
|
||||
,"attribute":"Kenmerken"
|
||||
,"status":"Status"
|
||||
}
|
||||
,"tree":{
|
||||
"all":"Alles"
|
||||
,"active":"Actief"
|
||||
,"paused":"Gepauzeerd"
|
||||
,"downloading":"Downloaden"
|
||||
,"sending":"Uploaden"
|
||||
,"error":"Fout"
|
||||
,"warning":"Waarschuwing"
|
||||
,"actively":"Actief"
|
||||
,"check":"Controleren"
|
||||
,"wait":"Wachten"
|
||||
,"search-result":"Zoekresultaat"
|
||||
,"status":{
|
||||
"loading":"Bezig met laden..."
|
||||
}
|
||||
,"statistics":"Statistieken"
|
||||
,"statistics":{
|
||||
"title":"Statistieken"
|
||||
,"cumulative":"Cumulatief"
|
||||
,"current":"Huidig"
|
||||
,"uploadedBytes":"Geüpload: "
|
||||
,"downloadedBytes":"Gedownload: "
|
||||
,"filesAdded":"Bestanden die zijn toegevoegd: "
|
||||
,"sessionCount":"Sessie teller: "
|
||||
,"secondsActive":"Actief: "
|
||||
}
|
||||
,"servers":"Trackers"
|
||||
,"folders":"Mappen"
|
||||
,"toolbar":{
|
||||
"nav":{
|
||||
"folders":"Mappen"
|
||||
}
|
||||
}
|
||||
}
|
||||
,"statusbar":{
|
||||
"downloadspeed":"Download snelheid:"
|
||||
,"uploadspeed":"Upload snelheid:"
|
||||
,"version":"Versie:"
|
||||
}
|
||||
,"dialog":{
|
||||
"torrent-add":{
|
||||
"download-dir":"Download Dir:"
|
||||
,"torrent-url":"Torrent URL:"
|
||||
,"tip-torrent-url":"Tip:scheid meerdere torrents met 'Enter'"
|
||||
,"autostart":"Auto Start:"
|
||||
,"tip-autostart":""
|
||||
,"set-default-download-dir":"Instellen als standaard dir"
|
||||
,"upload-file":"Torrent bestand(en):"
|
||||
,"nosource":"Geen torrent bestand of URL."
|
||||
,"tip-title":"Uploaden van het torrent-bestand heeft voorrang boven de URL van de torrent"
|
||||
}
|
||||
,"system-config":{
|
||||
"title":"Server Instellingen"
|
||||
,"tabs":{
|
||||
"base":"Algemeen"
|
||||
,"network":"Netwerk"
|
||||
,"limit":"Begrenzen"
|
||||
,"alt-speed":"Gepland"
|
||||
}
|
||||
,"config-dir":"Locatie van de configuratie directory:"
|
||||
,"download-dir":"Standaardpad voor downloaden:"
|
||||
,"download-dir-free-space":"Vrije ruimte:"
|
||||
,"incomplete-dir-enabled":"Locatie voor onvoltooide bestanden"
|
||||
,"cache-size-mb":"Schijf cache grootte:"
|
||||
,"rename-partial-files":"Voeg de '.part' extensie toe aan onvoltooide bestanden"
|
||||
,"start-added-torrents":"Automatisch starten toegevoegde torrents"
|
||||
,"download-queue-enabled":"Download wachtrij grootte:"
|
||||
,"seed-queue-enabled":"Upload wachtrij grootte:"
|
||||
,"peer-port-random-on-start":"Neem een willekeurige poort als daemon opstart"
|
||||
,"port-forwarding-enabled":"Poort forwarding ingeschakeld"
|
||||
,"test-port":"Test de poort"
|
||||
,"port-is-open-true":"De poort is open"
|
||||
,"port-is-open-false":"De poort is gesloten"
|
||||
,"testing":"Testen..."
|
||||
,"encryption":"Encryptie:"
|
||||
,"encryption-type":{
|
||||
"required":"Encryptie vereist"
|
||||
,"preferred":"Encryptie aan"
|
||||
,"tolerated":"Encryptie uit"
|
||||
}
|
||||
,"utp-enabled":"Enabled uTP(UPnP)"
|
||||
,"dht-enabled":"Distributed Hash Table (DHT)"
|
||||
,"lpd-enabled":"Local Peer Discovery (LPD)"
|
||||
,"pex-enabled":"Peer uitwisseling"
|
||||
,"peer-limit-global":"Maximum aantal peers:"
|
||||
,"peer-limit-per-torrent":"Maximum aantal peers per torrent:"
|
||||
,"speed-limit-down-enabled":"Maximum download snelheid:"
|
||||
,"speed-limit-up-enabled":"Maximum upload snelheid:"
|
||||
,"alt-speed-enabled":"Gebruik alternatieve bandbreedte instellingen"
|
||||
,"alt-speed-down":"Maximum download snelheid:"
|
||||
,"alt-speed-up":"Maximum upload snelheid:"
|
||||
,"alt-speed-time-enabled":"Gebruik planner"
|
||||
,"alt-speed-time":"Tijd:"
|
||||
,"weekday":{
|
||||
"1":"Maandag"
|
||||
,"2":"Dinsdag"
|
||||
,"3":"Woensdag"
|
||||
,"4":"Donderdag"
|
||||
,"5":"Vrijdag"
|
||||
,"6":"Zaterdag"
|
||||
,"0":"Zondag"
|
||||
}
|
||||
,"blocklist-enabled":"Blocklist gebruiken"
|
||||
,"seedRatioLimited":"Seed ratio:"
|
||||
,"queue-stalled-enabled":"Whether or not to consider idle torrents as stalled:"
|
||||
,"idle-seeding-limit-enabled":"Stop seeden wanneer inactief gedurende:"
|
||||
,"minuets":"Minuets"
|
||||
,"nochange":"Geen wijzigingen"
|
||||
,"saveing":"Verwerken..."
|
||||
}
|
||||
,"public":{
|
||||
"button-ok":"OK"
|
||||
,"button-cancel":"Annuleren"
|
||||
,"button-reload":"Opnieuw laden"
|
||||
,"button-save":"Opslaan"
|
||||
,"button-close":"Sluiten"
|
||||
}
|
||||
,"about":{
|
||||
"infos":"Auteur: culturist <br/> Verklaring: De meeste van de pictogrammen in dit programma komen vanaf het netwerk, als dit uw rechten schend, neem dan contact met mij op om deze te verwijderen."
|
||||
}
|
||||
,"torrent-remove":{
|
||||
"title":"Verwijderen bevestigen"
|
||||
,"confirm-text":"Weet je zeker dat je de gemarkeerde torrent(s) wilt verwijderen?"
|
||||
,"remove-data":"Verwijder locale data"
|
||||
,"remove-error":"Verwijderen is mislukt!"
|
||||
}
|
||||
,"torrent-changeDownloadDir":{
|
||||
"title":"Locatie instellen"
|
||||
,"old-download-dir":"Oude locatie:"
|
||||
,"new-download-dir":"Nieuwe locatie:"
|
||||
,"move-data":"Indien aangevinkt, verplaatsen van de vorige locatie. anders, zoeken 'Nieuwe locatie' voor bestanden."
|
||||
,"set-error":"Locatie instellen mislukt!"
|
||||
}
|
||||
,"system-replaceTracker":{
|
||||
"title":"Vervang Trackers"
|
||||
,"old-tracker":"Oude tracker:"
|
||||
,"new-tracker":"Nieuwe tracker:"
|
||||
,"tip":"Deze functie vindt <b>alle torrent</b> Trackers"
|
||||
,"not-found":"Tracker is niet gevonden."
|
||||
}
|
||||
}
|
||||
,"torrent":{
|
||||
"fields":{
|
||||
"id":"#"
|
||||
,"name":"Naam"
|
||||
,"hashString":"HASH"
|
||||
,"downloadDir":"Download Dir"
|
||||
,"totalSize":"Totale grootte"
|
||||
,"status":"Status"
|
||||
,"percentDone":"Gereed"
|
||||
,"remainingTime":"Resterende tijd"
|
||||
,"addedDate":"Toegevoegd op"
|
||||
,"completeSize":"Grootte voltooid"
|
||||
,"rateDownload":"Rate download"
|
||||
,"rateUpload":"Rate upload"
|
||||
,"leecherCount":"Leecher"
|
||||
,"seederCount":"Seeder"
|
||||
,"uploadedEver":"Geüpload"
|
||||
,"uploadRatio":"Ratio"
|
||||
}
|
||||
,"status-text":{
|
||||
"0":"Gepauzeerd"
|
||||
,"1":"Wacht check"
|
||||
,"2":"Verifiëren"
|
||||
,"3":"Wacht download"
|
||||
,"4":"Downloaden"
|
||||
,"5":"Wacht seed"
|
||||
,"6":"Seeding"
|
||||
}
|
||||
,"attribute":{
|
||||
"tabs":{
|
||||
"base":"Algemeen"
|
||||
,"servers":"Trackers"
|
||||
,"files":"Bestanden"
|
||||
,"users":"Peers"
|
||||
,"config":"Instellingen"
|
||||
}
|
||||
,"files-fields":{
|
||||
"name":"Naam"
|
||||
,"length":"Totale grootte"
|
||||
,"percentDone":"Gereed"
|
||||
,"bytesCompleted":"Voltooid"
|
||||
,"wanted":"Gewenst"
|
||||
,"priority":"Prioriteit"
|
||||
}
|
||||
,"servers-fields":{
|
||||
"announce":"Aangekondigd bij"
|
||||
,"announceState":"Status"
|
||||
,"lastAnnounceResult":"Info"
|
||||
,"lastAnnounceSucceeded":"Geslaagd"
|
||||
,"lastAnnounceTime":"Tid van aankondiging"
|
||||
,"lastAnnounceTimedOut":"Time-out"
|
||||
,"downloadCount":"Aantal Downloads"
|
||||
,"nextAnnounceTime":"Volgende aankondiging"
|
||||
}
|
||||
,"peers-fields":{
|
||||
"address":"IP adres"
|
||||
,"clientName":"Client"
|
||||
,"flagStr":"Flag"
|
||||
,"progress":"Voortgang"
|
||||
,"rateToClient":"RateToClient"
|
||||
,"rateToPeer":"RateToPeer"
|
||||
}
|
||||
,"status":{
|
||||
"true":"Ja"
|
||||
,"false":"Nee"
|
||||
}
|
||||
,"priority":{
|
||||
"0":"Normaal"
|
||||
,"1":"Hoog"
|
||||
,"-1":"Laag"
|
||||
}
|
||||
,"label":{
|
||||
"name":"Naam:"
|
||||
,"addedDate":"Toegevoegd op:"
|
||||
,"totalSize":"Totale grootte:"
|
||||
,"completeSize":"Groote voltooid:"
|
||||
,"leftUntilDone":"Ovet tot voltooid:"
|
||||
,"hashString":"HASH:"
|
||||
,"downloadDir":"Download dir:"
|
||||
,"status":"Status:"
|
||||
,"rateDownload":"Rate download:"
|
||||
,"rateUpload":"Rate upload:"
|
||||
,"leecherCount":"Leecher:"
|
||||
,"seederCount":"Seeder:"
|
||||
,"uploadedEver":"Geüpload:"
|
||||
,"uploadRatio":"Upload Ratio:"
|
||||
,"creator":"Maker:"
|
||||
,"dateCreated":"Gemaakt op:"
|
||||
,"comment":"Commentaar:"
|
||||
,"errorString":"foutreeks:"
|
||||
,"downloadLimited":"Maximum algemene download snelheid"
|
||||
,"uploadLimited":"Maximum algemene upload snelheid"
|
||||
,"peer-limit":"Maximum aantal peers per torrent:"
|
||||
,"seedRatioMode":"Seed ratio:"
|
||||
,"seedIdleMode":"Stop seeden wanneer inactief gedurende:"
|
||||
}
|
||||
,"tip":{
|
||||
"button-allow":"Download gemarkeerd(e) bestand(en)"
|
||||
,"button-deny":"Gemarkeerd(e) bestand(en) overslaan"
|
||||
,"button-priority":"Ingestelde prioriteit"
|
||||
}
|
||||
,"other":{
|
||||
"tracker-remove-confim":"Bent u er zeker van dat u deze Tracker wilt verwijderen?"
|
||||
}
|
||||
}
|
||||
}
|
||||
,"torrent-head":{
|
||||
"buttons":{
|
||||
"autoExpandAttribute":"Automatisch uitvouwen kenmerken"
|
||||
}
|
||||
}
|
||||
,"public":{
|
||||
"text-unknown":"Onbekend"
|
||||
,"text-drop-title":"Bestand Slepen en neerzetten in de regio om aan Transmission toe te voegen ."
|
||||
,"text-saved":"Opgeslagen"
|
||||
,"text-nochange":"Geen verandering"
|
||||
,"text-info":"Info"
|
||||
,"text-confirm":"Weet u het zeker?"
|
||||
,"text-browsers-not-support-features":"De huidige browser ondersteunt deze functie niet!"
|
||||
,"text-download-update":"Download deze update"
|
||||
,"text-have-update":"Er is een update beschikbaar"
|
||||
}
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
var system={version:"0.5 Beta",codeupdate:"20130731",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null,autoExpandAttribute:false,defaultLang:""},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,templates:{"dialog-about.html":"",
|
||||
var system={version:"0.5 Beta",codeupdate:"20130830",config:{autoReload:true,reloadStep:5E3,pageSize:30,defaultSelectNode:null,autoExpandAttribute:false,defaultLang:""},checkUpdateScript:"https://transmission-control.googlecode.com/svn/resouces/checkupdate.js",contextMenus:{},panel:null,lang:null,reloading:false,autoReloadTimer:null,downloadDir:"",islocal:false,B64:new Base64,currentTorrentId:0,control:{tree:null,torrentlist:null},serverConfig:null,serverSessionStats:null,templates:{"dialog-about.html":"",
|
||||
"dialog-system-config.html":"","dialog-torrent-add.html":"","dialog-torrent-addfile.html":"","dialog-torrent-remove-confirm.html":""},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("lang/"+a+".js",function(){system.lang=$.extend(true,system.defaultLang,system.lang);system.resetLangText();
|
||||
$.getScript("script/easyui/locale/easyui-lang-"+a.replace("-","_")+".js").done(function(){b&&b()}).fail(function(){$.getScript("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"),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")};this.lang==null?this.setlang(a,function(){system.initdata()}):this.initdata()},resetLangText:function(a){a||(a=$);var b=a.find("*[system-lang]");$.each(b,function(c,e){var d=$(e).attr("system-lang");$(e).html(eval("system.lang."+d))});b=a.find("*[system-tip-lang]");$.each(b,function(c,e){var d=$(e).attr("system-tip-lang");$(e).attr("title",eval("system.lang."+d))})},initdata:function(){$(document).attr("title",
|
||||
|
@ -34,55 +34,56 @@ function(){a.linkbutton({iconCls:b,disabled:false});a=null})});this.panel.toolba
|
|||
$("#dialog-system-replaceTracker");if(a.length){a.dialog("open");a.dialog({content:system.templates["dialog-system-replaceTracker.html"]})}else{$("<div/>").attr("id","dialog-system-replaceTracker").appendTo(document.body).dialog({title:system.lang.dialog["system-replaceTracker"].title,width:600,height:220,resizable:true,cache:false,content:"loading...",modal:true});$.get("template/dialog-system-replaceTracker.html?time="+new Date,function(b){system.templates["dialog-system-replaceTracker.html"]=b;
|
||||
$("#dialog-system-replaceTracker").dialog({content:b})})}});this.panel.toolbar.find("#toolbar_start").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip.start).click(function(){system.changeSelectedTorrentStatus("start",$(this))});this.panel.toolbar.find("#toolbar_pause").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip.pause).click(function(){system.changeSelectedTorrentStatus("stop",$(this))});this.panel.toolbar.find("#toolbar_recheck").linkbutton({disabled:true}).attr("title",
|
||||
this.lang.toolbar.tip.recheck).click(function(){var a=system.control.torrentlist.datagrid("getChecked");if(a.length>0)if(a.length==1)if(transmission.torrents.all[a[0].id].percentDone>0)confirm(system.lang.toolbar.tip["recheck-confirm"])&&system.changeSelectedTorrentStatus("verify",$(this));else system.changeSelectedTorrentStatus("verify",$(this));else confirm(system.lang.toolbar.tip["recheck-confirm"])&&system.changeSelectedTorrentStatus("verify",$(this))});this.panel.toolbar.find("#toolbar_morepeers").linkbutton({disabled:true}).click(function(){system.changeSelectedTorrentStatus("reannounce",
|
||||
$(this))});this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip.remove).click(function(){var a=system.control.torrentlist.datagrid("getChecked"),b=[],c;for(c in a)b.push(a[c].id);if(b.length!=0){a=$("#dialog-torrent-remove-confirm");if(a.length){a.dialog("open");a.dialog("refresh");a.data("ids",b)}else $("<div/>").attr("id","dialog-torrent-remove-confirm").data("ids",b).appendTo(document.body).dialog({title:system.lang.dialog["torrent-remove"].title,
|
||||
width:350,height:150,resizable:false,cache:true,href:"template/dialog-torrent-remove-confirm.html",modal:true})}});this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip["change-download-dir"]).click(function(){var a=system.control.torrentlist.datagrid("getChecked"),b=[],c;for(c in a)b.push(a[c].id);if(b.length!=0){a=$("#dialog-torrent-changeDownloadDir");if(a.length){a.dialog("open");a.data("ids",b);a.dialog({content:system.templates["dialog-torrent-changeDownloadDir.html"]})}else{$("<div/>").attr("id",
|
||||
"dialog-torrent-changeDownloadDir").appendTo(document.body).dialog({title:system.lang.dialog["torrent-changeDownloadDir"].title,width:520,height:200,resizable:false,cache:true,content:"loading...",modal:true});$.get("template/dialog-torrent-changeDownloadDir.html?time="+new Date,function(e){system.templates["dialog-torrent-changeDownloadDir.html"]=e;$("#dialog-torrent-changeDownloadDir").data("ids",b);$("#dialog-torrent-changeDownloadDir").dialog({content:e})})}}});this.panel.toolbar.find("#toolbar_alt_speed").linkbutton().attr("title",
|
||||
this.lang.toolbar.tip["alt-speed"]).click(function(){var a=$(this),b=false;if(a.linkbutton("options").iconCls=="icon-alt-speed-false")b=true;transmission.exec({method:"session-set",arguments:{"alt-speed-enabled":b}},function(c){if(c.result=="success"){system.serverConfig["alt-speed-enabled"]=b;a.linkbutton({iconCls:"icon-alt-speed-"+b.toString()});b?$("#status_alt_speed").show():$("#status_alt_speed").hide()}});a.linkbutton({iconCls:"icon-loading"})});this.panel.toolbar.find("#toolbar_config").linkbutton().attr("title",
|
||||
this.lang.toolbar.tip["system-config"]).click(function(){var a=$("#dialog-system-config");if(a.length){a.dialog("open");a.dialog({content:system.templates["dialog-system-config.html"]})}else{$("<div/>").attr("id","dialog-system-config").appendTo(document.body).dialog({title:system.lang.toolbar["system-config"],width:620,height:440,resizable:true,cache:false,content:"loading...",modal:true});$.get("template/dialog-system-config.html?time="+new Date,function(b){system.templates["dialog-system-config.html"]=
|
||||
b;$("#dialog-system-config").dialog({content:b})})}});this.panel.toolbar.find("#toolbar_reload").linkbutton().attr("title",this.lang.toolbar.tip["system-reload"]).click(function(){system.reloadData()});this.panel.toolbar.find("#toolbar_search").searchbox({searcher:function(a){system.searchTorrents(a)},prompt:this.lang.toolbar["search-prompt"]})},initStatusBar:function(){this.panel.statusbar.find("#status_title_downloadspeed").html(this.lang.statusbar.downloadspeed);this.panel.statusbar.find("#status_title_uploadspeed").html(this.lang.statusbar.uploadspeed)},
|
||||
connect:function(){this.showStatus(this.lang.system.status.connect,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:"icon-alt-speed-true"});$("#status_alt_speed").show()}else{system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"icon-alt-speed-false"});$("#status_alt_speed").hide()}system.downloadDir=b["download-dir"];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){if(!this.reloading){clearTimeout(this.autoReloadTimer);this.reloading=true;var b={trackers:transmission.trackers,
|
||||
folders:transmission.torrents.folders};transmission.torrents.getallids(function(c){var e=[],d;for(d in c)e.push(c[d].id);c=transmission.torrents.getErrorIds(e,true);c.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(b)},c):system.resetTorrentInfos(b)},a)}},resetTorrentInfos:function(a){var b=this.currentTorrentId,c=this.panel.left.tree("find","servers");if(c)this.removeTreeNode("servers-loading");else{this.appendTreeNode(null,[{id:"servers",text:this.lang.tree.servers,
|
||||
iconCls:"icon-servers"}]);c=this.panel.left.tree("find","servers")}for(var e in transmission.trackers){var d=transmission.trackers[e],f=system.panel.left.tree("find",d.nodeid),g=d.name+this.showNodeMoreInfos(d.count,d.size);f?system.updateTreeNodeText(d.nodeid,g,d.connected?"icon-server":"icon-server-error"):system.appendTreeNode(c,[{id:d.nodeid,text:g,iconCls:d.connected?"icon-server":"icon-server-error"}]);a.trackers[d.nodeid]=null}for(e in a.trackers)(d=a.trackers[e])&&system.removeTreeNode(d.nodeid);
|
||||
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]){f=system.panel.left.tree("find","sending");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seedwait].length);c.length>0?system.updateTreeNodeText(c[0].id,g):system.appendTreeNode(f,[{id:"seedwait",text:g,iconCls:"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]){f=system.panel.left.tree("find","check");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.checkwait].length);c.length>0?system.updateTreeNodeText(c[0].id,
|
||||
g):system.appendTreeNode(f,[{id:"checkwait",text:g,iconCls:"icon-wait"}])}else system.removeTreeNode("checkwait");transmission.torrents.status[transmission._status.download]?system.updateTreeNodeText("downloading",system.lang.tree.downloading+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.download].length)):system.updateTreeNodeText("downloading",system.lang.tree.downloading);if(transmission.torrents.status[transmission._status.downloadwait]){f=system.panel.left.tree("find",
|
||||
"downloading");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.downloadwait].length);c.length>0?system.updateTreeNodeText(c[0].id,g):system.appendTreeNode(f,[{id:"downloadwait",text:g,iconCls:"icon-wait"}])}else system.removeTreeNode("downloadwait");system.updateTreeNodeText("actively",system.lang.tree.actively+this.showNodeMoreInfos(transmission.torrents.actively.length));system.updateTreeNodeText("error",
|
||||
system.lang.tree.error+this.showNodeMoreInfos(transmission.torrents.error.length));system.updateTreeNodeText("warning",system.lang.tree.warning+this.showNodeMoreInfos(transmission.torrents.warning.length));f=system.panel.left.tree("getSelected");if(f!=null){g=system.control.torrentlist.datagrid("options").pageNumber;system.loadTorrentToList({node:f,page:g})}b!=0&&system.control.torrentlist.datagrid("selectRecord",b);system.reloading=false;if(system.config.autoReload)system.autoReloadTimer=setTimeout(function(){system.reloadData()},
|
||||
system.config.reloadStep);system.updateTreeNodeText("torrent-all",system.lang.tree.all+this.showNodeMoreInfos(transmission.torrents.count,transmission.torrents.totalSize));b="uploadedBytes,downloadedBytes,filesAdded,sessionCount,secondsActive".split(",");$.each(b,function(h,i){switch(i){case "uploadedBytes":case "downloadedBytes":system.updateTreeNodeText(i,system.lang.tree.statistics[i]+formatSize(system.serverSessionStats["cumulative-stats"][i]));system.updateTreeNodeText("current-"+i,system.lang.tree.statistics[i]+
|
||||
formatSize(system.serverSessionStats["current-stats"][i]));break;case "secondsActive":system.updateTreeNodeText(i,system.lang.tree.statistics[i]+getTotalTime(system.serverSessionStats["cumulative-stats"][i]*1E3));system.updateTreeNodeText("current-"+i,system.lang.tree.statistics[i]+getTotalTime(system.serverSessionStats["current-stats"][i]*1E3));break;default:system.updateTreeNodeText(i,system.lang.tree.statistics[i]+system.serverSessionStats["cumulative-stats"][i]);system.updateTreeNodeText("current-"+
|
||||
i,system.lang.tree.statistics[i]+system.serverSessionStats["current-stats"][i])}});for(e in transmission.torrents.folders)a.folders[transmission.torrents.folders[e].nodeid]=null;this.loadFolderList(a.folders);navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})},showNodeMoreInfos:function(a,b){var c="";if(a>0)c=" <span class='nav-torrents-number'>("+a+")</span>";if(b>0)c+="<span class='nav-total-size'>["+formatSize(b)+"]</span>";return c},
|
||||
getServerStatus:function(){if(!this.reloading){clearTimeout(this.autoReloadTimer);this.reloading=true;transmission.getStatus(function(a){system.reloading=false;$("#status_downloadspeed").html(formatSize(a.downloadSpeed,false,"speed"));$("#status_uploadspeed").html(formatSize(a.uploadSpeed,false,"speed"));system.serverSessionStats=a;if(a.torrentCount==0){(a=system.panel.left.tree("find","servers"))&&system.panel.left.tree("remove",a.target);system.updateTreeNodeText("torrent-all",system.lang.tree.all)}})}},
|
||||
showStatus:function(a,b){$("#m_status").panel("options").collapsed&&$("#layout_left").layout("expand","south");this.panel.status_text.show();this.panel.status_text.html(a);if(b!=0){if(b==undefined)b=3E3;this.panel.status_text.fadeOut(b,function(){$("#layout_left").layout("collapse","south")})}},updateTreeNodeText:function(a,b,c){if(a=this.panel.left.tree("find",a)){b={target:a.target,text:b};if(c!=undefined)b.iconCls=c;this.panel.left.tree("update",b)}},appendTreeNode:function(a,b){var c=null;(c=
|
||||
typeof a=="string"?this.panel.left.tree("find",a):a)?this.panel.left.tree("append",{parent:c.target,data:b}):this.panel.left.tree("append",{data:b})},removeTreeNode:function(a){(a=this.panel.left.tree("find",a))&&this.panel.left.tree("remove",a.target)},loadTorrentToList:function(a){if(transmission.torrents.all){jQuery.extend({node:null,page:1},a);if(a.node){var b=null,c=this.panel.left.tree("getParent",a.node.target)||{id:""},e=this.panel.left.data("currentNodeId");if(e!=a.node.id){this.control.torrentlist.datagrid({pageNumber:1});
|
||||
e=a.node.id}this.panel.left.data("currentNodeId",e);switch(c.id){case "servers":b=transmission.trackers[a.node.id].torrents;break;default:switch(a.node.id){case "torrent-all":case "servers":b=transmission.torrents.all;break;case "paused":b=transmission.torrents.status[transmission._status.stopped];break;case "sending":b=transmission.torrents.status[transmission._status.seed];break;case "seedwait":b=transmission.torrents.status[transmission._status.seedwait];break;case "check":b=transmission.torrents.status[transmission._status.check];
|
||||
break;case "checkwait":b=transmission.torrents.status[transmission._status.checkwait];break;case "downloading":b=transmission.torrents.status[transmission._status.download];break;case "downloadwait":b=transmission.torrents.status[transmission._status.downloadwait];break;case "actively":b=transmission.torrents.actively;break;case "error":b=transmission.torrents.error;break;case "warning":b=transmission.torrents.warning;break;case "search-result":b=transmission.torrents.searchResult;break;default:if(a.node.id.indexOf("folders-")!=
|
||||
-1)if(c=transmission.torrents.folders[a.node.id])b=c.torrents}}if(this.config.defaultSelectNode!=a.node.id){this.control.torrentlist.datagrid("loadData",[]);this.config.defaultSelectNode=a.node.id;this.saveConfig()}a=[];for(var d in b){if(!b[d])return;c=this.lang.torrent["status-text"][b[d].status];parseFloat(b[d].percentDone*100).toFixed(2);c==transmission._status.check&&parseFloat(b[d].recheckProgress*100).toFixed(2);if(b[d].error!=0)c="<span class='text-status-error'>"+c+"</span>";else if(b[d].warning)c=
|
||||
"<span class='text-status-warning' title='"+b[d].warning+"'>"+c+"</span>";a.push({id:b[d].id,name:b[d].name,totalSize:b[d].totalSize,percentDone:b[d].percentDone,remainingTime:b[d].remainingTime,status:c,statusCode:b[d].status,addedDate:b[d].addedDate,completeSize:b[d].totalSize-b[d].leftUntilDone,rateDownload:b[d].rateDownload,rateUpload:b[d].rateUpload,leecherCount:b[d].leecher,seederCount:b[d].seeder,uploadRatio:b[d].uploadRatio,uploadedEver:b[d].uploadedEver})}this.panel.toolbar.find("#toolbar_start").linkbutton({disabled:true});
|
||||
this.panel.toolbar.find("#toolbar_pause").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_recheck").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_morepeers").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_queue").menubutton("disable");this.updateTorrentCurrentPageDatas(a)}}},updateTorrentCurrentPageDatas:function(a){var b=
|
||||
this.control.torrentlist.datagrid("getRows");if(a.length==0&&b.length>0)this.control.torrentlist.datagrid("loadData",[]);else{var c=this.control.torrentlist.datagrid("options"),e=null;if(c.sortName){e=c.sortName;a=a.sort(arrayObjectSort(e,c.sortOrder))}if(b.length==0||a.length!=this.control.torrentlist.datagrid("getData").total&&a.length>c.pageSize)this.control.torrentlist.datagrid({loadFilter:pagerFilter,pageNumber:c.pageNumber,sortName:e,sortOrder:c.sortOrder}).datagrid("loadData",a);else{this.control.torrentlist.datagrid("getData").originalRows=
|
||||
a;e=(c.pageNumber-1)*parseInt(c.pageSize);c=e+parseInt(c.pageSize);a=a.slice(e,c);c={};e={};for(var d in transmission.torrents.recently){var f=transmission.torrents.recently[d];c[f.id]=true}for(d in a){f=a[d];e[f.id]=f}var g={};for(d=b.length-1;d>=0;d--){f=b[d];if(c[f.id]){var h=e[f.id];if(h){this.control.torrentlist.datagrid("updateRow",{index:d,row:h});g[f.id]=f}else this.control.torrentlist.datagrid("deleteRow",d)}else if(transmission.torrents.removed.length>0&&$.inArray(f.id,transmission.torrents.removed)!=
|
||||
-1)this.control.torrentlist.datagrid("deleteRow",d);else g[f.id]=f}for(d in a){f=a[d];g[f.id]||this.control.torrentlist.datagrid("appendRow",f)}}}},getTorrentNameBar:function(a){var b="",c=a.name;switch(a.status){case transmission._status.stopped:b="iconlabel icon-pause-small";break;case transmission._status.check:b="iconlabel icon-checking";break;case transmission._status.download:b="iconlabel icon-down";break;case transmission._status.seed:b="iconlabel icon-up";break;case transmission._status.seedwait:case transmission._status.downloadwait:case transmission._status.checkwait:b=
|
||||
"iconlabel icon-wait"}if(a.warning){b="iconlabel icon-warning-type1";c+="\n\n"+this.lang["public"]["text-info"]+": "+a.warning}if(a.error!=0){b="iconlabel icon-exclamation";c+="\n\n"+this.lang["public"]["text-info"]+": "+a.errorString}return'<span class="'+b+'" title="'+c+'">'+a.name+"</span>"},getTorrentProgressBar:function(a,b){a+="%";var c="",e=0;e=typeof b=="object"?b.status:b;switch(e){case transmission._status.stopped:c="torrent-progress-stop";break;case transmission._status.checkwait:case transmission._status.check:c=
|
||||
"torrent-progress-check";break;case transmission._status.downloadwait:case transmission._status.download:c="torrent-progress-download";break;case transmission._status.seedwait:case transmission._status.seed:c="torrent-progress-seed"}if(typeof b=="object"){if(b.warning)c="torrent-progress-warning";if(b.error!=0)c="torrent-progress-error"}return'<div class="torrent-progress" title="'+a+'"><div class="torrent-progress-text">'+a+'</div><div class="torrent-progress-bar '+c+'" style="width:'+a+';"></div></div>'},
|
||||
addTorrentsToServer:function(a,b,c,e){var d=b-a.length,f=a.shift();if(f){this.showStatus(this.lang.system.status.queue+(d+1)+"/"+b+"<br/>"+f,0);transmission.addTorrentFromUrl(f,e,c,function(){system.addTorrentsToServer(a,b,c,e)})}else{this.showStatus(this.lang.system.status.queuefinish);this.getServerStatus()}},changeSelectedTorrentStatus:function(a,b,c){var e=this.control.torrentlist.datagrid("getChecked"),d=[];a||(a="start");for(var f in e)d.push(e[f].id);c||(c="torrent-"+a);if(d.length>0){if(b){var g=
|
||||
b.linkbutton("options").iconCls;b.linkbutton({disabled:true,iconCls:"icon-loading"})}transmission.exec({method:c,arguments:{ids:d}},function(){b&&b.linkbutton({iconCls:g});system.control.torrentlist.datagrid("uncheckAll");system.reloadTorrentBaseInfos()})}},searchTorrents:function(a){if(a!=""){var b=transmission.torrents.search(a);if(b==null||b.length==0)this.removeTreeNode("search-result");else{var c=this.panel.left.tree("find","search-result");a=this.lang.tree["search-result"]+" : "+a+" ("+b.length+
|
||||
")";if(c==null){this.appendTreeNode("torrent-all",[{id:"search-result",text:a,iconCls:"icon-search"}]);c=this.panel.left.tree("find","search-result")}else this.panel.left.tree("update",{target:c.target,text:a});this.panel.left.tree("select",c.target)}}},getTorrentInfos:function(a){if(transmission.torrents.all[a])if(!transmission.torrents.all[a].infoIsLoading){if(this.currentTorrentId>0&&transmission.torrents.all[this.currentTorrentId])if(transmission.torrents.all[this.currentTorrentId].infoIsLoading)return;
|
||||
this.currentTorrentId=a;if(!this.panel.attribute.panel("options").collapsed){this.panel.attribute.panel({iconCls:"icon-loading"});var b=transmission.torrents.all[a];b.infoIsLoading=true;var c="fileStats,trackerStats,peers,leftUntilDone,status,rateDownload,rateUpload,uploadedEver,uploadRatio,error,errorString";b.moreInfosTag||(c+=",files,trackers,comment,dateCreated,creator,downloadDir");transmission.torrents.getMoreInfos(c,a,function(e){b.infoIsLoading=false;system.panel.attribute.panel({iconCls:""});
|
||||
if(e!=null){jQuery.extend(b,e[0]);if(system.currentTorrentId==0||system.currentTorrentId!=a)system.clearTorrentAttribute();else{b.completeSize=b.totalSize-b.leftUntilDone;b.moreInfosTag=true;system.fillTorrentBaseInfos(b);system.fillTorrentFileList(b);system.fillTorrentServerList(b);system.fillTorrentPeersList(b);system.fillTorrentConfig(b);transmission.torrents.all[a]=b;transmission.torrents.datas[a]=b}}})}}},clearTorrentAttribute:function(){system.panel.attribute.find("#torrent-files-table").datagrid("loadData",
|
||||
[]);system.panel.attribute.find("#torrent-servers-table").datagrid("loadData",[]);system.panel.attribute.find("#torrent-peers-table").datagrid("loadData",[]);system.panel.attribute.find("span[id*='torrent-attribute-value']").html("")},updateCurrentPageDatas:function(a,b,c){var e=c.datagrid("getRows"),d=c.datagrid("options"),f=null;if(d.sortName){f=d.sortName;b=b.sort(arrayObjectSort(f,d.sortOrder))}if(e.length==0||b.length!=c.datagrid("getData").total&&b.length>d.pageSize)c.datagrid({loadFilter:pagerFilter,
|
||||
pageNumber:1,sortName:f,sortOrder:d.sortOrder}).datagrid("loadData",b);else{c.datagrid("getData").originalRows=b;f=(d.pageNumber-1)*parseInt(d.pageSize);d=f+parseInt(d.pageSize);b=b.slice(f,d);d={};for(var g in b){f=b[g];d[f[a]]=f}for(g=e.length-1;g>=0;g--){f=e[g];(b=d[f[a]])?c.datagrid("updateRow",{index:g,row:b}):c.datagrid("deleteRow",g)}}},fillTorrentBaseInfos:function(a){$.each(a,function(b,c){switch(b){case "rateDownload":case "rateUpload":c=formatSize(c,true,"speed");break;case "totalSize":case "uploadedEver":case "leftUntilDone":case "completeSize":c=
|
||||
formatSize(c);break;case "addedDate":case "dateCreated":c=formatLongTime(c);break;case "status":c=system.lang.torrent["status-text"][c];break;case "error":c==0?system.panel.attribute.find("#torrent-attribute-tr-error").hide():system.panel.attribute.find("#torrent-attribute-tr-error").show();break;case "comment":c=system.replaceURI(c)}system.panel.attribute.find("#torrent-attribute-value-"+b).html(c)})},fillTorrentFileList:function(a){var b=a.files,c=a.fileStats,e=[],d=a.name.length+1,f;for(f in b){var g=
|
||||
b[f],h=c[f],i=parseFloat(h.bytesCompleted/g.length*100).toFixed(2);e.push({name:g.name==a.name?g.name:g.name.substr(d),index:f,bytesCompleted:h.bytesCompleted,percentDone:system.getTorrentProgressBar(i,transmission._status.download),length:g.length,wanted:system.lang.torrent.attribute.status[h.wanted],priority:'<span class="iconlabel icon-flag-'+h.priority+'">'+system.lang.torrent.attribute.priority[h.priority]+"</span>"})}this.updateCurrentPageDatas("index",e,system.panel.attribute.find("#torrent-files-table"))},
|
||||
fillTorrentServerList:function(a){var b=a.trackers,c=a.trackerStats,e=[],d;for(d in b){var f=c[d],g={},h;for(h in f)switch(h){case "lastAnnounceTime":case "nextAnnounceTime":g[h]=formatLongTime(f[h]);break;case "lastAnnounceSucceeded":case "lastAnnounceTimedOut":g[h]=system.lang.torrent.attribute.status[f[h]];break;default:g[h]=f[h]}e.push(g)}transmission.torrents.addTracker(a);this.updateCurrentPageDatas("id",e,system.panel.attribute.find("#torrent-servers-table"))},fillTorrentPeersList:function(a){a=
|
||||
a.peers;var b=[],c;for(c in a){var e=a[c],d={},f;for(f in e)d[f]=e[f];e=parseFloat(e.progress*100).toFixed(2);d.progress=system.getTorrentProgressBar(e,transmission._status.download);b.push(d)}this.updateCurrentPageDatas("address",b,system.panel.attribute.find("#torrent-peers-table"))},fillTorrentConfig:function(a){system.panel.attribute.find("#torrent-attribute-tabs").data("selectedIndex")==4&&transmission.torrents.getConfig(a.id,function(b){if(b!=null){jQuery.extend(transmission.torrents.all[system.currentTorrentId],
|
||||
b[0]);system.currentTorrentId!=0&&$.each(b[0],function(c,e){var d=false,f=false,g=false;switch(c){case "seedIdleMode":case "seedRatioMode":if(e==0){f=false;d=true}g=true;case "downloadLimited":case "uploadLimited":if(e==true||e==1)f=true;system.panel.attribute.find("input[enabledof='"+c+"']").prop("disabled",!f);g&&system.panel.attribute.find("#"+c).prop("indeterminate",d).data("_tag",e);system.panel.attribute.find("#"+c).prop("checked",f);break;default:system.panel.attribute.find("#"+c).val(e);system.panel.attribute.find("#"+
|
||||
c).numberspinner("setValue",e)}})}})},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 e=parseFloat(b*100).toFixed(2);return system.getTorrentProgressBar(e,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])}}}},reloadData:function(){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"})})},appendFolder:function(a){if(a){var b="folders";a=a.split("/");var c="folders-",e;for(e in a){var d=a[e];if(d!=""){c+=this.B64.encode(d);var f=this.panel.left.tree("find",c),g=transmission.torrents.folders[c];d=d+this.showNodeMoreInfos(g.count,g.size);if(f)this.updateTreeNodeText(c,d);else{this.appendTreeNode(b,[{id:c,text:d}]);if(b!="folders"){f=this.panel.left.tree("find",b);this.panel.left.tree("collapse",f.target)}}b=
|
||||
c}}}},replaceURI:function(a){return a.replace(/(http|https|ftp):\/\/([^/:]+)(:\d*)?([^# ]*)/ig,function(b){return'<a href="'+b+'" target="_blank">'+b+"</a>"})},readConfig:function(){var a=cookies.get("transmission-web-control");if($.isPlainObject(a))this.config=$.extend(this.config,a)},saveConfig:function(){cookies.set("transmission-web-control",this.config,100)},uploadTorrentFile:function(a,b,c,e){if(window.FileReader){a=$("input[id='"+a+"']")[0].files;$.each(a,function(d,f){transmission.addTorrentFromFile(f,
|
||||
b,c,e)})}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();$("#msg-updateInfos").html(system.lastUpdateInfos.update+" -> "+system.lastUpdateInfos.infos)}else $("#area-update-infos").hide()})},changeLanguages:function(a){if(!(a==this.lang.name||!a)){this.config.defaultLang=a;this.saveConfig();location.href="?lang="+a}},debug:function(a,
|
||||
b){window.console&&window.console.log&&window.console.log(a,b)}};$(document).ready(function(){$.getScript("lang/default.js");$.getScript("lang/_languages.js",function(){system.init(location.search.getQueryString("lang"),location.search.getQueryString("local"))})});
|
||||
$(this))});this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip.remove).click(function(){var a=system.control.torrentlist.datagrid("getChecked"),b=[],c;for(c in a)b.push(a[c].id);if(b.length!=0){a=$("#dialog-torrent-remove-confirm");if(a.length){a.dialog("open");a.dialog({content:system.templates["dialog-torrent-remove-confirm.html"]});a.data("ids",b)}else{$("<div/>").attr("id","dialog-torrent-remove-confirm").data("ids",b).appendTo(document.body).dialog({title:system.lang.dialog["torrent-remove"].title,
|
||||
width:350,height:150,resizable:false,cache:false,content:"loading...",modal:true});$.get("template/dialog-torrent-remove-confirm.html?time="+new Date,function(e){system.templates["dialog-torrent-remove-confirm.html"]=e;$("#dialog-torrent-remove-confirm").dialog({content:e})})}}});this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:true}).attr("title",this.lang.toolbar.tip["change-download-dir"]).click(function(){var a=system.control.torrentlist.datagrid("getChecked"),b=[],c;
|
||||
for(c in a)b.push(a[c].id);if(b.length!=0){a=$("#dialog-torrent-changeDownloadDir");if(a.length){a.dialog("open");a.data("ids",b);a.dialog({content:system.templates["dialog-torrent-changeDownloadDir.html"]})}else{$("<div/>").attr("id","dialog-torrent-changeDownloadDir").appendTo(document.body).dialog({title:system.lang.dialog["torrent-changeDownloadDir"].title,width:520,height:200,resizable:false,cache:true,content:"loading...",modal:true});$.get("template/dialog-torrent-changeDownloadDir.html?time="+
|
||||
new Date,function(e){system.templates["dialog-torrent-changeDownloadDir.html"]=e;$("#dialog-torrent-changeDownloadDir").data("ids",b);$("#dialog-torrent-changeDownloadDir").dialog({content:e})})}}});this.panel.toolbar.find("#toolbar_alt_speed").linkbutton().attr("title",this.lang.toolbar.tip["alt-speed"]).click(function(){var a=$(this),b=false;if(a.linkbutton("options").iconCls=="icon-alt-speed-false")b=true;transmission.exec({method:"session-set",arguments:{"alt-speed-enabled":b}},function(c){if(c.result==
|
||||
"success"){system.serverConfig["alt-speed-enabled"]=b;a.linkbutton({iconCls:"icon-alt-speed-"+b.toString()});b?$("#status_alt_speed").show():$("#status_alt_speed").hide()}});a.linkbutton({iconCls:"icon-loading"})});this.panel.toolbar.find("#toolbar_config").linkbutton().attr("title",this.lang.toolbar.tip["system-config"]).click(function(){var a=$("#dialog-system-config");if(a.length){a.dialog("open");a.dialog({content:system.templates["dialog-system-config.html"]})}else{$("<div/>").attr("id","dialog-system-config").appendTo(document.body).dialog({title:system.lang.toolbar["system-config"],
|
||||
width:620,height:440,resizable:true,cache:false,content:"loading...",modal:true});$.get("template/dialog-system-config.html?time="+new Date,function(b){system.templates["dialog-system-config.html"]=b;$("#dialog-system-config").dialog({content:b})})}});this.panel.toolbar.find("#toolbar_reload").linkbutton().attr("title",this.lang.toolbar.tip["system-reload"]).click(function(){system.reloadData()});this.panel.toolbar.find("#toolbar_search").searchbox({searcher:function(a){system.searchTorrents(a)},
|
||||
prompt:this.lang.toolbar["search-prompt"]})},initStatusBar:function(){this.panel.statusbar.find("#status_title_downloadspeed").html(this.lang.statusbar.downloadspeed);this.panel.statusbar.find("#status_title_uploadspeed").html(this.lang.statusbar.uploadspeed)},connect:function(){this.showStatus(this.lang.system.status.connect,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:"icon-alt-speed-true"});$("#status_alt_speed").show()}else{system.panel.toolbar.find("#toolbar_alt_speed").linkbutton({iconCls:"icon-alt-speed-false"});
|
||||
$("#status_alt_speed").hide()}system.downloadDir=b["download-dir"];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){if(!this.reloading){clearTimeout(this.autoReloadTimer);this.reloading=true;var b={trackers:transmission.trackers,folders:transmission.torrents.folders};transmission.torrents.getallids(function(c){var e=[],d;for(d in c)e.push(c[d].id);c=transmission.torrents.getErrorIds(e,true);c.length>0?transmission.torrents.getallids(function(){system.resetTorrentInfos(b)},
|
||||
c):system.resetTorrentInfos(b)},a)}},resetTorrentInfos:function(a){var b=this.currentTorrentId,c=this.panel.left.tree("find","servers");if(c)this.removeTreeNode("servers-loading");else{this.appendTreeNode(null,[{id:"servers",text:this.lang.tree.servers,iconCls:"icon-servers"}]);c=this.panel.left.tree("find","servers")}for(var e in transmission.trackers){var d=transmission.trackers[e],f=system.panel.left.tree("find",d.nodeid),g=d.name+this.showNodeMoreInfos(d.count,d.size);f?system.updateTreeNodeText(d.nodeid,
|
||||
g,d.connected?"icon-server":"icon-server-error"):system.appendTreeNode(c,[{id:d.nodeid,text:g,iconCls:d.connected?"icon-server":"icon-server-error"}]);a.trackers[d.nodeid]=null}for(e in a.trackers)(d=a.trackers[e])&&system.removeTreeNode(d.nodeid);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]){f=system.panel.left.tree("find","sending");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.seedwait].length);
|
||||
c.length>0?system.updateTreeNodeText(c[0].id,g):system.appendTreeNode(f,[{id:"seedwait",text:g,iconCls:"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]){f=system.panel.left.tree("find",
|
||||
"check");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.checkwait].length);c.length>0?system.updateTreeNodeText(c[0].id,g):system.appendTreeNode(f,[{id:"checkwait",text:g,iconCls:"icon-wait"}])}else system.removeTreeNode("checkwait");transmission.torrents.status[transmission._status.download]?system.updateTreeNodeText("downloading",system.lang.tree.downloading+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.download].length)):
|
||||
system.updateTreeNodeText("downloading",system.lang.tree.downloading);if(transmission.torrents.status[transmission._status.downloadwait]){f=system.panel.left.tree("find","downloading");c=system.panel.left.tree("getChildren",f.target);g=system.lang.tree.wait+this.showNodeMoreInfos(transmission.torrents.status[transmission._status.downloadwait].length);c.length>0?system.updateTreeNodeText(c[0].id,g):system.appendTreeNode(f,[{id:"downloadwait",text:g,iconCls:"icon-wait"}])}else system.removeTreeNode("downloadwait");
|
||||
system.updateTreeNodeText("actively",system.lang.tree.actively+this.showNodeMoreInfos(transmission.torrents.actively.length));system.updateTreeNodeText("error",system.lang.tree.error+this.showNodeMoreInfos(transmission.torrents.error.length));system.updateTreeNodeText("warning",system.lang.tree.warning+this.showNodeMoreInfos(transmission.torrents.warning.length));f=system.panel.left.tree("getSelected");if(f!=null){g=system.control.torrentlist.datagrid("options").pageNumber;system.loadTorrentToList({node:f,
|
||||
page:g})}b!=0&&system.control.torrentlist.datagrid("selectRecord",b);system.reloading=false;if(system.config.autoReload)system.autoReloadTimer=setTimeout(function(){system.reloadData()},system.config.reloadStep);system.updateTreeNodeText("torrent-all",system.lang.tree.all+this.showNodeMoreInfos(transmission.torrents.count,transmission.torrents.totalSize));b="uploadedBytes,downloadedBytes,filesAdded,sessionCount,secondsActive".split(",");$.each(b,function(h,i){switch(i){case "uploadedBytes":case "downloadedBytes":system.updateTreeNodeText(i,
|
||||
system.lang.tree.statistics[i]+formatSize(system.serverSessionStats["cumulative-stats"][i]));system.updateTreeNodeText("current-"+i,system.lang.tree.statistics[i]+formatSize(system.serverSessionStats["current-stats"][i]));break;case "secondsActive":system.updateTreeNodeText(i,system.lang.tree.statistics[i]+getTotalTime(system.serverSessionStats["cumulative-stats"][i]*1E3));system.updateTreeNodeText("current-"+i,system.lang.tree.statistics[i]+getTotalTime(system.serverSessionStats["current-stats"][i]*
|
||||
1E3));break;default:system.updateTreeNodeText(i,system.lang.tree.statistics[i]+system.serverSessionStats["cumulative-stats"][i]);system.updateTreeNodeText("current-"+i,system.lang.tree.statistics[i]+system.serverSessionStats["current-stats"][i])}});for(e in transmission.torrents.folders)a.folders[transmission.torrents.folders[e].nodeid]=null;this.loadFolderList(a.folders);navigator.userAgent.indexOf("Firefox")>0&&system.panel.left.find("span.nav-total-size").css({"margin-top":"-19px"})},showNodeMoreInfos:function(a,
|
||||
b){var c="";if(a>0)c=" <span class='nav-torrents-number'>("+a+")</span>";if(b>0)c+="<span class='nav-total-size'>["+formatSize(b)+"]</span>";return c},getServerStatus:function(){if(!this.reloading){clearTimeout(this.autoReloadTimer);this.reloading=true;transmission.getStatus(function(a){system.reloading=false;$("#status_downloadspeed").html(formatSize(a.downloadSpeed,false,"speed"));$("#status_uploadspeed").html(formatSize(a.uploadSpeed,false,"speed"));system.serverSessionStats=a;if(a.torrentCount==
|
||||
0){(a=system.panel.left.tree("find","servers"))&&system.panel.left.tree("remove",a.target);system.updateTreeNodeText("torrent-all",system.lang.tree.all)}})}},showStatus:function(a,b){$("#m_status").panel("options").collapsed&&$("#layout_left").layout("expand","south");this.panel.status_text.show();this.panel.status_text.html(a);if(b!=0){if(b==undefined)b=3E3;this.panel.status_text.fadeOut(b,function(){$("#layout_left").layout("collapse","south")})}},updateTreeNodeText:function(a,b,c){if(a=this.panel.left.tree("find",
|
||||
a)){b={target:a.target,text:b};if(c!=undefined)b.iconCls=c;this.panel.left.tree("update",b)}},appendTreeNode:function(a,b){var c=null;(c=typeof a=="string"?this.panel.left.tree("find",a):a)?this.panel.left.tree("append",{parent:c.target,data:b}):this.panel.left.tree("append",{data:b})},removeTreeNode:function(a){(a=this.panel.left.tree("find",a))&&this.panel.left.tree("remove",a.target)},loadTorrentToList:function(a){if(transmission.torrents.all){jQuery.extend({node:null,page:1},a);if(a.node){var b=
|
||||
null,c=this.panel.left.tree("getParent",a.node.target)||{id:""},e=this.panel.left.data("currentNodeId");if(e!=a.node.id){this.control.torrentlist.datagrid({pageNumber:1});e=a.node.id}this.panel.left.data("currentNodeId",e);switch(c.id){case "servers":b=transmission.trackers[a.node.id].torrents;break;default:switch(a.node.id){case "torrent-all":case "servers":b=transmission.torrents.all;break;case "paused":b=transmission.torrents.status[transmission._status.stopped];break;case "sending":b=transmission.torrents.status[transmission._status.seed];
|
||||
break;case "seedwait":b=transmission.torrents.status[transmission._status.seedwait];break;case "check":b=transmission.torrents.status[transmission._status.check];break;case "checkwait":b=transmission.torrents.status[transmission._status.checkwait];break;case "downloading":b=transmission.torrents.status[transmission._status.download];break;case "downloadwait":b=transmission.torrents.status[transmission._status.downloadwait];break;case "actively":b=transmission.torrents.actively;break;case "error":b=
|
||||
transmission.torrents.error;break;case "warning":b=transmission.torrents.warning;break;case "search-result":b=transmission.torrents.searchResult;break;default:if(a.node.id.indexOf("folders-")!=-1)if(c=transmission.torrents.folders[a.node.id])b=c.torrents}}if(this.config.defaultSelectNode!=a.node.id){this.control.torrentlist.datagrid("loadData",[]);this.config.defaultSelectNode=a.node.id;this.saveConfig()}a=[];for(var d in b){if(!b[d])return;c=this.lang.torrent["status-text"][b[d].status];parseFloat(b[d].percentDone*
|
||||
100).toFixed(2);c==transmission._status.check&&parseFloat(b[d].recheckProgress*100).toFixed(2);if(b[d].error!=0)c="<span class='text-status-error'>"+c+"</span>";else if(b[d].warning)c="<span class='text-status-warning' title='"+b[d].warning+"'>"+c+"</span>";a.push({id:b[d].id,name:b[d].name,totalSize:b[d].totalSize,percentDone:b[d].percentDone,remainingTime:b[d].remainingTime,status:c,statusCode:b[d].status,addedDate:b[d].addedDate,completeSize:b[d].totalSize-b[d].leftUntilDone,rateDownload:b[d].rateDownload,
|
||||
rateUpload:b[d].rateUpload,leecherCount:b[d].leecher,seederCount:b[d].seeder,uploadRatio:b[d].uploadRatio,uploadedEver:b[d].uploadedEver})}this.panel.toolbar.find("#toolbar_start").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_pause").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_remove").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_recheck").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_changeDownloadDir").linkbutton({disabled:true});
|
||||
this.panel.toolbar.find("#toolbar_morepeers").linkbutton({disabled:true});this.panel.toolbar.find("#toolbar_queue").menubutton("disable");this.updateTorrentCurrentPageDatas(a)}}},updateTorrentCurrentPageDatas:function(a){var b=this.control.torrentlist.datagrid("getRows");if(a.length==0&&b.length>0)this.control.torrentlist.datagrid("loadData",[]);else{var c=this.control.torrentlist.datagrid("options"),e=null;if(c.sortName){e=c.sortName;a=a.sort(arrayObjectSort(e,c.sortOrder))}if(b.length==0||a.length!=
|
||||
this.control.torrentlist.datagrid("getData").total&&a.length>c.pageSize)this.control.torrentlist.datagrid({loadFilter:pagerFilter,pageNumber:c.pageNumber,sortName:e,sortOrder:c.sortOrder}).datagrid("loadData",a);else{this.control.torrentlist.datagrid("getData").originalRows=a;e=(c.pageNumber-1)*parseInt(c.pageSize);c=e+parseInt(c.pageSize);a=a.slice(e,c);c={};e={};for(var d in transmission.torrents.recently){var f=transmission.torrents.recently[d];c[f.id]=true}for(d in a){f=a[d];e[f.id]=f}var g={};
|
||||
for(d=b.length-1;d>=0;d--){f=b[d];var h=e[f.id];if(h)if(c[f.id]){this.control.torrentlist.datagrid("updateRow",{index:d,row:h});g[f.id]=f}else if(transmission.torrents.removed)if(transmission.torrents.removed.length>0&&$.inArray(f.id,transmission.torrents.removed)!=-1)this.control.torrentlist.datagrid("deleteRow",d);else g[f.id]=f;else g[f.id]=f;else this.control.torrentlist.datagrid("deleteRow",d)}for(d in a){f=a[d];g[f.id]||this.control.torrentlist.datagrid("appendRow",f)}}}},getTorrentNameBar:function(a){var b=
|
||||
"",c=a.name;switch(a.status){case transmission._status.stopped:b="iconlabel icon-pause-small";break;case transmission._status.check:b="iconlabel icon-checking";break;case transmission._status.download:b="iconlabel icon-down";break;case transmission._status.seed:b="iconlabel icon-up";break;case transmission._status.seedwait:case transmission._status.downloadwait:case transmission._status.checkwait:b="iconlabel icon-wait"}if(a.warning){b="iconlabel icon-warning-type1";c+="\n\n"+this.lang["public"]["text-info"]+
|
||||
": "+a.warning}if(a.error!=0){b="iconlabel icon-exclamation";c+="\n\n"+this.lang["public"]["text-info"]+": "+a.errorString}return'<span class="'+b+'" title="'+c+'">'+a.name+"</span>"},getTorrentProgressBar:function(a,b){a+="%";var c="",e=0;e=typeof b=="object"?b.status:b;switch(e){case transmission._status.stopped:c="torrent-progress-stop";break;case transmission._status.checkwait:case transmission._status.check:c="torrent-progress-check";break;case transmission._status.downloadwait:case transmission._status.download:c=
|
||||
"torrent-progress-download";break;case transmission._status.seedwait:case transmission._status.seed:c="torrent-progress-seed"}if(typeof b=="object"){if(b.warning)c="torrent-progress-warning";if(b.error!=0)c="torrent-progress-error"}return'<div class="torrent-progress" title="'+a+'"><div class="torrent-progress-text">'+a+'</div><div class="torrent-progress-bar '+c+'" style="width:'+a+';"></div></div>'},addTorrentsToServer:function(a,b,c,e){var d=b-a.length,f=a.shift();if(f){this.showStatus(this.lang.system.status.queue+
|
||||
(d+1)+"/"+b+"<br/>"+f,0);transmission.addTorrentFromUrl(f,e,c,function(){system.addTorrentsToServer(a,b,c,e)})}else{this.showStatus(this.lang.system.status.queuefinish);this.getServerStatus()}},changeSelectedTorrentStatus:function(a,b,c){var e=this.control.torrentlist.datagrid("getChecked"),d=[];a||(a="start");for(var f in e)d.push(e[f].id);c||(c="torrent-"+a);if(d.length>0){if(b){var g=b.linkbutton("options").iconCls;b.linkbutton({disabled:true,iconCls:"icon-loading"})}transmission.exec({method:c,
|
||||
arguments:{ids:d}},function(){b&&b.linkbutton({iconCls:g});system.control.torrentlist.datagrid("uncheckAll");system.reloadTorrentBaseInfos()})}},searchTorrents:function(a){if(a!=""){var b=transmission.torrents.search(a);if(b==null||b.length==0)this.removeTreeNode("search-result");else{var c=this.panel.left.tree("find","search-result");a=this.lang.tree["search-result"]+" : "+a+" ("+b.length+")";if(c==null){this.appendTreeNode("torrent-all",[{id:"search-result",text:a,iconCls:"icon-search"}]);c=this.panel.left.tree("find",
|
||||
"search-result")}else this.panel.left.tree("update",{target:c.target,text:a});this.panel.left.tree("select",c.target)}}},getTorrentInfos:function(a){if(transmission.torrents.all[a])if(!transmission.torrents.all[a].infoIsLoading){if(this.currentTorrentId>0&&transmission.torrents.all[this.currentTorrentId])if(transmission.torrents.all[this.currentTorrentId].infoIsLoading)return;this.currentTorrentId=a;if(!this.panel.attribute.panel("options").collapsed){this.panel.attribute.panel({iconCls:"icon-loading"});
|
||||
var b=transmission.torrents.all[a];b.infoIsLoading=true;var c="fileStats,trackerStats,peers,leftUntilDone,status,rateDownload,rateUpload,uploadedEver,uploadRatio,error,errorString";b.moreInfosTag||(c+=",files,trackers,comment,dateCreated,creator,downloadDir");transmission.torrents.getMoreInfos(c,a,function(e){b.infoIsLoading=false;system.panel.attribute.panel({iconCls:""});if(e!=null){jQuery.extend(b,e[0]);if(system.currentTorrentId==0||system.currentTorrentId!=a)system.clearTorrentAttribute();else{b.completeSize=
|
||||
b.totalSize-b.leftUntilDone;b.moreInfosTag=true;system.fillTorrentBaseInfos(b);system.fillTorrentFileList(b);system.fillTorrentServerList(b);system.fillTorrentPeersList(b);system.fillTorrentConfig(b);transmission.torrents.all[a]=b;transmission.torrents.datas[a]=b}}})}}},clearTorrentAttribute:function(){system.panel.attribute.find("#torrent-files-table").datagrid("loadData",[]);system.panel.attribute.find("#torrent-servers-table").datagrid("loadData",[]);system.panel.attribute.find("#torrent-peers-table").datagrid("loadData",
|
||||
[]);system.panel.attribute.find("span[id*='torrent-attribute-value']").html("")},updateCurrentPageDatas:function(a,b,c){var e=c.datagrid("getRows"),d=c.datagrid("options"),f=null;if(d.sortName){f=d.sortName;b=b.sort(arrayObjectSort(f,d.sortOrder))}if(e.length==0||b.length!=c.datagrid("getData").total&&b.length>d.pageSize)c.datagrid({loadFilter:pagerFilter,pageNumber:1,sortName:f,sortOrder:d.sortOrder}).datagrid("loadData",b);else{c.datagrid("getData").originalRows=b;f=(d.pageNumber-1)*parseInt(d.pageSize);
|
||||
d=f+parseInt(d.pageSize);b=b.slice(f,d);d={};for(var g in b){f=b[g];d[f[a]]=f}for(g=e.length-1;g>=0;g--){f=e[g];(b=d[f[a]])?c.datagrid("updateRow",{index:g,row:b}):c.datagrid("deleteRow",g)}}},fillTorrentBaseInfos:function(a){$.each(a,function(b,c){switch(b){case "rateDownload":case "rateUpload":c=formatSize(c,true,"speed");break;case "totalSize":case "uploadedEver":case "leftUntilDone":case "completeSize":c=formatSize(c);break;case "addedDate":case "dateCreated":c=formatLongTime(c);break;case "status":c=
|
||||
system.lang.torrent["status-text"][c];break;case "error":c==0?system.panel.attribute.find("#torrent-attribute-tr-error").hide():system.panel.attribute.find("#torrent-attribute-tr-error").show();break;case "comment":c=system.replaceURI(c)}system.panel.attribute.find("#torrent-attribute-value-"+b).html(c)})},fillTorrentFileList:function(a){var b=a.files,c=a.fileStats,e=[],d=a.name.length+1,f;for(f in b){var g=b[f],h=c[f],i=parseFloat(h.bytesCompleted/g.length*100).toFixed(2);e.push({name:g.name==a.name?
|
||||
g.name:g.name.substr(d),index:f,bytesCompleted:h.bytesCompleted,percentDone:system.getTorrentProgressBar(i,transmission._status.download),length:g.length,wanted:system.lang.torrent.attribute.status[h.wanted],priority:'<span class="iconlabel icon-flag-'+h.priority+'">'+system.lang.torrent.attribute.priority[h.priority]+"</span>"})}this.updateCurrentPageDatas("index",e,system.panel.attribute.find("#torrent-files-table"))},fillTorrentServerList:function(a){var b=a.trackers,c=a.trackerStats,e=[],d;for(d in b){var f=
|
||||
c[d],g={},h;for(h in f)switch(h){case "lastAnnounceTime":case "nextAnnounceTime":g[h]=formatLongTime(f[h]);break;case "lastAnnounceSucceeded":case "lastAnnounceTimedOut":g[h]=system.lang.torrent.attribute.status[f[h]];break;default:g[h]=f[h]}e.push(g)}transmission.torrents.addTracker(a);this.updateCurrentPageDatas("id",e,system.panel.attribute.find("#torrent-servers-table"))},fillTorrentPeersList:function(a){a=a.peers;var b=[],c;for(c in a){var e=a[c],d={},f;for(f in e)d[f]=e[f];e=parseFloat(e.progress*
|
||||
100).toFixed(2);d.progress=system.getTorrentProgressBar(e,transmission._status.download);b.push(d)}this.updateCurrentPageDatas("address",b,system.panel.attribute.find("#torrent-peers-table"))},fillTorrentConfig:function(a){system.panel.attribute.find("#torrent-attribute-tabs").data("selectedIndex")==4&&transmission.torrents.getConfig(a.id,function(b){if(b!=null){jQuery.extend(transmission.torrents.all[system.currentTorrentId],b[0]);system.currentTorrentId!=0&&$.each(b[0],function(c,e){var d=false,
|
||||
f=false,g=false;switch(c){case "seedIdleMode":case "seedRatioMode":if(e==0){f=false;d=true}g=true;case "downloadLimited":case "uploadLimited":if(e==true||e==1)f=true;system.panel.attribute.find("input[enabledof='"+c+"']").prop("disabled",!f);g&&system.panel.attribute.find("#"+c).prop("indeterminate",d).data("_tag",e);system.panel.attribute.find("#"+c).prop("checked",f);break;default:system.panel.attribute.find("#"+c).val(e);system.panel.attribute.find("#"+c).numberspinner("setValue",e)}})}})},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 e=parseFloat(b*100).toFixed(2);return system.getTorrentProgressBar(e,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])}}}},reloadData:function(){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"})})},appendFolder:function(a){if(a){var b="folders";
|
||||
a=a.split("/");var c="folders-",e;for(e in a){var d=a[e];if(d!=""){c+=this.B64.encode(d);var f=this.panel.left.tree("find",c),g=transmission.torrents.folders[c];d=d+this.showNodeMoreInfos(g.count,g.size);if(f)this.updateTreeNodeText(c,d);else{this.appendTreeNode(b,[{id:c,text:d}]);if(b!="folders"){f=this.panel.left.tree("find",b);this.panel.left.tree("collapse",f.target)}}b=c}}}},replaceURI:function(a){return a.replace(/(http|https|ftp):\/\/([^/:]+)(:\d*)?([^# ]*)/ig,function(b){return'<a href="'+
|
||||
b+'" target="_blank">'+b+"</a>"})},readConfig:function(){var a=cookies.get("transmission-web-control");if($.isPlainObject(a))this.config=$.extend(this.config,a)},saveConfig:function(){cookies.set("transmission-web-control",this.config,100)},uploadTorrentFile:function(a,b,c,e){if(window.FileReader){var d=$("input[id='"+a+"']")[0].files;$.each(d,function(f,g){transmission.addTorrentFromFile(g,b,c,e,d.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();$("#msg-updateInfos").html(system.lastUpdateInfos.update+" -> "+system.lastUpdateInfos.infos)}else $("#area-update-infos").hide()})},changeLanguages:function(a){if(!(a==this.lang.name||!a)){this.config.defaultLang=a;this.saveConfig();location.href="?lang="+a}},debug:function(a,b){window.console&&window.console.log&&window.console.log(a,b)}};
|
||||
$(document).ready(function(){$.getScript("lang/default.js");$.getScript("lang/_languages.js",function(){system.init(location.search.getQueryString("lang"),location.search.getQueryString("local"))})});
|
||||
function pagerFilter(a){if(typeof a.length=="number"&&typeof a.splice=="function")a={total:a.length,rows:a};var b=$(this),c=b.datagrid("options"),e=b.datagrid("getPager"),d=b.data("buttons");e.pagination({onSelectPage:function(g,h){c.pageNumber=g;c.pageSize=h;e.pagination("refresh",{pageNumber:g,pageSize:h});b.datagrid("loadData",a)},buttons:d});if(!a.originalRows)a.originalRows=a.rows;d=(c.pageNumber-1)*parseInt(c.pageSize);var f=d+parseInt(c.pageSize);a.rows=a.originalRows.slice(d,f);return a};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var transmission={SessionId:"",isInitialized:false,host:"",port:"9091",path:"/transmission/rpc",fullpath:"",on:{torrentCountChange:null,postError:null},username:"",password:"",_status:{stopped:0,checkwait:1,check:2,downloadwait:3,download:4,seedwait:5,seed:6,actively:101},options:{getFolders:true,getTarckers:true},headers:{},trackers:{},islocal:false,downloadDirs:[],getSessionId:function(b,a){jQuery.ajax({type:"POST",url:this.fullpath,error:function(d){var c="";if(d.status===409&&(c=d.getResponseHeader("X-Transmission-Session-Id"))){b.isInitialized=
|
||||
true;b.SessionId=c;b.headers["X-Transmission-Session-Id"]=c;a&&a()}},headers:this.headers})},init:function(b,a){jQuery.extend(this,b);if(this.islocal==true)this.fullpath=this.path;else{if(this.fullpath=="")this.fullpath=this.host+(this.port?":"+this.port:"")+this.path;if(this.username&&this.password)this.headers.Authorization="Basic "+(new Base64).encode(this.username+":"+this.password)}this.getSessionId(this,a)},exec:function(b,a,d){if(!this.isInitialized)return false;var c={method:"",arguments:{},
|
||||
tag:""};jQuery.extend(c,b);var f={type:"POST",url:this.fullpath,dataType:"json",data:JSON.stringify(c),success:function(e){a&&a(e,d)},error:function(e){var g="";if(e.status===409&&(g=e.getResponseHeader("X-Transmission-Session-Id"))){transmission.SessionId=g;transmission.headers["X-Transmission-Session-Id"]=g;jQuery.ajax(f)}else transmission.on.postError&&transmission.on.postError(e)},headers:this.headers};jQuery.ajax(f)},getStatus:function(b){this.exec({method:"session-stats"},function(a){if(a.result==
|
||||
"success"){b&&b(a.arguments);if(transmission.torrents.count!=a.arguments.torrentCount||transmission.torrents.activeTorrentCount!=a.arguments.activeTorrentCount||transmission.torrents.pausedTorrentCount!=a.arguments.pausedTorrentCount){transmission.torrents.count=a.arguments.torrentCount;transmission.torrents.activeTorrentCount=a.arguments.activeTorrentCount;transmission.torrents.pausedTorrentCount=a.arguments.pausedTorrentCount;transmission._onTorrentCountChange()}}})},getSession:function(b){this.exec({method:"session-get"},
|
||||
function(a){a.result=="success"&&b&&b(a.arguments)})},addTorrentFromUrl:function(b,a,d,c){if(b.match(/^[0-9a-f]{40}$/i))b="magnet:?xt=urn:btih:"+b;this.exec({method:"torrent-add",arguments:{filename:b,"download-dir":a,paused:!d}},function(f){switch(f.result){case "success":c&&c(f.arguments["torrent-added"]);break;default:c&&c(f.result)}})},addTorrentFromFile:function(b,a,d,c){var f=new FileReader;f.onload=function(e){e=e.target.result;var g=e.indexOf("base64,");if(g!=-1){e=e.substring(g+7);transmission.exec({method:"torrent-add",
|
||||
arguments:{metainfo:e,"download-dir":a,paused:d}},function(h){switch(h.result){case "success":c&&c(h.arguments["torrent-added"]);break;case "duplicate torrent":c&&c("duplicate")}})}};f.readAsDataURL(b)},_onTorrentCountChange:function(){this.torrents.loadSimpleInfo=false;this.on.torrentCountChange&&this.on.torrentCountChange()},removeTorrent:function(b,a,d){this.exec({method:"torrent-remove",arguments:{ids:b,"delete-local-data":a}},function(c){d&&d(c.result)})},getFreeSpace:function(b,a){this.exec({method:"free-space",
|
||||
var transmission={SessionId:"",isInitialized:false,host:"",port:"9091",path:"/transmission/rpc",rpcpath:"../rpc",fullpath:"",on:{torrentCountChange:null,postError:null},username:"",password:"",_status:{stopped:0,checkwait:1,check:2,downloadwait:3,download:4,seedwait:5,seed:6,actively:101},options:{getFolders:true,getTarckers:true},headers:{},trackers:{},islocal:false,downloadDirs:[],getSessionId:function(b,a){jQuery.ajax({type:"POST",url:this.fullpath,error:function(d){var c="";if(d.status===409&&
|
||||
(c=d.getResponseHeader("X-Transmission-Session-Id"))){b.isInitialized=true;b.SessionId=c;b.headers["X-Transmission-Session-Id"]=c;a&&a()}},headers:this.headers})},init:function(b,a){jQuery.extend(this,b);if(this.username&&this.password)this.headers.Authorization="Basic "+(new Base64).encode(this.username+":"+this.password);this.fullpath=this.rpcpath;this.getSessionId(this,a)},exec:function(b,a,d){if(!this.isInitialized)return false;var c={method:"",arguments:{},tag:""};jQuery.extend(c,b);var g={type:"POST",
|
||||
url:this.fullpath,dataType:"json",data:JSON.stringify(c),success:function(f){a&&a(f,d)},error:function(f){var e="";if(f.status===409&&(e=f.getResponseHeader("X-Transmission-Session-Id"))){transmission.SessionId=e;transmission.headers["X-Transmission-Session-Id"]=e;jQuery.ajax(g)}else transmission.on.postError&&transmission.on.postError(f)},headers:this.headers};jQuery.ajax(g)},getStatus:function(b){this.exec({method:"session-stats"},function(a){if(a.result=="success"){b&&b(a.arguments);if(transmission.torrents.count!=
|
||||
a.arguments.torrentCount||transmission.torrents.activeTorrentCount!=a.arguments.activeTorrentCount||transmission.torrents.pausedTorrentCount!=a.arguments.pausedTorrentCount){transmission.torrents.count=a.arguments.torrentCount;transmission.torrents.activeTorrentCount=a.arguments.activeTorrentCount;transmission.torrents.pausedTorrentCount=a.arguments.pausedTorrentCount;transmission._onTorrentCountChange()}}})},getSession:function(b){this.exec({method:"session-get"},function(a){a.result=="success"&&
|
||||
b&&b(a.arguments)})},addTorrentFromUrl:function(b,a,d,c){if(b.match(/^[0-9a-f]{40}$/i))b="magnet:?xt=urn:btih:"+b;this.exec({method:"torrent-add",arguments:{filename:b,"download-dir":a,paused:!d}},function(g){switch(g.result){case "success":c&&c(g.arguments["torrent-added"]);break;default:c&&c(g.result)}})},addTorrentFromFile:function(b,a,d,c,g){var f=new FileReader;f.onload=function(e){e=e.target.result;var h=e.indexOf("base64,");if(h!=-1){e=e.substring(h+7);transmission.exec({method:"torrent-add",
|
||||
arguments:{metainfo:e,"download-dir":a,paused:d}},function(i){switch(i.result){case "success":c&&c(i.arguments["torrent-added"],g);break;case "duplicate torrent":c&&c("duplicate")}})}};f.readAsDataURL(b)},_onTorrentCountChange:function(){this.torrents.loadSimpleInfo=false;this.on.torrentCountChange&&this.on.torrentCountChange()},removeTorrent:function(b,a,d){this.exec({method:"torrent-remove",arguments:{ids:b,"delete-local-data":a}},function(c){d&&d(c.result)})},getFreeSpace:function(b,a){this.exec({method:"free-space",
|
||||
arguments:{path:b}},function(d){a&&a(d)})},updateBlocklist:function(b){this.exec({method:"blocklist-update"},function(a){b&&b(a.result)})}};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// 当前系统全局对象
|
||||
var system = {
|
||||
version:"0.5 Beta"
|
||||
,codeupdate:"20130731"
|
||||
,codeupdate:"20130830"
|
||||
,config:{
|
||||
autoReload: true
|
||||
,reloadStep: 5000
|
||||
|
@ -977,24 +977,30 @@ var system = {
|
|||
ids.push(rows[i].id);
|
||||
}
|
||||
if (ids.length==0) return;
|
||||
|
||||
var dialog = $("#dialog-torrent-remove-confirm");
|
||||
|
||||
var dialogId = "dialog-torrent-remove-confirm";
|
||||
var dialog = $("#"+dialogId);
|
||||
if (dialog.length)
|
||||
{
|
||||
dialog.dialog("open");
|
||||
dialog.dialog("refresh");
|
||||
dialog.dialog({content:system.templates[dialogId+".html"]});
|
||||
dialog.data("ids",ids);
|
||||
return;
|
||||
}
|
||||
$("<div/>").attr("id","dialog-torrent-remove-confirm").data("ids",ids).appendTo(document.body).dialog({
|
||||
$("<div/>").attr("id",dialogId).data("ids",ids).appendTo(document.body).dialog({
|
||||
title: system.lang.dialog["torrent-remove"].title,
|
||||
width: 350,
|
||||
height: 150,
|
||||
resizable: false,
|
||||
cache: true,
|
||||
href: 'template/dialog-torrent-remove-confirm.html',
|
||||
cache: false,
|
||||
content: "loading...",
|
||||
modal: true
|
||||
});
|
||||
|
||||
$.get("template/"+dialogId+".html?time="+(new Date()),function(data){
|
||||
system.templates[dialogId+".html"] = data;
|
||||
$("#"+dialogId).dialog({content:data});
|
||||
});
|
||||
});
|
||||
|
||||
// 修改选定的种子数据保存目录
|
||||
|
@ -1796,34 +1802,37 @@ var system = {
|
|||
for (var index=rows.length-1;index>=0;index--)
|
||||
{
|
||||
var item = rows[index];
|
||||
if (recently[item.id])
|
||||
var data = datas[item.id];
|
||||
if (!data)
|
||||
{
|
||||
var data = datas[item.id];
|
||||
|
||||
if (data)
|
||||
{
|
||||
this.control.torrentlist.datagrid("updateRow",{
|
||||
index: index
|
||||
,row:data
|
||||
});
|
||||
addedDatas[item.id] = item;
|
||||
}
|
||||
else
|
||||
this.control.torrentlist.datagrid("deleteRow",index);
|
||||
}
|
||||
else if (recently[item.id])
|
||||
{
|
||||
this.control.torrentlist.datagrid("updateRow",{
|
||||
index: index
|
||||
,row:data
|
||||
});
|
||||
addedDatas[item.id] = item;
|
||||
}
|
||||
// 移除当前删除的种子
|
||||
else if (transmission.torrents.removed)
|
||||
{
|
||||
if (transmission.torrents.removed.length>0&&$.inArray(item.id,transmission.torrents.removed)!=-1)
|
||||
{
|
||||
this.control.torrentlist.datagrid("deleteRow",index);
|
||||
}
|
||||
data = null;
|
||||
}
|
||||
// 移除当前删除的种子
|
||||
else if (transmission.torrents.removed.length>0&&$.inArray(item.id,transmission.torrents.removed)!=-1)
|
||||
{
|
||||
this.control.torrentlist.datagrid("deleteRow",index);
|
||||
else
|
||||
{
|
||||
addedDatas[item.id] = item;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addedDatas[item.id] = item;
|
||||
}
|
||||
item = null;
|
||||
data = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2481,7 +2490,7 @@ var system = {
|
|||
{
|
||||
var files = $("input[id='"+fileInputId+"']")[0].files;
|
||||
$.each(files,function(index,file){
|
||||
transmission.addTorrentFromFile(file,savePath,paused,callback);
|
||||
transmission.addTorrentFromFile(file,savePath,paused,callback,files.length);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
|
@ -6,6 +6,7 @@ var transmission = {
|
|||
,host:""
|
||||
,port:"9091"
|
||||
,path:"/transmission/rpc"
|
||||
,rpcpath:"../rpc"
|
||||
,fullpath:""
|
||||
,on:{
|
||||
torrentCountChange:null
|
||||
|
@ -61,21 +62,18 @@ var transmission = {
|
|||
,init:function(config,callback)
|
||||
{
|
||||
jQuery.extend(this, config);
|
||||
if (this.islocal==true)
|
||||
|
||||
/*
|
||||
if (this.fullpath=="")
|
||||
{
|
||||
this.fullpath = this.path;
|
||||
}
|
||||
else
|
||||
this.fullpath = this.host + (this.port?":"+this.port:"") + this.path;
|
||||
}*/
|
||||
if (this.username&&this.password)
|
||||
{
|
||||
if (this.fullpath=="")
|
||||
{
|
||||
this.fullpath = this.host + (this.port?":"+this.port:"") + this.path;
|
||||
}
|
||||
if (this.username&&this.password)
|
||||
{
|
||||
this.headers["Authorization"] = "Basic "+(new Base64()).encode(this.username+":"+this.password);
|
||||
}
|
||||
this.headers["Authorization"] = "Basic "+(new Base64()).encode(this.username+":"+this.password);
|
||||
}
|
||||
|
||||
this.fullpath = this.rpcpath;
|
||||
this.getSessionId(this,callback);
|
||||
}
|
||||
,exec:function(config,callback,tags)
|
||||
|
@ -213,7 +211,7 @@ var transmission = {
|
|||
);
|
||||
}
|
||||
// 从文件内容增加种子
|
||||
,addTorrentFromFile:function(file,savePath,paused,callback)
|
||||
,addTorrentFromFile:function(file,savePath,paused,callback,filecount)
|
||||
{
|
||||
var fileReader = new FileReader();
|
||||
|
||||
|
@ -243,7 +241,7 @@ var transmission = {
|
|||
case "success":
|
||||
if (callback)
|
||||
{
|
||||
callback(data.arguments["torrent-added"]);
|
||||
callback(data.arguments["torrent-added"],filecount);
|
||||
}
|
||||
break;
|
||||
// 重复的种子
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="dialog-torrent-add-nosource" style="display:none;"></span>
|
||||
<span id="dialog-torrent-add-queue" style="display:none;"></span>
|
||||
<a id="torrent-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
|
@ -98,8 +99,17 @@
|
|||
// rpc-version 版本为 15 起,停止使用原来的 ../upload 接口
|
||||
if (system.serverConfig["rpc-version"]>=15)
|
||||
{
|
||||
system.uploadTorrentFile("torrent_upload_file",dir,!autostart,function(){
|
||||
var uploaded = 0;
|
||||
system.uploadTorrentFile("torrent_upload_file",dir,!autostart,function(data,count){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
uploaded++;
|
||||
thisDialog.find("#dialog-torrent-add-queue").html(uploaded+"/"+count).show();
|
||||
if (uploaded==count)
|
||||
{
|
||||
thisDialog.find("#dialog-torrent-add-queue").html("").hide();
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
|
||||
system.reloadData();
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="dialog-torrent-add-queue" style="display:none;"></span>
|
||||
<a id="torrent-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
|
@ -66,13 +67,14 @@
|
|||
var olddir = system.downloadDir;
|
||||
var isnewdir = system.serverConfig["download-dir"]!=dir;
|
||||
var autostart = thisDialog.find("#chkautostart").prop("checked");
|
||||
var button = $(this);
|
||||
|
||||
if (dir=="")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$(this).linkbutton({disabled:true});
|
||||
button.linkbutton({disabled:true});
|
||||
|
||||
if (thisDialog.find("#set-default-download-dir").prop("checked")&&isnewdir)
|
||||
{
|
||||
|
@ -80,13 +82,22 @@
|
|||
}
|
||||
|
||||
var files = thisDialog.data("files");
|
||||
var uploaded = 0;
|
||||
$.each(files,function(i,item){
|
||||
transmission.addTorrentFromFile(item,dir,!autostart,function(){
|
||||
uploaded++;
|
||||
thisDialog.find("#dialog-torrent-add-queue").html(uploaded+"/"+files.length).show();
|
||||
if (uploaded==files.length)
|
||||
{
|
||||
thisDialog.find("#dialog-torrent-add-queue").html("").hide();
|
||||
button.linkbutton({disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
system.reloadData();
|
||||
});
|
||||
});
|
||||
$(this).linkbutton({disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
|
||||
//thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-button-cancel").click(function()
|
||||
|
|
Loading…
Reference in New Issue
Block a user