- const funcNames = ['substring', 'value', 'getElementsByTagName', 'del', 'input', 'toFixed', 'button', 'length', 'indexOf'];
- const _0x2055 = function (_0x31b18a, _0x2055dd) {
- return funcNames[_0x31b18a];
- };
- let btns = document['getElementsByTagName']('button');
- let input = document['querySelector']('input');
- let len = btns['length'];
- let a, b, result, type;
- for (let i = 0; i < len; i++) {
- btns[i]['addEventListener']('click', () => {
- let btnName = btns[i]['innerHTML'];
- let inputValue = input['value'];
- if (btnName >= 0 && btnName <= 0x9 || btnName === '.' && inputValue['indexOf']('.') === -1) {
- input['value'] += btnName;
- }
- if (inputValue === '' && btnName === '.') {
- input['value'] = '';
- }
- if (inputValue !== '') {
- switch (btnName) {
- case 'del':
- let _0x3acdc1 = inputValue['substring'](0, inputValue['length'] - 1);
- input['value'] = _0x3acdc1;
- break;
- case 'C':
- input['value'] = '';
- break;
- case '+':
- a = inputValue;
- input['value'] = '';
- type = '+';
- break;
- case '-':
- a = inputValue;
- input['value'] = '';
- type = '-';
- break;
- case '*':
- a = inputValue;
- input['value'] = '';
- type = '*';
- break;
- case '/':
- a = inputValue;
- input['value'] = '';
- type = '/';
- break;
- case '=':
- if (a !== undefined) {
- b = inputValue;
- if (type === '+') {
- result = parseFloat(a) + parseFloat(b);
- }
- if (type === '-') {
- result = parseFloat(a) - parseFloat(b);
- }
- if (type === '*') {
- result = parseFloat(a) * parseFloat(b);
- }
- if (type === '/') {
- result = parseFloat(a) / parseFloat(b);
- }
- let _0x20ce68 = result + '';
- let _0x136fde = _0x20ce68['split']('.');
- input['value'] = _0x136fde['length'] === 2 ? result['toFixed'](2) : result;
- }
- break;
- }
- }
- });
- }
复制代码
闲的蛋疼 给你解密一下
其实就是 找到所有 btn,然后 都加上 事件, 判断按钮的内容, 然后 也不知道到干嘛了 |