updating the values for global settings, very near to completing the feature
This commit is contained in:
parent
6c9f1843f1
commit
8501ccde77
76
index.html
76
index.html
|
@ -109,31 +109,58 @@
|
||||||
|
|
||||||
<!--{{{ start global settings item template -->
|
<!--{{{ start global settings item template -->
|
||||||
<script type="text/mustache" id="global_general_settings_template">
|
<script type="text/mustache" id="global_general_settings_template">
|
||||||
{{#general}}
|
{{#settings}}
|
||||||
<label class="control-label" for="input_settings_{{name}}">{{name}}</label>
|
<fieldset>
|
||||||
<div class="controls">
|
<legend>{{name}}</legend>
|
||||||
{{^options}}
|
<div class="control-group">
|
||||||
<input typ="text" class="input-xlarge" id="input_settings_{{name}}"></input>
|
{{#values}}
|
||||||
{{/options}}
|
<label class="control-label" for="input_settings_{{name}}">{{name}}</label>
|
||||||
|
<div class="controls">
|
||||||
|
{{^options}}
|
||||||
|
{{#has_value}}
|
||||||
|
<input typ="text" class="input-xlarge" id="input_settings_{{name}}" value="{{value}}"/>
|
||||||
|
{{/has_value}}
|
||||||
|
|
||||||
{{#option}}
|
{{^has_value}}
|
||||||
<select>
|
<input typ="text" class="input-xlarge" placeholder="default" id="input_settings_{{name}}"/>
|
||||||
<option value=" ">Default</option>
|
{{/has_value}}
|
||||||
{{/option}}
|
{{/options}}
|
||||||
|
|
||||||
{{#options}}
|
{{#option}}
|
||||||
<option>{{.}}</option>
|
{{#has_value}}
|
||||||
{{/options}}
|
<select id="input_settings_{{name}}">
|
||||||
|
{{/has_value}}
|
||||||
|
|
||||||
{{#option}}
|
{{^has_value}}
|
||||||
</select>
|
<select id="input_settings_{{name}}">
|
||||||
{{/option}}
|
<option value=" ">Default</option>
|
||||||
|
{{/has_value}}
|
||||||
|
|
||||||
<p class="help-block">{{desc}}</p>
|
{{/option}}
|
||||||
<br><br>
|
|
||||||
</div>
|
|
||||||
{{/general}}
|
|
||||||
|
|
||||||
|
{{#options}}
|
||||||
|
|
||||||
|
{{#has_value}}
|
||||||
|
<option value="{{& val}}">{{disp}}</option>
|
||||||
|
{{/has_value}}
|
||||||
|
|
||||||
|
{{^has_value}}
|
||||||
|
<option value="{{& .}}">{{.}}</option>
|
||||||
|
{{/has_value}}
|
||||||
|
|
||||||
|
{{/options}}
|
||||||
|
|
||||||
|
{{#option}}
|
||||||
|
</select>
|
||||||
|
{{/option}}
|
||||||
|
|
||||||
|
<p class="help-block">{{desc}}</p>
|
||||||
|
<br><br>
|
||||||
|
</div>
|
||||||
|
{{/values}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
{{/settings}}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- global settings template end }}}-->
|
<!-- global settings template end }}}-->
|
||||||
|
@ -282,13 +309,8 @@
|
||||||
<h3>Global Settings</h3>
|
<h3>Global Settings</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-horizontal">
|
<form class="form-horizontal" id="dynamic_global_settings">
|
||||||
<fieldset>
|
<!-- dynamic settings injection here -->
|
||||||
<legend>General Settings</legend>
|
|
||||||
<div id="dynamic_global_settings" class="control-group">
|
|
||||||
<!-- dynamic settings injection here -->
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
|
@ -199,7 +199,8 @@ var input_file_settings = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "file-allocation",
|
name: "file-allocation",
|
||||||
desc: "Specify file allocation method. none doesn't pre-allocate file space. prealloc pre-allocates file space before download begins. This may take some time depending on the size of the file. If you are using newer file systems such as ext4 (with extents support), btrfs, xfs or NTFS(MinGW build only), falloc is your best choice. It allocates large(few GiB) files almost instantly. Don't use falloc with legacy file systems such as ext3 and FAT32 because it takes almost same time as prealloc and it blocks aria2 entirely until allocation finishes. falloc may not be available if your system doesn't have posix_fallocate(3) function. Possible Values: none, prealloc, falloc Default: prealloc"
|
desc: "Specify file allocation method. none doesn't pre-allocate file space. prealloc pre-allocates file space before download begins. This may take some time depending on the size of the file. If you are using newer file systems such as ext4 (with extents support), btrfs, xfs or NTFS(MinGW build only), falloc is your best choice. It allocates large(few GiB) files almost instantly. Don't use falloc with legacy file systems such as ext3 and FAT32 because it takes almost same time as prealloc and it blocks aria2 entirely until allocation finishes. falloc may not be available if your system doesn't have posix_fallocate(3) function. Possible Values: none, prealloc, falloc Default: prealloc",
|
||||||
|
options: ["none", "prealloc", "falloc"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "follow-metalink",
|
name: "follow-metalink",
|
||||||
|
|
103
js/script.js
103
js/script.js
|
@ -127,13 +127,104 @@ $(function() {
|
||||||
});
|
});
|
||||||
$('#addNewDownload').click(newDownload);
|
$('#addNewDownload').click(newDownload);
|
||||||
});
|
});
|
||||||
function custom_global_settings() {
|
function check_global(name) {
|
||||||
var templ = $('#global_general_settings_template').text();
|
for(var i = 0; i < global_settings_exclude.length; i++) {
|
||||||
var item = Mustache.render(templ, {
|
if(global_settings_exclude[i] === name) {
|
||||||
general: input_file_settings
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function get_global_settings(cb) {
|
||||||
|
var sets = [];
|
||||||
|
var tmp_set;
|
||||||
|
for(var i = 0; i < input_file_settings.length; i++) {
|
||||||
|
tmp_set = input_file_settings[i];
|
||||||
|
if(check_global(tmp_set)) {
|
||||||
|
sets.push(tmp_set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(var i = 0; i < global_settings.length; i++) {
|
||||||
|
tmp_set = global_settings[i];
|
||||||
|
if(check_global(tmp_set)) {
|
||||||
|
sets.push(tmp_set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aria_syscall({
|
||||||
|
func: 'getGlobalOption',
|
||||||
|
success: function(data) {
|
||||||
|
var res = data.result;
|
||||||
|
console.log(res);
|
||||||
|
for(var i in data.result) {
|
||||||
|
for(var j = 0; j < sets.length; j++) {
|
||||||
|
if(sets[j].name === i) {
|
||||||
|
sets[j].value = res[i].trim();
|
||||||
|
sets[j].has_value = true;
|
||||||
|
if(sets[j].option) {
|
||||||
|
for(var k = 0; k < sets[j].options.length; k++) {
|
||||||
|
var tmp = {
|
||||||
|
val: sets[j].options[k].toString(),
|
||||||
|
disp: sets[j].options[k].toString()
|
||||||
|
};
|
||||||
|
if(sets[j].options[k].toString() === sets[j].value) {
|
||||||
|
tmp.val = sets[j].value + '" selected="true';
|
||||||
|
}
|
||||||
|
sets[j].options[k] = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb(sets);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
alert("Connection to aria server failed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function custom_global_settings() {
|
||||||
|
var gen = function(name) {
|
||||||
|
return { name: name, values: [] };
|
||||||
|
}
|
||||||
|
var general_settings = gen("General Settings");
|
||||||
|
var torrent_settings = gen("Bit-Torrent Settings");
|
||||||
|
var ftp_settings = gen("FTP Settings");
|
||||||
|
var http_settings = gen("HTTP(S) Settings");
|
||||||
|
var metalink_settings = gen("Metalink Settings");
|
||||||
|
|
||||||
|
get_global_settings(function(sets) {
|
||||||
|
for(var i = 0; i < sets.length; i++) {
|
||||||
|
var set = sets[i];
|
||||||
|
if(set.name.indexOf("bt") !== -1 || set.name.indexOf("torrent") !== -1) {
|
||||||
|
torrent_settings.values.push(set);
|
||||||
|
}
|
||||||
|
else if(set.name.indexOf("metalink") !== -1) {
|
||||||
|
metalink_settings.values.push(set);
|
||||||
|
}
|
||||||
|
else if(set.name.indexOf("http") !== -1) {
|
||||||
|
http_settings.values.push(set);
|
||||||
|
}
|
||||||
|
else if(set.name.indexOf("ftp") !== -1) {
|
||||||
|
ftp_settings.values.push(set);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
general_settings.values.push(set);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var templ = $('#global_general_settings_template').text();
|
||||||
|
var item = Mustache.render(templ, {
|
||||||
|
settings: [
|
||||||
|
general_settings,
|
||||||
|
http_settings,
|
||||||
|
ftp_settings,
|
||||||
|
torrent_settings,
|
||||||
|
metalink_settings
|
||||||
|
]
|
||||||
|
});
|
||||||
|
$('#dynamic_global_settings').html(item);
|
||||||
|
modals.global_settings_modal.modal('show');
|
||||||
});
|
});
|
||||||
$('#dynamic_global_settings').html(item);
|
|
||||||
modals.global_settings_modal.modal('show');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addDownload(uris) {
|
function addDownload(uris) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user