зеркало из https://github.com/mozilla/gecko-dev.git
108 строки
2.8 KiB
HTML
108 строки
2.8 KiB
HTML
<html>
|
|
<head>
|
|
<title>XPConnect Example</title>
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
var Account = Components.classes["component://netscape/profile/Account-services"].createInstance();
|
|
Account = Account.QueryInterface(Components.interfaces.nsIAccountServices);
|
|
dump("Account = " + Account + "\n");
|
|
nameGlobal = new Array();
|
|
nameArray = new Array();
|
|
var count = 0;
|
|
var dataCount = 0;
|
|
|
|
function Create()
|
|
{
|
|
var field = document.getElementById('loginname');
|
|
Account.SetDialerConfig(field.value);
|
|
}
|
|
|
|
function TestMe()
|
|
{
|
|
var field1 = document.getElementById('phone');
|
|
SetPhonebookValue(field1.id,field1.value);
|
|
|
|
var field2 = document.getElementById('loginname');
|
|
SetPhonebookValue(field2.id,field2.value);
|
|
var field3 = document.getElementById('loginpass');
|
|
SetPhonebookValue(field3.id,field3.value);
|
|
var field4 = document.getElementById('passagain');
|
|
SetPhonebookValue(field4.id,field4.value);
|
|
var field5 = document.getElementById('domainname');
|
|
SetPhonebookValue(field5.id,field5.value);
|
|
var field6 = document.getElementById('dnsp');
|
|
SetPhonebookValue(field6.id,field6.value);
|
|
var field7 = document.getElementById('dnss');
|
|
SetPhonebookValue(field7.id,field7.value);
|
|
// var field8 = document.getElementById('callwait');
|
|
// if (field8.value ==TRUE)
|
|
// SetPhonebookValue(field8.id,field8.value);
|
|
// var field9 = document.getElementById('tone');
|
|
// SetPhonebookValue(field9.id,field9.value);
|
|
|
|
Finish();
|
|
|
|
}
|
|
|
|
|
|
function SetPhonebookValue(name, value)
|
|
{
|
|
dump("Inside SetPhonebookValue\n");
|
|
var found = false;
|
|
for (i = 0; i !=dataCount; i++) {
|
|
if (nameArray[i] == name) {
|
|
dump("Name exists: "+nameGlobal[i]+"\n");
|
|
nameGlobal[i] = name+"="+value+"%";
|
|
dump("New values: "+name+" "+value+"\n");
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
if (!found) {
|
|
dump("Name does not exist\n");
|
|
nameGlobal[dataCount] = name+"="+value+"%";
|
|
dump("Name Value: "+name+" "+value+"\n");
|
|
|
|
nameArray[dataCount] = name;
|
|
dataCount++;
|
|
}
|
|
}
|
|
|
|
function Finish()
|
|
{
|
|
var data = "";
|
|
var i = 0;
|
|
dump("before for loop\n");
|
|
for (i = 0; i !=dataCount; i++) {
|
|
data = data+nameGlobal[i];
|
|
}
|
|
dump("DATA IS: "+data+"\n");
|
|
Account.SetDialerConfig(data);
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
<form name="form">
|
|
Current Modem <input type="text" id="modem"> <br><br>
|
|
Call Waiting <input type="checkbox" id="callwait">
|
|
<input type="radio" id="tone" value="tone">Tone
|
|
<input type="radio" id="tone" value="pulse">Pulse<br><br>
|
|
Phone <input type="text" id="phone"> This information will not be given to anyone else.<br><br>
|
|
Login Name<input type="text" id="loginname"> <br><br>
|
|
Password<input type="text" id="loginpass">
|
|
Enter Again<input type="text" id="passagain"><br><br>
|
|
Domain Name<input type="text" id="domainname"> <br><br>
|
|
Primary DNS<input type="text" id="dnsp"> <br><br>
|
|
Secondary DNS<input type="text" id="dnss"> <br><br>
|
|
|
|
<input type="button" value="Create Account" onclick="TestMe();">
|
|
|
|
<form>
|
|
</body>
|
|
</html> |