The website editor continues to modify the script and makes it useless

So, I use a script on my Weebly website for which a full-featured scientific calculator is being created. Unfortunately, the script throws an error:

"Ignoring the get or set property of having [LenientThis] because the 'this' object is invalid."

When I returned to the script to see what was happening, I noticed that some of the characters were changed (see below), which rendered the script unusable. Here is a piece of code that should look like this:

(function(window) {
    'use strict';

    var calcSS3 = document.querySelector('.calc-main'),
    // display things
    display = calcSS3.querySelector('.calc-display span'),
    radDeg = calcSS3.querySelector('.calc-rad'),
    smallerButton = calcSS3.querySelector('.calc-smaller'),
    hold = calcSS3.querySelector('.calc-hold'),
    lnButton = calcSS3.querySelector('.calc-ln'),
    helpButton = calcSS3.querySelector('.calc-info'),
    secondKeySet = [].slice.call(calcSS3.querySelector('.calc-left').children, 12, 20),
    hiddenCopy = calcSS3.querySelector('textarea'),

    pressedKey,
    frozenKey, // active calculation keys
    secondActive = false, // 2nd key active?
    bracketKey,
    brackets = 0, // count of current open brackets
    calculator = [], // instances of Calculator
    deg = false, // Deg mode or Rad
    memory = 0,
    resBuffer = '0',
    bigger = false, // app size
    ln = 0,
    buffStr = [],
    sav = ['secondActive', 'deg', 'memory', 'buffStr', 'resBuffer'],
    keyBoard = {},
    secondLayer = [
        ['sin', 'cos', 'tan', 'ln', 'sinh', 'cosh', 'tanh', 'e<sup>x</sup>'],
        [
            'sin<sup>-1</sup>',  'cos<sup>-1</sup>',  'tan<sup>-1</sup>',  'log<sub>2</sub>',
            'sinh<sup>-1</sup>', 'cosh<sup>-1</sup>', 'tanh<sup>-1</sup>', '2<sup>x</sup>'
        ]
    ],
    Calculator = function() { // for every '(' a new instance
        this.stack = [],
        this.num = 0,
        this.res = 0,
        this.buff = [false, false];

        this.curr = true;

        this.rank = {
            '=': 0,
            '+': 1, '-': 1,
            '/': 2, '*': 2,
            'yx': 3, 'x√y': 3, 'EE': 3
        };
    };          

In the third last line, this is what I get:

    'yx': 3, 'xây': 3, 'EE': 3

I get similar results appearing elsewhere throughout the script. What's happening?

+4
source share
1 answer

"\u221A" sqrt, .

:

Javascript
/

+1

Source: https://habr.com/ru/post/1617547/


All Articles