blob: 8f32af83bda7a3e57db61a3344d5cf9e6a54e823 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* This file is part of DAV-4-TbSync.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
"use strict";
const dav = TbSync.providers.dav;
var tbSyncEditAccountOverlay = {
onload: function (window, accountData) {
this.accountData = accountData;
let serviceprovider = this.accountData.getAccountProperty("serviceprovider");
let isServiceProvider = dav.sync.serviceproviders.hasOwnProperty(serviceprovider);
// special treatment for configuration label, which is a permanent setting and will not change by switching modes
let configlabel = window.document.getElementById("tbsync.accountsettings.label.config");
if (configlabel) {
let extra = "";
if (isServiceProvider) {
extra = " [" + TbSync.getString("add.serverprofile." + serviceprovider, "dav") + "]";
}
configlabel.setAttribute("value", TbSync.getString("config.custom", "dav") + extra);
}
//set certain elements as "alwaysDisable", if locked by service provider
if (isServiceProvider) {
let items = window.document.getElementsByClassName("lockIfServiceProvider");
for (let i=0; i < items.length; i++) {
items[i].setAttribute("alwaysDisabled", "true");
}
}
},
stripHost: function (document, field) {
let host = document.getElementById('tbsync.accountsettings.pref.' + field).value;
while (host.endsWith("/")) { host = host.slice(0,-1); }
document.getElementById('tbsync.accountsettings.pref.' + field).value = host
this.accountData.setAccountProperty(field, host);
}
};
|