Implement macro shortcuts
这个提交包含在:
父节点
ba89628b8c
当前提交
b13f2b032c
共有 2 个文件被更改,包括 51 次插入 和 35 次删除
|
|
@ -7,6 +7,8 @@
|
||||||
var base_url = "<?php echo base_url(); ?>"; // Base URL
|
var base_url = "<?php echo base_url(); ?>"; // Base URL
|
||||||
var site_url = "<?php echo site_url(); ?>"; // Site URL
|
var site_url = "<?php echo site_url(); ?>"; // Site URL
|
||||||
var icon_dot_url = "<?php echo base_url();?>assets/images/dot.png";
|
var icon_dot_url = "<?php echo base_url();?>assets/images/dot.png";
|
||||||
|
// get the user_callsign from session
|
||||||
|
var my_call = "<?php echo $this->session->userdata('user_callsign'); ?>".toUpperCase();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- General JS Files used across Cloudlog -->
|
<!-- General JS Files used across Cloudlog -->
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ let function1Name, function1Macro, function2Name, function2Macro, function3Name,
|
||||||
|
|
||||||
getMacros();
|
getMacros();
|
||||||
|
|
||||||
|
|
||||||
let sendText = document.getElementById("sendText");
|
let sendText = document.getElementById("sendText");
|
||||||
let sendButton = document.getElementById("sendButton");
|
let sendButton = document.getElementById("sendButton");
|
||||||
let receiveText = document.getElementById("receiveText");
|
let receiveText = document.getElementById("receiveText");
|
||||||
|
|
@ -119,36 +120,36 @@ function clickSend() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function morsekey_func1() {
|
function morsekey_func1() {
|
||||||
console.log("F1: " + function1Macro);
|
console.log("F1: " + UpdateMacros(function1Macro));
|
||||||
writeToStream(function1Macro);
|
writeToStream(UpdateMacros(function1Macro));
|
||||||
//and clear the input field, so it's clear it has been sent
|
//and clear the input field, so it's clear it has been sent
|
||||||
sendText.value = "";
|
sendText.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function morsekey_func2() {
|
function morsekey_func2() {
|
||||||
console.log("F2: " + function2Macro);
|
console.log("F2: " + UpdateMacros(function2Macro));
|
||||||
writeToStream(function2Macro);
|
writeToStream(UpdateMacros(function2Macro));
|
||||||
//and clear the input field, so it's clear it has been sent
|
//and clear the input field, so it's clear it has been sent
|
||||||
sendText.value = "";
|
sendText.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function morsekey_func3() {
|
function morsekey_func3() {
|
||||||
console.log("F3: " + function3Macro);
|
console.log("F3: " + UpdateMacros(function3Macro));
|
||||||
writeToStream(function3Macro);
|
writeToStream(UpdateMacros(function3Macro));
|
||||||
//and clear the input field, so it's clear it has been sent
|
//and clear the input field, so it's clear it has been sent
|
||||||
sendText.value = "";
|
sendText.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function morsekey_func4() {
|
function morsekey_func4() {
|
||||||
console.log("F4: " + function4Macro);
|
console.log("F4: " + UpdateMacros(function4Macro));
|
||||||
writeToStream(function4Macro);
|
writeToStream(UpdateMacros(function4Macro));
|
||||||
//and clear the input field, so it's clear it has been sent
|
//and clear the input field, so it's clear it has been sent
|
||||||
sendText.value = "";
|
sendText.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function morsekey_func5() {
|
function morsekey_func5() {
|
||||||
console.log("F5: " + function5Macro);
|
console.log("F5: " + UpdateMacros(function5Macro));
|
||||||
writeToStream(function5Macro);
|
writeToStream(UpdateMacros(function5Macro));
|
||||||
//and clear the input field, so it's clear it has been sent
|
//and clear the input field, so it's clear it has been sent
|
||||||
sendText.value = "";
|
sendText.value = "";
|
||||||
}
|
}
|
||||||
|
|
@ -187,36 +188,49 @@ function closeModal() {
|
||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function UpdateMacros(macrotext) {
|
||||||
|
|
||||||
|
// Get the values from the form set to uppercase
|
||||||
|
let CALL = document.getElementById("callsign").value.toUpperCase();
|
||||||
|
let RSTS = document.getElementById("rst_sent").value;
|
||||||
|
|
||||||
|
let newString;
|
||||||
|
newString = macrotext.replace(/\[MYCALL\]/g, my_call);
|
||||||
|
newString = newString.replace(/\[CALL\]/g, CALL);
|
||||||
|
newString = newString.replace(/\[RSTS\]/g, RSTS);
|
||||||
|
console.log(newString);
|
||||||
|
return newString;
|
||||||
|
}
|
||||||
|
|
||||||
// Call url and store the returned json data as variables
|
// Call url and store the returned json data as variables
|
||||||
function getMacros() {
|
function getMacros() {
|
||||||
fetch(base_url + 'index.php/qso/cwmacros_json')
|
fetch(base_url + 'index.php/qso/cwmacros_json')
|
||||||
.then(response => response.json())
|
.then(response => response.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
function1Name = data.function1_name;
|
function1Name = data.function1_name;
|
||||||
function1Macro = data.function1_macro;
|
function1Macro = data.function1_macro;
|
||||||
function2Name = data.function2_name;
|
function2Name = data.function2_name;
|
||||||
function2Macro = data.function2_macro;
|
function2Macro = data.function2_macro;
|
||||||
function3Name = data.function3_name;
|
function3Name = data.function3_name;
|
||||||
function3Macro = data.function3_macro;
|
function3Macro = data.function3_macro;
|
||||||
function4Name = data.function4_name;
|
function4Name = data.function4_name;
|
||||||
function4Macro = data.function4_macro;
|
function4Macro = data.function4_macro;
|
||||||
function5Name = data.function5_name;
|
function5Name = data.function5_name;
|
||||||
function5Macro = data.function5_macro;
|
function5Macro = data.function5_macro;
|
||||||
// Do something with the variables
|
|
||||||
|
|
||||||
const morsekey_func1_Button = document.getElementById('morsekey_func1');
|
const morsekey_func1_Button = document.getElementById('morsekey_func1');
|
||||||
morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')';
|
morsekey_func1_Button.textContent = 'F1 (' + function1Name + ')';
|
||||||
|
|
||||||
const morsekey_func2_Button = document.getElementById('morsekey_func2');
|
const morsekey_func2_Button = document.getElementById('morsekey_func2');
|
||||||
morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')';
|
morsekey_func2_Button.textContent = 'F2 (' + function2Name + ')';
|
||||||
|
|
||||||
const morsekey_func3_Button = document.getElementById('morsekey_func3');
|
const morsekey_func3_Button = document.getElementById('morsekey_func3');
|
||||||
morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')';
|
morsekey_func3_Button.textContent = 'F3 (' + function3Name + ')';
|
||||||
|
|
||||||
const morsekey_func4_Button = document.getElementById('morsekey_func4');
|
const morsekey_func4_Button = document.getElementById('morsekey_func4');
|
||||||
morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')';
|
morsekey_func4_Button.textContent = 'F4 (' + function4Name + ')';
|
||||||
|
|
||||||
const morsekey_func5_Button = document.getElementById('morsekey_func5');
|
const morsekey_func5_Button = document.getElementById('morsekey_func5');
|
||||||
morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')';
|
morsekey_func5_Button.textContent = 'F5 (' + function5Name + ')';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
正在加载…
在新工单中引用