merge balonik's fixing issues with Folders Dictionary

This commit is contained in:
DarkAlexWang 2017-05-19 11:22:12 -04:00
parent 62d43662c9
commit 9846e41725
7 changed files with 35 additions and 34 deletions

File diff suppressed because one or more lines are too long

View File

@ -2,7 +2,7 @@
var system = {
version:"1.1 Beta"
,rootPath: "tr-web-control/"
,codeupdate:"20170504"
,codeupdate:"20170518"
,configHead: "transmission-web-control"
,config:{
autoReload: true

View File

@ -155,7 +155,7 @@ transmission.torrents = {
continue;
}
// If the current torrent is being acquired and there is no torrent in the previous torrent list, that is, the new torrent needs to be reloaded with the basic information
// If the current torrent is being acquired and there is no such torrent in the previous torrent list, that is, the new torrent needs to be reloaded with the basic information
if (this.isRecentlyActive&&!this.all[item.id])
{
this.newIds.push(item.id);
@ -554,4 +554,4 @@ transmission.torrents = {
);
}
}
};
};

View File

@ -10,13 +10,13 @@
</td>
</tr>
<tr>
<td colspan="2"><select id="download-dir" style="width:573px;"></select></td>
<td colspan="2"><select id="download-dir" style="width:100%;"></select></td>
</tr>
<tr>
<td colspan="2"><input id="incomplete-dir-enabled" type="checkbox" style="width:16px;"/><label id="system-config-incomplete-dir-enabled" for="incomplete-dir-enabled"></label></td>
</tr>
<tr>
<td colspan="2"><input id="incomplete-dir" value="" type="text" enabledof="incomplete-dir-enabled"/></td>
<td colspan="2"><input id="incomplete-dir" value="" type="text" enabledof="incomplete-dir-enabled" style="width:100%;"/></td>
</tr>
<tr>
<td colspan="2"><input id="rename-partial-files" type="checkbox" style="width:16px;"/><label id="system-config-rename-partial-files" for="rename-partial-files"></label></td>
@ -40,7 +40,7 @@
</td>
</tr>
<tr>
<td colspan="2"><input id="config-dir" value="" type="text" readonly="readonly" disabled="disabled"/></td>
<td colspan="2"><input id="config-dir" value="" type="text" readonly="readonly" disabled="disabled" style="width:100%;"/></td>
</tr>
<tr>
<td colspan="2"><hr/></td>
@ -396,16 +396,12 @@
}
thisDialog.find("#download-dir-free-space").text(tmp);
// Local dictionary folder list
//thisDialog.find("#local-storage-dictionary-folders").val(transmission.downloadDirs);
// Will add back this feature if the bug solved
var downloadDirs = $.merge([],transmission.downloadDirs);
if (system.dictionary.folders.length!=0)
{
$.merge(downloadDirs,system.dictionary.folders.split("\n"));
}
downloadDirs = uniq(downloadDirs);
thisDialog.find("#local-storage-dictionary-folders").val(downloadDirs.join("\n"));
// Local dictionary folder list (not including transmission.downloadDirs)
if (system.dictionary.folders == null) {
thisDialog.find("#local-storage-dictionary-folders").val("");
} else{
thisDialog.find("#local-storage-dictionary-folders").val(system.dictionary.folders);
}
//thisDialog.find("#local-storage-dictionary-folders").val(transmission.downloadDirs);
@ -623,7 +619,11 @@
// Save the local data
function saveLocalData()
{
system.dictionary.folders = thisDialog.find("#local-storage-dictionary-folders").val().replace(/^\s*[\r\n]/gm, "");
if(thisDialog.find("#local-storage-dictionary-folders").val().replace(/^\s*[\r\n]/gm, "").length==0) {
system.dictionary.folders=null;
} else {
system.dictionary.folders = thisDialog.find("#local-storage-dictionary-folders").val().replace(/^\s*[\r\n]/gm, "");
}
system.saveConfig();
thisDialog.dialog("close");
}

View File

@ -61,19 +61,19 @@
thisDialog.find("#download-dir").val(system.downloadDir);
var downloadDirs = $.merge([],transmission.downloadDirs);
if (system.dictionary.folders.length!=0)
if (system.dictionary.folders != null)
{
$.merge(downloadDirs,system.dictionary.folders.split("\n"));
}
downloadDirs = uniq(downloadDirs);
$.each(downloadDirs, function(i, item){
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
});
if (downloadDirs.length==0)
if (downloadDirs == null)
{
$("<option/>").text(system.downloadDir).val(system.downloadDir).attr("selected",true).appendTo(thisDialog.find("#download-dir"));
}
} else {
$.each(downloadDirs, function(i, item){
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
});
}
thisDialog.find("#chkautostart").prop("checked", system.serverConfig["start-added-torrents"]);
thisDialog.find("#download-dir").combobox();

View File

@ -50,19 +50,20 @@
thisDialog.find("#download-dir").val(system.downloadDir);
var downloadDirs = $.merge([],transmission.downloadDirs);
if (system.dictionary.folders.length!=0)
if (system.dictionary.folders != null)
{
$.merge(downloadDirs,system.dictionary.folders.split("\n"));
}
downloadDirs = uniq(downloadDirs);
$.each(downloadDirs, function(i, item){
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
});
if (downloadDirs.length==0)
{
if (downloadDirs == null)
{
$("<option/>").text(system.downloadDir).val(system.downloadDir).attr("selected",true).appendTo(thisDialog.find("#download-dir"));
}
} else {
$.each(downloadDirs, function(i, item){
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
});
}
thisDialog.find("#download-dir").combobox();
$.each(thisDialog.data("files"),function(i,item){
$("<option/>").text((i+1)+"."+item.name).appendTo(thisDialog.find("#torrent_upload_file"));