kopia lustrzana https://github.com/badra022/digital-filter-designer
fixed a addition
rodzic
9b66f8e5fe
commit
6a13760178
29
index.html
29
index.html
|
@ -23,7 +23,7 @@
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
<ul id="allpass_lib">
|
<ul id="allpass_lib">
|
||||||
<li><label>a = </label><input type="text" id="NewAllPassValue"></li>
|
<li><label>a = </label><input type="text" id="NewAllPassValue"></li><button class="form-control" onclick="addNew()" class="btn btn-primary">Add</button>
|
||||||
<li><a href="#" onclick="showZplaneForAllPass('2 + 2i')" ondblclick="addNewAllPass('2 + 2i')"><i class="lni lni-text-format"></i><span>a = 2 + 2j</span></a>
|
<li><a href="#" onclick="showZplaneForAllPass('2 + 2i')" ondblclick="addNewAllPass('2 + 2i')"><i class="lni lni-text-format"></i><span>a = 2 + 2j</span></a>
|
||||||
<input type="checkbox" onclick="addOrRemove(this, '2 + 2i')"></li>
|
<input type="checkbox" onclick="addOrRemove(this, '2 + 2i')"></li>
|
||||||
<li><a href="#" onclick="showZplaneForAllPass('2 - 2i')" ondblclick="addNewAllPass('2 - 2i')"><i class="lni lni-text-format" ></i><span>a = 2 - 2j</span></a>
|
<li><a href="#" onclick="showZplaneForAllPass('2 - 2i')" ondblclick="addNewAllPass('2 - 2i')"><i class="lni lni-text-format" ></i><span>a = 2 - 2j</span></a>
|
||||||
|
@ -114,11 +114,10 @@ function addNewZero() {
|
||||||
setZplane(poles, zeros);
|
setZplane(poles, zeros);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the input field
|
// // Get the input field
|
||||||
var allPassValue = document.getElementById("NewAllPassValue");
|
// var allPassValue = document.getElementById("");
|
||||||
|
|
||||||
// Execute a function when the user releases a key on the keyboard
|
$("#NewAllPassValue").keydown(function(event) {
|
||||||
allPassValue.addEventListener("keyup", function(event) {
|
|
||||||
// Number 13 is the "Enter" key on the keyboard
|
// Number 13 is the "Enter" key on the keyboard
|
||||||
if (event.keyCode === 13) {
|
if (event.keyCode === 13) {
|
||||||
// Cancel the default action, if needed
|
// Cancel the default action, if needed
|
||||||
|
@ -131,6 +130,26 @@ allPassValue.addEventListener("keyup", function(event) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function addNew() {
|
||||||
|
let target = document.getElementById("allpass_lib");
|
||||||
|
let input = document.getElementById("NewAllPassValue").value;
|
||||||
|
target.innerHTML += "<li><a href=\"#\" onclick=\"showZplaneForAllPass('" + input + "')\" ondblclick=\"addNewAllPass('" + input + "')\"><i class=\"lni lni-text-format\" ></i><span>a = "+ input + "</span></a>\
|
||||||
|
<input type=\"checkbox\" onclick=\"addOrRemove(this, '" + input + "')\"></li>";
|
||||||
|
}
|
||||||
|
// // Execute a function when the user releases a key on the keyboard
|
||||||
|
// allPassValue.addEventListener("keyup", function(event) {
|
||||||
|
// // Number 13 is the "Enter" key on the keyboard
|
||||||
|
// if (event.keyCode === 13) {
|
||||||
|
// // Cancel the default action, if needed
|
||||||
|
// event.preventDefault();
|
||||||
|
// // Trigger the button element with a click
|
||||||
|
// let target = document.getElementById("allpass_lib");
|
||||||
|
// let input = document.getElementById("NewAllPassValue").value;
|
||||||
|
// target.innerHTML += "<li><a href=\"#\" onclick=\"showZplaneForAllPass('" + input + "')\" ondblclick=\"addNewAllPass('" + input + "')\"><i class=\"lni lni-text-format\" ></i><span>a = "+ input + "</span></a>\
|
||||||
|
// <input type=\"checkbox\" onclick=\"addOrRemove(this, '" + input + "')\"></li>";
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
function addNewAllPass(a) {
|
function addNewAllPass(a) {
|
||||||
allPass.push(math.complex(a));
|
allPass.push(math.complex(a));
|
||||||
allPassNum = allPassNum + 1;
|
allPassNum = allPassNum + 1;
|
||||||
|
|
Ładowanie…
Reference in New Issue