74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
|
const valid_urls = ["https://boolean-algebra.com/"]
|
||
|
|
||
|
const bool_field = document.getElementById("bool-alg-input");
|
||
|
const bool_alg_btn = document.getElementById("bool-alg-btn");
|
||
|
|
||
|
const bool_alg_ab = document.getElementById('boolalg1');
|
||
|
const bool_alg_pl = document.getElementById('boolalg2');
|
||
|
const bool_alg_s = document.getElementById('boolalg3');
|
||
|
|
||
|
bool_alg_btn.addEventListener('click', () => {
|
||
|
chrome.runtime.sendMessage(
|
||
|
{
|
||
|
type: 'bool_alg',
|
||
|
content: {
|
||
|
expression: bool_field.value,
|
||
|
outputType: bool_alg_ab.checked ? 'algebra':
|
||
|
bool_alg_pl.checked ? 'logic' :
|
||
|
bool_alg_s.checked ? 'set' :
|
||
|
''
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
|
||
|
|
||
|
const ind_btn = document.getElementById("ind-btn");
|
||
|
|
||
|
const ind_expr1 = document.getElementById("ind-expr1");
|
||
|
const ind_expr2 = document.getElementById("ind-expr2");
|
||
|
const ind_sign = document.getElementById("ind-sign");
|
||
|
const ind_s = document.getElementById("ind-s");
|
||
|
const ind_n = document.getElementById("ind-n");
|
||
|
const ind_nsign = document.getElementById("ind-nsign");
|
||
|
|
||
|
const produce_induction_string = () =>
|
||
|
`prove by induction sum of ${ind_expr1.value} from ${ind_s.value} to n`
|
||
|
+ ` ${ind_sign.options[ind_sign.selectedIndex].text} ${ind_expr2.value} for n`
|
||
|
+ ` ${ind_nsign.options[ind_nsign.selectedIndex].text} ${ind_n.value}`;
|
||
|
|
||
|
ind_btn.addEventListener('click', () =>
|
||
|
chrome.runtime.sendMessage(
|
||
|
{
|
||
|
type: 'induction',
|
||
|
content: {expression: produce_induction_string()}
|
||
|
}
|
||
|
)
|
||
|
);
|
||
|
|
||
|
|
||
|
const perm_btn = document.getElementById('perm-btn');
|
||
|
const perm_n = document.getElementById('pn');
|
||
|
const perm_r = document.getElementById('pr');
|
||
|
|
||
|
const comb_btn = document.getElementById('comb-btn');
|
||
|
const comb_n = document.getElementById('cn');
|
||
|
const comb_r = document.getElementById('cr');
|
||
|
|
||
|
|
||
|
perm_btn.addEventListener('click', () =>
|
||
|
chrome.runtime.sendMessage(
|
||
|
{
|
||
|
type: 'perm',
|
||
|
content: {n: perm_n.value, r: perm_r.value}
|
||
|
}
|
||
|
)
|
||
|
);
|
||
|
|
||
|
comb_btn.addEventListener('click', () =>
|
||
|
chrome.runtime.sendMessage(
|
||
|
{
|
||
|
type: 'comb',
|
||
|
content: {n: comb_n.value, r: comb_r.value}
|
||
|
}
|
||
|
)
|
||
|
);
|