diff --git a/control.html b/control.html index bff0621..50f6cb2 100644 --- a/control.html +++ b/control.html @@ -234,6 +234,7 @@ $("input[name='lock']").val([`${data.lock}`]); } + \ No newline at end of file diff --git a/ducking.html b/ducking.html index 68aeeef..510b839 100644 --- a/ducking.html +++ b/ducking.html @@ -352,30 +352,73 @@ - - + + } + + function bindData() { + $("input[name='switch']").val([`${data.parameters.state}`]) + $("#mic1").prop("checked", data.mic1 == 'open') + $("#mic2").prop("checked", data.mic2 == 'open') + attackSlider(data.parameters.attack); + thresholdSlider(data.parameters.threshold); + ducklevelSlider(data.parameters.ducklevel); + releaseSlider(data.parameters.release); + } + + function attackSlider(number) { + let element = $('#attack') + let input = $("#attack .volume-slider input") + input.attr('value', (parseInt(number) - 10) / (490 / 100)) + updateAttackSlider(element); + + + input.on('input', function () { + updateAttackSlider(element); + }) + input.on('change', function () { + updateAttackSlider(element); + }) + } + + function updateAttackSlider(element) { + + let box = element.children().find(".volume-slider") + let input = element.children().find(".volume-slider input") + let $thumb = element.children().find(".range-slider-thumb") + let $bar = element.children().find(".range-slider-bar") + let $value = element.children().find(".slider-value") + pct = input.val() * ((box[0].clientHeight - $thumb[0].clientHeight) / box[0].clientHeight); + + $thumb.attr('style', `bottom:${pct}%`) + + let barHeight = `calc(${pct}% + ${$thumb[0].clientHeight / 2}px)`; + $bar.attr('style', `height:${barHeight}`) + let number = ((input.val() * (490 / 100)) + 10).toFixed(1) + $value.val(`${number}`); + //调用接口提交数据 + changeInputValue('attack', number) + } + + function thresholdSlider(number) { + let element = $('#threshold') + let input = $("#threshold .volume-slider input") + input.attr('value', (parseInt(number) + 60) / (60 / 100)) + updateThresholdSlider(element); + + + input.on('input', function () { + updateThresholdSlider(element); + }) + input.on('change', function () { + updateThresholdSlider(element); + }) + } + + function updateThresholdSlider(element) { + let box = element.children().find(".volume-slider") + let input = element.children().find(".volume-slider input") + let $thumb = element.children().find(".range-slider-thumb") + let $bar = element.children().find(".range-slider-bar") + let $value = element.children().find(".slider-value") + pct = input.val() * ((box[0].clientHeight - $thumb[0].clientHeight) / box[0].clientHeight); + + $thumb.attr('style', `bottom:${pct}%`) + + let barHeight = `calc(${pct}% + ${$thumb[0].clientHeight / 2}px)`; + $bar.attr('style', `height:${barHeight}`) + + let number = ((input.val() * (60 / 100)) - 60).toFixed(1) + $value.val(`${number}`); + //调用接口提交数据 + changeInputValue('threshold', number) + } + + function ducklevelSlider(number) { + let element = $('#ducklevel') + let input = $("#ducklevel .volume-slider input") + input.attr('value', (parseInt(number) + 100) / (100 / 100)) + updateDucklevelSlider(element); + + + input.on('input', function () { + updateDucklevelSlider(element); + }) + input.on('change', function () { + updateDucklevelSlider(element); + }) + } + + function updateDucklevelSlider(element) { + let box = element.children().find(".volume-slider") + let input = element.children().find(".volume-slider input") + let $thumb = element.children().find(".range-slider-thumb") + let $bar = element.children().find(".range-slider-bar") + let $value = element.children().find(".slider-value") + pct = input.val() * ((box[0].clientHeight - $thumb[0].clientHeight) / box[0].clientHeight); + + $thumb.attr('style', `bottom:${pct}%`) + + let barHeight = `calc(${pct}% + ${$thumb[0].clientHeight / 2}px)`; + $bar.attr('style', `height:${barHeight}`) + + let number = ((input.val() * (100 / 100)) - 100).toFixed(1) + $value.val(`${number}`); + //调用接口提交数据 + changeInputValue('ducklevel', number) + } + + function releaseSlider(number) { + let element = $('#release') + let input = $("#release .volume-slider input") + input.attr('value', (parseInt(number) - 10) / (2000 / 100)) + updateReleaseSlider(element); + + + input.on('input', function () { + updateReleaseSlider(element); + }) + input.on('change', function () { + updateReleaseSlider(element); + }) + } + + function updateReleaseSlider(element) { + let box = element.children().find(".volume-slider") + let input = element.children().find(".volume-slider input") + let $thumb = element.children().find(".range-slider-thumb") + let $bar = element.children().find(".range-slider-bar") + let $value = element.children().find(".slider-value") + pct = input.val() * ((box[0].clientHeight - $thumb[0].clientHeight) / box[0].clientHeight); + + $thumb.attr('style', `bottom:${pct}%`) + + let barHeight = `calc(${pct}% + ${$thumb[0].clientHeight / 2}px)`; + $bar.attr('style', `height:${barHeight}`) + + let number = ((input.val() * (2000 / 100)) - 10).toFixed(1) + $value.val(`${number}`); + //调用接口提交数据 + changeInputValue('release', number) + } + + + function changeInputValue(module, number) { + let url = "/cgi-bin/test.cgi&action=ducker_set" + let postData = { + subaction: module, + audio: number, + type: module + } + $.ajax({ + type: 'POST', + url: url, + data: postData, + dataType: "json", + contentType: "application/json; charset=utf-8", + success: function (res) { + if (res.success) { + data = res.content + bindData() + } + else { + alert(res.message) + } + }, + error: function (res) { + } + }) + } + + + + \ No newline at end of file diff --git a/eq.html b/eq.html index 22247e8..51b5d3c 100644 --- a/eq.html +++ b/eq.html @@ -720,330 +720,332 @@ + + + + - - \ No newline at end of file diff --git a/filter.html b/filter.html index 89ffb5e..1637c81 100644 --- a/filter.html +++ b/filter.html @@ -167,257 +167,259 @@ + + + + - - \ No newline at end of file diff --git a/fs.html b/fs.html index 9011a01..c2d7bab 100644 --- a/fs.html +++ b/fs.html @@ -148,197 +148,199 @@ + + + + - - \ No newline at end of file diff --git a/home.html b/home.html index a30e3ca..05b4bf2 100644 --- a/home.html +++ b/home.html @@ -952,564 +952,596 @@ + + + + - - \ No newline at end of file diff --git a/login.html b/login.html index fda950d..9edfe91 100644 --- a/login.html +++ b/login.html @@ -104,6 +104,7 @@ }) }) + \ No newline at end of file diff --git a/network.html b/network.html index 0ab3bfb..c684d65 100644 --- a/network.html +++ b/network.html @@ -229,6 +229,7 @@ return reg.test(ip); } + \ No newline at end of file diff --git a/security.html b/security.html index 1e6b367..d83e844 100644 --- a/security.html +++ b/security.html @@ -158,6 +158,7 @@ }) }) + \ No newline at end of file diff --git a/system.html b/system.html index 01327f0..9863c78 100644 --- a/system.html +++ b/system.html @@ -175,6 +175,6 @@ + - \ No newline at end of file